示例#1
0
文件: LessonView.cs 项目: mru00/vocab
 protected virtual void OnAddActionActivated(object sender, System.EventArgs e)
 {
     var pair = new PairNode ("", "");
     var dlg = new EditPairDialog ();
     dlg.De = pair.De;
     dlg.En = pair.En;
     if (dlg.Run () == (int)ResponseType.Ok) {
         pair.En = dlg.En;
         pair.De = dlg.De;
         nodeview2.NodeStore.AddNode (pair);
     }
     dlg.Destroy ();
 }
示例#2
0
        protected virtual void OnAddActionActivated(object sender, System.EventArgs e)
        {
            var pair = new PairNode("", "");
            var dlg  = new EditPairDialog();

            dlg.De = pair.De;
            dlg.En = pair.En;
            if (dlg.Run() == (int)ResponseType.Ok)
            {
                pair.En = dlg.En;
                pair.De = dlg.De;
                nodeview2.NodeStore.AddNode(pair);
            }
            dlg.Destroy();
        }
示例#3
0
        void newTest()
        {
            int      r_source = rand.Next(lesson.PairCount);
            PairNode p_source = null;

            {
                int j = 0;
                foreach (PairNode p in lesson.PairStore)
                {
                    if (j++ == r_source)
                    {
                        p_source = p; break;
                    }
                }

                if (p_source == null)
                {
                    return;
                }

                label1.Text = p_source.En;
            }

            for (int i = 0; i < buttonCount; i++)
            {
                int      r    = rand.Next(lesson.PairCount);
                PairNode pair = null;
                int      j    = 0;
                foreach (PairNode p in lesson.PairStore)
                {
                    if (j++ == r)
                    {
                        pair = p; break;
                    }
                }
                submitButtons[i].Label = pair.De;
            }

            int r_dest = rand.Next(buttonCount);

            correctAnswer = p_source.De;
            submitButtons[r_dest].Label = correctAnswer;
        }