public void DeckLoad()
        {
            OnPropertyChanged(nameof(DeckName));
            if ((DeckName == null) || DeckName.Equals(string.Empty))
            {
                return;
            }
            DeckList.Clear();
            var deckPath = CardUtils.GetDeckPath(DeckName);

            try
            {
                var sr = File.OpenText(deckPath);
                var numberListString = sr.ReadToEnd().Trim();
                sr.Close();
                var idList = JsonUtils.Deserialize <List <int> >(numberListString);
                foreach (var id in idList)
                {
                    AddCard(id);
                }
            }
            catch (Exception exception)
            {
                BaseDialogUtils.ShowDialogAuto(exception.Message);
            }
        }
        private void SetContainer(DeckName newDeck, int cardsCount)
        {
            _openDecks[newDeck] = new List <ContainerViewModel>();

            for (int i = 1; i <= cardsCount; i++)
            {
                var randomCard = _closedDecks[DeckName.MainDeckCard].Last();
                randomCard.CurrentDeck = newDeck;
                string cardPath = Properties.Resources.BackCardPath;
                if (i == cardsCount)
                {
                    cardPath = randomCard.CardPath;
                }
                var container = new ContainerViewModel()
                {
                    CardPath              = cardPath,
                    FrontCardPath         = randomCard.CardPath,
                    CardName              = randomCard.CardName.Value,
                    CardShape             = randomCard.CardShape.Value,
                    CardValue             = randomCard.CardValue,
                    DeckName              = newDeck,
                    TakeCardEventResource = TakeCardEventResource,
                };
                _openDecks[newDeck].Add(container);
                _closedDecks[DeckName.MainDeckCard].Remove(randomCard);
            }
        }
        public DeckMatch ValidateDeck(DeckName targetDeck)
        {
            DeckMatch matchState = DeckMatch.NotFound;

            if (_closedDecks.ContainsKey(targetDeck))
            {
                var targetCard = _closedDecks[targetDeck].LastOrDefault();

                if (targetDeck == DeckName.OpenDeckCard)
                {
                    return(matchState = DeckMatch.Found);
                }

                matchState = targetCard.CardShape == _moveableCard.CardShape ? DeckMatch.Found : DeckMatch.NotFound;
                if (matchState == DeckMatch.NotFound)
                {
                    return(matchState);
                }

                matchState = targetCard.CardValue == _moveableCard.CardValue - 1 ? DeckMatch.Found : DeckMatch.NotFound;
            }
            else
            {
                throw new KeyNotFoundException();
            }

            return(matchState);
        }
