/// <summary> /// Return a Copy of this item /// </summary> /// <returns>A copy of this catalog</returns> public WinHotkeyCat Copy( ) { var ret = new WinHotkeyCat(); foreach (var hk in this) { ret.Add(hk.Key, hk.Value.Copy( )); } return(ret); }
// Handle the hotkey entry for the given Key item private string HandleHotkey(Hotkeys hotkey) { // Setup of the Input Form if (m_hotkeys.ContainsKey(hotkey)) { HKdialog.Hotkey = m_hotkeys[hotkey]; } else { HKdialog.Hotkey = new Win.WinHotkey( ); // not set -> empty } var old = HKdialog.Hotkey.AsString; HKdialog.ProfileName = $"{hotkey} Hotkey"; if (HKdialog.ShowDialog(this) == DialogResult.OK) { // OK - save keys if (m_hotkeys.ContainsKey(hotkey)) { // HK exists if (HKdialog.Hotkey.isValid) { m_hotkeys[hotkey] = HKdialog.Hotkey.Copy( ); // replace } else { m_hotkeys.Remove(hotkey); // remove } } else { // HK does not exist if (HKdialog.Hotkey.isValid) { m_hotkeys.Add(hotkey, HKdialog.Hotkey.Copy( )); // add } } return(HKdialog.Hotkey.AsString); } else { // cancelled return(old); // the one we started with } }