Warn if trying to add existing shortcut

1. Warn if trying to add existing shortcut
This commit is contained in:
Vic 2022-10-08 16:40:48 +08:00
parent a0c70a3432
commit c2b14815e3
2 changed files with 6 additions and 1 deletions

View file

@ -175,6 +175,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
public ObservableCollection<CustomPluginHotkey> CustomPluginHotkeys { get; set; } = new ObservableCollection<CustomPluginHotkey>();
public ObservableCollection<CustomShortcutModel> CustomShortcuts { get; set; } = new ObservableCollection<CustomShortcutModel>();
public bool DontPromptUpdateMsg { get; set; }
public bool EnableUpdateLog { get; set; }
@ -204,7 +205,6 @@ namespace Flow.Launcher.Infrastructure.UserSettings
// This needs to be loaded last by staying at the bottom
public PluginsSettings PluginSettings { get; set; } = new PluginsSettings();
internal ObservableCollection<CustomShortcutModel> CustomShortcuts { get; set; } = new();
}
public enum LastQueryMode

View file

@ -415,6 +415,11 @@ namespace Flow.Launcher
var shortcutSettingWindow = new CustomShortcutSetting();
if (shortcutSettingWindow.ShowDialog() == true)
{
if (settings.CustomShortcuts.Contains(shortcutSettingWindow.ShortCut))
{
MessageBox.Show("Dulplicate shortcut");
return;
}
settings.CustomShortcuts.Add(shortcutSettingWindow.ShortCut);
}
}