示例#1
0
文件: MainWindow.cs 项目: mru00/vocab
        private void import(string filename)
        {
            try {
                XmlDataDocument xml_doc = new XmlDataDocument();

                xml_doc.Load(filename);

                var lessonNodes = xml_doc.SelectNodes("//lesson");

                foreach (XmlNode ln in lessonNodes)
                {
                    int    id          = Convert.ToInt32(getAttributeOrDefault(ln, "id", "-1"));
                    string description = getAttributeOrDefault(ln, "description", "No description set");

                    var lesson = new LessonNode(id, description);

                    var pairNodes = ln.SelectNodes("pair");
                    foreach (XmlNode pn in pairNodes)
                    {
                        lesson.PairStore.AddNode(new PairNode(SelectTextNode(pn, "en"), SelectTextNode(pn, "de")));
                    }

                    LessonStore.AddNode(lesson);
                }
            } catch (FileNotFoundException) {
            }
        }
示例#2
0
文件: LessonView.cs 项目: mru00/vocab
 public LessonView(LessonNode lesson)
 {
     Build ();
     this.lesson = lesson;
     this.Name = lesson.Description;
     nodeview2.NodeStore = lesson.PairStore;
     nodeview2.AppendColumn ("en", new Gtk.CellRendererText (), "text", 0);
     nodeview2.AppendColumn ("de", new Gtk.CellRendererText (), "text", 1);
     for(int i = 0; i< 2; i++ ) {
         nodeview2.Columns[i].Resizable=true;
     }
     entry3.Text = lesson.Description;
     ShowAll ();
     CanEditRemove = false;
 }
示例#3
0
        protected virtual void OnAddActionActivated(object sender, System.EventArgs e)
        {
            var lesson = new LessonNode (0, "New Lesson");

            var dlg = new EditLessonDialog ();
            dlg.Id = lesson.Id;
            dlg.Description = lesson.Description;

            if (dlg.Run () == (int)ResponseType.Ok) {
                lesson.Id = dlg.Id;
                lesson.Description = dlg.Description;
                nodeview3.NodeStore.AddNode (lesson);
            }
            dlg.Destroy ();
        }
示例#4
0
 public LessonView(LessonNode lesson)
 {
     Build();
     this.lesson         = lesson;
     this.Name           = lesson.Description;
     nodeview2.NodeStore = lesson.PairStore;
     nodeview2.AppendColumn("en", new Gtk.CellRendererText(), "text", 0);
     nodeview2.AppendColumn("de", new Gtk.CellRendererText(), "text", 1);
     for (int i = 0; i < 2; i++)
     {
         nodeview2.Columns[i].Resizable = true;
     }
     entry3.Text = lesson.Description;
     ShowAll();
     CanEditRemove = false;
 }
示例#5
0
        public SimpleAssessmentWidget(LessonNode lesson)
        {
            this.Build ();
            this.lesson = lesson;

            buttonCount = min(5, lesson.PairCount);

            submitButtons = new Button[buttonCount];
            for (int i = 0; i < buttonCount; i++) {
                var b = new Button();
                vbuttonbox1.Add(b);
                b.Clicked += submit;
                submitButtons[i] = b;
            }
            newTest();
        }
示例#6
0
        protected virtual void OnAddActionActivated(object sender, System.EventArgs e)
        {
            var lesson = new LessonNode(0, "New Lesson");

            var dlg = new EditLessonDialog();

            dlg.Id          = lesson.Id;
            dlg.Description = lesson.Description;

            if (dlg.Run() == (int)ResponseType.Ok)
            {
                lesson.Id          = dlg.Id;
                lesson.Description = dlg.Description;
                nodeview3.NodeStore.AddNode(lesson);
            }
            dlg.Destroy();
        }
示例#7
0
        public SimpleAssessmentWidget(LessonNode lesson)
        {
            this.Build();
            this.lesson = lesson;

            buttonCount = min(5, lesson.PairCount);

            submitButtons = new Button[buttonCount];
            for (int i = 0; i < buttonCount; i++)
            {
                var b = new Button();
                vbuttonbox1.Add(b);
                b.Clicked       += submit;
                submitButtons[i] = b;
            }
            newTest();
        }
示例#8
0
        protected virtual void OnEditActionActivated(object sender, System.EventArgs e)
        {
            LessonNode lesson = (LessonNode)nodeview3.NodeSelection.SelectedNode;

            openLesson.Invoke(this, new OpenLessonEventArgs(lesson));
        }
示例#9
0
文件: MainWindow.cs 项目: mru00/vocab
 public StartAssessmentEventArgs(LessonNode lesson)
 {
     this.lesson = lesson;
 }
示例#10
0
文件: MainWindow.cs 项目: mru00/vocab
 public OpenLessonEventArgs(LessonNode n)
 {
     Node = n;
 }
示例#11
0
文件: MainWindow.cs 项目: mru00/vocab
        private void import(string filename)
        {
            try {
                XmlDataDocument xml_doc = new XmlDataDocument ();

                xml_doc.Load (filename);

                var lessonNodes = xml_doc.SelectNodes ("//lesson");

                foreach (XmlNode ln in lessonNodes) {

                    int id = Convert.ToInt32 (getAttributeOrDefault (ln, "id", "-1"));
                    string description = getAttributeOrDefault (ln, "description", "No description set");

                    var lesson = new LessonNode (id, description);

                    var pairNodes = ln.SelectNodes ("pair");
                    foreach (XmlNode pn in pairNodes) {
                        lesson.PairStore.AddNode (new PairNode (SelectTextNode (pn, "en"), SelectTextNode (pn, "de")));
                    }

                    LessonStore.AddNode (lesson);
                }
            } catch (FileNotFoundException) {

            }
        }
示例#12
0
文件: MainWindow.cs 项目: mru00/vocab
 public StartAssessmentEventArgs(LessonNode lesson)
 {
     this.lesson = lesson;
 }
示例#13
0
文件: MainWindow.cs 项目: mru00/vocab
 public OpenLessonEventArgs(LessonNode n)
 {
     Node = n;
 }