/// <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);
 }
Ejemplo n.º 2
0
 private void ExtendCuttingLine(OxyKey key)
 {
     bool bok = CuttingInsidePolygon.Instance.Extend(key);
     if (bok)
        plotModel.InvalidatePlot(false);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OxyKeyGesture" /> class.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="modifiers">The modifier keys.</param>
 public OxyKeyGesture(OxyKey key, OxyModifierKeys modifiers = OxyModifierKeys.None)
 {
     this.Key       = key;
     this.Modifiers = modifiers;
 }
 /// <summary>
 /// Unbinds the specified key down gesture.
 /// </summary>
 /// <param name="controller">The controller.</param>
 /// <param name="key">The key.</param>
 /// <param name="modifiers">The modifier keys.</param>
 public static void UnbindKeyDown(this IController controller, OxyKey key, OxyModifierKeys modifiers = OxyModifierKeys.None)
 {
     controller.Unbind(new OxyKeyGesture(key, modifiers));
 }
Ejemplo n.º 5
0
 /// <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);
 }
Ejemplo n.º 6
0
 /// <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)
 {
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Unbinds the specified key down gesture.
 /// </summary>
 /// <param name="controller">The controller.</param>
 /// <param name="key">The key.</param>
 /// <param name="modifiers">The modifier keys.</param>
 public static void UnbindKeyDown(this IController controller, OxyKey key, OxyModifierKeys modifiers = OxyModifierKeys.None)
 {
     controller.Unbind(new OxyKeyGesture(key, modifiers));
 }
 private bool GetOffSetAndOperation(OxyKey key, ref double xOffSet, ref double yOffset, ref CuttingOperation op)
 {
     double unitX = FishingNet.Instance.WidthUnit / 2;
     double unitY = FishingNet.Instance.HeightUnit / 2;
     bool validKey = true;
     switch (key)
     {
         case OxyKey.NumPad8://up
         case OxyKey.Up:
             yOffset = unitY;
             break;
         case OxyKey.Right:
         case OxyKey.NumPad6: //right
             xOffSet = unitX;
             op = CuttingOperation.Right;
             break;
         case OxyKey.Left:
         case OxyKey.NumPad4: //left
             xOffSet = -unitX;
             op = CuttingOperation.Left;
             break;
         case OxyKey.NumPad9: //up right
             xOffSet = unitX;
             yOffset = unitY;
             op = CuttingOperation.UpRight;
             break;
         case OxyKey.NumPad7: //up left
             xOffSet = -unitX;
             yOffset = unitY;
             op = CuttingOperation.UpLeft;
             break;
         case OxyKey.NumPad1: //left down
             xOffSet = -unitX;
             yOffset = -unitY;
             break;
         case OxyKey.NumPad3: //right down
             xOffSet = unitX;
             yOffset = unitY;
             break;
         case OxyKey.NumPad2:// down
             yOffset = -unitY;
             break;
         default:
             validKey = false;
             break;
     }
     return validKey;
 }
        internal bool Extend(OxyKey key)
        {
            if (Current.Points.Count == 0)
                return false;

            double xOffSet = 0;
            double yOffset = 0;
            double maxY = FishingNet.Instance.HeightUnit * FishingNet.Instance.YNum;
            CuttingOperation op = CuttingOperation.Up;
            if (CuttingInsidePolygon.Instance.Current.Points[0].Y > maxY)
                return false;

            bool isValidKey = GetOffSetAndOperation(key, ref xOffSet, ref yOffset, ref op);
            if (!isValidKey)
                return false;

            bool bCango = Cango(xOffSet,yOffset);
            if(bCango)
            {
                var currentPt = CuttingInsidePolygon.Instance.Current.Points[0];
                Point2D latestCurrent = new Point2D(currentPt.X + xOffSet, currentPt.Y + yOffset);
                var reachablePts = FishingNet.Instance.GetReachablePts(latestCurrent, new Point2D(currentPt.X, currentPt.Y));
                CuttingInsidePolygon.Instance.UpdateCurrent(latestCurrent, reachablePts, true);
                if (onCutting != null)
                    onCutting(op);
            }
            return bCango;
        }
Ejemplo n.º 10
0
 /// <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)
 {
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OxyKeyGesture" /> class.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="modifiers">The modifier keys.</param>
 public OxyKeyGesture(OxyKey key, OxyModifierKeys modifiers = OxyModifierKeys.None)
 {
     this.Key = key;
     this.Modifiers = modifiers;
 }