当前位置: 首页>>代码示例>>C#>>正文


C# ProjectManager.Split方法代码示例

本文整理汇总了C#中ProjectManager.Split方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectManager.Split方法的具体用法?C# ProjectManager.Split怎么用?C# ProjectManager.Split使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProjectManager的用法示例。


在下文中一共展示了ProjectManager.Split方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AdjustGroupDuringJoin

        public void AdjustGroupDuringJoin()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var group = new Task();
            var split = new Task();
            var part1 = new Task();
            var part2 = new Task();
            var part3 = new Task();
            manager.Add(split);
            manager.Add(group);

            // setup: create a split under a group
            manager.Group(group, split);
            manager.Split(split, part1, part2, 1);
            manager.Split(part2, part3, 1);
            Assert.IsTrue(group.Duration == 5);
            Assert.IsTrue(group.Duration == split.Duration);
            Assert.IsTrue(group.End == part3.End);

            // test: join and make sure group duration is shortened
            manager.Join(part1, part3);
            Assert.IsTrue(!manager.IsPart(part3));
            Assert.IsTrue(group.Duration == 4);
            Assert.IsTrue(group.Duration == split.Duration);
            Assert.IsTrue(group.End == part2.End);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:26,代码来源:ProjectTest.cs

示例2: Form1

        public Form1()
        {
            InitializeComponent();
            // create a project manager
            var manager = new ProjectManager();
            // create built-in task or use your own derived task
            var task = new Braincase.GanttChart.Task() { Name = "Hello "};
            var task1 = new Braincase.GanttChart.Task() { Name = " World" };
            var task2 = new Braincase.GanttChart.Task() { Name = "Helly" };
            var task3 = new Braincase.GanttChart.Task() { Name = "Hel7875" };
            var task5 = new Braincase.GanttChart.Task() { Name = "gmmail" };


            // add the task to the manager
            manager.Add(task2);
            manager.Add(task);
            manager.Add(task1);

            manager.Add(task3);
            manager.Split(task2,task1,2);

            
            //manager.SetDuration(task, 3);
            
            // create a chart control
            var chart = new Chart();
            // initialise the chart with the manager
            chart.Init(manager);
            // add chart to the form controls collection.
            this.Controls.Add(chart);
            
            // throughout your own code, call chart.Invalidate()
            // where you expect updates to the drawn chart,
            // to tell the chart to Paint() itself.
        }
开发者ID:bilale,项目名称:TestVisualStudioGitHub,代码行数:35,代码来源:Form1.cs

示例3: AdjustGroupDurationOnUngroup

        public void AdjustGroupDurationOnUngroup()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var split = new Task();
            var part1 = new Task();
            var part2 = new Task();
            var group = new Task();
            var task = new Task();
            manager.Add(group);
            manager.Add(split);
            manager.Add(task);

            // setup: create a group and split under it
            manager.Split(split, part1, part2, 1);
            manager.Group(group, part1); // intentionall group using part
            manager.Group(group, task);
            manager.SetDuration(part1, 30);
            manager.SetDuration(part2, 15);
            manager.SetDuration(task, 20);
            manager.SetStart(task, 50);
            Assert.IsTrue(group.Duration == 70);

            // test: ungroup part should ungroup split task
            manager.Ungroup(group, part1);
            Assert.IsTrue(group.Duration == 20);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:26,代码来源:ProjectTest.cs

示例4: AdjustGroupDurationOnSplit

        public void AdjustGroupDurationOnSplit()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var group = new Task();
            var split = new Task();
            var part1 = new Task();
            var part2 = new Task();
            var part3 = new Task();
            manager.Add(split);
            manager.Add(group);

            // setup: create a split under a group
            manager.Group(group, split);
            manager.Split(split, part1, part2, 1);
            Assert.IsTrue(group.Duration == split.Duration);
            Assert.IsTrue(group.End == part2.End);

            // test: split somemore and ensure group duration and end adjust correctly
            manager.Split(part2, part3, 1);
            Assert.IsTrue(group.Duration == split.Duration);
            Assert.IsTrue(group.End == part3.End);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:22,代码来源:ProjectTest.cs

