Beispiel #1
0
 public void DeleteTask(TaskWpf task)
 {
     if (this.Content.Contains(task))
     {
         this.Content.Remove(task);
     }
     else
     {
         foreach (TaskWpf t in Content)
         {
             t.Delete(task);
         }
     }
 }
Beispiel #2
0
        public TaskWpf(Task task, TaskWpf parent)
        {
            _task = task;
            _parent = parent;
            if (IsOverEstimatedTime())
                TaskColor = "Red";
            else
                TaskColor = "YellowGreen";

            _state = TaskState.Stoped;

            List<TaskWpf> tasks = new List<TaskWpf>();
            if (task.Childrens != null)
            {
                foreach (var t in task.Childrens)
                {
                    tasks.Add(new TaskWpf(t, this));
                }
            }
            this.Childrens = tasks;

            ImageSource = srcOkButton;
        }
        private void FillableButton_Click(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;
            if (btn != null)
            {
                var template = btn.TemplatedParent as ContentPresenter;
                TaskWpf task = template.Content as TaskWpf;
                if (task.State == TaskState.Stoped)
                {
                    if (_backgroundWorker != null)
                    {
                        _backgroundWorker.Abort();
                        if (_currentTask.State == TaskState.Started)
                        {
                            _currentTask.ToogleState();
                        }
                    }

                    _currentTask = task;
                    task.ToogleState();

                    _backgroundWorker = new Thread(delegate()
                    {
                        while (true)
                        {
                            if (DateTime.Now.TimeOfDay.Seconds % 10 == 0)
                            {
                                foreach (Project p in projects)
                                {
                                    p.SaveProject();
                                }
                            }
                            task.Increment(1);
                            Thread.Sleep(TimeSpan.FromSeconds(1));

                        }
                    });
                    _backgroundWorker.Start();
                }
                else
                {
                    task.ToogleState();
                    _backgroundWorker.Abort();
                }
            }
        }
Beispiel #4
0
 internal void Delete(TaskWpf task)
 {
     if (Childrens.Contains(task))
     {
         Childrens.Remove(task);
     }
     else
     {
         foreach (TaskWpf t in Childrens)
         {
             t.Delete(task);
         }
     }
 }