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


C# ProjectManager.SetDuration方法代码示例

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


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

示例1: 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

示例2: AdjustDependantScheduleOnRelate

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

            // setup: make 2 independant tasks
            manager.SetStart(one, 10);
            manager.SetDuration(one, 6);
            manager.SetStart(two, 10);
            manager.SetDuration(two, 10);
            Assert.IsTrue(one.Start == 10);
            Assert.IsTrue(one.End == 16);
            Assert.IsTrue(two.Start == 10);
            Assert.IsTrue(two.End == 20);

            // test: relate one and two; one before two
            manager.Relate(one, two);
            Assert.IsTrue(one.Start == 10);
            Assert.IsTrue(one.End == 16);
            Assert.IsTrue(two.Start == 17);
            Assert.IsTrue(two.End == 27);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:25,代码来源:TaskTest.cs

示例3: 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

示例4: SetSplitSchedule

        public void SetSplitSchedule()
        {
            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 regular task of 30 duration
            manager.SetStart(split, 12);
            manager.SetDuration(split, 30);
            Assert.IsTrue(split.Start == 12);
            Assert.IsTrue(split.Duration == 30);
            Assert.IsTrue(split.End == 42);

            // test: split task and get the correct 10 unit duration back for each part
            manager.Split(split, part1, part2, 10);
            manager.Split(part2, part3, 10);
            Assert.IsTrue(part1.Duration == 10);
            Assert.IsTrue(part1.Start == 12);
            Assert.IsTrue(part1.End == 22);

            Assert.IsTrue(part2.Duration == 10);
            Assert.IsTrue(part2.Start == 23);
            Assert.IsTrue(part2.End == 33);

            Assert.IsTrue(part3.Duration == 10);
            Assert.IsTrue(part3.Start == 34);
            Assert.IsTrue(part3.End == 44);

            Assert.IsTrue(split.Start == 12);
            Assert.IsTrue(split.Duration == 32);
            Assert.IsTrue(split.End == 44);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:35,代码来源:TaskTest.cs

示例5: SetPartCompleteUpdatesSplitTaskAndGroup

        public void SetPartCompleteUpdatesSplitTaskAndGroup()
        {
            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 member = new Task() { Name = "member" };
            manager.Add(split);
            manager.Add(member);
            manager.Add(group);

            // setup: create split task under a group
            manager.SetDuration(split, 6);
            manager.SetDuration(member, 14);
            manager.Group(group, split);
            manager.Group(group, member);
            manager.Split(split, part1, part2, 2);
            Assert.IsTrue(manager.IsGroup(group));
            Assert.IsTrue(manager.IsMember(member));
            Assert.IsTrue(manager.IsMember(split));

            Assert.IsTrue(group.Complete == 0);
            Assert.IsTrue(split.Complete == 0);
            Assert.IsTrue(part1.Complete == 0);
            Assert.IsTrue(part2.Complete == 0);

            Assert.IsTrue(group.Duration == 14);
            Assert.IsTrue(member.Duration == 14);
            Assert.IsTrue(split.Duration == 7);
            Assert.IsTrue(part1.Duration == 2);
            Assert.IsTrue(part2.Duration == 4);

            // test: set complete for part1 and see group and split complete increase
            manager.SetComplete(part1, 0.3f);
            Assert.IsTrue(Math.Abs(split.Complete - (0.3f * 2) / 6.0f) < 0.01f);
            Assert.IsTrue(Math.Abs(group.Complete - (split.Complete * 7) / 20.0f) < 0.01f);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:38,代码来源:TaskTest.cs

示例6: CannotStartPartBeforeSplitTaskPrecedentStart

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

            // setup: create a split task with precendent
            manager.SetStart(precedent, 5);
            manager.SetDuration(precedent, 5);
            manager.SetStart(split, 15);
            manager.SetDuration(split, 5);
            manager.Relate(precedent, split);
            manager.Split(split, part1, part2, 2);
            Assert.IsTrue(manager.PrecedentsOf(split).Contains(precedent));
            Assert.IsTrue(manager.PartsOf(split).Contains(part1));
            Assert.IsTrue(manager.PartsOf(split).Contains(part2));
            Assert.IsTrue(precedent.End == 10);
            Assert.IsTrue(split.Start == 15);
            Assert.IsTrue(part1.Start == 15);

            // test: move part1 start before precendent start
            manager.SetStart(part1, 8);
            Assert.IsTrue(manager.PrecedentsOf(split).Contains(precedent));
            Assert.IsTrue(manager.PartsOf(split).Contains(part1));
            Assert.IsTrue(manager.PartsOf(split).Contains(part2));
            Assert.IsTrue(part1.Start == 11);
            Assert.IsTrue(split.Start == 11);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:32,代码来源:TaskTest.cs

示例7: JoinPartsConfirmPackedSchedule

        public void JoinPartsConfirmPackedSchedule()
        {
            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.SetDuration(split, 40);
            manager.Split(split, part1, part2, 5);
            manager.Split(part2, part3, 10);
            manager.Split(part3, part4, 20);
            Assert.IsTrue(part4.Duration == 5);
            Assert.IsTrue(part2.Duration == 10);
            Assert.IsTrue(manager.IsPart(part1));
            Assert.IsTrue(manager.IsPart(part2));
            Assert.IsTrue(manager.IsPart(part3));
            Assert.IsTrue(manager.IsPart(part4));
            Assert.IsTrue(manager.IsSplit(split));
            Assert.IsTrue(manager.PartsOf(split).Count() == 4);

            Assert.IsTrue(part1.Start == 0);
            Assert.IsTrue(part1.End == 5);
            Assert.IsTrue(part2.Start == 6);
            Assert.IsTrue(part2.End == 16);
            Assert.IsTrue(part3.Start == 17);
            Assert.IsTrue(part3.End == 37);
            Assert.IsTrue(part4.Start == 38);
            Assert.IsTrue(part4.End == 43);

            // test: join part 2 and 4
            manager.Join(part2, part4);
            Assert.IsTrue(part2.Duration == 15);
            Assert.IsTrue(manager.IsPart(part1));
            Assert.IsTrue(manager.IsPart(part2));
            Assert.IsTrue(manager.IsPart(part3));
            Assert.IsTrue(!manager.IsPart(part4));
            Assert.IsTrue(manager.IsSplit(split));
            Assert.IsTrue(manager.PartsOf(split).Count() == 3);

            Assert.IsTrue(part1.Start == 0);
            Assert.IsTrue(part1.End == 5);
            Assert.IsTrue(part2.Start == 6);
            Assert.IsTrue(part2.End == 21);
            Assert.IsTrue(part3.Start == 22);
            Assert.IsTrue(part3.End == 42);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:50,代码来源:ProjectTest.cs

示例8: ExampleFull

        /// <summary>
        /// Example starts here
        /// </summary>
        public ExampleFull()
        {
            InitializeComponent();

            // Create a Project and some Tasks
            _mManager = new ProjectManager();
            var work = new MyTask(_mManager) { Name = "Prepare for Work" };
            var wake = new MyTask(_mManager) { Name = "Wake Up" };
            var teeth = new MyTask(_mManager) { Name = "Brush Teeth" };
            var shower = new MyTask(_mManager) { Name = "Shower" };
            var clothes = new MyTask(_mManager) { Name = "Change into New Clothes" };
            var hair = new MyTask(_mManager) { Name = "Blow My Hair" };
            var pack = new MyTask(_mManager) { Name = "Pack the Suitcase" };

            _mManager.Add(work);
            _mManager.Add(wake);
            _mManager.Add(teeth);
            _mManager.Add(shower);
            _mManager.Add(clothes);
            _mManager.Add(hair);
            _mManager.Add(pack);

            // Create another 1000 tasks for stress testing
            Random rand = new Random();
            for (int i = 0; i < 1000; i++)
            {
                var task = new MyTask(_mManager) { Name = string.Format("New Task {0}", i.ToString()) };
                _mManager.Add(task);
                _mManager.SetStart(task, rand.Next(300));
                _mManager.SetDuration(task, rand.Next(50));
            }

            // Set task durations, e.g. using ProjectManager methods
            _mManager.SetDuration(wake, 3);
            _mManager.SetDuration(teeth, 5);
            _mManager.SetDuration(shower, 7);
            _mManager.SetDuration(clothes, 4);
            _mManager.SetDuration(hair, 3);
            _mManager.SetDuration(pack, 5);

            // demostrate splitting a task
            _mManager.Split(pack, new MyTask(_mManager), new MyTask(_mManager), 2);

            // Set task complete status, e.g. using newly created properties
            wake.Complete = 0.9f;
            teeth.Complete = 0.5f;
            shower.Complete = 0.4f;

            // Give the Tasks some organisation, setting group and precedents
            _mManager.Group(work, wake);
            _mManager.Group(work, teeth);
            _mManager.Group(work, shower);
            _mManager.Group(work, clothes);
            _mManager.Group(work, hair);
            _mManager.Group(work, pack);
            _mManager.Relate(wake, teeth);
            _mManager.Relate(wake, shower);
            _mManager.Relate(shower, clothes);
            _mManager.Relate(shower, hair);
            _mManager.Relate(hair, pack);
            _mManager.Relate(clothes, pack);

            // Create and assign Resources.
            // MyResource is just custom user class. The API can accept any object as resource.
            var jake = new MyResource() { Name = "Jake" };
            var peter = new MyResource() { Name = "Peter" };
            var john = new MyResource() { Name = "John" };
            var lucas = new MyResource() { Name = "Lucas" };
            var james = new MyResource() { Name = "James" };
            var mary = new MyResource() { Name = "Mary" };
            // Add some resources
            _mManager.Assign(wake, jake);
            _mManager.Assign(wake, peter);
            _mManager.Assign(wake, john);
            _mManager.Assign(teeth, jake);
            _mManager.Assign(teeth, james);
            _mManager.Assign(pack, james);
            _mManager.Assign(pack, lucas);
            _mManager.Assign(shower, mary);
            _mManager.Assign(shower, lucas);
            _mManager.Assign(shower, john);

            // Initialize the Chart with our ProjectManager and CreateTaskDelegate
            _mChart.Init(_mManager);
            _mChart.CreateTaskDelegate = delegate() { return new MyTask(_mManager); };

            // Attach event listeners for events we are interested in
            _mChart.TaskMouseOver += new EventHandler<TaskMouseEventArgs>(_mChart_TaskMouseOver);
            _mChart.TaskMouseOut += new EventHandler<TaskMouseEventArgs>(_mChart_TaskMouseOut);
            _mChart.TaskSelected += new EventHandler<TaskMouseEventArgs>(_mChart_TaskSelected);
            _mChart.PaintOverlay += _mOverlay.ChartOverlayPainter;
            _mChart.AllowTaskDragDrop = true;

            // set some tooltips to show the resources in each task
            _mChart.SetToolTip(wake, string.Join(", ", _mManager.ResourcesOf(wake).Select(x => (x as MyResource).Name)));
            _mChart.SetToolTip(teeth, string.Join(", ", _mManager.ResourcesOf(teeth).Select(x => (x as MyResource).Name)));
            _mChart.SetToolTip(pack, string.Join(", ", _mManager.ResourcesOf(pack).Select(x => (x as MyResource).Name)));
//.........这里部分代码省略.........
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:101,代码来源:ExampleFull.cs

示例9: SetSplitTaskStartMaintainPartsRelativeSchedule

        public void SetSplitTaskStartMaintainPartsRelativeSchedule()
        {
            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: move the split task itself - maintain interrupts
            var offset = 10 - split.Start;
            manager.SetStart(split, 10);
            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 + offset);
            Assert.IsTrue(part2.Start == 15 + offset);
            Assert.IsTrue(part3.Start == 30 + offset);
            Assert.IsTrue(part1.Duration == 3);
            Assert.IsTrue(part2.Duration == 4);
            Assert.IsTrue(part3.Duration == 5);
            Assert.IsTrue(part1.End == 3 + offset);
            Assert.IsTrue(part2.End == 19 + offset);
            Assert.IsTrue(part3.End == 35 + offset);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:49,代码来源:TaskTest.cs

示例10: MovePartLaterOverlap

        public void MovePartLaterOverlap()
        {
            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 3 part split
            manager.SetStart(split, 0);
            manager.SetDuration(split, 30);
            manager.Split(split, part1, part2, 10);
            manager.Split(part2, part3, 10);
            Assert.IsTrue(part1.Duration == 10);
            Assert.IsTrue(part1.Start == 0);
            Assert.IsTrue(part1.End == 10);

            Assert.IsTrue(part2.Duration == 10);
            Assert.IsTrue(part2.Start == 11);
            Assert.IsTrue(part2.End == 21);

            Assert.IsTrue(part3.Duration == 10);
            Assert.IsTrue(part3.Start == 22);
            Assert.IsTrue(part3.End == 32);

            Assert.IsTrue(split.Start == 0);
            Assert.IsTrue(split.Duration == 32);
            Assert.IsTrue(split.End == 32);

            // test: move part1 to overlap with part2, should pack parts to get earliest end date
            // with at least 1 time unit interrupt between each part
            manager.SetStart(part1, 12);
            Assert.IsTrue(part1.Duration == 10);
            Assert.IsTrue(part1.Start == 12);
            Assert.IsTrue(part1.End == 22);

            Assert.IsTrue(part2.Duration == 10);
            Assert.IsTrue(part2.Start == 23);
            Assert.IsTrue(part2.End == 33);

            Assert.IsTrue(part3.Duration == 10);
            Assert.IsTrue(part3.Start == 34);
            Assert.IsTrue(part3.End == 44);

            Assert.IsTrue(split.Start == 12);
            Assert.IsTrue(split.Duration == 32);
            Assert.IsTrue(split.End == 44);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:49,代码来源:TaskTest.cs

示例11: MovePartEarlierStart

        public void MovePartEarlierStart()
        {
            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 3 part split with extra interrupt in between
            manager.SetStart(split, 0);
            manager.SetDuration(split, 30);
            manager.Split(split, part1, part2, 10);
            manager.Split(part2, part3, 10);
            manager.SetStart(part2, 16);
            manager.SetStart(part3, 32);
            Assert.IsTrue(part1.Duration == 10);
            Assert.IsTrue(part1.Start == 0);
            Assert.IsTrue(part1.End == 10);

            Assert.IsTrue(part2.Duration == 10);
            Assert.IsTrue(part2.Start == 16);
            Assert.IsTrue(part2.End == 26);

            Assert.IsTrue(part3.Duration == 10);
            Assert.IsTrue(part3.Start == 32);
            Assert.IsTrue(part3.End == 42);

            Assert.IsTrue(split.Start == 0);
            Assert.IsTrue(split.Duration == 42);
            Assert.IsTrue(split.End == 42);

            // test: start part3 slight earlier
            manager.SetStart(part3, 28);
            Assert.IsTrue(part1.Duration == 10);
            Assert.IsTrue(part1.Start == 0);
            Assert.IsTrue(part1.End == 10);

            Assert.IsTrue(part2.Duration == 10);
            Assert.IsTrue(part2.Start == 16);
            Assert.IsTrue(part2.End == 26);

            Assert.IsTrue(part3.Duration == 10);
            Assert.IsTrue(part3.Start == 28);
            Assert.IsTrue(part3.End == 38);

            Assert.IsTrue(split.Start == 0);
            Assert.IsTrue(split.Duration == 38);
            Assert.IsTrue(split.End == 38);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:50,代码来源:TaskTest.cs

示例12: MovePartEarlierOverlap

        public void MovePartEarlierOverlap()
        {
            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 3 part split with extra interrupt in between
            manager.SetStart(split, 0);
            manager.SetDuration(split, 30);
            manager.Split(split, part1, part2, 10);
            manager.Split(part2, part3, 10);
            manager.SetStart(part2, 16);
            manager.SetStart(part3, 32);
            Assert.IsTrue(part1.Duration == 10);
            Assert.IsTrue(part1.Start == 0);
            Assert.IsTrue(part1.End == 10);

            Assert.IsTrue(part2.Duration == 10);
            Assert.IsTrue(part2.Start == 16);
            Assert.IsTrue(part2.End == 26);

            Assert.IsTrue(part3.Duration == 10);
            Assert.IsTrue(part3.Start == 32);
            Assert.IsTrue(part3.End == 42);

            Assert.IsTrue(split.Start == 0);
            Assert.IsTrue(split.Duration == 42);
            Assert.IsTrue(split.End == 42);

            // test: move part3 earlier, should pack parts to get earliest end date while start date remain
            manager.SetStart(part3, 26);
            Assert.IsTrue(part1.Duration == 10);
            Assert.IsTrue(part1.Start == 0);
            Assert.IsTrue(part1.End == 10);

            Assert.IsTrue(part2.Duration == 10);
            Assert.IsTrue(part2.Start == 15);
            Assert.IsTrue(part2.End == 25);

            Assert.IsTrue(part3.Duration == 10);
            Assert.IsTrue(part3.Start == 26);
            Assert.IsTrue(part3.End == 36);

            Assert.IsTrue(split.Start == 0);
            Assert.IsTrue(split.Duration == 36);
            Assert.IsTrue(split.End == 36);

            // test: move part3 even earlier, tight packing
            manager.SetStart(part3, 1);
            Assert.IsTrue(part1.Duration == 10);
            Assert.IsTrue(part1.Start == 0);
            Assert.IsTrue(part1.End == 10);

            Assert.IsTrue(part2.Duration == 10);
            Assert.IsTrue(part2.Start == 11);
            Assert.IsTrue(part2.End == 21);

            Assert.IsTrue(part3.Duration == 10);
            Assert.IsTrue(part3.Start == 22);
            Assert.IsTrue(part3.End == 32);

            Assert.IsTrue(split.Start == 0);
            Assert.IsTrue(split.Duration == 32);
            Assert.IsTrue(split.End == 32);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:68,代码来源:TaskTest.cs

示例13: 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

示例14: 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

示例15: 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


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