Beispiel #4
0
 public Deck TrimValues()
 {
     DeckID   = DeckID.Trim();
     UserID   = UserID.Trim();
     DeckName = DeckName.Trim();
     return(this);
 }
        private DeckMatch ValidateCard(DeckName targetDeck, CardShape moveableItemCardShape, int moveableItemCardValue, CardName?cardName, CardShape?cardShape, int cardValue)
        {
            DeckMatch matchState = DeckMatch.NotFound;

            if (cardName == null && cardShape == null)
            {
                return(matchState = DeckMatch.Found);
            }

            var targetCard = _openDecks[targetDeck].Find(c => (c.CardName == cardName && c.CardShape == cardShape));

            if (targetCard == null && moveableItemCardValue == 13)
            {
                return(matchState = DeckMatch.Found);
            }
            if (targetCard == null)
            {
                return(matchState = DeckMatch.NotFound);
            }

            if (targetCard.CardPath == Properties.Resources.BackCardPath)
            {
                return(matchState = DeckMatch.Found);
            }

            //if (targetCard.CardPath == Properties.Resources.EmptyCardPath && moveableItemCardValue == 14) return matchState = DeckMatch.Found;

            if ((moveableItemCardShape == CardShape.Hearts || moveableItemCardShape == CardShape.Diamonds) &&
                (targetCard.CardShape == CardShape.Clubs || targetCard.CardShape == CardShape.Spades))
            {
                matchState = DeckMatch.Found;
            }
            else if ((moveableItemCardShape == CardShape.Clubs || moveableItemCardShape == CardShape.Spades) &&
                     (targetCard.CardShape == CardShape.Hearts || targetCard.CardShape == CardShape.Diamonds))
            {
                matchState = DeckMatch.Found;
            }
            else
            {
                return(DeckMatch.NotFound);
            }

            if (targetCard.CardValue - moveableItemCardValue == 1)
            {
                matchState = DeckMatch.Found;
            }
            else
            {
                matchState = DeckMatch.NotFound;
            }

            return(matchState);
        }
        public DeckMatch ValidateCard(DeckName targetDeck, CardName?cardName, CardShape?cardShape, int cardValue)
        {
            if (_moveableContainer != null)
            {
                if (_openDecks.ContainsKey(targetDeck))
                {
                    return(ValidateCard(targetDeck, _moveableContainer.CardShape.Value, _moveableContainer.CardValue, cardName, cardShape, cardValue));
                }
            }
            else if (_openDecks.ContainsKey(targetDeck))
            {
                return(ValidateCard(targetDeck, _moveableCard.CardShape.Value, _moveableCard.CardValue, cardName, cardShape, cardValue));
            }

            throw new KeyNotFoundException();
        }
        public void DeckResave_Click(object obj)
        {
            OnPropertyChanged(nameof(DeckName));
            if (DeckName.Equals(string.Empty))
            {
                BaseDialogUtils.ShowDialogAuto(StringConst.DeckNameNone);
                return;
            }
            var deckPath = CardUtils.GetDeckPath(DeckName);

            if (File.Exists(deckPath))
            {
                BaseDialogUtils.ShowDialogAuto(StringConst.DeckNameExist);
                return;
            }
            DeckSave_Click(DeckName);
        }
        public void DeckSave_Click(object obl)
        {
            OnPropertyChanged(nameof(DeckName));
            if (DeckName.Equals(string.Empty))
            {
                BaseDialogUtils.ShowDialogAuto(StringConst.DeckNameNone);
                return;
            }
            var deckPath       = CardUtils.GetDeckPath(DeckName);
            var deckBuilder    = new StringBuilder();
            var deckNumberList = new List <int>();

            deckNumberList.AddRange(DeckList.Select(deck => deck.Id).ToList());
            deckBuilder.Append(JsonUtils.Serializer(deckNumberList));
            var isSaveSucceed = FileUtils.SaveFile(deckPath, deckBuilder.ToString());

            BaseDialogUtils.ShowDialogAuto(isSaveSucceed ? StringConst.SaveSucceed : StringConst.SaveFailed);
        }
        public void SetFllipedCardBinding(DeckName sourceDeck, CardName cardName, CardShape cardShape)
        {
            var containerToFlip = _openDecks[sourceDeck].Find(c => c.CardName == cardName && c.CardShape == cardShape);

            if (containerToFlip.SubContainer != null)
            {
                return;
            }

            var frontPath = containerToFlip.FrontCardPath;

            containerToFlip.CardPath = frontPath;

            switch (sourceDeck)
            {
            case DeckName.FirstDeck:
                FirstDeckCards = _openDecks[sourceDeck];
                break;

            case DeckName.SecondDeck:
                SecondDeckCards = _openDecks[sourceDeck];
                break;

            case DeckName.ThirdDeck:
                ThirdDeckCards = _openDecks[sourceDeck];
                break;

            case DeckName.FourthDeck:
                FourthDeckCards = _openDecks[sourceDeck];
                break;

            case DeckName.FifthDeck:
                FifthDeckCards = _openDecks[sourceDeck];
                break;

            case DeckName.SixthDeck:
                SixthDeckCards = _openDecks[sourceDeck];
                break;

            case DeckName.SeventhDeck:
                SeventhDeckCards = _openDecks[sourceDeck];
                break;
            }
        }
