/// <summary> /// Binds the specified modifier+key to the specified command. /// </summary> /// <param name="controller">The plot controller.</param> /// <param name="key">The key.</param> /// <param name="modifiers">The key modifiers.</param> /// <param name="command">A plot controller command that takes key event arguments.</param> public static void BindKeyDown(this IController controller, OxyKey key, OxyModifierKeys modifiers, IViewCommand <OxyKeyEventArgs> command) { controller.Bind(new OxyKeyGesture(key, modifiers), command); }
/// <summary> /// Binds the specified mouse button to the specified command. /// </summary> /// <param name="controller">The plot controller.</param> /// <param name="mouseButton">The mouse button.</param> /// <param name="command">A plot controller command that takes mouse event arguments.</param> public static void BindMouseDown(this IController controller, OxyMouseButton mouseButton, IViewCommand<OxyMouseDownEventArgs> command) { controller.Bind(new OxyMouseDownGesture(mouseButton), command); }
/// <summary> /// Binds the specified command to the specified key gesture. Removes old bindings to the gesture. /// </summary> /// <param name="gesture">The gesture.</param> /// <param name="command">The command. If <c>null</c>, the binding will be removed.</param> public virtual void Bind(OxyKeyGesture gesture, IViewCommand<OxyKeyEventArgs> command) { this.BindCore(gesture, command); }
/// <summary> /// Binds the specified command to the specified gesture. Removes old bindings to the gesture. /// </summary> /// <param name="gesture">The gesture.</param> /// <param name="command">The command. If <c>null</c>, the binding will be removed.</param> /// <remarks>This method was created to avoid calling a virtual method in the constructor.</remarks> protected void BindCore(OxyInputGesture gesture, IViewCommand command) { var current = this.InputCommandBindings.FirstOrDefault(icb => icb.Gesture.Equals(gesture)); if (current != null) { this.InputCommandBindings.Remove(current); } if (command != null) { this.InputCommandBindings.Add(new InputCommandBinding(gesture, command)); } }
/// <summary> /// Initializes a new instance of the <see cref="InputCommandBinding" /> class by a key gesture. /// </summary> /// <param name="key">The key.</param> /// <param name="modifiers">The modifiers.</param> /// <param name="command">The command.</param> public InputCommandBinding(OxyKey key, OxyModifierKeys modifiers, IViewCommand command) : this(new OxyKeyGesture(key, modifiers), command) { }
/// <summary> /// Binds the specified command to the specified mouse wheel gesture. Removes old bindings to the gesture. /// </summary> /// <param name="gesture">The gesture.</param> /// <param name="command">The command. If <c>null</c>, the binding will be removed.</param> public virtual void Bind(OxyMouseWheelGesture gesture, IViewCommand <OxyMouseWheelEventArgs> command) { this.BindCore(gesture, command); }
/// <summary> /// Initializes a new instance of the <see cref="InputCommandBinding" /> class by a gesture. /// </summary> /// <param name="gesture">The gesture.</param> /// <param name="command">The command.</param> public InputCommandBinding(OxyInputGesture gesture, IViewCommand command) { this.Gesture = gesture; this.Command = command; }
/// <summary> /// Binds the mouse enter event to the specified command. /// </summary> /// <param name="controller">The plot controller.</param> /// <param name="command">A plot controller command that takes mouse event arguments.</param> public static void BindMouseEnter(this IController controller, IViewCommand<OxyMouseEventArgs> command) { controller.Bind(new OxyMouseEnterGesture(), command); }
/// <summary> /// Binds the mouse enter event to the specified command. /// </summary> /// <param name="controller">The plot controller.</param> /// <param name="command">A plot controller command that takes mouse event arguments.</param> public static void BindMouseEnter(this IController controller, IViewCommand <OxyMouseEventArgs> command) { controller.Bind(new OxyMouseEnterGesture(), command); }
bool IViewService.TryResolveViewCommand(string command, out IViewCommand viewCommand) { throw new NotImplementedException(); }
/// <summary> /// Binds the touch down event to the specified command. /// </summary> /// <param name="controller">The plot controller.</param> /// <param name="command">A plot controller command that takes touch event arguments.</param> public static void BindTouchDown(this IController controller, IViewCommand <OxyTouchEventArgs> command) { controller.Bind(new OxyTouchGesture(), command); }
/// <summary> /// Binds the specified modifiers+mouse button+click count gesture to the specified command. /// </summary> /// <param name="controller">The plot controller.</param> /// <param name="mouseButton">The mouse button.</param> /// <param name="modifiers">The modifiers.</param> /// <param name="clickCount">The click count.</param> /// <param name="command">A plot controller command that takes mouse event arguments.</param> public static void BindMouseDown(this IController controller, OxyMouseButton mouseButton, OxyModifierKeys modifiers, int clickCount, IViewCommand <OxyMouseDownEventArgs> command) { controller.Bind(new OxyMouseDownGesture(mouseButton, modifiers, clickCount), command); }
/// <summary> /// Binds the specified mouse button to the specified command. /// </summary> /// <param name="controller">The plot controller.</param> /// <param name="mouseButton">The mouse button.</param> /// <param name="command">A plot controller command that takes mouse event arguments.</param> public static void BindMouseDown(this IController controller, OxyMouseButton mouseButton, IViewCommand <OxyMouseDownEventArgs> command) { controller.Bind(new OxyMouseDownGesture(mouseButton), command); }
/// <summary> /// Binds the specified modifiers+mouse button+click count gesture to the specified command. /// </summary> /// <param name="controller">The plot controller.</param> /// <param name="mouseButton">The mouse button.</param> /// <param name="modifiers">The modifiers.</param> /// <param name="clickCount">The click count.</param> /// <param name="command">A plot controller command that takes mouse event arguments.</param> public static void BindMouseDown(this IController controller, OxyMouseButton mouseButton, OxyModifierKeys modifiers, int clickCount, IViewCommand<OxyMouseDownEventArgs> command) { controller.Bind(new OxyMouseDownGesture(mouseButton, modifiers, clickCount), command); }
/// <summary> /// Binds the touch down event to the specified command. /// </summary> /// <param name="controller">The plot controller.</param> /// <param name="command">A plot controller command that takes touch event arguments.</param> public static void BindTouchDown(this IController controller, IViewCommand<OxyTouchEventArgs> command) { controller.Bind(new OxyTouchGesture(), command); }
/// <summary> /// Initializes a new instance of the <see cref="InputCommandBinding" /> class by a mouse gesture. /// </summary> /// <param name="mouseButton">The mouse button.</param> /// <param name="modifiers">The modifiers.</param> /// <param name="command">The command.</param> public InputCommandBinding(OxyMouseButton mouseButton, OxyModifierKeys modifiers, IViewCommand command) : this(new OxyMouseDownGesture(mouseButton, modifiers), command) { }
public bool TryResolveViewCommand(string command, out IViewCommand viewCommand) { throw new NotImplementedException(); }
/// <summary> /// Binds the specified command to the specified key gesture. Removes old bindings to the gesture. /// </summary> /// <param name="gesture">The gesture.</param> /// <param name="command">The command. If <c>null</c>, the binding will be removed.</param> public virtual void Bind(OxyKeyGesture gesture, IViewCommand <OxyKeyEventArgs> command) { this.BindCore(gesture, command); }
/// <summary> /// Binds the specified command to the specified mouse wheel gesture. Removes old bindings to the gesture. /// </summary> /// <param name="gesture">The gesture.</param> /// <param name="command">The command. If <c>null</c>, the binding will be removed.</param> public virtual void Bind(OxyMouseWheelGesture gesture, IViewCommand<OxyMouseWheelEventArgs> command) { this.BindCore(gesture, command); }
/// <summary> /// Binds the modifier+mouse wheel event to the specified command. /// </summary> /// <param name="controller">The plot controller.</param> /// <param name="modifiers">The modifier key(s).</param> /// <param name="command">A plot controller command that takes mouse wheel event arguments.</param> public static void BindMouseWheel(this IController controller, OxyModifierKeys modifiers, IViewCommand<OxyMouseWheelEventArgs> command) { controller.Bind(new OxyMouseWheelGesture(modifiers), command); }
/// <summary> /// Unbinds the specified command from all gestures. /// </summary> /// <param name="command">The command to unbind.</param> public virtual void Unbind(IViewCommand command) { // ReSharper disable once RedundantNameQualifier foreach (var icb in this.InputCommandBindings.Where(icb => object.ReferenceEquals(icb.Command, command)).ToArray()) { this.InputCommandBindings.Remove(icb); } }
/// <summary> /// Binds the specified modifier+key to the specified command. /// </summary> /// <param name="controller">The plot controller.</param> /// <param name="key">The key.</param> /// <param name="modifiers">The key modifiers.</param> /// <param name="command">A plot controller command that takes key event arguments.</param> public static void BindKeyDown(this IController controller, OxyKey key, OxyModifierKeys modifiers, IViewCommand<OxyKeyEventArgs> command) { controller.Bind(new OxyKeyGesture(key, modifiers), command); }
/// <summary> /// Handles a command triggered by an input gesture. /// </summary> /// <param name="command">The command.</param> /// <param name="view">The plot view.</param> /// <param name="args">The <see cref="OxyInputEventArgs" /> instance containing the event data.</param> /// <returns><c>true</c> if the command was handled.</returns> protected virtual bool HandleCommand(IViewCommand command, IView view, OxyInputEventArgs args) { if (command == null) { return false; } command.Execute(view, this, args); return args.Handled; }
/// <summary> /// Binds the modifier+mouse wheel event to the specified command. /// </summary> /// <param name="controller">The plot controller.</param> /// <param name="modifiers">The modifier key(s).</param> /// <param name="command">A plot controller command that takes mouse wheel event arguments.</param> public static void BindMouseWheel(this IController controller, OxyModifierKeys modifiers, IViewCommand <OxyMouseWheelEventArgs> command) { controller.Bind(new OxyMouseWheelGesture(modifiers), command); }