This repository has been archived by the owner on Jul 18, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathEverythingSettings.xaml.cs
89 lines (71 loc) · 2.68 KB
/
EverythingSettings.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
using System.Windows;
using System.Windows.Controls;
using Flow.Launcher.Plugin.Everything.ViewModels;
using Microsoft.Win32;
namespace Flow.Launcher.Plugin.Everything
{
public partial class EverythingSettings : UserControl
{
public Settings settings { get; }
private SettingsViewModel vm;
public EverythingSettings(Settings settings, SettingsViewModel vm)
{
this.settings = settings;
this.vm = vm;
DataContext = vm;
InitializeComponent();
}
private void View_Loaded(object sender, RoutedEventArgs re)
{
UseLocationAsWorkingDir.IsChecked = settings.UseLocationAsWorkingDir;
UseLocationAsWorkingDir.Checked += (o, e) =>
{
settings.UseLocationAsWorkingDir = true;
};
UseLocationAsWorkingDir.Unchecked += (o, e) =>
{
settings.UseLocationAsWorkingDir = false;
};
LaunchHidden.IsChecked = settings.LaunchHidden;
LaunchHidden.Checked += (o, e) =>
{
settings.LaunchHidden = true;
};
LaunchHidden.Unchecked += (o, e) =>
{
settings.LaunchHidden = false;
};
ShowWindowsContextMenu.IsChecked = settings.ShowWindowsContextMenu;
ShowWindowsContextMenu.Checked += (o, e) =>
{
settings.ShowWindowsContextMenu = true;
};
ShowWindowsContextMenu.Unchecked += (o, e) =>
{
settings.ShowWindowsContextMenu = false;
};
EditorPath.Content = settings.EditorPath;
}
private void EditorPath_Clicked(object sender, RoutedEventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "Executable File(*.exe)| *.exe";
if (!string.IsNullOrEmpty(settings.EditorPath))
openFileDialog.InitialDirectory = System.IO.Path.GetDirectoryName(settings.EditorPath);
if (openFileDialog.ShowDialog() == true)
{
settings.EditorPath = openFileDialog.FileName;
}
EditorPath.Content = settings.EditorPath;
}
private void onSelectionChange(object sender, SelectionChangedEventArgs e)
{
// on load, tbFastSortWarning control will not have been loaded yet
if (tbFastSortWarning is not null)
{
tbFastSortWarning.Visibility = vm.FastSortWarningVisibility;
tbFastSortWarning.Text = vm.GetSortOptionWarningMessage;
}
}
}
}