Exemple #1
0
        /// <summary>
        /// Testing saving code.
        /// </summary>
        void testingSavingAndLoading()
        {
            Card        card1 = new Card("1", "1b");
            Card        card2 = new Card("2", "2b");
            Card        card3 = new Card("3", "3b");
            List <Card> cards = new List <Card>();

            cards.Add(card1);
            cards.Add(card2);
            cards.Add(card3);

            Subject        calculus = new Subject("Calculus", new List <Subject>(), cards);
            List <Subject> subjects = new List <Subject>();

            subjects.Add(calculus);
            RootSubject math = new RootSubject("Math", subjects, new List <Card>());

            if (math.Save("C:\\Users\\grayma0717\\Desktop\\test.xml"))
            {
                MessageBox.Show("yay");
            }
            else
            {
                MessageBox.Show("nay");
            }

            var x = RootSubject.Open("C:\\Users\\grayma0717\\Desktop\\test.xml");

            treeMain.Nodes.Add(LoadSubjectToNode(x));
        }
Exemple #2
0
        /// <summary>
        /// Opens a file to the TreeView.
        /// </summary>
        /// <param name="fileName">Path to file that will be opened.</param>
        void openFile(string fileName)
        {
            //clear list and tree
            treeMain.Nodes.Clear();
            listMain.Items.Clear();
            //open selected subject
            RootSubject openedSubject = RootSubject.Open(fileName);

            treeMain.Nodes.Add(LoadSubjectToNode(openedSubject));
            currentOpenFilePath = fileName;
        }