Beispiel #10
0
        private void Save()
        {
            if (DeckName.Equals(string.Empty))
            {
                BaseDialogUtils.ShowDialogAuto(StringConst.DeckNameNone);
                return;
            }
            var deckPath       = CardUtils.GetDeckPath(DeckName);
            var deckBuilder    = new StringBuilder();
            var deckNumberList = new List <string>();

            deckNumberList.AddRange(_playerVm.PlayerModels.Select(deckEntity => deckEntity.NumberEx).ToList());
            deckNumberList.AddRange(_deckVm.IgModels.Select(deckEntity => deckEntity.NumberEx).ToList());
            deckNumberList.AddRange(_deckVm.UgModels.Select(deckEntity => deckEntity.NumberEx).ToList());
            deckNumberList.AddRange(_deckVm.ExModels.Select(deckEntity => deckEntity.NumberEx).ToList());
            deckBuilder.Append(JsonUtils.Serializer(deckNumberList));
            var isSave = FileUtils.SaveFile(deckPath, deckBuilder.ToString());

            BaseDialogUtils.ShowDialogAuto(isSave ? StringConst.SaveSucceed : StringConst.SaveFailed);
        }
        public async void DeckDelete_Click(object obj)
        {
            OnPropertyChanged(nameof(DeckName));
            if (DeckName.Equals(string.Empty))
            {
                return;
            }
            if (!await BaseDialogUtils.ShowDialogConfirm(StringConst.DeleteHint))
            {
                return;
            }
            var deckPath = CardUtils.GetDeckPath(DeckName);

            if (!File.Exists(deckPath))
            {
                return;
            }
            File.Delete(deckPath);
            DeckList.Clear();
        }
Beispiel #12
0
        /// <summary>
        ///     卡组删除事件
        /// </summary>
        public void Delete_Click(object obj)
        {
            if (DeckName.Equals(string.Empty))
            {
                return;
            }
            if (!BaseDialogUtils.ShowDialogConfirm(StringConst.DeleteHint))
            {
                return;
            }
            var deckPath = CardUtils.GetDeckPath(DeckName);

            if (!File.Exists(deckPath))
            {
                return;
            }
            File.Delete(deckPath);
            ClearDeck();
            DeckName = string.Empty;
            BaseDialogUtils.ShowDialogAuto(StringConst.DeleteSucceed);
        }
Beispiel #13
0
        /// <summary>
        ///     卡组载入
        /// </summary>
        public void LoadDeck()
        {
            if (DeckName.Equals(string.Empty))
            {
                return;
            }
            ClearDeck();
            var deckPath = CardUtils.GetDeckPath(DeckName);

            try
            {
                var numberListString = FileUtils.GetFileContent(deckPath);
                var numberExList     = JsonUtils.Deserialize <List <string> >(numberListString);
                foreach (var numberEx in numberExList)
                {
                    AddCard(numberEx);
                }
            }
            catch (Exception exception)
            {
                BaseDialogUtils.ShowDialogAuto(exception.Message);
            }
        }
