Beispiel #1
0
        /// <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));
            }
        }
Beispiel #2
0
 /// <summary>
 /// Handles the specified gesture.
 /// </summary>
 /// <param name="view">The plot view.</param>
 /// <param name="gesture">The gesture.</param>
 /// <param name="args">The <see cref="OxyInputEventArgs" /> instance containing the event data.</param>
 /// <returns><c>true</c> if the event was handled.</returns>
 public bool HandleGesture(IView view, OxyInputGesture gesture, OxyInputEventArgs args)
 {
     var command = this.GetCommand(gesture);
     return this.HandleCommand(command, view, args);
 }
Beispiel #3
0
 /// <summary>
 /// Unbinds the specified gesture.
 /// </summary>
 /// <param name="gesture">The gesture to unbind.</param>
 public virtual void Unbind(OxyInputGesture gesture)
 {
     // ReSharper disable once RedundantNameQualifier
     foreach (var icb in this.InputCommandBindings.Where(icb => icb.Gesture.Equals(gesture)).ToArray())
     {
         this.InputCommandBindings.Remove(icb);
     }
 }
Beispiel #4
0
        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns><c>true</c> if the current object is equal to the <paramref name="other" /> parameter; otherwise, <c>false</c>.</returns>
        public override bool Equals(OxyInputGesture other)
        {
            var tg = other as OxyTouchGesture;

            return(tg != null);
        }
        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns><c>true</c> if the current object is equal to the <paramref name="other" /> parameter; otherwise, <c>false</c>.</returns>
        public override bool Equals(OxyInputGesture other)
        {
            var mwg = other as OxyMouseWheelGesture;

            return(mwg != null && mwg.Modifiers == this.Modifiers);
        }
 /// <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;
 }
Beispiel #7
0
        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns><c>true</c> if the current object is equal to the <paramref name="other" /> parameter; otherwise, <c>false</c>.</returns>
        public override bool Equals(OxyInputGesture other)
        {
            var kg = other as OxyKeyGesture;

            return(kg != null && kg.Modifiers == this.Modifiers && kg.Key == this.Key);
        }
Beispiel #8
0
        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns><c>true</c> if the current object is equal to the <paramref name="other" /> parameter; otherwise, <c>false</c>.</returns>
        public override bool Equals(OxyInputGesture other)
        {
            var mg = other as OxyMouseDownGesture;

            return(mg != null && mg.Modifiers == this.Modifiers && mg.MouseButton == this.MouseButton && mg.ClickCount == this.ClickCount);
        }
 /// <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>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns><c>true</c> if the current object is equal to the <paramref name="other" /> parameter; otherwise, <c>false</c>.</returns>
        public override bool Equals(OxyInputGesture other)
        {
            var mg = other as OxyMouseEnterGesture;

            return(mg != null && mg.Modifiers == this.Modifiers);
        }
Beispiel #11
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <param name="other">An object to compare with this object.</param>
 /// <returns><c>true</c> if the current object is equal to the <paramref name="other" /> parameter; otherwise, <c>false</c>.</returns>
 public override bool Equals(OxyInputGesture other)
 {
     var sg = other as OxyShakeGesture;
     return sg != null;
 }
Beispiel #12
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <param name="other">An object to compare with this object.</param>
 /// <returns><c>true</c> if the current object is equal to the <paramref name="other" /> parameter; otherwise, <c>false</c>.</returns>
 public override bool Equals(OxyInputGesture other)
 {
     var mg = other as OxyMouseDownGesture;
     return mg != null && mg.Modifiers == this.Modifiers && mg.MouseButton == this.MouseButton && mg.ClickCount == this.ClickCount;
 }
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <param name="other">An object to compare with this object.</param>
 /// <returns><c>true</c> if the current object is equal to the <paramref name="other" /> parameter; otherwise, <c>false</c>.</returns>
 public override bool Equals(OxyInputGesture other)
 {
     var mg = other as OxyMouseEnterGesture;
     return mg != null && mg.Modifiers == this.Modifiers;
 }
Beispiel #14
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <param name="other">An object to compare with this object.</param>
 /// <returns><c>true</c> if the current object is equal to the <paramref name="other" /> parameter; otherwise, <c>false</c>.</returns>
 public override bool Equals(OxyInputGesture other)
 {
     var tg = other as OxyTouchGesture;
     return tg != null;
 }
Beispiel #15
0
        /// <summary>
        /// Gets the command for the specified <see cref="OxyInputGesture" />.
        /// </summary>
        /// <param name="gesture">The input gesture.</param>
        /// <returns>A command.</returns>
        protected virtual IViewCommand GetCommand(OxyInputGesture gesture)
        {
            var binding = this.InputCommandBindings.FirstOrDefault(b => b.Gesture.Equals(gesture));
            if (binding == null)
            {
                return null;
            }

            return binding.Command;
        }
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <param name="other">An object to compare with this object.</param>
 /// <returns><c>true</c> if the current object is equal to the <paramref name="other" /> parameter; otherwise, <c>false</c>.</returns>
 public override bool Equals(OxyInputGesture other)
 {
     var mwg = other as OxyMouseWheelGesture;
     return mwg != null && mwg.Modifiers == this.Modifiers;
 }
Beispiel #17
0
        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns><c>true</c> if the current object is equal to the <paramref name="other" /> parameter; otherwise, <c>false</c>.</returns>
        public override bool Equals(OxyInputGesture other)
        {
            var sg = other as OxyShakeGesture;

            return(sg != null);
        }
Beispiel #18
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <param name="other">An object to compare with this object.</param>
 /// <returns><c>true</c> if the current object is equal to the <paramref name="other" /> parameter; otherwise, <c>false</c>.</returns>
 public override bool Equals(OxyInputGesture other)
 {
     var kg = other as OxyKeyGesture;
     return kg != null && kg.Modifiers == this.Modifiers && kg.Key == this.Key;
 }