Beispiel #1
0
        /// <summary>
        /// Detect the sortingbox deleting gesture (Drag and drop the box to the delete box on the menubar).
        /// The touches in the sorting gesture will be removed from the touchList
        /// </summary>
        /// <param name="touchList"></param>
        /// <returns></returns>
        internal static async Task Detect(List <Touch> touchList, CentralControllers controllers)
        {
            List <Touch>       usedTouches = new List <Touch>();
            DeletingBoxGesture gesture     = null;

            foreach (Touch touch in touchList)
            {
                if (touch.Type == typeof(SortingBox) && !usedTouches.Contains(touch))
                {
                    SortingBox box  = touch.Sender as SortingBox;
                    MenuBar[]  bars = controllers.MenuLayerController.GetAllMenuBars();
                    foreach (MenuBar bar in bars)
                    {
                        bool isIntersect = await bar.IsIntersectWithDelete(box.Position);

                        if (isIntersect)
                        {
                            foreach (Touch otherTouches in touchList)
                            {
                                if (touch.Sender == otherTouches.Sender && !usedTouches.Contains(otherTouches))
                                {
                                    usedTouches.Add(otherTouches);
                                }
                            }
                            gesture = new DeletingBoxGesture(controllers.GestureController);
                            gesture.AssociatedTouches = usedTouches;
                            gesture.AssociatedObjects = new List <object>()
                            {
                                box, bar
                            };
                            gesture.AssociatedObjectTypes = new List <Type>()
                            {
                                typeof(SortingBox), typeof(MenuBar)
                            };
                            DeletingBoxListener listener = controllers.ListenerController.GetListener(typeof(DeletingBoxListener)) as DeletingBoxListener;
                            RegisterListener(gesture, listener);// Register the gesture and add the gesture to the gesture list.
                        }
                    }
                }
            }
            foreach (Touch touch in usedTouches)
            {
                touchList.Remove(touch);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Detect the sorting gesture (Drag and drop the card to the sorting box).
        /// The touches in the sorting gesture will be removed from the touchList
        /// </summary>
        /// <param name="touchList"></param>
        /// <returns></returns>
        internal static async Task Detect(List <Touch> touchList, CentralControllers controllers)
        {
            List <Touch>   usedTouches = new List <Touch>();
            SortingGesture gesture     = null;

            foreach (Touch touch in touchList)
            {
                if (touch.Type == typeof(Card) && !usedTouches.Contains(touch))
                {
                    Card         card  = touch.Sender as Card;
                    SortingBox[] boxes = controllers.SortingBoxController.GetAllSortingBoxes();
                    foreach (SortingBox box in boxes)
                    {
                        bool isIntersect = await box.IsIntersected(card.Position);

                        if (isIntersect)
                        {
                            foreach (Touch otherTouches in touchList)
                            {
                                if (touch.Sender == otherTouches.Sender && !usedTouches.Contains(otherTouches))
                                {
                                    usedTouches.Add(otherTouches);
                                }
                            }
                            gesture = new SortingGesture(controllers.GestureController);
                            gesture.AssociatedTouches = usedTouches;
                            gesture.AssociatedObjects = new List <object>()
                            {
                                card, box
                            };
                            gesture.AssociatedObjectTypes = new List <Type>()
                            {
                                typeof(Card), typeof(SortingBox)
                            };
                            SortingListener listener = controllers.ListenerController.GetListener(typeof(SortingListener)) as SortingListener;
                            RegisterListener(gesture, listener);// Register the gesture and add the gesture to the gesture list.
                        }
                    }
                }
            }
            foreach (Touch touch in usedTouches)
            {
                touchList.Remove(touch);
            }
        }
 public CardLayerController(CentralControllers ctrls)
 {
     this.controllers = ctrls;
 }
 public GestureController(CentralControllers ctrls)
 {
     this.controllers = ctrls;
 }
 public SortingBoxLayerController(CentralControllers ctrls)
 {
     this.controllers = ctrls;
 }
Beispiel #6
0
 public DocumentController(CentralControllers ctrls)
 {
     this.controllers = ctrls;
 }
 public MenuLayerController(CentralControllers ctrls)
 {
     this.controllers = ctrls;
 }
 public TouchController(CentralControllers ctrls)
 {
     this.controllers = ctrls;
 }
Beispiel #9
0
 public BaseLayerController(CentralControllers ctrls)
 {
     controllers = ctrls;
 }