コード例 #1
0
        internal static int GenerateRandomID()
        {
            Random rand;
            Tasks  tasks = new Tasks();

            tasks.Load();
            bool done = true;
            int  id;

            do
            {
                rand = new Random(DateTime.Now.Millisecond + DateTime.Now.Second + DateTime.Now.Minute + DateTime.Now.Hour + DateTime.Now.Day + DateTime.Now.Month + DateTime.Now.Year); // So we don't get stuck in an infinite loop
                id   = rand.Next(100000000, 999999999);                                                                                                                                  //Generate a random ID.
                foreach (Task task in tasks.tasks)
                {
                    foreach (Subtask subtask in task.Subtasks)
                    {
                        if (subtask.ID == id)
                        {
                            done = false;
                        }
                    }
                    if (task.ID == id)
                    {
                        done = false;
                    }
                }
            } while (!done);
            return(id);
        }
コード例 #2
0
ファイル: RequestWork.cs プロジェクト: dmulder/Task-Tracker
        static void HandleEditTask(object sender, ActionArgs e)
        {
            Tasks tasks = new Tasks();

            tasks.Load();
            EditTask(tasks.CurrentTask());
        }
コード例 #3
0
ファイル: RequestWork.cs プロジェクト: dmulder/Task-Tracker
        static internal void SuggestTask()
        {
            SetPidginStatus("Available", "");
            Notification notify;
            Tasks        tasks = new Tasks();

            tasks.Load();
            Task task = tasks.GetPriority();

            if (task != null)
            {
                notify = new Notification("Tasks", "This is the next priority task:\n" + task.Summary);
                notify.AddAction("select", "Select", HandleSelectTask);
                notify.AddAction("postpone", "Delay", HandlePostponeTask);
                notify.AddAction("AddTask", "Add Task", HandleAddTask);
                notify.Timeout = 0;
                notify.Urgency = Urgency.Critical;
                notify.Show();
            }
            else
            {
                notify = new Notification("Tasks", "What are you working on?");
                notify.AddAction("AddTask", "Add Task", HandleAddTask);
                notify.Timeout = 0;
                notify.Urgency = Urgency.Critical;
                notify.Show();
            }
        }
コード例 #4
0
ファイル: Main.cs プロジェクト: dmulder/Task-Tracker
        static void HandleEditTaskActivated(object sender, EventArgs e)
        {
            Tasks tasks = new Tasks();

            tasks.Load();
            RequestWork.EditTask(tasks.CurrentTask());
        }
コード例 #5
0
 internal static void SuggestTask()
 {
     SetPidginStatus("Available", "");
     Notification notify;
     Tasks tasks = new Tasks();
     tasks.Load();
     Task task = tasks.GetPriority();
     if (task != null)
     {
         notify = new Notification("Tasks", "This is the next priority task:\n" + task.Summary);
         notify.AddAction("select", "Select", HandleSelectTask);
         notify.AddAction("postpone", "Delay", HandlePostponeTask);
         notify.AddAction("AddTask", "Add Task", HandleAddTask);
         notify.Timeout = 0;
         notify.Urgency = Urgency.Critical;
         notify.Show();
     }
     else
     {
         notify = new Notification("Tasks", "What are you working on?");
         notify.AddAction("AddTask", "Add Task", HandleAddTask);
         notify.Timeout = 0;
         notify.Urgency = Urgency.Critical;
         notify.Show();
     }
 }
コード例 #6
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();
        }
コード例 #7
0
ファイル: RequestWork.cs プロジェクト: dmulder/Task-Tracker
        static void HandlePostponeTask(object sender, ActionArgs e)
        {
            Tasks tasks = new Tasks();

            tasks.Load();
            tasks.PostponePriorityTask();
            SuggestTask();
        }
コード例 #8
0
ファイル: RequestWork.cs プロジェクト: dmulder/Task-Tracker
        static void SelectTask()
        {
            Tasks tasks = new Tasks();

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

            SetPidginStatus("Busy", current.Summary);
        }
コード例 #9
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();
            }
        }
コード例 #10
0
ファイル: AddTask.cs プロジェクト: DavidMulder/Task-Tracker
 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();
     }
 }
コード例 #11
0
ファイル: RequestWork.cs プロジェクト: dmulder/Task-Tracker
        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);
        }
コード例 #12
0
ファイル: Main.cs プロジェクト: dmulder/Task-Tracker
        static void MenuViewTaskActivated(object sender, EventArgs e)
        {
            Tasks tasks = new Tasks();

            tasks.Load();
            Task         current = tasks.CurrentTask();
            Notification notify  = new Notification(current.Summary, current.Description.Substring(0, (current.Description.Length > 1000 ? 1000 : current.Description.Length)));

            notify.AddAction("edit", "Edit", HandleEditTaskActivated);
            notify.AddAction("finish", "Mark Finished", MenuFinishTaskActivated);
            notify.AddAction("list", "Tasks", HandleViewTaskListActivated);
            notify.Urgency = Urgency.Critical;
            notify.Show();
        }
コード例 #13
0
ファイル: Main.cs プロジェクト: dmulder/Task-Tracker
        static void MenuFinishTaskActivated(object sender, EventArgs e)
        {
            Tasks tasks = new Tasks();

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

            tasks.SetCurrentTaskFinished();
            Notification notify = new Notification();

            notify.Summary = "Task Finished";
            notify.Body    = task.Summary;
            notify.Urgency = Urgency.Critical;
            notify.Show();
            RequestWork.SuggestTask();
        }
