mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-25 10:05:49 +08:00
Merge remote-tracking branch 'origin/d-v3' into d-v3
This commit is contained in:
@@ -144,6 +144,10 @@
|
||||
Content="新建"
|
||||
Icon="{ui:SymbolIcon Add24}"
|
||||
Margin="0,0,4,0" />
|
||||
<ui:Button Command="{Binding ExecuteSelectedTaskDefinitionCommand}"
|
||||
Content="执行任务组"
|
||||
Icon="{ui:SymbolIcon Play24}"
|
||||
Margin="0,0,4,0" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- 任务定义列表 -->
|
||||
@@ -167,6 +171,10 @@
|
||||
<MenuItem Header="新增任务定义"
|
||||
Command="{Binding AddTaskDefinitionCommand}"
|
||||
Icon="{ui:SymbolIcon Add24}" />
|
||||
<MenuItem Header="执行选中任务组"
|
||||
Command="{Binding ExecuteTaskDefinitionCommand}"
|
||||
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}, Path=PlacementTarget.SelectedItem}"
|
||||
Icon="{ui:SymbolIcon Play24}" />
|
||||
<Separator />
|
||||
<MenuItem Header="编辑选中项"
|
||||
Command="{Binding EditSelectedTaskDefinitionCommand}"
|
||||
@@ -334,4 +342,4 @@
|
||||
</ui:Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
</UserControl>
|
||||
|
||||
@@ -317,6 +317,46 @@ public partial class GearTaskListPageViewModel : ViewModel
|
||||
await DeleteTaskDefinition(SelectedTaskDefinition);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行选中的任务定义(整组执行)
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
private async Task ExecuteSelectedTaskDefinition()
|
||||
{
|
||||
await ExecuteTaskDefinition(SelectedTaskDefinition);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行指定任务定义(整组执行)
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
private async Task ExecuteTaskDefinition(GearTaskDefinitionViewModel? taskDefinition)
|
||||
{
|
||||
taskDefinition ??= SelectedTaskDefinition;
|
||||
if (taskDefinition == null)
|
||||
{
|
||||
Toast.Warning("请先选择要执行的任务组");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var executor = App.GetRequiredService<GearTaskExecutor>();
|
||||
if (executor.IsExecuting)
|
||||
{
|
||||
Toast.Warning("已有任务组正在执行,请稍后再试");
|
||||
return;
|
||||
}
|
||||
|
||||
await executor.ExecuteTaskDefinitionAsync(taskDefinition.Name);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "执行任务定义失败: {TaskName}", taskDefinition.Name);
|
||||
Toast.Error($"执行任务组失败:{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加任务节点
|
||||
|
||||
Reference in New Issue
Block a user