示例#1
0
        private void studySubjectToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //create menu/form to ask which method they'd like to study by
            System.Windows.Forms.DialogResult dialogResult =
                MessageBox.Show("Would you like to study this subject's child subjects along with it?",
                                "Studying Options", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
            if (dialogResult == System.Windows.Forms.DialogResult.Cancel)
            {
                return; //no studying today
            }
            bool includeChildren = dialogResult == System.Windows.Forms.DialogResult.Yes ? true : false;

            //in the future add other study methods
            //hide main form, create study dialog, and let study session occur
            this.Hide();
            List <Card> cards = populateCards((Subject)lastSelectedNode.Tag, includeChildren);

            if (cards.Count < 3)
            {
                Helper.ShowError("There must be at least 3 cards to study.");
                return;
            }
            StudySession session = StudyView.CreateSession(cards);

            //get and display results
            ResultView.ShowResults(session);
            //add study session to past study sessions
            ((RootSubject)treeMain.Nodes[0].Tag).PastStudySessions.Add(session);
            //show main form and edit flag or prompt for saving
            this.Show();
            doEdited();
        }
示例#2
0
        public static StudySession CreateSession(List <Card> cards)
        {
            StudyView study = new StudyView(cards);

            study.ShowDialog();
            StudySession session = new StudySession();

            session.SessionCards = study.studyCards;
            return(session);
        }