示例5: SplitTaskAndConfirmSchedule

        public void SplitTaskAndConfirmSchedule()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var split = new Task() { Name = "split" };
            var part1 = new Task() { Name = "part1" };
            var part2 = new Task() { Name = "part2" };
            manager.Add(split);

            // setup: set schedule on regular task
            manager.SetStart(split, 11);
            manager.SetDuration(split, 15);
            Assert.IsTrue(split.Start == 11);
            Assert.IsTrue(split.End == 26);

            // test: split the task into parts and make sure the schedules of the new parts tally with original task
            manager.Split(split, part1, part2, 5);
            Assert.IsTrue(part1.Duration == 5);
            Assert.IsTrue(part1.Start == 11);
            Assert.IsTrue(part1.End == 16);

            Assert.IsTrue(part2.Duration == 10);
            Assert.IsTrue(part2.Start == 17);
            Assert.IsTrue(part2.End == 27);

            Assert.IsTrue(split.Start == 11);
            Assert.IsTrue(split.End == 27);
            Assert.IsTrue(split.Duration == 16);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:28,代码来源:ProjectTest.cs

示例6: SplitTask

        public void SplitTask()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var split = new Task();
            var part1 = new Task();
            var part2 = new Task();
            manager.Add(split);

            // setup: confirm no split tasks
            Assert.IsTrue(!manager.IsSplit(split));
            Assert.IsTrue(!manager.IsPart(part1));
            Assert.IsTrue(!manager.IsPart(part2));

            // test: split the task
            manager.Split(split, part1, part2, 1);
            Assert.IsTrue(manager.IsSplit(split));
            Assert.IsTrue(manager.IsPart(part1));
            Assert.IsTrue(manager.IsPart(part2));
            Assert.IsTrue(manager.PartsOf(split).Count() == 2);
            Assert.IsTrue(manager.PartsOf(split).ElementAt(0).Equals(part1));
            Assert.IsTrue(manager.PartsOf(split).ElementAt(1).Equals(part2));
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:22,代码来源:ProjectTest.cs

示例7: JoinParts

        public void JoinParts()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var split = new Task();
            var part1 = new Task();
            var part2 = new Task();
            var part3 = new Task();
            manager.Add(split);

            // setup: create a split task with 3 parts
            manager.Split(split, part1, part2, 1);
            manager.Split(part2, part3, 1);
            Assert.IsTrue(manager.IsSplit(split));
            Assert.IsTrue(manager.IsPart(part1));
            Assert.IsTrue(manager.IsPart(part2));
            Assert.IsTrue(manager.IsPart(part3));
            Assert.IsTrue(manager.PartsOf(split).Count() == 3);
            Assert.IsTrue(manager.PartsOf(split).ElementAt(0) == part1);
            Assert.IsTrue(manager.PartsOf(split).ElementAt(1) == part2);
            Assert.IsTrue(manager.PartsOf(split).ElementAt(2) == part3);

            // test: join part 1 and part2
            manager.Join(part1, part2);
            Assert.IsTrue(manager.IsSplit(split));
            Assert.IsTrue(manager.IsPart(part1));
            Assert.IsTrue(!manager.IsPart(part2));
            Assert.IsTrue(manager.IsPart(part3));
            Assert.IsTrue(manager.PartsOf(split).Count() == 2);
            Assert.IsTrue(manager.PartsOf(split).ElementAt(0) == part1);
            Assert.IsTrue(manager.PartsOf(split).ElementAt(1) == part3);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:31,代码来源:ProjectTest.cs

