예제 #1
0
        public override void TerminateGesture(object sender, Gesture_Event_Args gEventArgs)
        {
            Card          c = gEventArgs.GestureObjects[1] as Card;
            Menu_Sort_Box b = gEventArgs.GestureObjects[0] as Menu_Sort_Box;

            Group_List.RemoveCard(b, c);
            gestureControler.Control.MainWindow.SortingGestureLayer.Repaint();
            base.TerminateGesture(sender, gEventArgs);
        }
        protected override bool checkValid(object[] senders, My_Point[] myPoints)
        {
            Card          c     = senders[0] as Card;
            Menu_Sort_Box b     = senders[1] as Menu_Sort_Box;
            bool          crit1 = c.Contain(b.CurrentPosition);
            bool          crit2 = !Group_List.ContainCard(b, c);

            return(crit1 && crit2);
        }
 internal void DeleteGroup(Menu_Sort_Box box)
 {
     Card[] cards = Group_List.CardGroups[box].ToArray();
     foreach (Card c in cards)
     {
         c.RemoveFromGroup(box);
     }
     Group_List.Remove(box);
     control.MainWindow.MenuLayer.RemoveGroupButton(box);
 }
        public void CreateGroup(String owner, String id, String text, String textbrief, Point position)
        {
            Menu_Sort_Box box = new Menu_Sort_Box(control.MainWindow.MenuLayer, owner, id, text, textbrief);

            box.IsManipulationEnabled = true;
            box.IsHitTestVisible      = true;
            Matrix matrix = new Matrix(1, 0, 0, 1, position.X, position.Y);

            box.RenderTransform = new MatrixTransform(matrix);
            box.SetStartPosition(matrix.OffsetX + box.Width / 2, matrix.OffsetY + box.Height / 2);
            Group_List.CreateGroup(box);
            control.MainWindow.MenuLayer.AddGroupButton(box);
        }
        public override void TerminateGesture(object sender, Gesture_Event_Args gEventArgs)
        {
            Card          c = gEventArgs.GestureObjects[0] as Card;
            Menu_Sort_Box b = gEventArgs.GestureObjects[1] as Menu_Sort_Box;

            if (!gestureControler.Control.MainWindow.MenuLayer.IsButtonInOriginPos(b))
            {
                c.SortToGroup(b);
                Group_List.Add(b, c);
                My_Point point = gEventArgs.GesturePoints[0];
                Vector   v     = new Vector(c.PreviousPostion.X - c.CurrentPosition.X, c.PreviousPostion.Y - c.CurrentPosition.Y);
                v.Normalize();
                c.MoveCard(v.X * 150, v.Y * 150, 0.5);
            }
            if (Group_List.CardGroups.ContainsKey(b))
            {
                Card[] cards = Group_List.CardGroups[b].ToArray();
                foreach (Card cc in cards)
                {
                    cc.Dehightlight();
                }
            }
            base.TerminateGesture(sender, gEventArgs);
        }
 public void RemoveCard(Menu_Sort_Box key, Card c)
 {
     Group_List.RemoveCard(key, c);
     c.RemoveFromGroup(key);
 }
 public void GroupCard(Menu_Sort_Box key, Card c)
 {
     Group_List.Add(key, c);
     c.SortToGroup(key);
 }