Пример #1
0
        protected void OnButtonOkClicked(object sender, System.EventArgs e)
        {
            Tasks tasks = new Tasks();

            tasks.Load();
            if (current.Active)
            {
                tasks.SetTaskNotActive();
            }
            List <Subtask> subtasks = Subtasks();

            if (!edit)
            {
                task = new Task(DateTime.Now, summary.Text, description.Buffer.Text, priority.Active * 5, current.Active);
                if (current.Active)
                {
                    task.Start = DateTime.Now;
                    if (!task.IsWorked(DateTime.Now))
                    {
                        task.Worked.Add(DateTime.Now);
                    }
                }
                task.Subtasks = subtasks;
                tasks.tasks.Add(task);
                tasks.Save();
            }
            else
            {
                DateTime        start  = task.Date;
                List <DateTime> worked = new List <DateTime>();
                foreach (DateTime date in task.Worked)
                {
                    worked.Add(date);
                }
                tasks.Remove(task);
                task = new Task(start, summary.Text, description.Buffer.Text, priority.Active * 5, current.Active);
                foreach (DateTime date in worked)
                {
                    task.Worked.Add(date);
                }
                if (current.Active)
                {
                    task.Start = DateTime.Now;
                    if (!task.IsWorked(DateTime.Now))
                    {
                        task.Worked.Add(DateTime.Now);
                    }
                }
                task.Subtasks = subtasks;
                tasks.tasks.Add(task);
                tasks.Save();
            }
        }
Пример #2
0
        internal void FinishCurrentTaskAndStartPriorityTask()
        {
            Task task = GetPriority();

            SetTaskNotActive();
            task.InProgress = true;
            task.Start      = DateTime.Now;
            if (!task.IsWorked(DateTime.Now))
            {
                task.Worked.Add(DateTime.Now);
            }
            Save();
        }
Пример #3
0
 protected void OnButtonOkClicked(object sender, System.EventArgs e)
 {
     Tasks tasks = new Tasks();
     tasks.Load();
     if (current.Active)
     {
         tasks.SetTaskNotActive();
     }
     List<Subtask> subtasks = Subtasks();
     if (!edit)
     {
         task = new Task(DateTime.Now, summary.Text, description.Buffer.Text, priority.Active*5, current.Active);
         if (current.Active)
         {
             task.Start = DateTime.Now;
             if (!task.IsWorked(DateTime.Now))
             {
                 task.Worked.Add(DateTime.Now);
             }
         }
         task.Subtasks = subtasks;
         tasks.tasks.Add(task);
         tasks.Save();
     }
     else
     {
         DateTime start = task.Date;
         List<DateTime> worked = new List<DateTime>();
         foreach (DateTime date in task.Worked)
         {
             worked.Add(date);
         }
         tasks.Remove(task);
         task = new Task(start, summary.Text, description.Buffer.Text, priority.Active*5, current.Active);
         foreach (DateTime date in worked)
         {
             task.Worked.Add(date);
         }
         if (current.Active)
         {
             task.Start = DateTime.Now;
             if (!task.IsWorked(DateTime.Now))
             {
                 task.Worked.Add(DateTime.Now);
             }
         }
         task.Subtasks = subtasks;
         tasks.tasks.Add(task);
         tasks.Save();
     }
 }
Пример #4
0
        static void HandleDoNothing(object sender, ActionArgs e)
        {
            Tasks tasks = new Tasks();

            tasks.Load();
            Task current = tasks.CurrentTask();

            if (!current.IsWorked(DateTime.Now))
            {
                current.Worked.Add(DateTime.Now);
            }
            tasks.Save();
            SetPidginStatus("Busy", current.Summary);
        }