From c2b14815e30334c8d0563b60d7ffb4fda82a86c7 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Sat, 8 Oct 2022 16:40:48 +0800 Subject: [PATCH] Warn if trying to add existing shortcut 1. Warn if trying to add existing shortcut --- Flow.Launcher.Infrastructure/UserSettings/Settings.cs | 2 +- Flow.Launcher/SettingWindow.xaml.cs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 8feba325c..c9b76c2f5 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -175,6 +175,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings public ObservableCollection CustomPluginHotkeys { get; set; } = new ObservableCollection(); + public ObservableCollection CustomShortcuts { get; set; } = new ObservableCollection(); 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 CustomShortcuts { get; set; } = new(); } public enum LastQueryMode diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 2db00f959..f896af4a0 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -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); } }