using System.Diagnostics; using System.Linq; using System.Windows; using static QuikDawEditor.EDITING.ShorcutKeys; using static QuikDawEditor.EDITING.StaticProperties; namespace QuikDawEditor; public partial class EditorWindow { bool settingsWereUpdated = false; private void SetUserMenuCommandBindings() { //Remove any extra shortcutkey entries from settings for (int sckcount = Properties.Settings.Default.ShortcutKeys.Count - 1; sckcount > -1; sckcount -= 1) { if (DefaultShortCutKeyList.Where(sck=>sck.CommandName ==Properties.Settings.Default.ShortcutKeys[sckcount].Split("=")[0]).Count() == 0) { Properties.Settings.Default.ShortcutKeys.RemoveAt(sckcount); settingsWereUpdated = true; } } //Add any new shortcutkey entries to settings foreach (UserCommandKeyPair userckp in DefaultShortCutKeyList) { bool foundInSettings = false; foreach (string ssstring in Properties.Settings.Default.ShortcutKeys) { if (ssstring.Split("=")[0] == userckp.CommandName) { foundInSettings = true; break; } } if (!foundInSettings) { Properties.Settings.Default.ShortcutKeys.Add(userckp.GetSettingString); settingsWereUpdated = true; } } if (settingsWereUpdated) { Debug.WriteLine("Shortcut key list updated"); Properties.Settings.Default.Save(); } foreach (string s in Properties.Settings.Default.ShortcutKeys) userCommandKeyPairs.Add(new UserCommandKeyPair(s)); } }