Exemplo n.º 1
0
        public DialogResult ShowEditDialog(Task t, Task project)
        {
            TaskFontColorBtn.BackColor = t.getFontColor();
            this.EditedTask = t;
            if (t.Tasks.Count > 0)
            {
                if (this.tableLayoutPanel2.Controls.Contains(nudProgress))
                {
                    chbCompleted.Visible = false;
                    this.tableLayoutPanel2.Controls.Remove(nudProgress);
                    this.tableLayoutPanel2.Controls.Add(ProgressLabel, 5, 2);
                }
            }
            else
            {
                if (this.tableLayoutPanel2.Controls.Contains(ProgressLabel))
                {
                    chbCompleted.Visible = true;
                    this.tableLayoutPanel2.Controls.Remove(ProgressLabel);
                    this.tableLayoutPanel2.Controls.Add(nudProgress, 5, 2);
                }
            }
            if (this.editedTask.Level != 0)
            {
                this.peopleList.Visible = false;
                this.comboBox1.Items.Clear();
                foreach (String person in project.PeopleList)
                {
                    this.comboBox1.Items.Add(person);
                }

                // parent = this.parent;
            }
            else
            {
                this.peopleList.Visible = true;
            }
            return this.ShowDialog();
        }
Exemplo n.º 2
0
 public void AddProject(Task t)
 {
     this.projects.Add(t);
 }
Exemplo n.º 3
0
 public TaskTreeModel(Task project)
 {
     projects = new List<Task>();
     projects.Add(project);
 }
Exemplo n.º 4
0
        public DialogResult ShowEditDialog(Task t)
        {
            this.EditedTask = t;

            return this.ShowDialog();
        }
Exemplo n.º 5
0
        void TsbTaskAddClick(object sender, EventArgs e)
        {
            if (tree.SelectedNode == null || tree.SelectedNode.Tag == null) return;

            Task pt = tree.SelectedNode.Tag as Task;
            Task nt = new Task();
            if (dlgEditTask.ShowEditDialog(nt) != DialogResult.OK) return; ;
            nt.Level = pt.Level + 1;
            pt.Tasks.Add(nt);
            RefreshTree();

            tree.SelectedNode = tree.FindNodeByTag(nt);
            Saved = false;
        }
Exemplo n.º 6
0
        private void tsbAddProject_Click(object sender, EventArgs e)
        {
            Task nt = new Task();
            if (dlgEditTask.ShowEditDialog(nt) != DialogResult.OK) return; ;
            model.AddProject(nt);
            RefreshTree();

            tree.SelectedNode = tree.FindNodeByTag(nt);
            Saved = false;
        }
Exemplo n.º 7
0
 void SaveNodesState(Task t)
 {
     Aga.Controls.Tree.TreeNodeAdv n = tree.FindNodeByTag(t);
     if (n != null) t.Expanded = n.IsExpanded;
     foreach (Task t1 in t.Tasks) SaveNodesState(t1);
 }
Exemplo n.º 8
0
 private void pd_PrintTask(Task t, PrintPageEventArgs e, int i)
 {
     switch (t.Status)
     {
         case MyProject.Task.TaskStatus.PLANNED:
             brush.Color = Color.Black;
             break;
         case MyProject.Task.TaskStatus.INPROGRESS:
             brush.Color = Color.Blue;
             break;
         case MyProject.Task.TaskStatus.OVERTIME:
             brush.Color = Color.Red;
             break;
         case MyProject.Task.TaskStatus.DONE:
             brush.Color = Color.Green;
             break;
         case MyProject.Task.TaskStatus.ERROR:
             brush.Color = Color.Gray;
             break;
         default:
             brush.Color = Color.Black;
             break;
     }
     e.Graphics.DrawString(t.Name + "   " + t.Duration + "   " + t.Start + "   " + t.End + "   " + t.Progress + "%   " + t.Priority + "   " + t.Description, tree.Font, brush,
             new PointF(t.Level * (float)tree.Font.Size, i * (float)tree.Font.Height), StringFormat.GenericTypographic);
 }
Exemplo n.º 9
0
 private void MkNewProject()
 {
     project = new Task();
     project.Name = "New Project";
     model = new TaskTreeModel(project);
     tree.Model = model;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Funkcja zwraca kolor na podstawie statusu Tasku
 /// </summary>
 /// <param name="status"></param>
 /// <returns></returns>
 private Color getColorByTaskStatus(Task.TaskStatus status)
 {
     Color c = Color.Violet;
     switch (status)
     {
         case Task.TaskStatus.DONE:
             c = Color.Green;
             break;
         case Task.TaskStatus.INPROGRESS:
             c = Color.Blue;
             break;
         case Task.TaskStatus.OVERTIME:
             c = Color.Red;
             break;
         case Task.TaskStatus.PLANNED:
             c = Color.Black;
             break;
         default:
             c = Color.Gray;
             break;
     }
     return c;
 }
Exemplo n.º 11
0
 private void ChangeLevel(Task t, bool up)
 {
     if (up)
     {
         foreach (Task tt in t.Tasks)
         {
             tt.Level++;
             ChangeLevel(tt, true);
         }
     }
     else
     {
         foreach (Task tt in t.Tasks)
         {
             tt.Level--;
             ChangeLevel(tt, false);
         }
     }
 }
Exemplo n.º 12
0
 private void changeChildLevel(Task t)
 {
     foreach (Task tt in t.Tasks)
     {
         tt.Level = t.Level + 1;
         changeChildLevel(tt);
     }
 }
Exemplo n.º 13
0
        private void tsbTaskEdit_Click(object sender, EventArgs e)
        {
            if (tree.SelectedNode == null || tree.SelectedNode.Tag == null) return;

            Task t = tree.SelectedNode.Tag as Task;
            Aga.Controls.Tree.TreeNodeAdv project = tree.SelectedNode;
            while ((project.Tag as Task).Level != 0)
            {
                project = project.Parent;
            }
            if (dlgEditTask.ShowEditDialog(t, project.Tag as Task) == DialogResult.OK) Saved = false;
        }
Exemplo n.º 14
0
        void TsbTaskAddClick(object sender, EventArgs e)
        {
            if (tree.SelectedNode == null || tree.SelectedNode.Tag == null) return;

            Task pt = tree.SelectedNode.Tag as Task;
            Task nt = new Task();
            nt.Level = pt.Level + 1;

            Aga.Controls.Tree.TreeNodeAdv project = tree.SelectedNode;
            while ((project.Tag as Task).Level != 0)
            {
                project = project.Parent;
            }

            if (dlgEditTask.ShowEditDialog(nt, project.Tag as Task) != DialogResult.OK) return; ;
            pt.Tasks.Add(nt);

            RefreshTree();

            tree.SelectedNode = tree.FindNodeByTag(nt);
            Saved = false;
        }
Exemplo n.º 15
0
 private void pd_PrintTask(Task t, PrintPageEventArgs e, int i)
 {
     e.Graphics.DrawString(t.Name + "   " + t.Duration + "   " + t.Start + "   " + t.End + "   " + t.Progress + "%   " + t.Priority + "   " + t.Description, tree.Font, brush,
             new PointF(t.Level * (float)tree.Font.Size, i * (float)tree.Font.Height), StringFormat.GenericTypographic);
 }