public PreferencesWindow() { this.InitializeComponent(); Toggl.OnSettings += this.onSettings; Toggl.OnLogin += this.onLogin; Toggl.OnProjectAutocomplete += this.onProjectAutocomplete; this.showHideShortcutRecorder = new ShortcutRecorder( this.showHideShortcutRecordButton, this.showHideShortcutClearButton, this.shortcutErrorText, "Global Show/Hide" ); this.continueStopShortcutRecorder = new ShortcutRecorder( this.continueStopShortcutRecordButton, this.continueStopShortcutClearButton, this.shortcutErrorText, "Global Continue/Stop" ); var allShortcutRecorders = new List <ShortcutRecorder> { this.showHideShortcutRecorder, this.continueStopShortcutRecorder }.AsReadOnly(); foreach (var recorder in allShortcutRecorders) { recorder.SetShortcutList(allShortcutRecorders); } this.IsVisibleChanged += (sender, args) => this.isVisibleChanged(); }
public PreferencesWindow() { this.InitializeComponent(); Toggl.OnSettings += this.onSettings; Toggl.OnLogin += this.onLogin; Toggl.OnProjectAutocomplete += this.onProjectAutocomplete; this.showHideShortcutRecorder = new ShortcutRecorder( this.showHideShortcutRecordButton, this.showHideShortcutClearButton, this.shortcutErrorText, "Global Show/Hide" ); this.continueStopShortcutRecorder = new ShortcutRecorder( this.continueStopShortcutRecordButton, this.continueStopShortcutClearButton, this.shortcutErrorText, "Global Continue/Stop" ); var allShortcutRecorders = new List<ShortcutRecorder> { this.showHideShortcutRecorder, this.continueStopShortcutRecorder }.AsReadOnly(); foreach (var recorder in allShortcutRecorders) { recorder.SetShortcutList(allShortcutRecorders); } this.IsVisibleChanged += (sender, args) => this.isVisibleChanged(); }
public PreferencesWindow() { this.InitializeComponent(); Toggl.OnSettings += this.onSettings; Toggl.OnLogin += this.onLogin; this.showHideShortcutRecorder = new ShortcutRecorder(this.showHideShortcutRecordButton, this.showHideShortcutClearButton); this.continueStopShortcutRecorder = new ShortcutRecorder(this.continueStopShortcutRecordButton, this.continueStopShortcutClearButton); this.IsVisibleChanged += (sender, args) => this.isVisibleChanged(); }
private static void trySetHotKey(Func<string> getKeyCode, Func<ModifierKeys> getModifiers, ShortcutRecorder recorder) { try { var keyCode = getKeyCode(); if (string.IsNullOrEmpty(keyCode)) { recorder.Reset(null); return; } var modifiers = getModifiers(); recorder.Reset(new Utils.KeyCombination(modifiers, keyCode)); } catch (Exception e) { Toggl.Debug(string.Format("Could not load hotkey: {0}", e)); recorder.Reset(null); } }
private static void trySetHotKey(Func <string> getKeyCode, Func <ModifierKeys> getModifiers, ShortcutRecorder recorder) { try { var keyCode = getKeyCode(); if (string.IsNullOrEmpty(keyCode)) { recorder.Reset(null); return; } var modifiers = getModifiers(); recorder.Reset(new Utils.KeyCombination(modifiers, keyCode)); } catch (Exception e) { Toggl.Debug(string.Format("Could not load hotkey: {0}", e)); recorder.Reset(null); } }