mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-25 10:05:49 +08:00
移除任务选择窗口的显示模式相关逻辑,始终展示文件和目录,简化代码结构
This commit is contained in:
@@ -46,17 +46,7 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 工具栏 -->
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0,0,0,12">
|
||||
<ui:Button Content="刷新"
|
||||
Icon="{ui:SymbolIcon ArrowSync24}"
|
||||
Command="{Binding RefreshTasksCommand}"
|
||||
Margin="0,0,8,0" />
|
||||
<ToggleButton Content="显示文件"
|
||||
IsChecked="{Binding ShowFilesMode}"
|
||||
Command="{Binding ToggleShowModeCommand}"
|
||||
Margin="0,0,8,0" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<!-- 主内容区域 -->
|
||||
<Grid Grid.Row="1">
|
||||
@@ -101,10 +91,12 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 图标 -->
|
||||
<Grid Grid.Column="0" Width="20" Height="20" Margin="0,0,8,0">
|
||||
<Grid Grid.Column="0" Width="20" Height="20" Margin="0,0,8,0"
|
||||
VerticalAlignment="Center">
|
||||
<!-- WPF图标 -->
|
||||
<ui:SymbolIcon Symbol="{Binding IsDirectory, Converter={x:Static local:PathingTaskSelectionWindow.DirectoryToSymbolConverter}}"
|
||||
FontSize="16"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="{Binding UseSystemIcon, Converter={StaticResource BooleanToVisibilityConverter}}" />
|
||||
</Grid>
|
||||
|
||||
|
||||
@@ -77,9 +77,6 @@ public partial class PathingTaskSelectionWindow : FluentWindow
|
||||
Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取消按钮点击事件
|
||||
/// </summary>
|
||||
private void OnCancelClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = false;
|
||||
|
||||
@@ -47,11 +47,7 @@ public partial class PathingTaskSelectionViewModel : ViewModel
|
||||
[ObservableProperty]
|
||||
private string _searchKeyword = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 显示模式:true=显示到文件级别,false=仅显示文件夹
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _showFilesMode = true;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 右侧显示的内容
|
||||
@@ -158,21 +154,18 @@ public partial class PathingTaskSelectionViewModel : ViewModel
|
||||
parentCollection.Add(taskInfo);
|
||||
}
|
||||
|
||||
// 如果是显示文件模式,加载JSON文件
|
||||
if (ShowFilesMode)
|
||||
// 加载JSON文件(默认展示到文件级别)
|
||||
foreach (var file in Directory.GetFiles(directoryPath, "*.json"))
|
||||
{
|
||||
foreach (var file in Directory.GetFiles(directoryPath, "*.json"))
|
||||
var taskInfo = new PathingTaskInfo(file, rootPath)
|
||||
{
|
||||
var taskInfo = new PathingTaskInfo(file, rootPath)
|
||||
{
|
||||
IsDirectory = false
|
||||
};
|
||||
|
||||
// 设置图标
|
||||
SetTaskIcon(taskInfo);
|
||||
|
||||
parentCollection.Add(taskInfo);
|
||||
}
|
||||
IsDirectory = false
|
||||
};
|
||||
|
||||
// 设置图标
|
||||
SetTaskIcon(taskInfo);
|
||||
|
||||
parentCollection.Add(taskInfo);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -272,8 +265,8 @@ public partial class PathingTaskSelectionViewModel : ViewModel
|
||||
task.Name.Contains(SearchKeyword, StringComparison.OrdinalIgnoreCase) ||
|
||||
task.RelativePath.Contains(SearchKeyword, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
// 根据显示模式过滤
|
||||
bool modeMatches = ShowFilesMode || task.IsDirectory;
|
||||
// 始终显示文件和目录(默认展示到文件级别)
|
||||
bool modeMatches = true;
|
||||
|
||||
// 创建新的任务对象用于显示
|
||||
var filteredTask = new PathingTaskInfo
|
||||
@@ -347,29 +340,5 @@ public partial class PathingTaskSelectionViewModel : ViewModel
|
||||
FilterTasks();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当显示模式改变时
|
||||
/// </summary>
|
||||
partial void OnShowFilesModeChanged(bool value)
|
||||
{
|
||||
LoadPathingTasks();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刷新任务列表
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
private void RefreshTasks()
|
||||
{
|
||||
LoadPathingTasks();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 切换显示模式
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
private void ToggleShowMode()
|
||||
{
|
||||
ShowFilesMode = !ShowFilesMode;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user