Remove SettingsWindowViewModel mentions from CustomShortcutSetting.xaml.cs

This commit is contained in:
Yusyuriv 2024-05-19 05:51:05 +06:00
parent 61d3758359
commit ac3c053f88
No known key found for this signature in database
GPG key ID: A91C52E6F73148E0

View file

@ -8,7 +8,6 @@ namespace Flow.Launcher
{ {
public partial class CustomShortcutSetting : Window public partial class CustomShortcutSetting : Window
{ {
private SettingWindowViewModel viewModel;
public string Key { get; set; } = String.Empty; public string Key { get; set; } = String.Empty;
public string Value { get; set; } = String.Empty; public string Value { get; set; } = String.Empty;
private string originalKey { get; init; } = null; private string originalKey { get; init; } = null;
@ -17,13 +16,11 @@ namespace Flow.Launcher
public CustomShortcutSetting(SettingWindowViewModel vm) public CustomShortcutSetting(SettingWindowViewModel vm)
{ {
viewModel = vm;
InitializeComponent(); InitializeComponent();
} }
public CustomShortcutSetting(string key, string value, SettingWindowViewModel vm) public CustomShortcutSetting(string key, string value)
{ {
viewModel = vm;
Key = key; Key = key;
Value = value; Value = value;
originalKey = key; originalKey = key;
@ -46,8 +43,7 @@ namespace Flow.Launcher
return; return;
} }
// Check if key is modified or adding a new one // Check if key is modified or adding a new one
if (((update && originalKey != Key) || !update) if ((update && originalKey != Key) || !update)
&& (viewModel?.ShortcutExists(Key) ?? false)) // TODO Remove this check after removing unused code from SettingWindow.xaml.cs
{ {
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("duplicateShortcut")); MessageBox.Show(InternationalizationManager.Instance.GetTranslation("duplicateShortcut"));
return; return;