Beispiel #14
0
 public DropData(DeckName sourceDeck, Card movedCard)
 {
     SourceDeck = sourceDeck;
     MovedCard  = movedCard;
 }
        private List <ContainerViewModel> SetDeckCards(List <ContainerViewModel> deckCards, DeckName targetDeck, IMoveable moveableItem)
        {
            deckCards.Add(new ContainerViewModel()
            {
                CardPath              = moveableItem.CardPath,
                FrontCardPath         = moveableItem.CardPath,
                CardName              = moveableItem.CardName.Value,
                CardShape             = moveableItem.CardShape.Value,
                CardValue             = moveableItem.CardValue,
                DeckName              = targetDeck,
                TakeCardEventResource = TakeCardEventResource,
            });

            if (moveableItem is CardViewModel)
            {
                _moveableCard = null;
            }
            else if (moveableItem is ContainerViewModel)
            {
                if ((moveableItem as ContainerViewModel).SubContainer != null)
                {
                    deckCards = SetDeckCards(deckCards, targetDeck, (moveableItem as ContainerViewModel).SubContainer);
                }
                _moveableContainer = null;
            }

            return(deckCards);
        }
        public void DropCard(DeckName targetDeck)
        {
            if (_closedDecks.ContainsKey(targetDeck))
            {
                _closedDecks[targetDeck].Add(_moveableCard);
                var dropedCard = _closedDecks[targetDeck].Last();
                _lastMovedCard = dropedCard;
                _moveableCard  = null;

                switch (targetDeck)
                {
                case DeckName.OpenDeckCard:
                    OpenDeckCard = dropedCard;
                    break;

                case DeckName.DiamondsDeckCard:
                    DiamondsDeckCard = dropedCard;
                    break;

                case DeckName.HeartsDeckCard:
                    HeartsDeckCard = dropedCard;
                    break;

                case DeckName.SpadesDeckCard:
                    SpadesDeckCard = dropedCard;
                    break;

                case DeckName.ClubsDeckCard:
                    ClubsDeckCard = dropedCard;
                    break;
                }
            }
            else if (_openDecks.ContainsKey(targetDeck))
            {
                if (_moveableContainer != null)
                {
                    _openDecks[targetDeck] = SetDeckCards(_openDecks[targetDeck], targetDeck, _moveableContainer);

                    // TODO: maintain _moveableContainer.Card
                    //_lastMovedCard = _moveableContainer.Card;
                }
                else
                {
                    _openDecks[targetDeck] = SetDeckCards(_openDecks[targetDeck], targetDeck, _moveableCard);
                    //_lastMovedCard = _moveableCard;
                }

                switch (targetDeck)
                {
                case DeckName.FirstDeck:
                    FirstDeckCards = new List <ContainerViewModel>(_openDecks[targetDeck]);
                    break;

                case DeckName.SecondDeck:
                    SecondDeckCards = new List <ContainerViewModel>(_openDecks[targetDeck]);
                    break;

                case DeckName.ThirdDeck:
                    ThirdDeckCards = new List <ContainerViewModel>(_openDecks[targetDeck]);
                    break;

                case DeckName.FourthDeck:
                    FourthDeckCards = new List <ContainerViewModel>(_openDecks[targetDeck]);
                    break;

                case DeckName.FifthDeck:
                    FifthDeckCards = new List <ContainerViewModel>(_openDecks[targetDeck]);
                    break;

                case DeckName.SixthDeck:
                    SixthDeckCards = new List <ContainerViewModel>(_openDecks[targetDeck]);
                    break;

                case DeckName.SeventhDeck:
                    SeventhDeckCards = new List <ContainerViewModel>(_openDecks[targetDeck]);
                    break;
                }
            }

            CheckGameStatus();
        }
        public async void CreateOrEditFlashcard()
        {
            if (!await _internetConnectionService.IsNetworkAvailable())
            {
                Messenger.Default.Send <MessageToMessageBoxControl>(new MessageToMessageBoxControl(true, false, true, true,
                                                                                                   StringResources.GetString("NoInternetConnection")));
                return;
            }
            else if (!_internetConnectionService.IsInternetAccess())
            {
                Messenger.Default.Send <MessageToMessageBoxControl>(new MessageToMessageBoxControl(true, false, StringResources.GetString("AccessDenied")));
                return;
            }
            else
            {
                if (!ValidateForm())
                {
                    return;
                }

                _flashcard.Answer   = Answer.TrimEnd();
                _flashcard.Question = Question.TrimEnd();

                string oldDeckName = _deck.Name;
                bool   oldIsPublic = _deck.IsPublic;
                _deck.Name     = DeckName.Trim();
                _deck.IsPublic = IsPublic;


                List <Tip> tips = new List <Tip>();
                foreach (TipViewModel tip in TipsCollection)
                {
                    tips.Add(new Tip(tip.ID, tip.Essence.Trim()));
                }

                try
                {
                    IsDataLoading = true;

                    switch (_mode)
                    {
                    case Mode.AddNewFlashcardToDeck:

                        if (oldDeckName != DeckName || oldIsPublic != IsPublic)
                        {
                            await _restService.UpdateDeck(_deck);
                        }

                        Flashcard createdFlashcard = await _restService.CreateFlashcard(_flashcard, _deck.ID);

                        foreach (var tip in tips)
                        {
                            await _restService.CreateTip(tip, _deck.ID, createdFlashcard.Id);
                        }

                        break;

                    case Mode.CreateFlashcardAndDeck:

                        Deck createdDeck = await _restService.CreateDeck(_deck);

                        Flashcard addedFlashcard = await _restService.CreateFlashcard(_flashcard, createdDeck.ID);

                        foreach (var tip in tips)
                        {
                            await _restService.CreateTip(tip, createdDeck.ID, addedFlashcard.Id);
                        }

                        break;

                    case Mode.EditFlashcard:

                        if (oldDeckName != DeckName || oldIsPublic != IsPublic)
                        {
                            await _restService.UpdateDeck(_deck);
                        }

                        string flashcardId = _flashcard.Id;
                        string deckId      = _flashcard.DeckID;

                        bool result = await _restService.UpdateFlashcard(_flashcard, deckId);

                        var oldTips = await _restService.GetTips(deckId, flashcardId);

                        if (oldTips != null)
                        {
                            foreach (var oldTip in oldTips)
                            {
                                await _restService.RemoveTip(deckId, flashcardId, oldTip.ID);
                            }
                        }

                        foreach (var tip in tips)
                        {
                            await _restService.CreateTip(tip, deckId, flashcardId);
                        }

                        break;
                    }
                }
                catch
                {
                    Messenger.Default.Send <MessageToMessageBoxControl>(new MessageToMessageBoxControl(true, false, StringResources.GetString("OperationFailed")));
                }
                finally
                {
                    IsDataLoading = false;
                }

                LeaveForm();
            }
        }
        private void CreateDecklistPDF()
        {
            AddToLog("Creating PDF...");

            List <Card> tempList = DeckList.ToList <Card>();

            string qrURL = "https://www.underworldsdb.com/shared.php?deck=0,";

            int objectiveCount = 0;
            int gambitCount    = 0;
            int upgradeCount   = 0;

            foreach (Card currentCard in tempList)
            {
                switch (currentCard.Type)
                {
                case "Objective": objectiveCount++; break;

                case "Ploy": gambitCount++; break;

                case "Spell": gambitCount++; break;

                case "Upgrade": upgradeCount++; break;
                }
            }

            int maxRows = Math.Max(objectiveCount, Math.Max(gambitCount, upgradeCount));

            maxRows = maxRows + 3;

            if (!Directory.Exists(_decklistsFolderFullPath))
            {
                Directory.CreateDirectory(_decklistsFolderFullPath);
            }

            string datePrefix = DateTime.Now.ToString("yyyyMMdd_HHmmss_");

            string decklistFileName;

            if (DeckName.Length > 0)
            {
                decklistFileName = datePrefix + DeckName + _decklistFileExtension;
            }
            else
            {
                decklistFileName = datePrefix + _decklistFile + _decklistFileExtension;
            }

            string decklistFileFullPath = _decklistsFolderFullPath + decklistFileName;

            AddToLog("PDF file: " + decklistFileFullPath);

            PdfWriter   pdfWriter   = new PdfWriter(decklistFileFullPath);
            PdfDocument pdfDocument = new PdfDocument(pdfWriter);
            Document    document    = new Document(pdfDocument, PageSize.A4);

            document.SetMargins(20, 20, 20, 20);

            Table table = new Table(3);

            table.SetWidth(UnitValue.CreatePercentValue(100));

            PdfFont regular = PdfFontFactory.CreateFont(iText.IO.Font.Constants.StandardFonts.HELVETICA);
            PdfFont bold    = PdfFontFactory.CreateFont(iText.IO.Font.Constants.StandardFonts.HELVETICA_BOLD);

            for (int row = 1; row <= maxRows; row++)
            {
                for (int col = 1; col <= 3; col++)
                {
                    if (row == 1 && col == 2)
                    {
                        if (DeckName.Length > 0)
                        {
                            table.AddCell(createCell(DeckName, TextAlignment.CENTER, bold, false, false, false, false));
                        }
                        else
                        {
                            table.AddCell(createCell("Decklist", TextAlignment.CENTER, bold, false, false, false, false));
                        }

                        continue;
                    }

                    if (row == 2 && col == 1)
                    {
                        table.AddCell(createCell("Objectives (" + objectiveCount.ToString() + ")", TextAlignment.CENTER, bold, false, false, false, false));
                        continue;
                    }

                    if (row == 2 && col == 2)
                    {
                        table.AddCell(createCell("Gambits (" + gambitCount.ToString() + ")", TextAlignment.CENTER, bold, false, false, false, false));
                        continue;
                    }

                    if (row == 2 && col == 3)
                    {
                        table.AddCell(createCell("Upgrades (" + upgradeCount.ToString() + ")", TextAlignment.CENTER, bold, false, false, false, false));
                        continue;
                    }

                    if (row > 2 && row < maxRows)
                    {
                        if (col == 1)
                        {
                            bool bFound = false;
                            for (int i = 0; i < tempList.Count; i++)
                            {
                                if (tempList[i].Type == "Objective")
                                {
                                    bool championship = false;
                                    if (tempList[i].OrganisedPlay.Substring(0, 1) == "V")
                                    {
                                        championship = true;
                                    }
                                    bool restricted = false;
                                    if (tempList[i].Restricted == "Restricted")
                                    {
                                        restricted = true;
                                    }
                                    bool surge = false;
                                    if (tempList[i].ObjType == "Surge")
                                    {
                                        surge = true;
                                    }
                                    table.AddCell(createCell(tempList[i].Name, TextAlignment.LEFT, regular, true, championship, restricted, surge));
                                    qrURL += tempList[i].Number + ",";
                                    tempList.RemoveAt(i);
                                    bFound = true;
                                    break;
                                }
                            }
                            if (bFound)
                            {
                                continue;
                            }
                        }

                        if (col == 2)
                        {
                            bool bFound = false;
                            for (int i = 0; i < tempList.Count; i++)
                            {
                                if (tempList[i].Type == "Ploy" || tempList[i].Type == "Spell")
                                {
                                    bool championship = false;
                                    if (tempList[i].OrganisedPlay.Substring(0, 1) == "V")
                                    {
                                        championship = true;
                                    }
                                    bool restricted = false;
                                    if (tempList[i].Restricted == "Restricted")
                                    {
                                        restricted = true;
                                    }
                                    table.AddCell(createCell(tempList[i].Name, TextAlignment.LEFT, regular, true, championship, restricted, false));
                                    qrURL += tempList[i].Number + ",";
                                    tempList.RemoveAt(i);
                                    bFound = true;
                                    break;
                                }
                            }
                            if (bFound)
                            {
                                continue;
                            }
                        }

                        if (col == 3)
                        {
                            bool bFound = false;
                            for (int i = 0; i < tempList.Count; i++)
                            {
                                if (tempList[i].Type == "Upgrade")
                                {
                                    bool championship = false;
                                    if (tempList[i].OrganisedPlay.Substring(0, 1) == "V")
                                    {
                                        championship = true;
                                    }
                                    bool restricted = false;
                                    if (tempList[i].Restricted == "Restricted")
                                    {
                                        restricted = true;
                                    }
                                    table.AddCell(createCell(tempList[i].Name, TextAlignment.LEFT, regular, true, championship, restricted, false));
                                    qrURL += tempList[i].Number + ",";
                                    tempList.RemoveAt(i);
                                    bFound = true;
                                    break;
                                }
                            }
                            if (bFound)
                            {
                                continue;
                            }
                        }
                    }

                    if (row == maxRows && col == 1)
                    {
                        QrCodeEncodingOptions options = new QrCodeEncodingOptions();

                        options = new QrCodeEncodingOptions
                        {
                            DisableECI   = true,
                            CharacterSet = "UTF-8",
                            Width        = 150,
                            Height       = 150,
                        };

                        var writer = new BarcodeWriter();
                        writer.Format  = BarcodeFormat.QR_CODE;
                        writer.Options = options;

                        qrURL = qrURL.Remove(qrURL.Length - 1, 1);

                        if (DeckName.Length > 0)
                        {
                            qrURL += "&deckname=" + DeckName.Replace(" ", "%20");
                        }

                        if (qrURL.Length <= 2953)
                        {
                            Image img = writer.Write(qrURL);

                            MemoryStream ms = new MemoryStream();

                            img.Save(ms, ImageFormat.Bmp);


                            ImageData rawImage = ImageDataFactory.Create(ms.ToArray());

                            iText.Layout.Element.Image image = new iText.Layout.Element.Image(rawImage);

                            table.AddCell(createCell(image, HorizontalAlignment.CENTER, 3));
                        }

                        break;
                    }

                    table.AddCell(createCell("", TextAlignment.CENTER, regular, false, false, false, false));
                }
            }


            document.Add(table);
            AddToLog("Finalizing...");
            document.Close();
            pdfWriter.Close();

            AddToLog("Finished");
        }
        public void SetMoveableCardBinding(CardName cardName, CardShape cardShape, int cardValue, DeckName sourceDeck, string path)
        {
            _moveableCard = new CardViewModel()
            {
                CardName = cardName, CardShape = cardShape, CardValue = cardValue, CardPath = path, CurrentDeck = sourceDeck
            };

            if (_closedDecks.ContainsKey(sourceDeck))
            {
                _closedDecks[sourceDeck].RemoveAll(c => c.CardName == cardName && c.CardShape == cardShape);
                var cardBehind = _closedDecks[sourceDeck].LastOrDefault() ?? _transparentCard;

                switch (sourceDeck)
                {
                case DeckName.OpenDeckCard:
                    OpenDeckCard = cardBehind;
                    break;

                case DeckName.DiamondsDeckCard:
                    DiamondsDeckCard = cardBehind;
                    break;

                case DeckName.HeartsDeckCard:
                    HeartsDeckCard = cardBehind;
                    break;

                case DeckName.SpadesDeckCard:
                    SpadesDeckCard = cardBehind;
                    break;

                case DeckName.ClubsDeckCard:
                    ClubsDeckCard = cardBehind;
                    break;
                }
            }
            else
            {
                _openDecks[sourceDeck].RemoveAll(c => c.CardName == cardName && c.CardShape == cardShape);
                if (_openDecks[sourceDeck].LastOrDefault() != null)
                {
                    _openDecks[sourceDeck].Last().SubContainer = null;
                }

                switch (sourceDeck)
                {
                case DeckName.FirstDeck:
                    FirstDeckCards = new List <ContainerViewModel>(_openDecks[sourceDeck]);
                    break;

                case DeckName.SecondDeck:
                    SecondDeckCards = new List <ContainerViewModel>(_openDecks[sourceDeck]);
                    break;

                case DeckName.ThirdDeck:
                    ThirdDeckCards = new List <ContainerViewModel>(_openDecks[sourceDeck]);
                    break;

                case DeckName.FourthDeck:
                    FourthDeckCards = new List <ContainerViewModel>(_openDecks[sourceDeck]);
                    break;

                case DeckName.FifthDeck:
                    FifthDeckCards = new List <ContainerViewModel>(_openDecks[sourceDeck]);
                    break;

                case DeckName.SixthDeck:
                    SixthDeckCards = new List <ContainerViewModel>(_openDecks[sourceDeck]);
                    break;

                case DeckName.SeventhDeck:
                    SeventhDeckCards = new List <ContainerViewModel>(_openDecks[sourceDeck]);
                    break;
                }
            }
        }