Esempio n. 1
0
        private void deleteTheCourseFromLibrary(string courseId)
        {
            AttandanceLibrary lib = libHall.libraryRef;

            if (lib.containsCourse(courseId))
            {
                Model.Course course = lib[courseId];
                lib.removeCourse(course);
                GlobalStation.shareInstance.librarySave(null, delegate() {
                    lib.addCourse(course);
                });
                libHall.contentInit();
            }
        }
Esempio n. 2
0
        private void bar_deleteBtn_Click(object sender, EventArgs e)
        {
            AttandanceLibrary lib = GlobalStation.shareInstance.librarys[libraryUUID];

            Model.Course  course = courseRef;
            HKConfirmForm form   = new HKConfirmForm();

            form.title = string.Format("确定要删除课程《{0}》?", course.name);
            if (form.showConfirm() != true)
            {
                return;
            }
            if (lib.containsCourse(course.id))
            {
                lib.removeCourse(course);
            }
            GlobalStation.shareInstance.librarySave(delegate() {
                bar_backBtn_Click(null, null);
            }, delegate() {
                lib.addCourse(course);
            });
        }
        private void addPanel_importCourseBtn_Click(string title)
        {
            try {
                string       path   = HKOpenFileDialog.selectFile(HKDialogFilter.Course);
                Model.Course course = FileSerilizeOpener <Model.Course> .open(path);

                AttandanceLibrary lib = libraryRef;
                if (!lib.containsCourse(course.id))
                {
                    lib.addCourse(course);
                }
                else
                {
                    overwriteOrCreateNew(lib, course);
                }
                GlobalStation.shareInstance.librarySave(delegate() {
                    contentInit();
                }, null);
            }catch (HKOpenFileDialog.CancelOpenFileException e) {
                Console.WriteLine(e.Message);
            }catch (FileSerilizeOpener <Model.Course> .FileOpenException e) {
                HKConfirmForm.showConfirmForm(e.Message);
            }
        }