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 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); } } }
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); }
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(); }
private void clearDeck(object sender, EventArgs e) { decklist.Clear(); updateListBox(); }
public void DeckClear_Click(object obj) { DeckList.Clear(); }
private void RemoveAllCardsFromDeckList() { DeckList.Clear(); }