예제 #1
0
        private void CommandFavEditFunc(SolvableDeckViewModel favDeck)
        {
            var deckVM = new DeckViewModel()
            {
                Name = favDeck.Deck.Name
            };

            foreach (var card in favDeck.Deck.Cards)
            {
                deckVM.Cards.Add(new CardViewModel()
                {
                    CardModel = card.CardModel
                });
            }

            var editVM = new FavDeckEditViewModel()
            {
                FavDeck = deckVM
            };
            var result = ViewModelServices.DialogWindow.ShowDialog(editVM);

            if (result ?? false)
            {
                favDeck.Deck.Name = deckVM.Name;
                AssignFavDeckFrom(favDeck, deckVM);
            }
        }
예제 #2
0
        private void AssignFavDeckFrom(SolvableDeckViewModel favDeck, DeckViewModel sourceDeck)
        {
            if (sourceDeck.Cards.Count == favDeck.Deck.Cards.Count)
            {
                favDeck.Deck.Cards.SuspendNotifies();
                var cards = new List <TriadCard>();

                for (int idx = 0; idx < sourceDeck.Cards.Count; idx++)
                {
                    var cardProxy = sourceDeck.Cards[idx].CardModel;
                    favDeck.Deck.Cards[idx].CardModel = cardProxy;
                    cards.Add(cardProxy.cardOb);
                }

                favDeck.Deck.Cards.ResumeNotifies();

                int slotIdx   = favDecks.IndexOf(favDeck);
                var namedDeck = new TriadDeckNamed(new TriadDeck(cards))
                {
                    Name = favDeck.Deck.Name
                };
                PlayerSettingsDB.Get().UpdateFavDeck(slotIdx, namedDeck);

                favDeck.RefreshSolver(gameModel, namedDeck);
            }
        }