コード例 #14
0
ファイル: RequestWork.cs プロジェクト: dmulder/Task-Tracker
        static void HandleFinishedTask(object sender, ActionArgs e)
        {
            Tasks tasks = new Tasks();

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

            tasks.SetCurrentTaskFinished();
            Notification notify = new Notification();

            notify.Summary = "Task Finished";
            notify.Body    = task.Summary;
            notify.Urgency = Urgency.Critical;
            notify.Show();
            SuggestTask();
        }
コード例 #15
0
 internal static void DisplayMessage()
 {
     Tasks tasks = new Tasks();
     tasks.Load();
     Task current = tasks.CurrentTask();
     Notification notify;
     if (current != null)
     {
         notify = new Notification("Tasks", "Are you still working on this task?\n" + current.Summary);
         notify.AddAction("yes", "Yes", HandleDoNothing);
         notify.AddAction("view", "View", HandleEditTask);
         notify.AddAction("finish", "Finish", HandleFinishedTask);
         notify.Timeout = 0;
         notify.Urgency = Urgency.Critical;
         notify.Show();
     }
     else
     {
         SuggestTask();
     }
 }
コード例 #16
0
ファイル: RequestWork.cs プロジェクト: dmulder/Task-Tracker
        static internal void DisplayMessage()
        {
            Tasks tasks = new Tasks();

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

            if (current != null)
            {
                notify = new Notification("Tasks", "Are you still working on this task?\n" + current.Summary);
                notify.AddAction("yes", "Yes", HandleDoNothing);
                notify.AddAction("view", "View", HandleEditTask);
                notify.AddAction("finish", "Finish", HandleFinishedTask);
                notify.Timeout = 0;
                notify.Urgency = Urgency.Critical;
                notify.Show();
            }
            else
            {
                SuggestTask();
            }
        }
コード例 #17
0
 static void SelectTask()
 {
     Tasks tasks = new Tasks();
     tasks.Load();
     tasks.FinishCurrentTaskAndStartPriorityTask();
     Task current = tasks.CurrentTask();
     SetPidginStatus("Busy", current.Summary);
 }
コード例 #18
0
 static void HandlePostponeTask(object sender, ActionArgs e)
 {
     Tasks tasks = new Tasks();
     tasks.Load();
     tasks.PostponePriorityTask();
     SuggestTask();
 }
コード例 #19
0
 static void HandleFinishedTask(object sender, ActionArgs e)
 {
     Tasks tasks = new Tasks();
     tasks.Load();
     Task task = tasks.CurrentTask();
     tasks.SetCurrentTaskFinished();
     Notification notify = new Notification();
     notify.Summary = "Task Finished";
     notify.Body = task.Summary;
     notify.Urgency = Urgency.Critical;
     notify.Show();
     SuggestTask();
 }
コード例 #20
0
ファイル: Main.cs プロジェクト: DavidMulder/Task-Tracker
 static void HandleEditTaskActivated(object sender, EventArgs e)
 {
     Tasks tasks = new Tasks();
     tasks.Load();
     RequestWork.EditTask(tasks.CurrentTask());
 }
コード例 #21
0
ファイル: Reports.cs プロジェクト: dmulder/Task-Tracker
 public Reports()
 {
     tasks.Load();
     FindFinishedTasks();
     finishedTasks.Sort(CompareTasks);
 }
コード例 #22
0
ファイル: Main.cs プロジェクト: DavidMulder/Task-Tracker
 static void MenuViewTaskActivated(object sender, EventArgs e)
 {
     Tasks tasks = new Tasks();
     tasks.Load();
     Task current = tasks.CurrentTask();
     Notification notify = new Notification(current.Summary, current.Description.Substring(0, (current.Description.Length > 1000 ? 1000 : current.Description.Length)));
     notify.AddAction("edit", "Edit", HandleEditTaskActivated);
     notify.AddAction("finish", "Mark Finished", MenuFinishTaskActivated);
     notify.AddAction("list", "Tasks", HandleViewTaskListActivated);
     notify.Urgency = Urgency.Critical;
     notify.Show();
 }
コード例 #23
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);
 }
コード例 #24
0
ファイル: Tasks.cs プロジェクト: DavidMulder/Task-Tracker
 internal static int GenerateRandomID()
 {
     Random rand;
     Tasks tasks = new Tasks ();
     tasks.Load ();
     bool done = true;
     int id;
     do {
         rand = new Random (DateTime.Now.Millisecond + DateTime.Now.Second + DateTime.Now.Minute + DateTime.Now.Hour + DateTime.Now.Day + DateTime.Now.Month + DateTime.Now.Year); // So we don't get stuck in an infinite loop
         id = rand.Next (100000000, 999999999); //Generate a random ID.
         foreach (Task task in tasks.tasks) {
             foreach (Subtask subtask in task.Subtasks) {
                 if (subtask.ID == id)
                     done = false;
             }
             if (task.ID == id)
                 done = false;
         }
     } while (!done);
     return id;
 }
コード例 #25
0
 static void HandleEditTask(object sender, ActionArgs e)
 {
     Tasks tasks = new Tasks();
     tasks.Load();
     EditTask(tasks.CurrentTask());
 }
コード例 #26
0
ファイル: Main.cs プロジェクト: DavidMulder/Task-Tracker
 static void MenuFinishTaskActivated(object sender, EventArgs e)
 {
     Tasks tasks = new Tasks();
     tasks.Load();
     Task task = tasks.CurrentTask();
     tasks.SetCurrentTaskFinished();
     Notification notify = new Notification();
     notify.Summary = "Task Finished";
     notify.Body = task.Summary;
     notify.Urgency = Urgency.Critical;
     notify.Show();
     RequestWork.SuggestTask();
 }