修复托盘退出卡死、启动隐藏闪窗和隐藏实例再次启动无法唤醒的问题。 统一深色主题资源与控件模板,补齐卡片、内置图标、右键菜单和弹窗背景样式。 验证:dotnet build PersonalToolbox.sln;dotnet run --project tests\PersonalToolbox.Tests\PersonalToolbox.Tests.csproj。
217 lines
9.7 KiB
XML
217 lines
9.7 KiB
XML
<Window x:Class="PersonalToolbox.Views.CombinationEditorWindow"
|
||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||
Title="编辑组合"
|
||
Width="760"
|
||
Height="640"
|
||
MinWidth="680"
|
||
MinHeight="560"
|
||
Background="{DynamicResource AppBackgroundBrush}"
|
||
Foreground="{DynamicResource PrimaryTextBrush}"
|
||
WindowStartupLocation="CenterOwner">
|
||
<Grid Margin="18"
|
||
Background="{DynamicResource AppBackgroundBrush}">
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="Auto" />
|
||
<RowDefinition Height="*" />
|
||
<RowDefinition Height="Auto" />
|
||
</Grid.RowDefinitions>
|
||
|
||
<Grid>
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="96" />
|
||
<ColumnDefinition Width="*" />
|
||
<ColumnDefinition Width="96" />
|
||
<ColumnDefinition Width="*" />
|
||
</Grid.ColumnDefinitions>
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="Auto" />
|
||
<RowDefinition Height="Auto" />
|
||
<RowDefinition Height="Auto" />
|
||
<RowDefinition Height="Auto" />
|
||
</Grid.RowDefinitions>
|
||
|
||
<TextBlock Text="名称" VerticalAlignment="Center" />
|
||
<TextBox x:Name="NameTextBox"
|
||
Grid.Column="1"
|
||
MinHeight="32"
|
||
Margin="0,0,16,8"
|
||
ToolTip="组合卡片显示名称。" />
|
||
|
||
<TextBlock Grid.Column="2" Text="分类" VerticalAlignment="Center" />
|
||
<ComboBox x:Name="CategoryComboBox"
|
||
Grid.Column="3"
|
||
MinHeight="32"
|
||
Margin="0,0,0,8"
|
||
DisplayMemberPath="Name"
|
||
SelectedValuePath="Id"
|
||
ToolTip="组合也作为一种工具,只能属于一个一级分类。" />
|
||
|
||
<TextBlock Grid.Row="1" Text="说明" VerticalAlignment="Top" Margin="0,8,0,0" />
|
||
<TextBox x:Name="DescriptionTextBox"
|
||
Grid.Row="1"
|
||
Grid.Column="1"
|
||
Grid.ColumnSpan="3"
|
||
MinHeight="58"
|
||
TextWrapping="Wrap"
|
||
AcceptsReturn="True"
|
||
ToolTip="描述这个组合会打开哪些环境或工具。" />
|
||
|
||
<TextBlock Grid.Row="2" Text="快捷键" VerticalAlignment="Center" />
|
||
<Grid Grid.Row="2"
|
||
Grid.Column="1"
|
||
Margin="0,8,16,0">
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="*" />
|
||
<ColumnDefinition Width="Auto" />
|
||
<ColumnDefinition Width="Auto" />
|
||
</Grid.ColumnDefinitions>
|
||
<TextBox x:Name="HotkeyTextBox"
|
||
MinHeight="32"
|
||
ToolTip="格式示例:Ctrl + Alt + D。可点击录入来捕获快捷键。" />
|
||
<Button Grid.Column="1"
|
||
Content="录入"
|
||
Width="64"
|
||
Margin="8,0,0,0"
|
||
ToolTip="打开快捷键捕获窗口。"
|
||
Click="CaptureHotkeyButton_OnClick" />
|
||
<Button Grid.Column="2"
|
||
Content="清除"
|
||
Width="64"
|
||
Margin="8,0,0,0"
|
||
ToolTip="清除当前快捷键。"
|
||
Click="ClearHotkeyButton_OnClick" />
|
||
</Grid>
|
||
|
||
<StackPanel Grid.Row="2"
|
||
Grid.Column="2"
|
||
Grid.ColumnSpan="2"
|
||
Orientation="Horizontal"
|
||
Margin="0,8,0,0">
|
||
<CheckBox x:Name="AutoRunCheckBox"
|
||
Content="工具箱启动时自动运行"
|
||
VerticalAlignment="Center"
|
||
ToolTip="开启后组合会出现在自动运行列表中。" />
|
||
<ComboBox x:Name="FailurePolicyComboBox"
|
||
Width="180"
|
||
Margin="18,0,0,0"
|
||
ToolTip="设置成员启动失败后继续执行,还是停止整个组合。">
|
||
<ComboBoxItem Content="失败后继续" Tag="Continue" />
|
||
<ComboBoxItem Content="失败后停止" Tag="Stop" />
|
||
</ComboBox>
|
||
</StackPanel>
|
||
|
||
<TextBlock Grid.Row="3" Text="图标" VerticalAlignment="Center" Margin="0,12,0,0" />
|
||
<StackPanel Grid.Row="3"
|
||
Grid.Column="1"
|
||
Grid.ColumnSpan="3"
|
||
Orientation="Horizontal"
|
||
Margin="0,12,0,0">
|
||
<Border Width="42"
|
||
Height="30"
|
||
CornerRadius="6"
|
||
Background="{DynamicResource IconBackgroundBrush}">
|
||
<TextBlock x:Name="IconPreviewTextBlock"
|
||
HorizontalAlignment="Center"
|
||
VerticalAlignment="Center"
|
||
FontFamily="Segoe MDL2 Assets"
|
||
FontSize="18"
|
||
Foreground="{DynamicResource PrimaryBrush}" />
|
||
</Border>
|
||
<TextBlock x:Name="IconNameTextBlock"
|
||
Margin="10,0,0,0"
|
||
VerticalAlignment="Center"
|
||
Foreground="{DynamicResource SecondaryTextBrush}" />
|
||
<Button Content="选择图标"
|
||
Width="88"
|
||
Margin="12,0,0,0"
|
||
ToolTip="从内置图标库选择,或导入本地图片/ico。"
|
||
Click="ChooseIconButton_OnClick" />
|
||
</StackPanel>
|
||
</Grid>
|
||
|
||
<Grid Grid.Row="1" Margin="0,16,0,0">
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="Auto" />
|
||
<RowDefinition Height="*" />
|
||
</Grid.RowDefinitions>
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="*" />
|
||
<ColumnDefinition Width="Auto" />
|
||
</Grid.ColumnDefinitions>
|
||
|
||
<StackPanel Orientation="Horizontal">
|
||
<ComboBox x:Name="ToolPickerComboBox"
|
||
Width="300"
|
||
DisplayMemberPath="Name"
|
||
ToolTip="从已有工具或组合中选择一个成员。" />
|
||
<Button Content="添加成员"
|
||
Width="96"
|
||
Margin="8,0,0,0"
|
||
ToolTip="把选择的工具加入组合成员列表。"
|
||
Click="AddMemberButton_OnClick" />
|
||
</StackPanel>
|
||
|
||
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
||
<Button Content="上移"
|
||
Width="70"
|
||
Margin="0,0,8,0"
|
||
ToolTip="将选中成员提前执行。"
|
||
Click="MoveUpButton_OnClick" />
|
||
<Button Content="下移"
|
||
Width="70"
|
||
Margin="0,0,8,0"
|
||
ToolTip="将选中成员延后执行。"
|
||
Click="MoveDownButton_OnClick" />
|
||
<Button Content="移除"
|
||
Width="70"
|
||
ToolTip="从组合中移除选中成员。"
|
||
Click="RemoveMemberButton_OnClick" />
|
||
</StackPanel>
|
||
|
||
<DataGrid x:Name="MembersDataGrid"
|
||
Grid.Row="1"
|
||
Grid.ColumnSpan="2"
|
||
Margin="0,10,0,0"
|
||
AutoGenerateColumns="False"
|
||
CanUserAddRows="False"
|
||
SelectionMode="Single"
|
||
ToolTip="组合成员会按列表顺序启动,可临时禁用成员并设置执行后的等待间隔。">
|
||
<DataGrid.Columns>
|
||
<DataGridCheckBoxColumn Header="启用"
|
||
Width="70"
|
||
Binding="{Binding Enabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||
<DataGridTextColumn Header="名称"
|
||
Width="*"
|
||
IsReadOnly="True"
|
||
Binding="{Binding ToolName}" />
|
||
<DataGridTextColumn Header="类型"
|
||
Width="90"
|
||
IsReadOnly="True"
|
||
Binding="{Binding ToolTypeLabel}" />
|
||
<DataGridTextColumn Header="间隔(ms)"
|
||
Width="110"
|
||
Binding="{Binding IntervalAfterMs, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||
</DataGrid.Columns>
|
||
</DataGrid>
|
||
</Grid>
|
||
|
||
<StackPanel Grid.Row="2"
|
||
Orientation="Horizontal"
|
||
HorizontalAlignment="Right"
|
||
Margin="0,14,0,0">
|
||
<Button Content="保存"
|
||
Width="88"
|
||
Margin="0,0,8,0"
|
||
IsDefault="True"
|
||
ToolTip="校验循环引用和重复工具后保存组合。"
|
||
Click="SaveButton_OnClick" />
|
||
<Button Content="取消"
|
||
Width="88"
|
||
IsCancel="True"
|
||
ToolTip="放弃本次组合修改。"
|
||
Click="CancelButton_OnClick" />
|
||
</StackPanel>
|
||
</Grid>
|
||
</Window>
|