private bool RegHotkeyFromString(string hotkeyStr, string callbackName, Label indicator = null) { var _callback = HotkeyCallbacks.GetCallback(callbackName); if (_callback == null) { throw new Exception($"{callbackName} not found"); } var callback = _callback as HotKeys.HotKeyCallBackHandler; if (hotkeyStr.IsNullOrEmpty()) { HotKeys.UnregExistingHotkey(callback); if (indicator != null) { indicator.ResetBackColor(); } return(true); } else { var hotkey = HotKeys.Str2HotKey(hotkeyStr); if (hotkey == null) { MessageBox.Show(string.Format(I18N.GetString("Cannot parse hotkey: {0}"), hotkeyStr)); return(false); } else { bool regResult = (HotKeys.RegHotkey(hotkey, callback)); if (indicator != null) { indicator.BackColor = regResult ? Color.Green : Color.Yellow; } return(regResult); } } }