public ConnectionViewModel(IAnchorViewModel originator, IAnchorViewModel destination) { this.originator = originator; this.destination = destination; Left = originator.Left; Top = originator.Top; X1 = 0; Y1 = 0; double xDirection = 1; double yDirection = 1; if (originator.Node.City.Name == "San Francisco" && destination.Node.City.Name == "Tokyo" || originator.Node.City.Name == "Tokyo" && destination.Node.City.Name == "San Francisco") { xDirection = -0.1; yDirection = 0.1; } if (originator.Node.City.Name == "San Francisco" && destination.Node.City.Name == "Manila" || originator.Node.City.Name == "Manila" && destination.Node.City.Name == "San Francisco") { xDirection = -0.1; yDirection = 0.1; } if (originator.Node.City.Name == "Los Angeles" && destination.Node.City.Name == "Sydney" || originator.Node.City.Name == "Sydney" && destination.Node.City.Name == "Los Angeles") { xDirection = -0.1; yDirection = 0.1; } X2 = (destination.Left - originator.Left) * xDirection; Y2 = (destination.Top - originator.Top) * yDirection; Stroke = Brushes.White; Thickness = 3; Opacity = 1; }
private void AnimateDispatchPath(IAnchorViewModel sender) { PathGeometry pg = new PathGeometry(); pg.Figures = new PathFigureCollection(); pg.Figures.Add(new PathFigure() { StartPoint = new Point(sender.Left, sender.Top), Segments = new PathSegmentCollection(), IsClosed = false }); pg.Figures.First().Segments.Add(new LineSegment(new Point(Left, Top), true)); BoardViewModel.PathAnimationViewModel.Data = pg; opacityTimer.Start(); }