Exemplo n.º 1
0
        public DeckPropertiesDialog(eFlash.Data.Deck newDeck, bool changeType)
        {
            InitializeComponent();

            deck = newDeck;

            txtTitle.Text = deck.title;
            txtCategory.Text = deck.category;
            txtSubcategory.Text = deck.subcategory;

            grpType.Enabled = changeType;

            switch (deck.type)
            {
                case Constant.textDeck:
                    rdText.Checked = true;
                    break;
                case Constant.imageDeck:
                    rdImage.Checked = true;
                    break;
                case Constant.soundDeck:
                    rdAudio.Checked = true;
                    break;
                case Constant.noQuizDeck:
                    rdNoQuiz.Checked = true;
                    break;
            }

            saved = false;
        }
Exemplo n.º 2
0
        public static int insertToCards(eFlash.Data.Card c)
        {
            if (c.cardID != -1)
            {
                throw new ArgumentException("Trying to create a new card that already exists");
            }

            c.cardID = insertToCards(c.tag, c.uid);
            return c.cardID;
        }
Exemplo n.º 3
0
        public LayoutEditor(main newPrevWindow, eFlash.Data.Deck newDeck, bool makeCopy)
        {
            InitializeComponent();

            prevWindow = newPrevWindow;

            if (makeCopy)
            {
                deck = deepCopy(newDeck);
            }
            else
            {
                deck = newDeck;
            }

            initialize();
        }
Exemplo n.º 4
0
 public static void updateDeck(eFlash.Data.Deck d)
 {
     updateDecks(d.id, d.type, d.category, d.subcategory, d.title, d.uid, d.netID);
 }
Exemplo n.º 5
0
 public static void updateCards(eFlash.Data.Card card)
 {
     updateCards(card.cardID, card.tag, card.uid);
 }
Exemplo n.º 6
0
 public static int insertToDecks(eFlash.Data.Deck d)
 {
     return insertToDecks(d.category, d.subcategory, d.title, d.type, d.uid, d.netID);
 }
Exemplo n.º 7
0
 public LayoutEditor(main newPrevWindow, eFlash.Data.Deck newDeck)
     : this(newPrevWindow, newDeck, false)
 {
 }
Exemplo n.º 8
0
        /// <summary>
        /// Makes a deep copy of deck, duplicating all its cards,
        /// objects, and files, and sets it to be the current deck. 
        /// </summary>
        /// <param name="otherDeck">Deck to copy</param>
        /// <returns>Deck object of copy of deck</returns>
        private eFlash.Data.Deck deepCopy(eFlash.Data.Deck otherDeck)
        {
            otherDeck.load();

            _deck = new eFlash.Data.Deck(-1, otherDeck.type, otherDeck.category, otherDeck.subcategory, otherDeck.title, ProfileManager.getCurrentUserID(), ProfileManager.getCurrentNetID());

            // Put deck entry into DB
            saveDeck();

            Card newCard;
            eObject newObj;
            CreatorObject newCreatorObj;

            foreach (Card curCard in otherDeck.cardList)
            {
                newCard = new Card(curCard.tag, ProfileManager.getCurrentUserID());

                // Add each card to the DB
                newCard.cardID = dbAccess.insertLocalDB.insertToCards(newCard);
                dbAccess.insertLocalDB.insertToCDRelations(deck.id, newCard.cardID);

                foreach (eObject curObj in curCard.eObjectList)
                {
                    newObj = new eObject(newCard.cardID, curObj.side, curObj.type, curObj.x1, curObj.x2, curObj.y1, curObj.y2, curObj.data);

                    // Make a CreatorObject to let it load up the data file
                    newCreatorObj = CreatorObject.newFromEObject(this, newObj, 0);
                    newCreatorObj.initialize();
                    newObj.actualFilename = newObj.generateFileName();

                    // Save each object to DB and file
                    saveObject(newCreatorObj);
                }
            }

            return deck;
        }