Пример #1
0
        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);
            }
        }
Пример #2
0
        private void ImportCardsFromString(string cards)
        {
            DeckList.Clear();

            List <string> cardNumberList;


            if (Uri.TryCreate(cards, UriKind.Absolute, out Uri uri))
            {
                cards    = HttpUtility.ParseQueryString(uri.Query).Get("deck");
                DeckName = HttpUtility.ParseQueryString(uri.Query).Get("deckname");
            }



            cardNumberList = cards.Split(',').ToList();

            foreach (string currentCardNumber in cardNumberList)
            {
                Card newCard = CardList.Where(x => x.Number == currentCardNumber).FirstOrDefault();
                if (newCard != null)
                {
                    DeckList.Add(newCard);
                }
            }
        }
Пример #3
0
        private void DeckOrder()
        {
            var tempDeckList = DeckList.AsEnumerable().OrderByDescending(deck => deck.CampCode)
                               .ThenByDescending(deck => deck.TypeCode)
                               .ThenByDescending(deck => deck.Cost)
                               .ThenBy(deck => deck.Name)
                               .ToList();

            DeckList.Clear();
            tempDeckList.ForEach(DeckList.Add);
        }
Пример #4
0
        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();
        }
Пример #5
0
 private void clearDeck(object sender, EventArgs e)
 {
     decklist.Clear();
     updateListBox();
 }
Пример #6
0
 public void DeckClear_Click(object obj)
 {
     DeckList.Clear();
 }
Пример #7
0
 private void RemoveAllCardsFromDeckList()
 {
     DeckList.Clear();
 }