public static void AddLink(Gesture_Event_Linking link) { if (!cardLinks.Contains(link)) { cardLinks.Add(link); } }
public static Gesture_Event_Linking Detect(List<My_Point> points, Gesture_Controler controler) { List<My_Point> result = new List<My_Point>(); foreach (My_Point point in points) { if (point.Sender is Linking_Icon) { result.Add(point); Card card = (point.Sender as Linking_Icon).Card; My_Point[] argPoints = result.ToArray(); object[] objects = new object[2]; objects[0] = card; Gesture_Event_Linking linkEvent = new Gesture_Event_Linking(); linkEvent.Points = argPoints; Gesture_List.addGesture(linkEvent); Gesture_Linking_Listener gestureLinkingListener = new Gesture_Linking_Listener(controler, linkEvent); linkEvent.Register(objects, argPoints); foreach (My_Point p in result) { controler.NewGesturePoints.Remove(p); } return linkEvent; } } return null; }
public static void RemoveLink(Gesture_Event_Linking link) { if (cardLinks.Contains(link)) { cardLinks.Remove(link); } }
public override void RegisterGesture(object sender, Gesture_Event_Args gEventArgs) { Gesture_Event_Linking gesture = sender as Gesture_Event_Linking; gestureControler.Control.MainWindow.LinkingGestureLayer.Add(gesture); base.RegisterGesture(sender, gEventArgs); }
public static Gesture_Event_Linking Detect(List <My_Point> points, Gesture_Controler controler) { List <My_Point> result = new List <My_Point>(); foreach (My_Point point in points) { if (point.Sender is Linking_Icon) { result.Add(point); Card card = (point.Sender as Linking_Icon).Card; My_Point[] argPoints = result.ToArray(); object[] objects = new object[2]; objects[0] = card; Gesture_Event_Linking linkEvent = new Gesture_Event_Linking(); linkEvent.Points = argPoints; Gesture_List.addGesture(linkEvent); Gesture_Linking_Listener gestureLinkingListener = new Gesture_Linking_Listener(controler, linkEvent); linkEvent.Register(objects, argPoints); foreach (My_Point p in result) { controler.NewGesturePoints.Remove(p); } return(linkEvent); } } return(null); }
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 override bool Equals(object obj) { if (obj is Gesture_Event_Linking) { Gesture_Event_Linking link = obj as Gesture_Event_Linking; return(link.Card1 == this.card1 && link.Card2 == this.card2); } else { return(false); } }
public bool Contain(Gesture_Event_Linking link) { Gesture_Event_Linking temp = null; foreach (Gesture_Event_Linking gesture in cardLinks.Keys) { if (gesture.Equals(link)) { temp = gesture; } } return(temp != null); }
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 override void TerminateGesture(object sender, Gesture_Event_Args gEventArgs) { Gesture_Event_Linking gesture = sender as Gesture_Event_Linking; if (gEventArgs.GestureObjects != null && gEventArgs.GestureObjects[1] != null) { gestureControler.Control.MainWindow.LinkingGestureLayer.Move(gesture); } else { gestureControler.Control.MainWindow.LinkingGestureLayer.Remove(gesture); } base.TerminateGesture(sender, gEventArgs); }
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); })); }
public void Move(Gesture_Event_Linking link) { Dispatcher.BeginInvoke(new Action(() => { if (cardLinks.ContainsKey(link)) { cardLinks[link].X1 = link.Card1.CurrentPosition.X; cardLinks[link].Y1 = link.Card1.CurrentPosition.Y; cardLinks[link].X2 = link.Points[0].CurrentPoint.Position.X; cardLinks[link].Y2 = link.Points[0].CurrentPoint.Position.Y; if (link.Card2 != null) { cardLinks[link].X2 = link.Card2.CurrentPosition.X; cardLinks[link].Y2 = link.Card2.CurrentPosition.Y; } moveArrow(cardLinks[link]); } }), System.Windows.Threading.DispatcherPriority.Background); }
private void detectGesture() { if (newGesturePoints.Count > 0) { // the code that you want to measure comes here Gesture_Event_Linking.Detect(newGesturePoints, this); //Gesture_Event_Copying.Detect(newGesturePoints, this); Gesture_Event_Sorting.Detect(newGesturePoints, this); //Gesture_Event_Emphasizing.Detect(newGesturePoints, this); //Gesture_Event_Grouping.Detect(newGesturePoints,this); //Gesture_Event_Sorting_Group.Detect(newGesturePoints, this); Gesture_Event_Showing.Detect(newGesturePoints, this); Gesture_Event_Showing_Sorting.Detect(newGesturePoints, this); Gesture_Event_Cutting_Sorting.Detect(newGesturePoints, this); Gesture_Event_Cutting_Link.Detect(newGesturePoints, this); Gesture_Event_Deleting_Bin.Detect(newGesturePoints, this); Gesture_Event_Collaborative_Zoon.Detect(newGesturePoints, this); } }
public void Move(Gesture_Event_Linking link) { Dispatcher.BeginInvoke(new Action(() => { if (cardLinks.ContainsKey(link)) { cardLinks[link].X1 = link.Card1.CurrentPosition.X; cardLinks[link].Y1 = link.Card1.CurrentPosition.Y; cardLinks[link].X2 = link.Points[0].CurrentPoint.Position.X; cardLinks[link].Y2 = link.Points[0].CurrentPoint.Position.Y; if (link.Card2 != null) { cardLinks[link].X2 = link.Card2.CurrentPosition.X; cardLinks[link].Y2 = link.Card2.CurrentPosition.Y; } moveArrow(cardLinks[link]); } }),System.Windows.Threading.DispatcherPriority.Background); }
public Gesture_Linking_Listener(Gesture_Controler gestureControler, Gesture_Event_Linking gestureEvent) : base(gestureControler, gestureEvent) { }
public bool Contain(Gesture_Event_Linking link) { Gesture_Event_Linking temp = null; foreach (Gesture_Event_Linking gesture in cardLinks.Keys) { if (gesture.Equals(link)) { temp = gesture; } } return temp!=null; }