void NewGame() { timer.Stop(); gameShape.NewGame(); TotalScore.Text = gameShape.Score.ToString(); TotalMoves.Text = gameShape.MoveCount.ToString(); dealer.Clear(); stack.Clear(); foreach (var d in ground) { d.Clear(); } //Создаем карты Deck deal = new Deck(); for (int i = 0; i < 2; i++) { for (int suit = 1; suit <= 4; suit++) { for (int number = 1; number <= 13; number++) { Card c = new Card((CardRank)number, (CardSuit)suit); deal.TopCard = c; } } deal.Shuffle(5); } //Добавляем в основную колоду for (int i = 0; i < 104; i++) { CardShape cp = new CardShape(); cp.Card = deal.TopCard; deal.TakeTopCard(); cp.MouseLeftButtonDown += cp_MouseLeftButtonDown; //cp.MouseDoubleClick += cp_MouseDoubleClick; dealer.Add(cp); } // по 1 карты в стопку for (int i = 0; i < 3; i++) { bool visible = true; for (int j = 0; j < 7; j++) { ground[(i * 7) + j].Add(dealer.TopCardShape); ground[(i * 7) + j].Deck.TopCard.Visible = visible; visible = !visible; } } for (int j = 0; j < ground.Count; j++) { ground[j].Deck.TopCard.Enabled = true; ground[j].Deck.TopCard.IsDragable = false; } dealer.Deck.MakeAllCardsDragable(false); dealer.Deck.TopCard.Visible = false; dealer.Deck.TopCard.IsDragable = false; Canvas.SetZIndex(dealer, 0); timer.Start(); }