public override void TerminateGesture(object sender, Gesture_Event_Args gEventArgs) { Gesture_Event_Linking link = gEventArgs.GestureObjects[0] as Gesture_Event_Linking; Link_List.RemoveLink(link); gestureControler.Control.MainWindow.LinkingGestureLayer.Remove(link); base.TerminateGesture(sender, gEventArgs); }
public void Remove(Gesture_Event_Linking link) { Dispatcher.BeginInvoke(new Action(() => { if (Contain(link)) { Line follower = cardLinks[link]; this.Children.Remove(arrows[follower][0]); arrows.Remove(follower); this.Children.Remove(follower); cardLinks.Remove(link); Link_List.RemoveLink(link); } })); }
public void Add(Gesture_Event_Linking link) { Dispatcher.BeginInvoke(new Action(() => { Gesture_Event_Linking temp = null; foreach (Gesture_Event_Linking gesture in cardLinks.Keys) { if (gesture.Equals(link)) { temp = gesture; } } if (temp != null) { Remove(temp); return; } Line follower = new Line(); follower.X1 = link.Card1.CurrentPosition.X; follower.Y1 = link.Card1.CurrentPosition.Y; follower.X2 = link.Points[0].CurrentPoint.Position.X; follower.Y2 = link.Points[0].CurrentPoint.Position.Y; follower.Stroke = new SolidColorBrush(link.Card1.HightlightColor); follower.StrokeThickness = 3; follower.Opacity = 1; cardLinks[link] = follower; Link_List.AddLink(link); Image image = new Image(); image.Source = arrowImage[link.Card1.Owner]; image.Width = 50; image.Height = 50; image.Stretch = Stretch.Fill; arrows[follower] = new Image[] { image }; moveArrow(follower); this.Children.Add(follower); this.Children.Add(image); Canvas.SetZIndex(image, cardLinks.Count); DoubleAnimation animation = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(STATICS.ANIMATION_DURATION)); follower.BeginAnimation(Canvas.OpacityProperty, animation); image.BeginAnimation(Canvas.OpacityProperty, animation); })); }