/// <summary> /// Launches the editor for this type. /// </summary> /// <param name="context">Type descriptor context.</param> /// <param name="provider">Service provider.</param> /// <param name="value">The current value.</param> /// <returns>The updated values.</returns> public override Object EditValue(ITypeDescriptorContext context, IServiceProvider provider, Object value) { Hotkey hotkey = value as Hotkey; View.Editors.HotkeyEditor hotkeyEditor = new View.Editors.HotkeyEditor(hotkey) { Owner = Application.Current.MainWindow }; if (hotkeyEditor.ShowDialog() == true) { hotkey = hotkeyEditor.HotkeyEditorViewModel.ActiveHotkey.Build(hotkey); if (hotkey != null) { return(hotkey); } else { return(null); } } return(value); }
public void EditKeys() { View.Editors.HotkeyEditor hotKeyEditor = new View.Editors.HotkeyEditor(this.HotKeys); if (hotKeyEditor.ShowDialog() == true) { this.HotKeys = new List <IHotkey>(hotKeyEditor.HotkeyEditorViewModel.Hotkeys); } }
private void EditHotkeys() { View.Editors.HotkeyEditor hotkeyEditor = new View.Editors.HotkeyEditor(InputCorrelatorModel.HotKeys); hotkeyEditor.Owner = Application.Current.MainWindow; if (hotkeyEditor.ShowDialog() == true) { List <IHotkey> newOffsets = hotkeyEditor.HotkeyEditorViewModel.Hotkeys.ToList(); if (newOffsets != null && newOffsets.Count > 0) { this.InputCorrelatorModel.HotKeys = hotkeyEditor.HotkeyEditorViewModel.Hotkeys.ToList(); this.RaisePropertyChanged(nameof(this.Hotkeys)); } else { return; } } }
/// <summary> /// Launches the editor for this type. /// </summary> /// <param name="context">Type descriptor context.</param> /// <param name="provider">Service provider.</param> /// <param name="value">The current value.</param> /// <returns>The updated values.</returns> public override Object EditValue(ITypeDescriptorContext context, IServiceProvider provider, Object value) { View.Editors.HotkeyEditor hotkeyEditor = new View.Editors.HotkeyEditor(value == null ? null : (value as IEnumerable <IHotkey>)?.ToList()); hotkeyEditor.Owner = Application.Current.MainWindow; if (hotkeyEditor.ShowDialog() == true) { List <IHotkey> newOffsets = hotkeyEditor.HotkeyEditorViewModel.Hotkeys.ToList(); if (newOffsets != null && newOffsets.Count > 0) { return(newOffsets); } else { return(null); } } return(value); }