Exemplo n.º 1
0
        private void Generate100RandomTasks(ref List <Task> tasks)
        {
            SuperTask st = new SuperTask();

            st.Name = "MainSuperTask";

            for (int i = 0; i < 100; i++)
            {
                Task t = new Task(st);
                t.Name  = i + " Task";
                t.Start = START.AddHours(Math.Abs(Math.Sin(i) * 40));
                t.End   = t.Start.AddHours(Math.Abs(Math.Cos(i) * 3));
                Debug.Assert(t.Start <= t.End);
                tasks.Add(t);

                if (t.Start < minDate)
                {
                    minDate = t.Start;
                }
                if (t.End > maxDate)
                {
                    maxDate = t.End;
                }
            }
        }
Exemplo n.º 2
0
        private void GenerateDependentTasks()
        {
            SuperTask st1 = new SuperTask();

            st1.Name = "S1";
            superTasks.Add(st1);

            SuperTask st2 = new SuperTask();

            st2.Name = "S2";
            superTasks.Add(st2);

            SuperTask st3 = new SuperTask();

            st3.Name = "S3";
            superTasks.Add(st3);


            tasksMap[9] = new Task(st1)
            {
                Name = new string('9', 500), Start = dt("22:00"), End = dt("23:00")
            };
            tasksMap[8] = new Task(st3)
            {
                Name = "8", Start = dt("21:00"), End = dt("21:30")
            };
            tasksMap[8].DepTasks.Add(tasksMap[9]);
            tasksMap[7] = new Task(st3)
            {
                Name = "7", Start = dt("20:00"), End = dt("20:30")
            };
            tasksMap[7].DepTasks.Add(tasksMap[8]);
            tasksMap[6] = new Task(st3)
            {
                Name = "6", Start = dt("21:10"), End = dt("21:40")
            };
            tasksMap[6].DepTasks.Add(tasksMap[9]);
            tasksMap[5] = new Task(st2)
            {
                Name = new string('5', 10), Start = dt("20:10"), End = dt("20:30")
            };
            tasksMap[5].DepTasks.Add(tasksMap[6]);
            tasksMap[4] = new Task(st2)
            {
                Name = new string('4', 20), Start = dt("19:00"), End = dt("19:30")
            };
            tasksMap[4].DepTasks.Add(tasksMap[5]);
            tasksMap[4].DepTasks.Add(tasksMap[7]);
            tasksMap[3] = new Task(st1)
            {
                Name = "3", Start = dt("18:00"), End = dt("18:30")
            };
            tasksMap[3].DepTasks.Add(tasksMap[4]);
            tasksMap[2] = new Task(st1)
            {
                Name = "2", Start = dt("17:50"), End = dt("18:30")
            };
            tasksMap[2].DepTasks.Add(tasksMap[4]);
            tasksMap[1] = new Task(st1)
            {
                Name = "1", Start = dt("16:00"), End = dt("17:00")
            };
            tasksMap[1].DepTasks.Add(tasksMap[2]);
            tasksMap[1].DepTasks.Add(tasksMap[3]);

            st1.Tasks.Add(tasksMap[1]);
            st1.Tasks.Add(tasksMap[2]);
            st1.Tasks.Add(tasksMap[3]);
            st1.Tasks.Add(tasksMap[9]);

            st2.Tasks.Add(tasksMap[4]);
            st2.Tasks.Add(tasksMap[5]);

            st3.Tasks.Add(tasksMap[6]);
            st3.Tasks.Add(tasksMap[7]);
            st3.Tasks.Add(tasksMap[8]);

            foreach (var priorTask in tasksMap)
            {
                foreach (var depTask in priorTask.Value.DepTasks)
                {
                    TaskDependency dep = new TaskDependency();
                    dep.Prior  = priorTask.Value;
                    dep.Depend = depTask;
                    taskDependencies.Add(dep);
                }
            }

            minDate = dt("16:00");
            maxDate = dt("22:00");

            ApplySorting();
        }
Exemplo n.º 3
0
 public Task(SuperTask parent)
 {
     depTasks    = new ObservableCollection <Task>();
     this.parent = parent;
 }