예제 #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
        private void HandleSummaryCellEdited(object o, EditedArgs args)
        {
            TreeIter iter;

            taskList.GetIterFromString(out iter, args.Path);
            taskList.SetValue(iter, 1, args.NewText);

            tasks.Load();
            int  id   = Convert.ToInt32((string)taskList.GetValue(iter, 3));
            Task task = tasks.Find(id);

            if (task != null)
            {
                task.Summary = args.NewText;
            }
            tasks.Save();
        }
예제 #3
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);
        }
예제 #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);
 }
예제 #5
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();
     }
 }