Beispiel #1
0
        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 Gesture_Event_Collaborative_Zoon Detect(List<My_Point> points, Gesture_Controler controler)
 {
     List<My_Point> result = new List<My_Point>();
     Gesture_Event_Collaborative_Zoon colZoonEvent = null;
     foreach (My_Point p in points)
     {
         if (p.Sender is News_Card)
         {
             if (STATICS.COLLABORATIVE_ZOON.Contains((int)p.CurrentPoint.Position.X, (int)p.CurrentPoint.Position.Y)) {
                 result.Add(p);
                 My_Point[] argPoints = result.ToArray();
                 object[] objects = new object[1];
                 objects[0] = p.Sender;
                 colZoonEvent = new Gesture_Event_Collaborative_Zoon();
                 colZoonEvent.Points = argPoints;
                 Gesture_List.addGesture(colZoonEvent);
                 Gesture_Collaborative_Zoon_Listener gestureListener = new Gesture_Collaborative_Zoon_Listener(controler, colZoonEvent);
                 colZoonEvent.Register(objects, argPoints);
                 foreach (My_Point p2 in result)
                 {
                     points.Remove(p2);
                 }
                 return colZoonEvent;
             }
         }
     }
     return null;
 }
 public static Gesture_Event_Copying 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 Copy_Icon)
         {
             result.Add(point);
             Card card = (point.Sender as Copy_Icon).Card;
             My_Point[] argPoints = result.ToArray();
             object[] objects = new object[2];
             objects[0] = card;
             Gesture_Event_Copying copyEvent = new Gesture_Event_Copying();
             copyEvent.Points = argPoints;
             Gesture_List.addGesture(copyEvent);
             Gesture_Copying_Listener gestureLinkingListener = new Gesture_Copying_Listener(controler, copyEvent);
             copyEvent.Register(objects, argPoints);
             foreach (My_Point p in result)
             {
                 controler.NewGesturePoints.Remove(p);
             }
             return copyEvent;
         }
     }
     return null;
 }
Beispiel #4
0
        public static Gesture_Event_Sorting_Group Detect(List <My_Point> points, Gesture_Controler controler)
        {
            List <My_Point>             result            = new List <My_Point>();
            Gesture_Event_Grouping      resturedCluster   = null;
            Gesture_Event_Sorting_Group sortingGroupEvent = null;

            foreach (My_Point p in points)
            {
                if (p.Sender is Menu_Sort_Box)
                {
                    foreach (Gesture_Event gesture in Gesture_List.GestureList)
                    {
                        if (gesture is Gesture_Event_Grouping)
                        {
                            Gesture_Event_Grouping cluster = gesture as Gesture_Event_Grouping;
                            if (cluster.IsGrouping())
                            {
                                My_Point[] clusterPoints = cluster.Points;
                                if (Enclose_Helper.PNPoly(clusterPoints, p.CurrentPoint.Position.X, p.CurrentPoint.Position.Y))
                                {
                                    resturedCluster = cluster;
                                    result.Add(p);
                                    foreach (My_Point clusterPoint in clusterPoints)
                                    {
                                        result.Add(clusterPoint);
                                    }
                                    My_Point[] argPoints = result.ToArray();
                                    object[]   objects   = new object[cluster.Senders.Length + 1];
                                    objects[0] = cluster.Points[0].Sender;
                                    for (int i = 0; i < cluster.Senders.Length; i++)
                                    {
                                        objects[i + 1] = cluster.Senders[i];
                                    }
                                    sortingGroupEvent        = new Gesture_Event_Sorting_Group();
                                    sortingGroupEvent.Points = cluster.Points;
                                    Gesture_List.addGesture(sortingGroupEvent);
                                    Gesture_SortingGroup_Listener listener = new Gesture_SortingGroup_Listener(controler, sortingGroupEvent);
                                    sortingGroupEvent.Register(objects, argPoints);
                                }
                            }
                        }
                    }
                }
            }
            if (resturedCluster != null)
            {
                Gesture_List.removeGesture(resturedCluster);
                controler.Control.MainWindow.GroupingGestureLayer.Remove(resturedCluster);
                foreach (My_Point p in result)
                {
                    points.Remove(p);
                }
                return(sortingGroupEvent);
            }
            return(null);
        }
 public void Initialize()
 {
     userControler    = new User_Controler(this);
     cardControler    = new Card_Controler(this);
     touchControler   = new Touch_Controler(this);
     gestureControler = new Gesture_Controler(this);
     gestureControler.Start();
     sortingBoxControler = new Sorting_Group_Controler(this);
     cloudControler      = new Cloud_Controler(this);
 }
 public static Gesture_Event_Sorting_Group Detect(List<My_Point> points,Gesture_Controler controler)
 {
     List<My_Point> result = new List<My_Point>();
     Gesture_Event_Grouping resturedCluster = null;
     Gesture_Event_Sorting_Group sortingGroupEvent = null;
     foreach (My_Point p in points)
     {
         if (p.Sender is Menu_Sort_Box)
         {
             foreach (Gesture_Event gesture in Gesture_List.GestureList)
             {
                 if (gesture is Gesture_Event_Grouping)
                 {
                     Gesture_Event_Grouping cluster = gesture as Gesture_Event_Grouping;
                     if (cluster.IsGrouping())
                     {
                         My_Point[] clusterPoints = cluster.Points;
                         if (Enclose_Helper.PNPoly(clusterPoints, p.CurrentPoint.Position.X, p.CurrentPoint.Position.Y))
                         {
                             resturedCluster = cluster;
                             result.Add(p);
                             foreach (My_Point clusterPoint in clusterPoints)
                             {
                                 result.Add(clusterPoint);
                             }
                             My_Point[] argPoints = result.ToArray();
                             object[] objects = new object[cluster.Senders.Length + 1];
                             objects[0] = cluster.Points[0].Sender;
                             for (int i = 0; i < cluster.Senders.Length; i++)
                             {
                                 objects[i + 1] = cluster.Senders[i];
                             }
                             sortingGroupEvent = new Gesture_Event_Sorting_Group();
                             sortingGroupEvent.Points = cluster.Points;
                             Gesture_List.addGesture(sortingGroupEvent);
                             Gesture_SortingGroup_Listener listener = new Gesture_SortingGroup_Listener(controler, sortingGroupEvent);
                             sortingGroupEvent.Register(objects, argPoints);
                         }
                     }
                 }
             }
         }
     }
     if (resturedCluster != null)
     {
         Gesture_List.removeGesture(resturedCluster);
         controler.Control.MainWindow.GroupingGestureLayer.Remove(resturedCluster);
         foreach (My_Point p in result)
         {
             points.Remove(p);
         }
         return sortingGroupEvent;
     }
     return null;
 }
 public Gesture_Listener(Gesture_Controler gestureControler,  Gesture_Event gesture)
 {
     registerHandler = new RegisteredEventHandler(RegisterGesture);
     continueHandler = new ContinuedEventHandler(ContinueGesture);
     terminateHandler = new TerminatedEventHandler(TerminateGesture);
     failHandler = new FailEventHandler(FailGesture);
     this.gestureEvent = gesture;
     this.gestureEvent.Registered += registerHandler;
     this.gestureEvent.Continued += continueHandler;
     this.gestureEvent.Terminated += terminateHandler;
     this.gestureEvent.Failed += failHandler;
     this.gestureControler = gestureControler;
 }
