public void ReceiveCard(String userName, Card card)
 {
     if (userList.ContainsKey(userName))
     {
         card.HightlightColor = userList[userName].UserColor;
         userList[userName].ReceiveCard(card);
     }
 }
 public Linking_Icon(Card card)
 {
     InitializeComponent();
     this.card = card;
     ImageBrush brush = new ImageBrush();
     BitmapImage img = new BitmapImage(new Uri(@"Resource\Image\link_icon.png", UriKind.RelativeOrAbsolute));
     brush.ImageSource = img;
     rect.Fill = brush;
 }
Ejemplo n.º 3
0
 public static bool ContainCard(String key, Card card)
 {
     if (cardGroups.ContainsKey(key))
     {
         return cardGroups[key].Contains(card);
     }
     else {
         return false;
     }
 }
Ejemplo n.º 4
0
 public static bool ContainCard(Menu_Sort_Box key, Card card)
 {
     if (cardGroups.ContainsKey(key))
     {
         return cardGroups[key].Contains(card);
     }
     else {
         return false;
     }
 }
Ejemplo n.º 5
0
 //Add a card to the group "key"
 public static void Add(Menu_Sort_Box key, Card card)
 {
     if (!cardGroups.ContainsKey(key))
     {
         List<Card> list = new List<Card>();
         list.Add(card);
         cardGroups.Add(key, list);
     }
     else
     {
         cardGroups[key].Add(card);
     }
 }
 public override void Register(object[] senders, My_Point[] myPoints)
 {
     if (myPoints != null)
     {
         Points = myPoints;
         Senders = senders;
         card1 = (Card)senders[0];
         Gesture_Event_Args gestureEventArgs = new Gesture_Event_Args();
         gestureEventArgs.GesturePoints = myPoints;
         gestureEventArgs.Senders = senders;
         this.Status = GESTURESTATUS.REGISTER;
         OnRegistered(this, gestureEventArgs);
     }
 }
Ejemplo n.º 7
0
 //remove the card from the group "key"
 public static void RemoveCard(String key, Card card)
 {
     if (cardGroups.ContainsKey(key))
     {
         if (cardGroups[key].Contains(card))
         {
             card.RemoveFromGroup(key);
             cardGroups[key].Remove(card);
             if (cardGroups[key].Count == 0)
             {
                 Remove(key);
             }
         }
     }
 }
 public override void TerminateGesture(object sender, Gesture_Event_Args gEventArgs)
 {
     Menu_Sort_Box button = gEventArgs.GestureObjects[0] as Menu_Sort_Box;
     Card[] cards = new Card[gEventArgs.GestureObjects.Length - 1];
     for (int i = 0; i < cards.Length; i++)
     {
         cards[i] = gEventArgs.GestureObjects[i + 1] as Card;
     }
     foreach (Card card in cards)
     {
         if (!gestureControler.Control.MainWindow.Controlers.SortingBoxControler.ContainCard(button, card))
         {
             gestureControler.Control.MainWindow.Controlers.SortingBoxControler.GroupCard(button, card);
         }
         else
         {
             gestureControler.Control.MainWindow.Controlers.SortingBoxControler.RemoveCard(button, card);
         }
     }
     base.TerminateGesture(sender, gEventArgs);
 }