示例8: DoNotRelatePartsOfTheSameSplitTask

        public void DoNotRelatePartsOfTheSameSplitTask()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var split = new Task();
            var part1a = new Task();
            var part1b = new Task();
            manager.Add(split);

            // setup: create a split task
            manager.Split(split, part1a, part1b, 1);
            Assert.IsTrue(manager.IsSplit(split));
            Assert.IsTrue(!manager.IsSplit(part1a));
            Assert.IsTrue(!manager.IsSplit(part1b));
            Assert.IsTrue(!manager.IsPart(split));
            Assert.IsTrue(manager.IsPart(part1a));
            Assert.IsTrue(manager.IsPart(part1b));
            Assert.IsTrue(!manager.HasRelations(split));
            Assert.IsTrue(!manager.HasRelations(part1a));
            Assert.IsTrue(!manager.HasRelations(part1b));

            // test: relate the two parts
            manager.Relate(part1a, part1b);
            Assert.IsTrue(manager.IsSplit(split));
            Assert.IsTrue(!manager.IsSplit(part1a));
            Assert.IsTrue(!manager.IsSplit(part1b));
            Assert.IsTrue(!manager.IsPart(split));
            Assert.IsTrue(manager.IsPart(part1a));
            Assert.IsTrue(manager.IsPart(part1b));
            Assert.IsTrue(!manager.HasRelations(split));
            Assert.IsTrue(!manager.HasRelations(part1a));
            Assert.IsTrue(!manager.HasRelations(part1b));
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:32,代码来源:ProjectTest.cs

示例9: UngroupPartBecomeUngroupSplitTask

        public void UngroupPartBecomeUngroupSplitTask()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var split = new Task() { Name = "split" };
            var part1 = new Task() { Name = "part1" };
            var part2 = new Task() { Name = "part2" };
            var group = new Task() { Name = "group" };
            var task = new Task() { Name = "task" };
            manager.Add(split);
            manager.Add(group);
            manager.Add(task);

            // setup: group split task into group
            manager.Split(split, part1, part2, 2);
            manager.Group(group, task);
            manager.Group(group, split);
            Assert.IsTrue(manager.IsSplit(split));
            Assert.IsTrue(manager.IsPart(part1));
            Assert.IsTrue(manager.IsPart(part2));
            Assert.IsTrue(manager.IsGroup(group));
            Assert.IsTrue(manager.IsMember(task));
            Assert.IsTrue(!manager.IsMember(part1));
            Assert.IsTrue(manager.IsMember(split));
            Assert.IsTrue(manager.ChildrenOf(group).Count() == 2);
            Assert.IsTrue(manager.ChildrenOf(group).Contains(task));
            Assert.IsTrue(manager.ChildrenOf(group).Contains(split));

            // test: ungroup part from group
            manager.Ungroup(group, part1);
            Assert.IsTrue(manager.IsSplit(split));
            Assert.IsTrue(manager.IsPart(part1));
            Assert.IsTrue(manager.IsPart(part2));
            Assert.IsTrue(manager.IsGroup(group));
            Assert.IsTrue(manager.IsMember(task));
            Assert.IsTrue(!manager.IsMember(part1));
            Assert.IsTrue(!manager.IsMember(split));
            Assert.IsTrue(manager.ChildrenOf(group).Count() == 1);
            Assert.IsTrue(manager.ChildrenOf(group).Contains(task));
            Assert.IsTrue(!manager.ChildrenOf(group).Contains(split));
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:40,代码来源:ProjectTest.cs

示例10: SplitTaskUsingSamePartsNoEffect

        public void SplitTaskUsingSamePartsNoEffect()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var split = new Task();
            var part = new Task();
            manager.Add(split);

            // setup: confirm no splits and parts
            Assert.IsTrue(!manager.IsPart(split));
            Assert.IsTrue(!manager.IsPart(part));
            Assert.IsTrue(!manager.IsSplit(split));
            Assert.IsTrue(!manager.IsPart(part));

            // test: split using part and part
            manager.Split(split, part, part, 1);
            Assert.IsTrue(!manager.IsPart(split));
            Assert.IsTrue(!manager.IsPart(part));
            Assert.IsTrue(!manager.IsSplit(split));
            Assert.IsTrue(!manager.IsPart(part));
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:20,代码来源:ProjectTest.cs

示例11: SplitNonExistingPart

        public void SplitNonExistingPart()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var part1 = new Task();
            var part2 = new Task();

            // setup: confirm no parts
            Assert.IsTrue(!manager.IsPart(part1));
            Assert.IsTrue(!manager.IsPart(part2));
            Assert.IsTrue(manager.Tasks.Count() == 0);

            // test: attempt to split part (no effect)
            manager.Split(part1, part2, 1);
            Assert.IsTrue(!manager.IsPart(part1));
            Assert.IsTrue(!manager.IsPart(part2));
            Assert.IsTrue(manager.Tasks.Count() == 0);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:17,代码来源:ProjectTest.cs

