Add settings, cloud places, and optional archive-content indexing.
Keep official clients in charge of sync while Explorer can group locations, persist UI prefs, and list zip/rar/7z members without extracting them. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
51
src/Explorer.App/SettingsWindow.xaml.cs
Normal file
51
src/Explorer.App/SettingsWindow.xaml.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System.Windows;
|
||||
using Explorer.Application;
|
||||
using Explorer.Presentation.ViewModels;
|
||||
|
||||
namespace Explorer.App;
|
||||
|
||||
public partial class SettingsWindow : Window
|
||||
{
|
||||
private readonly MainViewModel _vm;
|
||||
private readonly string _originalTheme;
|
||||
|
||||
public SettingsWindow(MainViewModel vm)
|
||||
{
|
||||
InitializeComponent();
|
||||
_vm = vm;
|
||||
var prefs = vm.CurrentPreferences();
|
||||
_originalTheme = prefs.Theme;
|
||||
ThemeDark.IsChecked = prefs.Theme != "Light";
|
||||
ThemeLight.IsChecked = prefs.Theme == "Light";
|
||||
GroupNetwork.IsChecked = prefs.GroupNetworkPlaces;
|
||||
GroupCloud.IsChecked = prefs.GroupCloudPlaces;
|
||||
IndexArchives.IsChecked = prefs.IndexArchiveContents;
|
||||
}
|
||||
|
||||
private void OnThemeChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!IsLoaded)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_vm.Theme = ThemeLight.IsChecked == true ? "Light" : "Dark";
|
||||
}
|
||||
|
||||
private async void OnOk(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var prefs = new UiPreferences(
|
||||
ThemeLight.IsChecked == true ? "Light" : "Dark",
|
||||
GroupNetwork.IsChecked == true,
|
||||
GroupCloud.IsChecked == true,
|
||||
IndexArchives.IsChecked == true);
|
||||
await _vm.ApplyPreferencesAsync(prefs).ConfigureAwait(true);
|
||||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void OnCancel(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_vm.Theme = _originalTheme;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user