Пример #1
0
        /// <summary>
        /// ダイアログで指定された条件に一致する問題を抽出し返却します。
        /// </summary>
        /// <returns>抽出された問題の一覧 / 選択されなかった場合null</returns>
        public List<Quiz> QuizExtractWithTerm(IWin32Window f)
        {
            List<Quiz> lq;
            // Show Dialog
            if(ShowDialog(f) != DialogResult.OK) {
                return null;
            }
            // Load
            if(QuizBook != null) {
                // Open
                var mql = new MyQAList();
                mql.XmlLoad("Books/" + QuizBook);
                lq = (from qa in QuizManage.Quizs
                      where mql.mqa.Exists(p => p.q.QuizID == qa.QuizID)
                      select qa).ToList();
            }
            else {
                lq = QuizManage.Quizs;
            }
            QuizManage.LoadAnswerData();

            // Extract
            var ls = from q in lq
                     where _IsMatchQuiz(q) && q.IsEnabledSelections
                     orderby Guid.NewGuid()
                     select q;
            if(ShowCount != null) {
                ls = ls.Take(ShowCount.Value).OrderBy(a => true);
            }
            return ls.ToList();
        }
Пример #2
0
 private void 問題帳から練習を開始BToolStripMenuItem_Click(object sender, EventArgs e)
 {
     // Open QuizFile
     OpenFileDialog ofd = new OpenFileDialog();
     ofd.InitialDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Books\\";
     ofd.Filter = "quizfile(*.xml)|*.xml|all files(*.*)|*.*";
     if(ofd.ShowDialog() == DialogResult.OK) {
         // Load
         var mql = new MyQAList();
         mql.XmlLoad(ofd.FileName);
         ShowQuizs = (from qa in QuizManage.Quizs
                      where mql.mqa.Exists(p => p.q.QuizID == qa.QuizID)
                      select qa).ToList();
         QuizManage.LoadAnswerData();
         StartTraningMode();
     }
 }