示例12: RelateUnrelatePartsBecomeRelateUnrelateSplitTasks

        public void RelateUnrelatePartsBecomeRelateUnrelateSplitTasks()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var split1 = new Task();
            var part1a = new Task();
            var part1b = new Task();

            var split2 = new Task();
            var part2a = new Task();
            var part2b = new Task();
            manager.Add(split1);
            manager.Add(split2);

            // setup: create 2 split tasks each of 2 parts
            manager.Split(split1, part1a, part1b, 1);
            manager.Split(split2, part2a, part2b, 1);
            Assert.IsTrue(!manager.HasRelations(split1));
            Assert.IsTrue(!manager.HasRelations(part1a));
            Assert.IsTrue(!manager.HasRelations(part1b));
            Assert.IsTrue(!manager.HasRelations(split2));
            Assert.IsTrue(!manager.HasRelations(part2a));
            Assert.IsTrue(!manager.HasRelations(part2b));

            // test: relate parts from different splits
            manager.Relate(part1a, part2a);
            Assert.IsTrue(manager.HasRelations(split1));
            Assert.IsTrue(!manager.HasRelations(part1a));
            Assert.IsTrue(!manager.HasRelations(part1b));
            Assert.IsTrue(manager.HasRelations(split2));
            Assert.IsTrue(!manager.HasRelations(part2a));
            Assert.IsTrue(!manager.HasRelations(part2b));

            // test: relate parts from different splits
            manager.Unrelate(part1b, part2b);
            Assert.IsTrue(!manager.HasRelations(split1));
            Assert.IsTrue(!manager.HasRelations(part1a));
            Assert.IsTrue(!manager.HasRelations(part1b));
            Assert.IsTrue(!manager.HasRelations(split2));
            Assert.IsTrue(!manager.HasRelations(part2a));
            Assert.IsTrue(!manager.HasRelations(part2b));

            // test: relate parts using different parts
            manager.Relate(part2b, part1b);
            Assert.IsTrue(manager.HasRelations(split1));
            Assert.IsTrue(!manager.HasRelations(part1a));
            Assert.IsTrue(!manager.HasRelations(part1b));
            Assert.IsTrue(manager.HasRelations(split2));
            Assert.IsTrue(!manager.HasRelations(part2a));
            Assert.IsTrue(!manager.HasRelations(part2b));

            // test: unrelate all
            manager.Unrelate(part2a);
            Assert.IsTrue(!manager.HasRelations(split1));
            Assert.IsTrue(!manager.HasRelations(part1a));
            Assert.IsTrue(!manager.HasRelations(part1b));
            Assert.IsTrue(!manager.HasRelations(split2));
            Assert.IsTrue(!manager.HasRelations(part2a));
            Assert.IsTrue(!manager.HasRelations(part2b));
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:59,代码来源:ProjectTest.cs

示例13: RelatedTaskCannotBecomeParts

        public void RelatedTaskCannotBecomeParts()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var split = new Task();
            var part1 = new Task();
            var part2 = new Task();
            manager.Add(split);
            manager.Add(part1);
            manager.Add(part2);

            // setup: relate part1 and part2
            manager.Relate(part1, part2);
            Assert.IsTrue(manager.HasRelations(part1));
            Assert.IsTrue(manager.HasRelations(part2));
            Assert.IsTrue(manager.DependantsOf(part1).Contains(part2));

            // test: split task using part1 and part2
            manager.Split(split, part1, part2, 1);
            Assert.IsTrue(manager.HasRelations(part1));
            Assert.IsTrue(manager.HasRelations(part2));
            Assert.IsTrue(manager.DependantsOf(part1).Contains(part2));
            Assert.IsTrue(!manager.IsSplit(split));
            Assert.IsTrue(!manager.IsPart(part1));
            Assert.IsTrue(!manager.IsPart(part2));
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:25,代码来源:ProjectTest.cs

