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


C# ProjectManager.SetEnd方法代码示例

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


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

示例1: AdjustGroupScheduleOnGroup

        public void AdjustGroupScheduleOnGroup()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var group = new Task();
            var one = new Task();
            manager.Add(group);
            manager.Add(one);

            // setup: set initial task parameters
            manager.SetStart(group, 6);
            manager.SetDuration(group, 5);
            manager.SetStart(one, 9);
            manager.SetEnd(one, 15);
            Assert.IsTrue(group.Start == 6);
            Assert.IsTrue(group.End == 11);
            Assert.IsTrue(one.Start == 9);
            Assert.IsTrue(one.Duration == 6);

            // test: make a group and group make have same parameters as one
            manager.Group(group, one);
            Assert.IsTrue(group.Start == one.Start);
            Assert.IsTrue(group.End == one.End);
            Assert.IsTrue(group.Duration == one.Duration);
            Assert.IsTrue(group.Complete == one.Complete);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:25,代码来源:TaskTest.cs

示例2: SetTaskParameters

        public void SetTaskParameters()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var one = new Task();
            manager.Add(one);

            // setup: set some initial values
            manager.SetStart(one, 22);
            manager.SetEnd(one, 24);
            manager.SetComplete(one, 0.3f);
            manager.SetCollapse(one, false);
            Assert.IsTrue(one.Start == 22);
            Assert.IsTrue(one.End == 24);
            Assert.IsTrue(one.Complete == 0.3f);
            Assert.IsTrue(one.IsCollapsed == false);
            Assert.IsTrue(one.Slack == 0);
            Assert.IsTrue(one.Duration == 2);

            // test: change the values and check again
            manager.SetStart(one, 34);
            manager.SetDuration(one, 56);
            manager.SetComplete(one, 0.9f);
            manager.SetCollapse(one, true); // should have no effect unless on group
            Assert.IsTrue(one.Start == 34);
            Assert.IsTrue(one.End == 90);
            Assert.IsTrue(one.Complete == 0.9f);
            Assert.IsTrue(one.IsCollapsed == false);
            Assert.IsTrue(one.Slack == 0);
            Assert.IsTrue(one.Duration == 56);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:30,代码来源:TaskTest.cs

示例3: AdjustGroupScheduleOnMemberScheduleChange

        public void AdjustGroupScheduleOnMemberScheduleChange()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var group = new Task() { Name = "group" };
            var one = new Task() { Name = "one" };
            var two = new Task() { Name = "two" };
            manager.Add(group);
            manager.Add(one);
            manager.Add(two);

            // setup: create a group with 2 members and some initial schedule
            manager.Group(group, one);
            manager.Group(group, two);
            manager.SetStart(one, 10);
            manager.SetDuration(one, 6);
            manager.SetStart(two, 12);
            manager.SetEnd(two, 20);
            Assert.IsTrue(one.Start == 10);
            Assert.IsTrue(one.End == 16);
            Assert.IsTrue(two.Start == 12);
            Assert.IsTrue(two.Duration == 8);
            Assert.IsTrue(group.Start == 10);
            Assert.IsTrue(group.End == 20);
            Assert.IsTrue(group.Duration == 10, string.Format("Expected {0} != {1}", 10, group.Duration));

            // test: change the member schedule and confirm if the group schedule updates approperiately
            manager.SetStart(one, 26);
            Assert.IsTrue(group.Start == 12);
            Assert.IsTrue(group.End == 32);

            // test: change the member schedule back
            manager.SetStart(one, 10);
            Assert.IsTrue(group.Start == 10);
            Assert.IsTrue(group.End == 20);
            Assert.IsTrue(group.Duration == 10);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:36,代码来源:TaskTest.cs

