private void Window_Loaded(object sender, RoutedEventArgs e) { var shortcuts = ShortCut.LoadShortcuts(); var textboxes = new System.Windows.Controls.TextBox[] { TargetShowKeyText, TargetHideKeyText, WindowShowKeyText, WindowHideKeyText }; for (int i = 0; i < textboxes.Length; i++) { var textbox = textboxes[i]; if (i >= shortcuts.Count) { break; } textbox.Text = GetKeyString(shortcuts[i]); } }
private void initializeHotKey() { this.KeyBinder.Clear(); var sc = ShortCut.LoadShortcuts(); var i = 0; this.KeyBinder.AddBindHandler(sc[i].key, sc[i ++].modifierKey, delegate(object sender, KeyPressedEventArgs e) { this.showFetishes(); }); this.KeyBinder.AddBindHandler(sc[i].key, sc[i ++].modifierKey, delegate(object sender, KeyPressedEventArgs e) { this.hideFetishes(); }); this.KeyBinder.AddBindHandler(sc[i].key, sc[i ++].modifierKey, delegate(object sender, KeyPressedEventArgs e) { this.Show(); }); this.KeyBinder.AddBindHandler(sc[i].key, sc[i ++].modifierKey, delegate(object sender, KeyPressedEventArgs e) { this.Hide(); }); }