示例#1
0
        /// <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);
        }
示例#2
0
        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);
        }
示例#4
0
        public void RemoveDeck(Deck deck)
        {
            Decks.Remove(deck);
            db.DeleteDeck(deck);

            if (SelectedDeck.OriginalId == deck.Id)
            {
                SelectedDeck = Decks.First().AsCopy();
            }
        }
示例#5
0
        /// <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);
        }
示例#6
0
 public void Remove(Deck deck)
 {
     Decks.Remove(deck);
     save();
 }