Ejemplo n.º 9
0
 public Card CopyCard(Card card)
 {
     Card cardToBeAdd = null;
     Control.MainWindow.Dispatcher.BeginInvoke(new Action(() =>
     {
         Card cardToBeCyp = card;
         cardToBeAdd = new Card(this);
         cardToBeAdd.InitializeCard(
                         cardToBeCyp.BackgroundColor,
                         cardToBeCyp.CurrentPosition,
                         cardToBeCyp.CurrentRotation,
                         cardToBeCyp.CurrentScale,
                         cardToBeCyp.ZIndex);
         cardToBeAdd.UUID = cardToBeCyp.UUID+"_Copy";
         cardToBeAdd.Owner = cardToBeCyp.Owner;
         Card_List.AddCard(cardToBeAdd);
         Control.UserControler.ReceiveCard(cardToBeAdd.Owner, cardToBeAdd);
         Canvas.SetZIndex(cardToBeCyp, Card_List.CardList.Count);
         Canvas.SetZIndex(cardToBeAdd, cardToBeAdd.ZIndex);
         Control.MainWindow.CardLayer.AddCard(cardToBeAdd);
     }));
     return cardToBeAdd;
 }
 public override void Terminate(object[] senders, My_Point[] myPoints)
 {
     if (myPoints != null && senders != null)
     {
         Gesture_Event_Args gestureEventArgs = new Gesture_Event_Args();
         gestureEventArgs.GesturePoints = myPoints;
         My_Point point = myPoints[0];
         foreach (Card card in Card_List.CardList) {
             if (card.Contain(point.CurrentPoint.Position))
             {
                 Senders[1] = card;
                 card2 = card;
                 break;
             }
             else {
                 this.Senders = senders;
             }
         }
         gestureEventArgs.Senders = this.Senders;
         this.Status = GESTURESTATUS.TERMINATE;
         OnTerminated(this, gestureEventArgs);
     }
 }
 public void AddCard(Card card)
 {
     this.Children.Add(card);
 }
Ejemplo n.º 12
0
 public void LoadCardLayout(String dir)
 {
     configFileDir = Path.Combine(Environment.CurrentDirectory, dir);
     if (File.Exists(configFileDir))
     {
         StreamReader reader = new StreamReader(configFileDir);
         String nextLine = "";
         while ((nextLine = reader.ReadLine()) != null)
         {
             LoadingCard readCard = JsonConvert.DeserializeObject<LoadingCard>(nextLine);
             int zindex = 0;
             if (readCard.userID == "Alex" && STATICS.ALEX_ACTIVE ||
                 readCard.userID == "Ben" && STATICS.BEN_ACTIVE ||
                 readCard.userID == "Chris" && STATICS.CHRIS_ACTIVE ||
                 readCard.userID == "Danny" && STATICS.DANNY_ACTIVE)
             {
                 Card myCard = new Card(this);
                 myCard.InitializeCard(readCard.dir,
                     readCard.text,
                     Color.FromArgb(255, (byte)readCard.color[0], (byte)readCard.color[1], (byte)readCard.color[2]),
                     new Point(readCard.position[0], readCard.position[1]), readCard.rotate, 1, zindex++);
                 myCard.UID = readCard.cardID;
                 myCard.Owner = readCard.userID;
                 myCard.CardText = readCard.text;
                 Card_List.AddCard(myCard);
                 mainWindow.UserControler.ReceiveCard(readCard.userID, myCard);
                 mainWindow.CardLayer.AddCard(myCard);
                 Canvas.SetZIndex(myCard, myCard.ZIndex);
             }
         }
     }
 }
 public void RemoveCard(String key, Card c)
 {
     Group_List.RemoveCard(key, c);
     c.RemoveFromGroup(key);
 }
 public void GroupCard(String key, Card c)
 {
     Group_List.Add(key, c);
     c.SortToGroup(key);
 }
 public bool ContainCard(String key, Card c)
 {
     return Group_List.CardGroups.ContainsKey(key)&&
         Group_List.CardGroups[key].Contains(c);
 }
 public bool ContainCard(Menu_Sort_Box key, Card c)
 {
     return Group_List.CardGroups.ContainsKey(key)&&
         Group_List.CardGroups[key].Contains(c);
 }
Ejemplo n.º 17
0
 public void ReceiveCard(Card card)
 {
     cards.Add(card);
     card.Owner = this.Name;
     card.HightlightColor = this.userColor;
 }
Ejemplo n.º 18
0
 public static void AddCard(Card card)
 {
     cardList.Add(card);
 }
 public void Move(Card card)
 {
     Dispatcher.BeginInvoke(new Action(() =>
     {
         foreach (Gesture_Event_Linking gesture in cardLinks.Keys)
         {
             if (gesture.Card1==card||gesture.Card2==card)
             {
                 Move(gesture);
             }
         }
     }));
 }
 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);
 }