Beispiel #8
0
 public Gesture_Listener(Gesture_Controler gestureControler, Gesture_Event gesture)
 {
     registerHandler               = new RegisteredEventHandler(RegisterGesture);
     continueHandler               = new ContinuedEventHandler(ContinueGesture);
     terminateHandler              = new TerminatedEventHandler(TerminateGesture);
     failHandler                   = new FailEventHandler(FailGesture);
     this.gestureEvent             = gesture;
     this.gestureEvent.Registered += registerHandler;
     this.gestureEvent.Continued  += continueHandler;
     this.gestureEvent.Terminated += terminateHandler;
     this.gestureEvent.Failed     += failHandler;
     this.gestureControler         = gestureControler;
 }
 public void Deinitialize()
 {
     Point_List.Clear();
     Link_List.CardLinks.Clear();
     Group_List.CardGroups.Clear();
     Card_List.CardList.Clear();
     Shared_Card_List.ShardCards.Clear();
     cardControler = null;
     gestureControler.quit();
     gestureControler = null;
     userControler.UserList.Clear();
     userControler  = null;
     touchControler = null;
 }
Beispiel #10
0
        public static Gesture_Event_Cutting_Sorting Detect(List <My_Point> points, Gesture_Controler controler)
        {
            List <My_Point> result = new List <My_Point>();
            Gesture_Event_Cutting_Sorting cuttingEvent = null;

            if (Group_List.CardGroups.Count > 0 && controler.Control.MainWindow.SortingGestureLayer.GroupLinks.Count > 0)
            {
                Menu_Sort_Box[] keys = controler.Control.MainWindow.SortingGestureLayer.GroupLinks.Keys.ToArray();
                foreach (My_Point p in points)
                {
                    if (p.Sender is Card_Layer)
                    {
                        foreach (Menu_Sort_Box key in keys)
                        {
                            if (Group_List.CardGroups.ContainsKey(key))
                            {
                                Card[] cards = Group_List.CardGroups[key].ToArray();
                                foreach (Card c in cards)
                                {
                                    bool isIntersect = Calculator.DoLinesIntersect(new Point(key.CurrentPosition.X, key.CurrentPosition.Y),
                                                                                   new Point(c.CurrentPosition.X, c.CurrentPosition.Y),
                                                                                   new Point(p.StartPoint.Position.X, p.StartPoint.Position.Y),
                                                                                   new Point(p.CurrentPoint.Position.X, p.CurrentPoint.Position.Y));
                                    if (isIntersect)
                                    {
                                        result.Add(p);
                                        My_Point[] argPoints = result.ToArray();
                                        object[]   objects   = new object[2];
                                        objects[0]          = key;
                                        objects[1]          = c;
                                        cuttingEvent        = new Gesture_Event_Cutting_Sorting();
                                        cuttingEvent.Points = argPoints;
                                        Gesture_List.addGesture(cuttingEvent);
                                        Gesture_Cutting_Sorting_Listener gestureListener = new Gesture_Cutting_Sorting_Listener(controler, cuttingEvent);
                                        cuttingEvent.Register(objects, argPoints);
                                        foreach (My_Point p2 in result)
                                        {
                                            points.Remove(p2);
                                        }
                                        return(cuttingEvent);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(null);
        }
 public static Gesture_Event_Cutting_Sorting Detect(List<My_Point> points,Gesture_Controler controler)
 {
     List<My_Point> result = new List<My_Point>();
     Gesture_Event_Cutting_Sorting cuttingEvent = null;
     if (Group_List.CardGroups.Count > 0 && controler.Control.MainWindow.SortingGestureLayer.GroupLinks.Count > 0)
     {
         Menu_Sort_Box[] keys = controler.Control.MainWindow.SortingGestureLayer.GroupLinks.Keys.ToArray();
         foreach (My_Point p in points)
         {
             if (p.Sender is Card_Layer)
             {
                 foreach (Menu_Sort_Box key in keys)
                 {
                     if (Group_List.CardGroups.ContainsKey(key))
                     {
                         Card[] cards = Group_List.CardGroups[key].ToArray();
                         foreach (Card c in cards)
                         {
                             bool isIntersect = Calculator.DoLinesIntersect(new Point(key.CurrentPosition.X, key.CurrentPosition.Y),
                                 new Point(c.CurrentPosition.X, c.CurrentPosition.Y),
                                 new Point(p.StartPoint.Position.X, p.StartPoint.Position.Y),
                                 new Point(p.CurrentPoint.Position.X, p.CurrentPoint.Position.Y));
                             if (isIntersect)
                             {
                                 result.Add(p);
                                 My_Point[] argPoints = result.ToArray();
                                 object[] objects = new object[2];
                                 objects[0] = key;
                                 objects[1] = c;
                                 cuttingEvent = new Gesture_Event_Cutting_Sorting();
                                 cuttingEvent.Points = argPoints;
                                 Gesture_List.addGesture(cuttingEvent);
                                 Gesture_Cutting_Sorting_Listener gestureListener = new Gesture_Cutting_Sorting_Listener(controler, cuttingEvent);
                                 cuttingEvent.Register(objects, argPoints);
                                 foreach (My_Point p2 in result)
                                 {
                                     points.Remove(p2);
                                 }
                                 return cuttingEvent;
                             }
                         }
                     }
                 }
             }
         }
     }
     return null;
 }
        public static Gesture_Event_Showing_Sorting Detect(List <My_Point> points, Gesture_Controler controler)
        {
            List <My_Point> result = new List <My_Point>();
            Gesture_Event_Showing_Sorting showGroupEvent = null;

            if (points.Count > 0)
            {
                for (int i = 0; i < points.Count; i++)
                {
                    if (Calculator.CalDistance(points[i].StartPoint, points[i].CurrentPoint) < STATICS.MIN_DISTANCE_FOR_MOVE && points[i].Life > STATICS.MIN_LONG_PRESS_LIFE && points[i].Sender is Menu_Sort_Box)
                    {
                        bool moreThan1 = false;
                        if (points.Count > 1)
                        {
                            for (int m = 0; m < points.Count; m++)
                            {
                                if (i != m && points[i].Sender == points[m].Sender)
                                {
                                    moreThan1 = true;
                                    break;
                                }
                            }
                        }
                        if (!moreThan1)
                        {
                            result.Add(points[i]);
                            My_Point[] argPoints = result.ToArray();
                            object[]   objects   = new object[argPoints.Length];
                            objects[0]            = argPoints[0].Sender;
                            showGroupEvent        = new Gesture_Event_Showing_Sorting();
                            showGroupEvent.Points = argPoints;
                            Gesture_List.addGesture(showGroupEvent);
                            Gesture_Showing_Sorting_Listener gestureListener = new Gesture_Showing_Sorting_Listener(controler, showGroupEvent);
                            showGroupEvent.Register(objects, argPoints);
                            foreach (My_Point p in result)
                            {
                                points.Remove(p);
                            }
                            return(showGroupEvent);
                        }
                    }
                }
            }
            return(null);
        }
        public static Gesture_Event_Cutting_Link Detect(List <My_Point> points, Gesture_Controler controler)
        {
            List <My_Point>            result       = new List <My_Point>();
            Gesture_Event_Cutting_Link cuttingEvent = null;

            if (Link_List.CardLinks.Count > 0 && controler.Control.MainWindow.LinkingGestureLayer.CardLinks.Count > 0)
            {
                Gesture_Event_Linking[] links = Link_List.CardLinks.ToArray();
                foreach (My_Point p in points)
                {
                    if (p.Sender is Card_Layer)
                    {
                        foreach (Gesture_Event_Linking link in links)
                        {
                            if (link.Card1 != null && link.Card2 != null)
                            {
                                bool isIntersect = Calculator.DoLinesIntersect(new Point(link.Card1.CurrentPosition.X, link.Card1.CurrentPosition.Y),
                                                                               new Point(link.Card2.CurrentPosition.X, link.Card2.CurrentPosition.Y),
                                                                               new Point(p.StartPoint.Position.X, p.StartPoint.Position.Y),
                                                                               new Point(p.CurrentPoint.Position.X, p.CurrentPoint.Position.Y));
                                if (isIntersect)
                                {
                                    result.Add(p);
                                    My_Point[] argPoints = result.ToArray();
                                    object[]   objects   = new object[2];
                                    objects[0]          = link;
                                    cuttingEvent        = new Gesture_Event_Cutting_Link();
                                    cuttingEvent.Points = argPoints;
                                    Gesture_List.addGesture(cuttingEvent);
                                    Gesture_Cutting_Link_Listener gestureListener = new Gesture_Cutting_Link_Listener(controler, cuttingEvent);
                                    cuttingEvent.Register(objects, argPoints);
                                    foreach (My_Point p2 in result)
                                    {
                                        points.Remove(p2);
                                    }
                                    return(cuttingEvent);
                                }
                            }
                        }
                    }
                }
            }
            return(null);
        }
 public static Gesture_Event_Emphasizing Detect(List<My_Point> points,Gesture_Controler controler)
 {
     List<My_Point> result = new List<My_Point>();
     Gesture_Event_Emphasizing emphasizeEvent = null;
     if (points.Count > 0)
     {
         for (int i = 0; i < points.Count; i++)
         {
             if (Calculator.CalDistance(points[i].StartPoint, points[i].CurrentPoint) < STATICS.MIN_DISTANCE_FOR_MOVE && points[i].Life > STATICS.MIN_LONG_PRESS_LIFE && points[i].Sender is Card)
             {
                 bool moreThan1 = false;
                 if (points.Count > 1)
                 {
                     for (int m = 0; m < points.Count; m++)
                     {
                         if (i != m && points[i].Sender == points[m].Sender)
                         {
                             moreThan1 = true;
                             break;
                         }
                     }
                 }
                 if (!moreThan1)
                 {
                     result.Add(points[i]);
                     My_Point[] argPoints = result.ToArray();
                     object[] objects = new object[argPoints.Length];
                     objects[0] = argPoints[0].Sender;
                     emphasizeEvent = new Gesture_Event_Emphasizing();
                     emphasizeEvent.Points = argPoints;
                     Gesture_List.addGesture(emphasizeEvent);
                     Gesture_Emphasizing_Listener gestureListener = new Gesture_Emphasizing_Listener(controler, emphasizeEvent);
                     emphasizeEvent.Register(objects, argPoints);
                     foreach (My_Point p in result)
                     {
                         points.Remove(p);
                     }
                     return emphasizeEvent;
                 }
             }
         }
     }
     return null;
 }
 public static Gesture_Event_Cutting_Link Detect(List<My_Point> points,Gesture_Controler controler)
 {
     List<My_Point> result = new List<My_Point>();
     Gesture_Event_Cutting_Link cuttingEvent = null;
     if (Link_List.CardLinks.Count > 0 && controler.Control.MainWindow.LinkingGestureLayer.CardLinks.Count > 0)
     {
         Gesture_Event_Linking[] links = Link_List.CardLinks.ToArray();
         foreach (My_Point p in points)
         {
             if (p.Sender is Card_Layer)
             {
                 foreach (Gesture_Event_Linking link in links)
                 {
                     if (link.Card1 != null && link.Card2 != null)
                     {
                         bool isIntersect = Calculator.DoLinesIntersect(new Point(link.Card1.CurrentPosition.X, link.Card1.CurrentPosition.Y),
                             new Point(link.Card2.CurrentPosition.X, link.Card2.CurrentPosition.Y),
                             new Point(p.StartPoint.Position.X, p.StartPoint.Position.Y),
                             new Point(p.CurrentPoint.Position.X, p.CurrentPoint.Position.Y));
                         if (isIntersect)
                         {
                             result.Add(p);
                             My_Point[] argPoints = result.ToArray();
                             object[] objects = new object[2];
                             objects[0] = link;
                             cuttingEvent = new Gesture_Event_Cutting_Link();
                             cuttingEvent.Points = argPoints;
                             Gesture_List.addGesture(cuttingEvent);
                             Gesture_Cutting_Link_Listener gestureListener = new Gesture_Cutting_Link_Listener(controler, cuttingEvent);
                             cuttingEvent.Register(objects, argPoints);
                             foreach (My_Point p2 in result)
                             {
                                 points.Remove(p2);
                             }
                             return cuttingEvent;
                         }
                     }
                 }
             }
         }
     }
     return null;
 }
Beispiel #16
0
        public static Gesture_Event_Deleting_Bin Detect(List <My_Point> points, Gesture_Controler controler)
        {
            List <My_Point>            result        = new List <My_Point>();
            Gesture_Event_Deleting_Bin deletingEvent = null;

            foreach (My_Point p in points)
            {
                if (!result.Contains(p) && p.Sender is Menu_Sort_Box)
                {
                    Menu_Sort_Box category = p.Sender as Menu_Sort_Box;
                    foreach (Menu_Container mc in controler.Control.MainWindow.MenuLayer.MenuBars)
                    {
                        if (mc != null && category != null && Math.Sqrt(Math.Pow((category.CurrentPosition.X - mc.RecycleButton.XCoord), 2) +
                                                                        Math.Pow((category.CurrentPosition.Y - mc.RecycleButton.YCoord), 2))
                            < 50)
                        {
                            mc.displayRecycleNotification();
                            foreach (My_Point p2 in points)
                            {
                                if (p.Sender == p2.Sender && !result.Contains(p2))
                                {
                                    result.Add(p2);
                                }
                            }
                            My_Point[] argPoints = result.ToArray();
                            object[]   objects   = new object[2];
                            objects[0]    = category;
                            objects[1]    = mc.RecycleButton;
                            deletingEvent = new Gesture_Event_Deleting_Bin();
                            Gesture_List.addGesture(deletingEvent);
                            Gesture_Deleting_Bin_Listener gestureListener = new Gesture_Deleting_Bin_Listener(controler, deletingEvent);
                            deletingEvent.Register(objects, argPoints);
                        }
                        else if (mc != null)
                        {
                            mc.removeRecycleNotification();
                        }
                    }
                }
            }
            return(deletingEvent);
        }
        public static Gesture_Event_Sorting Detect(List <My_Point> points, Gesture_Controler controler)
        {
            List <My_Point>       result    = new List <My_Point>();
            Gesture_Event_Sorting sortEvent = null;

            foreach (My_Point p in points)
            {
                if (!result.Contains(p) && p.Sender is Card && Calculator.CalDistance(p.StartPoint, p.CurrentPoint) >= STATICS.MIN_DISTANCE_FOR_MOVE)
                {
                    Card c = p.Sender as Card;
                    foreach (Menu_Sort_Box box in Group_List.GroupBox)
                    {
                        if (c.Contain(box.CurrentPosition))
                        {
                            foreach (My_Point p2 in points)
                            {
                                if (p.Sender == p2.Sender && !result.Contains(p2))
                                {
                                    result.Add(p2);
                                }
                            }
                            My_Point[] argPoints = result.ToArray();
                            object[]   objects   = new object[2];
                            objects[0]       = c;
                            objects[1]       = box;
                            sortEvent        = new Gesture_Event_Sorting();
                            sortEvent.Points = argPoints;
                            Gesture_List.addGesture(sortEvent);
                            Gesture_Sorting_Listener gestureListener = new Gesture_Sorting_Listener(controler, sortEvent);
                            sortEvent.Register(objects, argPoints);
                        }
                    }
                }
            }
            foreach (My_Point p in result)
            {
                points.Remove(p);
            }
            return(sortEvent);
        }
        public static Gesture_Event_Deleting_Bin Detect(List<My_Point> points, Gesture_Controler controler)
        {
            List<My_Point> result = new List<My_Point>();
            Gesture_Event_Deleting_Bin deletingEvent = null;
            foreach (My_Point p in points)
            {
                if (!result.Contains(p) && p.Sender is Menu_Sort_Box)
                {
                    Menu_Sort_Box category = p.Sender as Menu_Sort_Box;
                    foreach (Menu_Container mc in controler.Control.MainWindow.MenuLayer.MenuBars)
                    {
                        if (mc != null && category != null && Math.Sqrt(Math.Pow((category.CurrentPosition.X - mc.RecycleButton.XCoord), 2) +
                            Math.Pow((category.CurrentPosition.Y - mc.RecycleButton.YCoord), 2))
                            < 50)
                        {
                            mc.displayRecycleNotification();
                            foreach (My_Point p2 in points)
                            {
                                if (p.Sender == p2.Sender && !result.Contains(p2))
                                    result.Add(p2);
                            }
                            My_Point[] argPoints = result.ToArray();
                            object[] objects = new object[2];
                            objects[0] = category;
                            objects[1] = mc.RecycleButton;
                            deletingEvent = new Gesture_Event_Deleting_Bin();
                            Gesture_List.addGesture(deletingEvent);
                            Gesture_Deleting_Bin_Listener gestureListener = new Gesture_Deleting_Bin_Listener(controler, deletingEvent);
                            deletingEvent.Register(objects, argPoints);
                        }
                        else if (mc != null)
                        {
                            mc.removeRecycleNotification();
                        }
                    }

                }
            }
            return deletingEvent;
        }
        public static Gesture_Event_Showing Detect(List <My_Point> points, Gesture_Controler controler)
        {
            List <My_Point> result = new List <My_Point>();

            if (points.Count > 0)
            {
                for (int i = 0; i < points.Count; i++)
                {
                    if (points[i].Life > STATICS.MIN_SHOW_LIFE && points[i].Sender is Card)
                    {
                        result.Add(points[i]);
                        for (int m = 0; m < points.Count; m++)
                        {
                            if (i != m && points[i].Sender == points[m].Sender && points[m].Life > STATICS.MIN_SHOW_LIFE)
                            {
                                result.Add(points[m]);
                            }
                        }
                        if (result.Count > 2)
                        {
                            My_Point[] argPoints = result.ToArray();
                            object[]   objects   = new object[1];
                            objects[0] = argPoints[0].Sender;
                            Gesture_Event_Showing showEvent = new Gesture_Event_Showing();
                            showEvent.Points = argPoints;
                            Gesture_List.addGesture(showEvent);
                            Gesture_Showing_Listener gestureListener = new Gesture_Showing_Listener(controler, showEvent);
                            showEvent.Register(objects, argPoints);
                            return(showEvent);
                        }
                        else
                        {
                            result.Clear();
                        }
                    }
                }
            }
            return(null);
        }
 public static Gesture_Event_Sorting Detect(List<My_Point> points, Gesture_Controler controler)
 {
     List<My_Point> result = new List<My_Point>();
     Gesture_Event_Sorting sortEvent = null;
     foreach (My_Point p in points)
     {
         if (!result.Contains(p) && p.Sender is Card && Calculator.CalDistance(p.StartPoint, p.CurrentPoint) >= STATICS.MIN_DISTANCE_FOR_MOVE)
         {
             Card c = p.Sender as Card;
             foreach (Menu_Sort_Box box in Group_List.GroupBox)
             {
                 if (c.Contain(box.CurrentPosition))
                 {
                     foreach (My_Point p2 in points)
                     {
                         if (p.Sender == p2.Sender && !result.Contains(p2))
                             result.Add(p2);
                     }
                     My_Point[] argPoints = result.ToArray();
                     object[] objects = new object[2];
                     objects[0] = c;
                     objects[1] = box;
                     sortEvent = new Gesture_Event_Sorting();
                     sortEvent.Points = argPoints;
                     Gesture_List.addGesture(sortEvent);
                     Gesture_Sorting_Listener gestureListener = new Gesture_Sorting_Listener(controler, sortEvent);
                     sortEvent.Register(objects, argPoints);
                 }
             }
         }
     }
     foreach (My_Point p in result)
     {
         points.Remove(p);
     }
     return sortEvent;
 }
 public Gesture_Collaborative_Zoon_Listener(Gesture_Controler gestureControler, Gesture_Event_Collaborative_Zoon gestureEvent)
     : base(gestureControler, gestureEvent)
 {
 }
 /// <param name="gestureControler">Should be the one created in the MainWindow</param>
 /// <param name="gestureEvent">The gesture variable which fire the event</param>
 public Gesture_Grouping_Listener(Gesture_Controler gestureControler, Gesture_Event_Grouping gestureEvent)
     : base(gestureControler, gestureEvent)
 {
 }
        public static Gesture_Event_Grouping Detect(List <My_Point> points, Gesture_Controler controler)
        {
            List <My_Point> result = new List <My_Point>();

            if (points.Count == 4)
            {
                foreach (My_Point p in points)
                {
                    if (p.Sender is Card_Layer)
                    {
                        result.Add(p);
                    }
                }
            }
            if (result.Count == 4)
            {
                My_Point[] argPoints = result.ToArray();
                Card[]     cards     = Card_List.CardList.ToArray();
                My_Point[] Newpoint  = new My_Point[4];
                for (int i = 0; i < 4; i++)
                {
                    Newpoint[i] = argPoints[i];
                }
                double maxX_1 = Math.Max(Math.Min(Newpoint[0].CurrentPoint.Position.X, Newpoint[1].CurrentPoint.Position.X), Math.Min(Newpoint[2].CurrentPoint.Position.X, Newpoint[3].CurrentPoint.Position.X));
                double maxX_2 = Math.Min(Math.Max(Newpoint[0].CurrentPoint.Position.X, Newpoint[1].CurrentPoint.Position.X), Math.Max(Newpoint[2].CurrentPoint.Position.X, Newpoint[3].CurrentPoint.Position.X));
                double maxY_1 = Math.Max(Math.Min(Newpoint[0].CurrentPoint.Position.Y, Newpoint[1].CurrentPoint.Position.Y), Math.Min(Newpoint[2].CurrentPoint.Position.Y, Newpoint[3].CurrentPoint.Position.Y));
                double maxY_2 = Math.Min(Math.Max(Newpoint[0].CurrentPoint.Position.Y, Newpoint[1].CurrentPoint.Position.Y), Math.Max(Newpoint[2].CurrentPoint.Position.Y, Newpoint[3].CurrentPoint.Position.Y));
                double midX   = (maxX_1 + maxX_2) / 2;
                double midY   = (maxY_1 + maxY_2) / 2;

                My_Point[] orderedPoints = new My_Point[4];
                int        count1        = 0;
                int        count2        = 0;
                int        count3        = 0;
                int        count4        = 0;
                for (int i = 0; i < 4; i++)
                {
                    if (Newpoint[i].CurrentPoint.Position.X > midX && Newpoint[i].CurrentPoint.Position.Y <= midY)
                    {
                        count1++;
                    }
                    if (Newpoint[i].CurrentPoint.Position.X <= midX && Newpoint[i].CurrentPoint.Position.Y < midY)
                    {
                        count2++;
                    }
                    if (Newpoint[i].CurrentPoint.Position.X < midX && Newpoint[i].CurrentPoint.Position.Y >= midY)
                    {
                        count3++;
                    }
                    if (Newpoint[i].CurrentPoint.Position.X >= midX && Newpoint[i].CurrentPoint.Position.Y > midY)
                    {
                        count4++;
                    }
                }
                if (count1 > 1 || count2 > 1 || count3 > 1 || count4 > 1)
                {
                    if (count1 > 1)
                    {
                        int countIndexRight1 = 0;
                        int countIndexRight2 = 0;
                        for (int i = 0; i < 4; i++)
                        {
                            if (Newpoint[i].CurrentPoint.Position.X > midX && Newpoint[i].CurrentPoint.Position.Y <= midY)
                            {
                                countIndexRight1++;
                                if (countIndexRight1 > 1)
                                {
                                    if (Newpoint[i].CurrentPoint.Position.X < orderedPoints[0].CurrentPoint.Position.X)
                                    {
                                        orderedPoints[1] = argPoints[i];
                                    }
                                    else
                                    {
                                        orderedPoints[1] = orderedPoints[0];
                                        orderedPoints[0] = argPoints[i];
                                    }
                                    break;
                                }
                                orderedPoints[0] = argPoints[i];
                            }
                        }
                        double disRight = 0;
                        for (int i = 0; i < 4; i++)
                        {
                            if (Newpoint[i].CurrentPoint.Position.X < midX && Newpoint[i].CurrentPoint.Position.Y >= midY)
                            {
                                countIndexRight2++;
                                if (countIndexRight2 > 1)
                                {
                                    double temp = Math.Pow((Newpoint[i].CurrentPoint.Position.X - orderedPoints[1].CurrentPoint.Position.X), 2) + Math.Pow((Newpoint[i].CurrentPoint.Position.Y - orderedPoints[1].CurrentPoint.Position.Y), 2);
                                    if (temp > disRight)
                                    {
                                        orderedPoints[3] = argPoints[i];
                                    }
                                    else
                                    {
                                        orderedPoints[3] = orderedPoints[2];
                                        orderedPoints[2] = argPoints[i];
                                    }
                                    break;
                                }
                                orderedPoints[2] = argPoints[i];
                                disRight         = Math.Pow((Newpoint[i].CurrentPoint.Position.X - orderedPoints[1].CurrentPoint.Position.X), 2) + Math.Pow((Newpoint[i].CurrentPoint.Position.Y - orderedPoints[1].CurrentPoint.Position.Y), 2);
                            }
                        }
                    }
                    else if (count2 > 1)
                    {
                        int countIndexLeft1 = 0;
                        int countIndexLeft2 = 0;
                        for (int i = 0; i < 4; i++)
                        {
                            if (Newpoint[i].CurrentPoint.Position.X <= midX && Newpoint[i].CurrentPoint.Position.Y < midY)
                            {
                                countIndexLeft1++;
                                if (countIndexLeft1 > 1)
                                {
                                    if (Newpoint[i].CurrentPoint.Position.X < orderedPoints[0].CurrentPoint.Position.X)
                                    {
                                        orderedPoints[1] = argPoints[i];
                                    }
                                    else
                                    {
                                        orderedPoints[1] = orderedPoints[0];
                                        orderedPoints[0] = argPoints[i];
                                    }
                                    break;
                                }
                                orderedPoints[0] = argPoints[i];
                            }
                        }
                        double disLeft = 0;
                        for (int i = 0; i < 4; i++)
                        {
                            if (Newpoint[i].CurrentPoint.Position.X >= midX && Newpoint[i].CurrentPoint.Position.Y > midY)
                            {
                                countIndexLeft2++;
                                if (countIndexLeft2 > 1)
                                {
                                    double temp = Math.Pow((Newpoint[i].CurrentPoint.Position.X - orderedPoints[1].CurrentPoint.Position.X), 2) + Math.Pow((Newpoint[i].CurrentPoint.Position.Y - orderedPoints[1].CurrentPoint.Position.Y), 2);
                                    if (temp > disLeft)
                                    {
                                        orderedPoints[3] = argPoints[i];
                                    }
                                    else
                                    {
                                        orderedPoints[3] = orderedPoints[2];
                                        orderedPoints[2] = argPoints[i];
                                    }
                                    break;
                                }
                                orderedPoints[2] = argPoints[i];
                                disLeft          = Math.Pow((Newpoint[i].CurrentPoint.Position.X - orderedPoints[1].CurrentPoint.Position.X), 2) + Math.Pow((Newpoint[i].CurrentPoint.Position.Y - orderedPoints[1].CurrentPoint.Position.Y), 2);
                            }
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < 4; i++)
                    {
                        if (Newpoint[i].CurrentPoint.Position.X > midX && Newpoint[i].CurrentPoint.Position.Y < midY)
                        {
                            orderedPoints[0] = argPoints[i];
                        }
                        else if (Newpoint[i].CurrentPoint.Position.X < midX && Newpoint[i].CurrentPoint.Position.Y < midY)
                        {
                            orderedPoints[1] = argPoints[i];
                        }
                        else if (Newpoint[i].CurrentPoint.Position.X <midX && Newpoint[i].CurrentPoint.Position.Y> midY)
                        {
                            orderedPoints[2] = argPoints[i];
                        }
                        else if (Newpoint[i].CurrentPoint.Position.X > midX && Newpoint[i].CurrentPoint.Position.Y > midY)
                        {
                            orderedPoints[3] = argPoints[i];
                        }
                    }
                }
                List <Card> objects = new List <Card>();
                lock (cards)
                {
                    foreach (Card c in cards)
                    {
                        if (Enclose_Helper.PNPoly(orderedPoints, c.CurrentPosition.X, c.CurrentPosition.Y))
                        {
                            objects.Add(c);
                        }
                    }
                }

                if (objects.Count > 0)
                {
                    Gesture_Event_Grouping gestureEvent = new Gesture_Event_Grouping();
                    gestureEvent.Points  = orderedPoints;
                    gestureEvent.Senders = objects.ToArray();
                    Gesture_List.addGesture(gestureEvent);
                    Gesture_Grouping_Listener gestureListener = new Gesture_Grouping_Listener(controler, gestureEvent);
                    gestureEvent.Register(objects.ToArray(), orderedPoints);
                    foreach (My_Point p in result)
                    {
                        points.Remove(p);
                    }
                    return(gestureEvent);
                }
                return(null);
            }
            else
            {
                return(null);
            }
        }
 /// <param name="gestureControler">Should be the one created in the MainWindow</param>
 /// <param name="gestureEvent">The gesture variable which fire the event</param>
 public Gesture_Showing_Sorting_Listener(Gesture_Controler gestureControler, Gesture_Event_Showing_Sorting gestureEvent)
     : base(gestureControler, gestureEvent)
 {
 }
        public static Gesture_Event_Collaborative_Zoon Detect(List <My_Point> points, Gesture_Controler controler)
        {
            List <My_Point> result = new List <My_Point>();
            Gesture_Event_Collaborative_Zoon colZoonEvent = null;

            foreach (My_Point p in points)
            {
                if (p.Sender is News_Card)
                {
                    if (STATICS.COLLABORATIVE_ZOON.Contains((int)p.CurrentPoint.Position.X, (int)p.CurrentPoint.Position.Y))
                    {
                        result.Add(p);
                        My_Point[] argPoints = result.ToArray();
                        object[]   objects   = new object[1];
                        objects[0]          = p.Sender;
                        colZoonEvent        = new Gesture_Event_Collaborative_Zoon();
                        colZoonEvent.Points = argPoints;
                        Gesture_List.addGesture(colZoonEvent);
                        Gesture_Collaborative_Zoon_Listener gestureListener = new Gesture_Collaborative_Zoon_Listener(controler, colZoonEvent);
                        colZoonEvent.Register(objects, argPoints);
                        foreach (My_Point p2 in result)
                        {
                            points.Remove(p2);
                        }
                        return(colZoonEvent);
                    }
                }
            }
            return(null);
        }
 /// <param name="gestureControler">Should be the one created in the MainWindow</param>
 /// <param name="gestureEvent">The gesture variable which fire the event</param>
 public Gesture_Showing_Sorting_Listener(Gesture_Controler gestureControler, Gesture_Event_Showing_Sorting gestureEvent)
     : base(gestureControler, gestureEvent)
 {
 }
Beispiel #27
0
 public Gesture_Cutting_Link_Listener(Gesture_Controler gestureControler, Gesture_Event_Cutting_Link gestureEvent)
     : base(gestureControler, gestureEvent)
 {
 }
 /// <param name="gestureControler">Should be the one created in the MainWindow</param>
 /// <param name="gestureEvent">The gesture variable which fire the event</param>
 public Gesture_Emphasizing_Listener(Gesture_Controler gestureControler, Gesture_Event_Emphasizing gestureEvent)
     : base(gestureControler, gestureEvent)
 {
 }
 /// <summary>
 /// Store and manage the sorting groups
 /// </summary>
 /// <param name="gestureControler">The one created in the MainWindow</param>
 public Sorting_Group_Controler(Gesture_Controler gestureControler)
 {
     this.gestureControler = gestureControler;
 }
        public void DeinitControlers()
        {
            MainContainer.Children.Remove(bottomLayer);
            MainContainer.Children.Remove(linkingGestureLayer);
            MainContainer.Children.Remove(sortingGestureLayer);
            MainContainer.Children.Remove(groupingGestureLayer);
            MainContainer.Children.Remove(cardLayer);
            MainContainer.Children.Remove(gestureIndicatorLayer);
            MainContainer.Children.Remove(menuLayer);
            sortingGestureLayer = null;
            gestureControler.quit();
            gestureControler = null;
            groupingGestureLayer = null;
            linkingGestureLayer = null;
            bottomLayer = null;
            gestureIndicatorLayer = null;
            iconControler = null;
            menuLayer = null;
            touchControler = null;
            cardControler = null;
            cardLayer = null;
            userControler.UserList.Clear();
            userControler = null;

            Card_List.CardList.Clear();
            Gesture_List.GestureList.Clear();
            Group_List.CardGroups.Clear();
            Group_List.GroupButtons.Clear();
            Link_List.CardLinks.Clear();
            Point_List.TouchPointList.Clear();
        }
        public void InitializeControlers()
        {
            STATICS.USER_COLOR["Alex"] = Color.FromArgb(255, 255, 102, 0);
            STATICS.USER_COLOR["Ben"] = Color.FromArgb(255, 0, 255, 0);
            STATICS.USER_COLOR["Chris"] = Color.FromArgb(255, 255, 255, 255);
            STATICS.USER_COLOR["Danny"] = Color.FromArgb(255, 128, 0, 128);

            userControler = new User_Controler(this);
            cardLayer = new Card_Layer(this);
            cardControler = new Card_Controler(this);
            cardControler.LoadCardLayout(layoutFile);
            touchControler = new Touch_Controler(this);
            menuLayer = new Menu_Layer(this);
            iconControler = new Sorting_Icon_Controler(this);
            iconControler.InitializeSortButton();
            gestureIndicatorLayer = new Gesture_Indicator_Layer();
            bottomLayer = new Bottom_Layer();

            linkingGestureLayer = new Linking_Gesture_Layer();
            groupingGestureLayer = new Grouping_Gesture_Layer();
            gestureControler = new Gesture_Controler(this);
            gestureControler.start();
            //For Lab
            //jointInterestControler = new Joint_Interest_Controler(this);//test
            //jointInterestControler.Start();
            sortingGestureLayer = new Sorting_Gesture_Layer(this);

            MainContainer.Children.Add(bottomLayer);
            MainContainer.Children.Add(linkingGestureLayer);
            MainContainer.Children.Add(sortingGestureLayer);
            MainContainer.Children.Add(groupingGestureLayer);
            MainContainer.Children.Add(cardLayer);
            MainContainer.Children.Add(gestureIndicatorLayer);
            MainContainer.Children.Add(menuLayer);
        }
 public Gesture_Collaborative_Zoon_Listener(Gesture_Controler gestureControler, Gesture_Event_Collaborative_Zoon gestureEvent)
     : base(gestureControler, gestureEvent)
 {
 }
 /// <param name="gestureControler">Should be the one created in the MainWindow</param>
 /// <param name="gestureEvent">The gesture variable which fire the event</param>
 public Gesture_SortingGroup_Listener(Gesture_Controler gestureControler, Gesture_Event_Sorting_Group nameclusterGesture)
     : base(gestureControler, nameclusterGesture)
 {
 }
 /// <param name="gestureControler">Should be the one created in the MainWindow</param>
 /// <param name="gestureEvent">The gesture variable which fire the event</param>
 public Gesture_SortingGroup_Listener(Gesture_Controler gestureControler, Gesture_Event_Sorting_Group nameclusterGesture)
     : base(gestureControler, nameclusterGesture)
 {
 }
 public Gesture_Cutting_Link_Listener(Gesture_Controler gestureControler, Gesture_Event_Cutting_Link gestureEvent)
     : base(gestureControler, gestureEvent)
 {
 }
 public Gesture_Deleting_Bin_Listener(Gesture_Controler gestureControler, Gesture_Event_Deleting_Bin gestureEvent)
     : base(gestureControler, gestureEvent)
 {
 }
 public Gesture_Copying_Listener(Gesture_Controler gestureControler, Gesture_Event_Copying gestureEvent)
     : base(gestureControler, gestureEvent)
 {
 }
 public Gesture_Deleting_Bin_Listener(Gesture_Controler gestureControler, Gesture_Event_Deleting_Bin gestureEvent)
     : base(gestureControler, gestureEvent)
 {
 }