示例14: MovePartBecomeMoveSplitTask

        public void MovePartBecomeMoveSplitTask()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var one = new Task();
            var two = new Task();
            var split = new Task();
            var part1 = new Task();
            var part2 = new Task();
            manager.Add(one);
            manager.Add(two);
            manager.Add(split);

            // setup: create split task
            manager.Split(split, part1, part2, 1);
            Assert.IsTrue(manager.IsSplit(split));
            Assert.IsTrue(manager.IsPart(part1));
            Assert.IsTrue(manager.IsPart(part2));
            Assert.IsTrue(manager.IndexOf(one) == 0);
            Assert.IsTrue(manager.IndexOf(two) == 1);
            Assert.IsTrue(manager.IndexOf(split) == 2);
            Assert.IsTrue(manager.IndexOf(part1) == -1);
            Assert.IsTrue(manager.IndexOf(part2) == -1);

            // test: move part and expect split task to move instead
            manager.Move(split, -1);
            Assert.IsTrue(manager.IndexOf(one) == 0);
            Assert.IsTrue(manager.IndexOf(split) == 1);
            Assert.IsTrue(manager.IndexOf(two) == 2);

            // test: move again
            manager.Move(split, -1);
            Assert.IsTrue(manager.IndexOf(split) == 0);
            Assert.IsTrue(manager.IndexOf(one) == 1);
            Assert.IsTrue(manager.IndexOf(two) == 2);

            // test: move again (no effect, reached the top)
            manager.Move(split, -1);
            Assert.IsTrue(manager.IndexOf(split) == 0);
            Assert.IsTrue(manager.IndexOf(one) == 1);
            Assert.IsTrue(manager.IndexOf(two) == 2);

            // test: move down
            manager.Move(split, 1);
            Assert.IsTrue(manager.IndexOf(one) == 0);
            Assert.IsTrue(manager.IndexOf(split) == 1);
            Assert.IsTrue(manager.IndexOf(two) == 2);

            // test: move out of bounds
            manager.Move(split, 2);
            Assert.IsTrue(manager.IndexOf(one) == 0);
            Assert.IsTrue(manager.IndexOf(two) == 1);
            Assert.IsTrue(manager.IndexOf(split) == 2);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:53,代码来源:ProjectTest.cs

示例15: MergeSplittedTask

        public void MergeSplittedTask()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var split = new Task();
            var part1 = new Task();
            var part2 = new Task();
            var part3 = new Task();
            var part4 = new Task();
            manager.Add(split);

            // setup: create a 4 part split task
            manager.Split(split, part1, part2, 1);
            manager.Split(part1, part3, 1);
            manager.Split(part3, part4, 1);
            Assert.IsTrue(manager.IsSplit(split));
            Assert.IsTrue(manager.IsPart(part1));
            Assert.IsTrue(manager.IsPart(part2));
            Assert.IsTrue(manager.IsPart(part3));
            Assert.IsTrue(manager.IsPart(part4));
            Assert.IsTrue(manager.PartsOf(split).Count() == 4);
            Assert.IsTrue(manager.PartsOf(split).ElementAt(0) == part1);
            Assert.IsTrue(manager.PartsOf(split).ElementAt(1) == part3);
            Assert.IsTrue(manager.PartsOf(split).ElementAt(2) == part4);
            Assert.IsTrue(manager.PartsOf(split).ElementAt(3) == part2);
            Assert.IsTrue(manager.Tasks.Count() == 1);

            // test: merge the split task
            manager.Merge(split);
            Assert.IsTrue(!manager.IsSplit(split));
            Assert.IsTrue(!manager.IsPart(part1));
            Assert.IsTrue(!manager.IsPart(part2));
            Assert.IsTrue(!manager.IsPart(part3));
            Assert.IsTrue(!manager.IsPart(part4));
            Assert.IsTrue(manager.Tasks.Count() == 1);
            Assert.IsTrue(split.Duration == 4);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:36,代码来源:ProjectTest.cs


注:本文中的ProjectManager.Split方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。