void settings_ChangeDoubleCharSettings() { if (!settings.DoubleCharEnabled) { if (ctrDoubleChar == null) return; ctrDoubleChar.Disable(); if (settings.SwitchEnableOrDisableDoubleCharShortCut == Keys.None) { ctrDoubleChar.Dispose(); ctrDoubleChar = null; } } else { // activate Double Char if (ctrDoubleChar == null) { ctrDoubleChar = new ControlShortCutAutoClose(settings, abbrevationCompletition); } ctrDoubleChar.EnabledAutoCloseAndListenOpenDocuments(); ctrDoubleChar.EnableCreateParameters(abbrevationCompletition); if (settings.SwitchEnableOrDisableDoubleCharShortCut != Keys.None) { if (dictNotifyPressKey.ContainsKey(settings.SwitchEnableOrDisableDoubleCharShortCut)) { settings.switchEnableOrDisableDoubleCharShortCut = Keys.None; MessageBox.Show("Shorcut already in use in QuickGenerator!!\nPlease choose another Shorcut!!"); } else dictNotifyPressKey.Add(settings.SwitchEnableOrDisableDoubleCharShortCut, ctrDoubleChar); ActivateEventKeys(); } } }
bool settings_ChangeShortCut(settingsComponent nameComponent, Keys oldKeys, Keys newKeys, bool disable) { switch (nameComponent) { case settingsComponent.CreateClass: if (dictNotifyPressKey.ContainsKey(newKeys)) { MessageBox.Show("Shorcut already in use in QuickGenerator!!\nPlease choose another Shorcut!!"); return true; } ShortcutMenuChangeHandler(); return false; case settingsComponent.FormatterCode: if (reformatterCode == null) return false; if (dictNotifyPressKey.ContainsKey(oldKeys)) { if (dictNotifyPressKey[oldKeys] is ReformatterCode) dictNotifyPressKey.Remove(oldKeys); } if (newKeys != Keys.None) if (settings.FormatterCodeEnabled) { if (!dictNotifyPressKey.ContainsKey(newKeys)) { dictNotifyPressKey.Add(newKeys, reformatterCode); } else { MessageBox.Show("Shorcut already in use in QuickGenerator!!\nPlease choose another Shorcut!!"); return true; } } break; case settingsComponent.ClipBoardRing: if (monitorClipBoard == null) return false; if (dictNotifyPressKey.ContainsKey(oldKeys)) { if (dictNotifyPressKey[oldKeys] is frmMonitor) dictNotifyPressKey.Remove(oldKeys); } if (newKeys != Keys.None) if (settings.EnableClipBoardRing) { if (!dictNotifyPressKey.ContainsKey(newKeys)) { dictNotifyPressKey.Add(newKeys, monitorClipBoard); } else { MessageBox.Show("Shorcut already in use in QuickGenerator!!\nPlease choose another Shorcut!!"); return true; } } break; case settingsComponent.Abbrevation: if (abbrevationCompletition == null) return false; if (dictNotifyPressKey.ContainsKey(oldKeys)) { if (dictNotifyPressKey[oldKeys] is Abbreviations) dictNotifyPressKey.Remove(oldKeys); } if (newKeys != Keys.None) if (settings.AbbrevationEnabled) { if (!dictNotifyPressKey.ContainsKey(newKeys)) { dictNotifyPressKey.Add(newKeys, abbrevationCompletition); } else { MessageBox.Show("Shorcut already in use in QuickGenerator!!\nPlease choose another Shorcut!!"); return true; } } break; case settingsComponent.DoubleChar: if (dictNotifyPressKey.ContainsKey(oldKeys)) { if (dictNotifyPressKey[oldKeys] is ControlShortCutAutoClose) dictNotifyPressKey.Remove(oldKeys); } if (newKeys != Keys.None) { if (settings.DoubleCharEnabled) { if (!dictNotifyPressKey.ContainsKey(newKeys)) { if (ctrDoubleChar == null) ctrDoubleChar = new ControlShortCutAutoClose(settings, abbrevationCompletition); dictNotifyPressKey.Add(newKeys, ctrDoubleChar); } else { MessageBox.Show("Shorcut already in use in QuickGenerator!!\nPlease choose another Shorcut!!"); return true; } } } else { if (!settings.DoubleCharEnabled) { ctrDoubleChar.Dispose(); ctrDoubleChar = null; } } break; } ActivateEventKeys(); DisactivateEventKey(); return false; }
private void Init() { if (settings.EnableClipBoardRing) EnableMonitor(); if (settings.AbbrevationEnabled) EnableAbbreviation(); // this is Auto Close option enabled if (settings.DoubleCharEnabled) { ctrDoubleChar = new ControlShortCutAutoClose(settings, abbrevationCompletition); ctrDoubleChar.Enable(); if (settings.SwitchEnableOrDisableDoubleCharShortCut != Keys.None) { dictNotifyPressKey.Add(settings.SwitchEnableOrDisableDoubleCharShortCut, ctrDoubleChar); ActivateEventKeys(); } } if (settings.FormatterCodeEnabled) EnableReformatterCode(); if (settings.FormatterCodeEnabled && settings.AbbrevationEnabled) abbrevationCompletition.reformatterCode = reformatterCode; settings.ChangeClipBoardRingSettings += new ChangeClipBoardRingSettingsEventHanlder(settings_ChangeClipBoardRingSettings); settings.ChangeAbbrevationSettings += new ChangeAbbrevationSettingsEventHanlder(settings_ChangeAbbrevationSettings); settings.ChangeDoubleCharSettings += new ChangeDoubleCharSettingsEventHanlder(settings_ChangeDoubleCharSettings); settings.ChangeFormatterCodeSettings += new ChangeFormatterCodeSettingsEventHanlder(settings_ChangeFormatterCodeSettings); settings.ChangeShortCut += new ChangeShortCutEventHanlder(settings_ChangeShortCut); settings.ChangeFunctionAutoClose += new ChangeAutoCloseFunctionEventHanlder(settings_ChangeFunctionAutoClose); }