コード例 #1
0
        private void addTaskButton_Click(object sender, EventArgs e)
        {
            AddTaskForm form = new AddTaskForm();

            form.ShowDialog();
            if (form.isSuccess)
            {
                ScheduleTask task = new ScheduleTask(
                    form.taskNameResult,
                    form.taskDescResult,
                    form.taskFileResult
                    );
                task.setDelayStart(form.delayStart.TotalSeconds);
                task.setInterval(form.timeInterval.TotalSeconds);
                task.setRepeat(form.isRepeat);
                FileUtils.appendToScheduleFile(task.getTaskName(), task);
                MessageBox.Show("Add task succesfully");
                loadScheduleTask();
            }

            DateTime now = DateTime.Now;
            //Process.Start("C:\\Users\\Nhu Hoang\\Desktop\\build.txt");
            DateTime firstRun = new DateTime(now.Year, now.Month, now.Day, now.Hour, 54, 0, 0);
            //Debug.WriteLine();

            //c.Wait();

            //Debug.WriteLine(FileUtils.getTaskFromFile(FileUtils.getAllScheduleFile()[0]).getDelayStartTotalSeconds().ToString());
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: cindymxcai/Doable
        private void AddTask_Click(object sender, EventArgs e)
        {
            p = new Panel();
            l = new Label();
            c = new CheckBox();

            this.p.BackgroundImage = global::WindowsFormsApp1.Properties.Resources.WhiteBackground;
            this.p.BorderStyle     = System.Windows.Forms.BorderStyle.FixedSingle;
            this.p.Location        = new System.Drawing.Point(3, 3);
            this.p.Name            = "taskP";
            this.p.Size            = new System.Drawing.Size(192, 35);
            this.p.TabIndex        = 13;

            this.c.Location = new System.Drawing.Point(170, 15);
            this.c.Size     = new System.Drawing.Size(13, 13);

            panel1.Controls.Add(c);
            panel1.Controls.Add(p);

            using (var form = new AddTaskForm())
            {
                var result = form.ShowDialog();
                if (result == DialogResult.OK)
                {
                    TaskInformation Tinfo = form.GetTInfo();

                    this.taskInformationList.Add(Tinfo);
                }
            }

            TaskUserControl t = new TaskUserControl(taskInformationList[taskInformationList.Count - 1].GetTaskTitle());

            this.l.Text     = taskInformationList[taskInformationList.Count - 1].GetTaskTitle();
            this.l.Location = new System.Drawing.Point(3, 9);
            this.l.Image    = global::WindowsFormsApp1.Properties.Resources.WhiteBackground;
            this.l.Size     = new System.Drawing.Size(180, 35);

            this.p.Controls.Add(l);
        }