- 数据模型: ToolItem 新增 IsGroup(bool) + SubToolIds(List<string>) 字段
- 执行逻辑: ProcessExecutionService 改为 ExecuteAsync, 组合卡片遍历子工具逐一启动(500ms延迟), 孤儿ID跳过并打印警告
- 组合编辑: GroupEditViewModel + GroupEditWindow, 复选框列表勾选非组合工具
- 主界面: 标题栏新增 '+添加组合' 按钮(蓝色), 组合卡片右下角显示 📦 角标
- 右键菜单: 区分 '编辑工具' (普通) 和 '编辑组合' (IsGroup=true)
- 快捷键: HotKeyManager 适配 ExecuteAsync 异步调用
- 测试: 82 tests total (ProcessExecution 4->6, GroupEdit 5 new)
101 lines
4.7 KiB
XML
101 lines
4.7 KiB
XML
<Window x:Class="PersonalToolBox.Views.GroupEditWindow"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
Title="{Binding WindowTitle}" Height="500" Width="500"
|
|
WindowStartupLocation="CenterOwner"
|
|
ResizeMode="NoResize"
|
|
Background="{DynamicResource Theme.Background}">
|
|
|
|
<Grid Margin="16">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="*"/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="70"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<!-- 组合名称 -->
|
|
<TextBlock Grid.Row="0" Grid.Column="0"
|
|
Text="名称:" Foreground="{DynamicResource Theme.Foreground}"
|
|
VerticalAlignment="Center" Margin="0,0,0,10"/>
|
|
<TextBox Grid.Row="0" Grid.Column="1"
|
|
Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}"
|
|
Background="{DynamicResource Theme.InputBackground}"
|
|
Foreground="{DynamicResource Theme.Foreground}"
|
|
BorderBrush="{DynamicResource Theme.InputBorder}"
|
|
Height="28" Margin="0,0,0,10" Padding="6,0"/>
|
|
|
|
<!-- 所属分类 -->
|
|
<TextBlock Grid.Row="1" Grid.Column="0"
|
|
Text="分类:" Foreground="{DynamicResource Theme.Foreground}"
|
|
VerticalAlignment="Center" Margin="0,0,0,10"/>
|
|
<ComboBox Grid.Row="1" Grid.Column="1"
|
|
ItemsSource="{Binding Categories}"
|
|
SelectedItem="{Binding SelectedCategory}"
|
|
DisplayMemberPath="Name"
|
|
Height="28" Margin="0,0,0,10" Padding="4,0"/>
|
|
|
|
<!-- 快捷键 -->
|
|
<TextBlock Grid.Row="2" Grid.Column="0"
|
|
Text="快捷键:" Foreground="{DynamicResource Theme.Foreground}"
|
|
VerticalAlignment="Center" Margin="0,0,0,10"/>
|
|
<TextBox Grid.Row="2" Grid.Column="1"
|
|
Text="{Binding HotKey, UpdateSourceTrigger=PropertyChanged}"
|
|
Background="{DynamicResource Theme.InputBackground}"
|
|
Foreground="{DynamicResource Theme.Foreground}"
|
|
BorderBrush="{DynamicResource Theme.InputBorder}"
|
|
Height="28" Margin="0,0,0,10" Padding="6,0"/>
|
|
|
|
<!-- 子工具选择 -->
|
|
<TextBlock Grid.Row="3" Grid.Column="0"
|
|
Text="包含工具:" Foreground="{DynamicResource Theme.Foreground}"
|
|
VerticalAlignment="Top" Margin="0,4,0,0"/>
|
|
<Border Grid.Row="3" Grid.Column="1"
|
|
Background="{DynamicResource Theme.InputBackground}"
|
|
BorderBrush="{DynamicResource Theme.InputBorder}"
|
|
BorderThickness="1"
|
|
Margin="0,0,0,10">
|
|
<ListBox ItemsSource="{Binding AvailableTools}"
|
|
Background="Transparent"
|
|
BorderThickness="0"
|
|
MaxHeight="240">
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<CheckBox IsChecked="{Binding IsSelected}"
|
|
Content="{Binding Tool.Name}"
|
|
Foreground="{DynamicResource Theme.Foreground}"
|
|
Margin="4,2"/>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
</Border>
|
|
|
|
<!-- 按钮 -->
|
|
<StackPanel Grid.Row="5" Grid.Column="1"
|
|
Orientation="Horizontal" HorizontalAlignment="Right"
|
|
Margin="0,10,0,0">
|
|
<Button Content="保存"
|
|
Command="{Binding SaveCommand}"
|
|
Background="{DynamicResource Theme.ButtonBackground}"
|
|
Foreground="{DynamicResource Theme.ButtonForeground}"
|
|
BorderThickness="0"
|
|
Width="80" Height="30" FontSize="13"
|
|
Cursor="Hand" Margin="0,0,10,0"/>
|
|
<Button Content="取消"
|
|
Command="{Binding CancelCommand}"
|
|
Background="{DynamicResource Theme.CardBackground}"
|
|
Foreground="{DynamicResource Theme.Foreground}"
|
|
BorderBrush="{DynamicResource Theme.CardBorder}"
|
|
BorderThickness="1"
|
|
Width="80" Height="30" FontSize="13"
|
|
Cursor="Hand"/>
|
|
</StackPanel>
|
|
</Grid>
|
|
</Window>
|