コード例 #1
0
        /// <summary>
        /// Processes.
        /// </summary>
        public override void Process()
        {
            if (dispatcher == null)
            {
                return;
            }
            var hasArg = Arguments.Count > 1 && !string.IsNullOrWhiteSpace(Arguments[1]);

            if (!hasArg)
            {
                WriteMessage(dispatcher.DefaultVerbFactory, false);
                System.Console.WriteLine();
            }

            foreach (var item in hasArg ? dispatcher.VerbFactorysRegistered(Arguments[1]) : dispatcher.VerbFactorysRegistered())
            {
                System.Console.WriteLine(item.MatchDescription);
                if (hasArg)
                {
                    System.Console.WriteLine();
                }
                WriteMessage(item.VerbFactory, hasArg);
                System.Console.WriteLine();
            }

            if (!hasArg)
            {
                LineUtilities.WriteDoubleLines(FurtherDescription);
            }
        }
コード例 #2
0
        public void MoveToEndOf(Line line)
        {
            var lineEnd = LineUtilities.EndPoint(line);

            Canvas.SetLeft(this, lineEnd.X - 10);
            Canvas.SetTop(this, lineEnd.Y - 10);
        }
コード例 #3
0
 public void OnLineTargeted(object line, EventArgs e)
 {
     if (line is SnappableLine snappableLine)
     {
         LineUtilities.MoveLineTo(PreviewLine, snappableLine);
     }
 }
コード例 #4
0
        public void PositionLabelBelowCenterOfLine()
        {
            var midPoint = LineUtilities.MidPoint(new Point(Line.X1, Line.Y1),
                                                  new Point(Line.X2, Line.Y2));

            SetLeft(Label, midPoint.X);
            SetTop(Label, midPoint.Y);
        }
コード例 #5
0
ファイル: LinesManager.cs プロジェクト: OliverNi/DrawableGrid
 public void OnMouseMove(object source, MouseEventArgs e)
 {
     if (_previewLineManager.IsActive() && source is IInputElement element)
     {
         RenderPreviewLine(LineUtilities.StartPoint(_previewLineManager.PreviewLine.Line),
                           element);
     }
 }
コード例 #6
0
 public void OnEditModeActivated(DrawableLine source, LineDragEventArgs e)
 {
     if (e.Direction is LineResizeGrip.DragDirection.Start)
     {
         LineUtilities.ChangeDirection(PreviewLine.Line);
     }
     PreviewLine.Show();
 }
コード例 #7
0
ファイル: LinesManager.cs プロジェクト: OliverNi/DrawableGrid
 private void OnLineDragged(DrawableLine source, MouseButtonEventArgs e)
 {
     if (source is SnappableLine line)
     {
         _lineManager.MoveLine(line, LineUtilities.StartPoint(line.Line), e.GetPosition(_grid));
     }
     else
     {
         source.Move(LineUtilities.StartPoint(source.Line), e.GetPosition(_grid));
     }
 }
コード例 #8
0
 public void Update()
 {
     Content = ((int)Math.Round(LineUtilities.Distance(new Point(_line.X1, _line.Y1),
                                                       new Point(_line.X2, _line.Y2)))).ToString();
 }
コード例 #9
0
 public PointToLineDistance DistanceFrom(Point point)
 {
     return(LineUtilities.GetClosestPointOnLineSegment(point, Line));
 }