feat(wpf): 战斗列表点击作业时自动关闭列表, 原逻辑迁移至鼠标右键

This commit is contained in:
status102
2025-09-12 13:30:25 +08:00
parent 61265768e5
commit cb31aa0dbd
2 changed files with 14 additions and 6 deletions

View File

@@ -556,9 +556,16 @@ namespace MaaWpfGui.ViewModels.UI
// UI 绑定的方法
[UsedImplicitly]
public void SelectCopilotTask(int index)
public void SelectCopilotTask(object? sender, MouseButtonEventArgs? e = null)
{
Filename = CopilotItemViewModels[index].FilePath;
if (e?.Source is FrameworkElement element && element.Tag is int index)
{
Filename = CopilotItemViewModels[index].FilePath; // 假设原方法接受int参数
if (e.ChangedButton == MouseButton.Left)
{
UseCopilotList = false;
}
}
}
// UI 绑定的方法

View File

@@ -306,7 +306,7 @@
IsEnabled="{Binding ElementName=CopilotList, Path=DataContext.Idle}"
IsHitTestVisible="{Binding ElementName=CopilotList, Path=DataContext.Idle}"
ToolTip="{c:Binding CopilotId}">
<TextBlock Text="{Binding Name}" ToolTip="{Binding CopilotId}"/>
<TextBlock Text="{Binding Name}" ToolTip="{Binding CopilotId}" />
</CheckBox>
<TextBlock
Grid.Column="1"
@@ -325,10 +325,11 @@
hc:VisualElement.HighlightForeground="{DynamicResource PrimaryBrush}"
Background="Transparent"
BorderThickness="0"
Command="{s:Action SelectCopilotTask}"
CommandParameter="{c:Binding Index}"
Foreground="{DynamicResource SecondaryTextBrush}"
IsEnabled="{Binding ElementName=CopilotList, Path=DataContext.Idle}" />
IsEnabled="{Binding ElementName=CopilotList, Path=DataContext.Idle}"
MouseRightButtonUp="{s:Action SelectCopilotTask}"
PreviewMouseLeftButtonUp="{s:Action SelectCopilotTask}"
Tag="{c:Binding Index}" />
<Button
Grid.Column="3"
Margin="0"