diff --git a/BetterGenshinImpact/Service/GearTask/GearTaskStorageService.cs b/BetterGenshinImpact/Service/GearTask/GearTaskStorageService.cs index cbedc921..04f44857 100644 --- a/BetterGenshinImpact/Service/GearTask/GearTaskStorageService.cs +++ b/BetterGenshinImpact/Service/GearTask/GearTaskStorageService.cs @@ -169,37 +169,7 @@ public class GearTaskStorageService } } - /// - /// 重命名任务定义文件 - /// - /// 旧名称 - /// 新名称 - /// - public async Task RenameTaskDefinitionAsync(string oldName, string newName) - { - try - { - var oldFileName = GetSafeFileName(oldName) + ".json"; - var newFileName = GetSafeFileName(newName) + ".json"; - var oldFilePath = Path.Combine(_taskStoragePath, oldFileName); - var newFilePath = Path.Combine(_taskStoragePath, newFileName); - - if (File.Exists(oldFilePath)) - { - await Task.Run(() => File.Move(oldFilePath, newFilePath)); - _logger.LogInformation("任务定义文件已重命名: {OldPath} -> {NewPath}", oldFilePath, newFilePath); - } - else - { - _logger.LogWarning("要重命名的任务定义文件不存在: {FilePath}", oldFilePath); - } - } - catch (Exception ex) - { - _logger.LogError(ex, "重命名任务定义 '{OldName}' -> '{NewName}' 时发生错误", oldName, newName); - throw; - } - } + /// /// 将 ViewModel 转换为数据模型 diff --git a/BetterGenshinImpact/View/Pages/GearTaskListPage.xaml b/BetterGenshinImpact/View/Pages/GearTaskListPage.xaml index f997b363..a9b4f093 100644 --- a/BetterGenshinImpact/View/Pages/GearTaskListPage.xaml +++ b/BetterGenshinImpact/View/Pages/GearTaskListPage.xaml @@ -173,7 +173,7 @@ - + diff --git a/BetterGenshinImpact/View/Pages/GearTaskListPage.xaml.cs b/BetterGenshinImpact/View/Pages/GearTaskListPage.xaml.cs index 91027ec7..74fbca7a 100644 --- a/BetterGenshinImpact/View/Pages/GearTaskListPage.xaml.cs +++ b/BetterGenshinImpact/View/Pages/GearTaskListPage.xaml.cs @@ -19,15 +19,5 @@ public partial class GearTaskListPage : UserControl InitializeComponent(); } - /// - /// 任务定义项双击事件 - /// - private void TaskDefinitionItem_MouseDoubleClick(object sender, MouseButtonEventArgs e) - { - if (sender is ListBoxItem item && item.DataContext is GearTaskDefinitionViewModel taskDefinition) - { - // 双击重命名 - ViewModel.RenameTaskDefinitionCommand.Execute(taskDefinition); - } - } + } \ No newline at end of file diff --git a/BetterGenshinImpact/ViewModel/Pages/GearTaskListPageViewModel.cs b/BetterGenshinImpact/ViewModel/Pages/GearTaskListPageViewModel.cs index 27a1f3d2..44e27c87 100644 --- a/BetterGenshinImpact/ViewModel/Pages/GearTaskListPageViewModel.cs +++ b/BetterGenshinImpact/ViewModel/Pages/GearTaskListPageViewModel.cs @@ -337,31 +337,7 @@ public partial class GearTaskListPageViewModel : ViewModel await DeleteTaskDefinition(SelectedTaskDefinition); } - /// - /// 重命名任务定义 - /// - [RelayCommand] - private async Task RenameTaskDefinition(GearTaskDefinitionViewModel? taskDefinition) - { - if (taskDefinition == null) return; - - // 这里可以弹出重命名对话框,暂时简单处理 - var newName = "新名称"; // 简化处理,实际应该弹出输入框 - - if (!string.IsNullOrWhiteSpace(newName) && newName != taskDefinition.Name) - { - var oldName = taskDefinition.Name; - taskDefinition.Name = newName; - taskDefinition.ModifiedTime = DateTime.Now; - if (taskDefinition.RootTask != null) - { - taskDefinition.RootTask.Name = newName; - } - - // 重命名对应的 JSON 文件 - await _storageService.RenameTaskDefinitionAsync(oldName, newName); - } - } + /// /// 添加任务节点