public void ReloadSettings() { bool firstTime; InitXml(out firstTime); InitNotify(firstTime); InitTimer(); sound.SoundLocation = settingsFile.Settings.SoundPath; try { globalHotkey.Dispose(); } catch { //Unregister key } finally { globalHotkey = new KeyboardHook(); } if (settingsFile.Settings.GlobalHotkey.Length > 0) { try { Tuple <Keys, ModifierKeys> keysTuple = KeysHelper.ConvertFromString(settingsFile.Settings.GlobalHotkey); globalHotkey.RegisterHotKey(keysTuple.Item2, keysTuple.Item1); } catch (Exception e) { MessageBox.Show(e.Message, assemblyTitle.Title, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { globalHotkey.KeyPressed += delegate { notify.ContextMenu.MenuItems[2].PerformClick(); }; } } }
public void ReloadSettings() { bool firstTime; InitXml(out firstTime); InitNotify(firstTime); InitTimer(); sound.SoundLocation = settingsFile.Settings.SoundPath; try { globalHotkey.Dispose(); } catch { //Unregister key } finally { globalHotkey = new KeyboardHook(); } if (settingsFile.Settings.GlobalHotkey.Length > 0) { try { Tuple<Keys, ModifierKeys> keysTuple = KeysHelper.ConvertFromString(settingsFile.Settings.GlobalHotkey); globalHotkey.RegisterHotKey(keysTuple.Item2, keysTuple.Item1); } catch (Exception e) { MessageBox.Show(e.Message, assemblyTitle.Title, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { globalHotkey.KeyPressed += delegate { notify.ContextMenu.MenuItems[2].PerformClick(); }; } } }