Exemplo n.º 1
0
 private void TempStackPanel_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
     {
         TempCardStack.Pop();
     }
 }
Exemplo n.º 2
0
        private void RefreshMainListPanel()
        {
            var tempStack = new LightStack <Card>();

            if (TempCardStack is null)
            {
                TempCardStack  = new LightStack <Card>();
                TempStackPanel = new LightStack <UIElement>();
            }

            else
            {
                if (MainList != null && MainList.Count > 0)
                {
                    int i        = 0;
                    int upBorder = MainList.Count > countOfCardsInMainStack ? countOfCardsInMainStack : MainList.Count;

                    if (TempCardStack.Count > 0)
                    {
                        TempCardStack.Reverse();

                        while (TempCardStack.Count >= 1)
                        {
                            TempList.Add(TempCardStack.Pop());
                        }

                        TempList.Add(TempCardStack.Peek());
                    }

                    while (i < upBorder)
                    {
                        Card card = MainList.First;
                        TempList.Add(card);
                        positionInMainDeck++;

                        MainList.Remove(card);
                        i++;
                    }

                    TempCardStack.Pop();
                }
            }

            TempCardStack = tempStack;
        }