Beispiel #1
0
        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) {
            }
        }
Beispiel #2
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;
 }
Beispiel #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 ();
        }
Beispiel #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;
 }
Beispiel #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();
        }
Beispiel #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();
        }
Beispiel #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();
        }
Beispiel #8
0
        protected virtual void OnEditActionActivated(object sender, System.EventArgs e)
        {
            LessonNode lesson = (LessonNode)nodeview3.NodeSelection.SelectedNode;

            openLesson.Invoke(this, new OpenLessonEventArgs(lesson));
        }
Beispiel #9
0
 public StartAssessmentEventArgs(LessonNode lesson)
 {
     this.lesson = lesson;
 }
Beispiel #10
0
 public OpenLessonEventArgs(LessonNode n)
 {
     Node = n;
 }
Beispiel #11
0
        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) {

            }
        }
Beispiel #12
0
 public StartAssessmentEventArgs(LessonNode lesson)
 {
     this.lesson = lesson;
 }
Beispiel #13
0
 public OpenLessonEventArgs(LessonNode n)
 {
     Node = n;
 }