示例4: SetSplitTaskEndLastTaskMinimun1UnitTime

        public void SetSplitTaskEndLastTaskMinimun1UnitTime()
        {
            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
            manager.Split(split, part1, part2, 1);
            manager.Split(part2, part3, 1);
            manager.SetStart(part1, 0);
            manager.SetStart(part2, 15);
            manager.SetStart(part3, 30);
            manager.SetDuration(part1, 3);
            manager.SetDuration(part2, 4);
            manager.SetDuration(part3, 5);
            Assert.IsTrue(manager.IsSplit(split));
            Assert.IsTrue(manager.IsPart(part1));
            Assert.IsTrue(manager.IsPart(part2));
            Assert.IsTrue(manager.IsPart(part3));
            Assert.IsTrue(part1.Start == 0);
            Assert.IsTrue(part2.Start == 15);
            Assert.IsTrue(part3.Start == 30);
            Assert.IsTrue(part1.Duration == 3);
            Assert.IsTrue(part2.Duration == 4);
            Assert.IsTrue(part3.Duration == 5);
            Assert.IsTrue(part1.End == 3);
            Assert.IsTrue(part2.End == 19);
            Assert.IsTrue(part3.End == 35);

            // test: set the split task end - last part end to increase or decrease,
            // resulting no less than 1 unit duration
            manager.SetEnd(split, 1);
            Assert.IsTrue(manager.IsSplit(split));
            Assert.IsTrue(manager.IsPart(part1));
            Assert.IsTrue(manager.IsPart(part2));
            Assert.IsTrue(manager.IsPart(part3));
            Assert.IsTrue(part1.Start == 0);
            Assert.IsTrue(part2.Start == 15);
            Assert.IsTrue(part3.Start == 30);
            Assert.IsTrue(part1.Duration == 3);
            Assert.IsTrue(part2.Duration == 4);
            Assert.IsTrue(part3.Duration == 1);
            Assert.IsTrue(part1.End == 3);
            Assert.IsTrue(part2.End == 19);
            Assert.IsTrue(part3.End == 31);

            // test: increase split task end and last part adjust accordingly
            manager.SetEnd(split, 100);
            Assert.IsTrue(part3.End == 100);
            Assert.IsTrue(part3.Duration == 70);
            Assert.IsTrue(part3.Start == 30);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:55,代码来源:TaskTest.cs

示例5: MovePartLaterThanDependantStart

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

            // setup: create a dependant on the split task
            manager.SetDuration(split, 20);
            manager.SetDuration(dependant, 7);
            manager.Split(split, part1, part2, 15);
            manager.Relate(split, dependant);
            Assert.IsTrue(dependant.Start == 22);
            Assert.IsTrue(part2.End == 21);
            Assert.IsTrue(split.End == 21);

            // test: adjust part2 duration beyond dependant start
            manager.SetEnd(part2, 25);
            Assert.IsTrue(dependant.Start == 26);
            Assert.IsTrue(part2.End == 25);
            Assert.IsTrue(split.End == 25);

            // test: adjust part2 start such that end beyond dependant start
            manager.SetStart(part2, 30);
            Assert.IsTrue(dependant.Start == 40);
            Assert.IsTrue(part2.End == 39);
            Assert.IsTrue(split.End == 39);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:31,代码来源:TaskTest.cs

示例6: DurationCannotLessThanOne

        public void DurationCannotLessThanOne()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var one = new Task();
            manager.Add(one);

            // setup: set initial value
            manager.SetStart(one, 14);
            manager.SetEnd(one, 20);
            Assert.IsTrue(one.Duration == 6);

            // test: moving the end point
            manager.SetEnd(one, 10);
            Assert.IsTrue(one.Duration == 1);

            // test: moving the duration point
            manager.SetDuration(one, -5);
            Assert.IsTrue(one.Duration == 1);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:19,代码来源:TaskTest.cs

示例7: DependantRescheduledStartEarlierThanPrecedentEnd

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

            // setup: one before two
            manager.Relate(one, two);
            manager.SetStart(one, 5);
            manager.SetEnd(one, 10);
            manager.SetStart(two, 15);
            manager.SetDuration(two, 25);
            Assert.IsTrue(one.Start == 5);
            Assert.IsTrue(one.Duration == 5);
            Assert.IsTrue(two.Start == 15);
            Assert.IsTrue(two.End == 40);

            // test: reschedule two to start before end of one
            manager.SetStart(two, 8);
            Assert.IsTrue(one.Start == 5);
            Assert.IsTrue(one.Duration == 5);
            Assert.IsTrue(two.Start == 11);
            Assert.IsTrue(two.Duration == 25);
            Assert.IsTrue(two.End == 36);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:27,代码来源:TaskTest.cs

示例8: CriticalPath

        public void CriticalPath()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var one = new Task();
            var two = new Task();
            var three = new Task();
            var four = new Task();
            var five = new Task();
            var six = new Task();
            var seven = new Task();
            var eight = new Task();
            var nine = new Task();
            var group1 = new Task() { Name = "group1" };
            var group2 = new Task() { Name = "group2" };
            manager.Add(one);
            manager.Add(two);
            manager.Add(three);
            manager.Add(four);
            manager.Add(five);
            manager.Add(six);
            manager.Add(seven);
            manager.Add(eight);
            manager.Add(nine);
            manager.Add(group1);
            manager.Add(group2);

            // setup: create some schedules and grouping, and confirm we laid it out correctly
            manager.Relate(one, two);
            manager.Relate(one, three);
            manager.Relate(three, four);
            manager.Relate(five, six);
            manager.Relate(six, four);
            manager.Relate(six, seven);
            manager.Relate(six, eight);
            manager.Relate(eight, nine);
            manager.Group(group1, one);
            manager.Group(group1, two);
            manager.Group(group1, three);
            manager.Group(group1, four);
            manager.Group(group2, five);
            manager.Group(group2, six);
            manager.Group(group2, seven);
            manager.Group(group2, eight);
            manager.SetStart(one, 0); manager.SetEnd(one, 3);
            manager.SetStart(two, 4); manager.SetEnd(two, 7);
            manager.SetStart(three, 5); manager.SetEnd(three, 8);
            manager.SetStart(four, 10); manager.SetEnd(four, 15);
            manager.SetStart(five, 1); manager.SetEnd(five, 5);
            manager.SetStart(six, 6); manager.SetEnd(six, 9);
            manager.SetStart(seven, 12); manager.SetEnd(seven, 15);
            manager.SetStart(eight, 11); manager.SetEnd(eight, 16);
            manager.SetStart(nine, 17); manager.SetEnd(nine, 20);
            Assert.IsTrue(one.Start == 0 && one.Duration == 3, string.Format("Expected ({0}, {1}) != ({2}, {3})", 0, 3, one.Start, one.Duration));
            Assert.IsTrue(two.Start == 4 && two.Duration == 3);
            Assert.IsTrue(three.Start == 5 && three.Duration == 3);
            Assert.IsTrue(four.Start == 10 && four.Duration == 5);
            Assert.IsTrue(five.Start == 1 && five.Duration == 4);
            Assert.IsTrue(six.Start == 6 && six.Duration == 3);
            Assert.IsTrue(seven.Start == 12 && seven.Duration == 3);
            Assert.IsTrue(eight.Start == 11 && eight.Duration == 5);
            Assert.IsTrue(nine.Start == 17 && nine.Duration == 3, string.Format("Expected ({0}, {1}) != ({2}, {3})", 17, 3, nine.Start, nine.Duration));
            var iter_nine = manager.PrecedentsOf(nine).GetEnumerator(); // nine is critical in this setup
            iter_nine.MoveNext(); Assert.IsTrue(iter_nine.Current.Equals(eight));
            iter_nine.MoveNext(); Assert.IsTrue(iter_nine.Current.Equals(six));
            iter_nine.MoveNext(); Assert.IsTrue(iter_nine.Current.Equals(five));
            Assert.IsTrue(iter_nine.MoveNext() == false);

            // test: change the critical path and see if it gets updated correctly
            manager.SetStart(four, 17); // four now ends later than 9;
            var critical_paths = manager.CriticalPaths; // should have 2 paths: 4 to 1; and 4 to 5;
            Assert.IsTrue(critical_paths.Count() == 2, string.Format("Expected {0} != {1}", 2, critical_paths.Count()));
            var critical_tasks = critical_paths.SelectMany(x => x);
            Assert.IsTrue(critical_tasks.Distinct().Count() == 6, string.Format("Expected {0} != {1}", 5, critical_tasks.Distinct().Count())); // 4, 3, 1, 6, 5, group1
            Assert.IsTrue(critical_tasks.Contains(four));
            Assert.IsTrue(critical_tasks.Contains(three));
            Assert.IsTrue(critical_tasks.Contains(one));
            Assert.IsTrue(critical_tasks.Contains(six));
            Assert.IsTrue(critical_tasks.Contains(five));
            Assert.IsTrue(critical_tasks.Contains(group1));
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:80,代码来源:TaskTest.cs

示例9: CompleteMustBetweenZeroAndOne

        public void CompleteMustBetweenZeroAndOne()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var one = new Task();
            manager.Add(one);

            // setup: set initial value
            manager.SetStart(one, 14);
            manager.SetEnd(one, 20);
            manager.SetComplete(one, 0.5f);
            Assert.IsTrue(one.Duration == 6);
            Assert.IsTrue(one.Complete == 0.5f);

            // test: complete > 1 become 1
            manager.SetComplete(one, 25.4f);
            Assert.IsTrue(one.Complete == 1);

            // test: complete < 0 become 0
            manager.SetComplete(one, -33.8f);
            Assert.IsTrue(one.Complete == 0);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:21,代码来源:TaskTest.cs

示例10: TaskStartLessThanEnd

        public void TaskStartLessThanEnd()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var task = new Task();
            manager.Add(task);

            // test: ensure end and start must conserve precedence
            manager.SetStart(task, 10);
            manager.SetEnd(task, 5);
            Assert.IsTrue(task.Start < task.End);

            // test: ensure negative case holds
            manager.SetStart(task, -9);
            manager.SetEnd(task, -15);
            Assert.IsTrue(task.Start < task.End);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:16,代码来源:TaskTest.cs


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