Exemplo n.º 1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            task = getTask();
            if (task == null) {
                //close_lock = false;
                this.Close();
                return;
            }

            lblFile.Text = Path.GetFileName(task.FileName);

            processor = new Processor(task);
            processor.setProcessFinishCallback(delegate() {
                if (InvokeRequired) {
                    BeginInvoke(new SimpleDelegate(delegate() {
                        this.finished();
                    }));
                } else this.finished();
            });
            processor.setProcessProgressCallback(delegate(int current, int total) {
                if (InvokeRequired) {
                    BeginInvoke(new SimpleDelegate(delegate() {
                        this.progress(current, total);
                    }));
                } else this.progress(current, total);
            });
            SystemEvents.SessionEnding += new SessionEndingEventHandler(SystemEvents_SessionEnding);
            processing = true;
            processor.startProcess();
            notifyIcon.Visible = true;
        }
Exemplo n.º 2
0
 private void saveTask(Task task)
 {
     ConfigAccessor accessor = new ConfigAccessor();
     Catagory cat = new Catagory("Task");
     cat.addAttribute("File", task.FileName);
     cat.addAttribute("Process", task.Process.ToString());
     accessor.addCatagory(cat.Name, cat);
     accessor.writeConfigToFile(TASK_FILE);
 }
Exemplo n.º 3
0
 private Task loadTaskFromFile()
 {
     ConfigAccessor accessor = new ConfigAccessor();
     if (!accessor.readConfigFromFile(TASK_FILE)) return null;
     Catagory cat = accessor.getCatagory("Task");
     if (cat == null) return null;
     String file = cat.getAttribute("File", null);
     int process = cat.getIntAttribute("Process", -1);
     if (file == null || process < 0) return null;
     Task task = new Task(file);
     task.Process = process;
     return task;
 }