/// <summary> /// Sort a sub-deck into its parent /// </summary> /// <param name="parent"></param> /// <param name="child"></param> private void SortIntoSubdeck(DeckInformation parent, DeckInformation child) { int currentIndex = decks.IndexOf(child); int parentIndex = decks.IndexOf(parent); //No need to do anything if it's already next to its parent if (currentIndex == parentIndex + 1) { return; } Decks.Remove(child); int childLevel = child.ChildLevel; parentIndex = decks.IndexOf(parent); for (int i = parentIndex + 1; i < decks.Count; i++) { int level = decks[i].ChildLevel; if (level > childLevel) { continue; } if ((level < childLevel) || (Compare(child, decks[i]) < 0)) { Decks.Insert(i, child); return; } } Decks.Add(child); }
private void RemoveDeck(object obj) { var deck = obj as Deck; Decks.Remove(deck); DeckDatabase.DeleteDeck(deck); }
public async Task RemoveDeck(long deckId) { var toRemove = GetDeck(deckId); //Change back to default image to delete deck Image if has await toRemove.ChangeBackToDefaultImage(); SubtractCardsCountFromTotalIfNotChild(toRemove); Decks.Remove(toRemove); }
public void RemoveDeck(Deck deck) { Decks.Remove(deck); db.DeleteDeck(deck); if (SelectedDeck.OriginalId == deck.Id) { SelectedDeck = Decks.First().AsCopy(); } }
/// <summary> /// Re-Sort a non-subdeck /// </summary> /// <param name="deck"></param> public void ResortNonSubdeck(DeckInformation deck) { Decks.Remove(deck); for (int i = 0; i < decks.Count; i++) { if (decks[i].Name.Contains(Constant.SUBDECK_SEPERATE)) { continue; } if (Compare(deck, decks[i]) < 0) { Decks.Insert(i, deck); return; } } Decks.Add(deck); }
public void Remove(Deck deck) { Decks.Remove(deck); save(); }