public void CreateRecurringTask()
        {
            try
            {
                // ExStart:CreateRecurringTask
                // ExFor: RecurringTaskParameters
                // ExFor: RecurringTaskParameters.#ctor
                // ExFor: RecurringTaskParameters.Duration
                // ExFor: RecurringTaskParameters.RecurrencePattern
                // ExFor: RecurringTaskParameters.IgnoreResourceCalendar
                // ExFor: RecurringTaskParameters.TaskName
                // ExFor: RecurringTaskParameters.SetCalendar(Project,String)
                // ExFor: WeeklyRecurrencePattern
                // ExFor: WeeklyRecurrencePattern.#ctor
                // ExFor: WeeklyRecurrencePattern.Repetition
                // ExFor: EndByRecurrenceRange
                // ExFor: EndByRecurrenceRange.#ctor
                // ExFor: EndByRecurrenceRange.Finish
                // ExFor: WeeklyRepetition
                // ExFor: WeeklyRepetition.#ctor
                // ExFor: WeeklyRepetition.WeekDays
                // ExFor: WeeklyRepetitionBase
                // ExFor: WeeklyRepetitionBase.#ctor
                // ExFor: WeeklyRepetitionBase.RepetitionInterval
                // ExFor: WeekdayType
                // ExFor: RecurrencePattern
                // ExSummary: Shows how to create a recurring task.
                var project    = new Project(DataDir + "Blank2010.mpp");
                var parameters = new RecurringTaskParameters
                {
                    TaskName          = "Recurring task",
                    Duration          = project.GetDuration(1, TimeUnitType.Day),
                    RecurrencePattern = new WeeklyRecurrencePattern
                    {
                        Repetition = new WeeklyRepetition
                        {
                            RepetitionInterval = 2,
                            WeekDays           = WeekdayType.Sunday | WeekdayType.Monday | WeekdayType.Friday
                        },
                        RecurrenceRange = new EndByRecurrenceRange
                        {
                            Start  = new DateTime(2018, 7, 1, 8, 0, 0),
                            Finish = new DateTime(2018, 7, 20, 17, 0, 0)
                        }
                    },
                    IgnoreResourceCalendar = false
                };

                parameters.SetCalendar(project, "Standard");

                project.RootTask.Children.Add(parameters);

                // ExEnd:CreateRecurringTask
            }
            catch (NotSupportedException ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx.");
            }
        }
        public void WorkWithDailyWorkRepetition()
        {
            // ExStart
            // ExFor: DailyWorkRepetition
            // ExFor: DailyWorkRepetition.#ctor
            // ExFor: DailyRepetitionBase
            // ExFor: DailyRepetitionBase.#ctor
            // ExFor: DailyRepetitionBase.RepetitionInterval
            // ExFor: DailyRecurrencePattern
            // ExFor: DailyRecurrencePattern.#ctor
            // ExFor: DailyRecurrencePattern.Repetition
            // ExFor: EndAfterRecurrenceRange
            // ExFor: EndAfterRecurrenceRange.#ctor
            // ExFor: EndAfterRecurrenceRange.OccurrenceNumber
            // ExFor: RecurrenceRangeBase
            // ExFor: RecurrenceRangeBase.#ctor
            // ExFor: RecurrenceRangeBase.Start
            // ExFor: RecurrencePatternBase
            // ExFor: RecurrencePatternBase.#ctor
            // ExFor: RecurrencePatternBase.RecurrenceRange
            // ExSummary: Shows how to work with daily work repetition pattern repetitions while create recurring tasks.
            var project    = new Project(DataDir + "Project1.mpp");
            var parameters = new RecurringTaskParameters
            {
                TaskName          = "New recurrent task",
                RecurrencePattern = new DailyRecurrencePattern
                {
                    RecurrenceRange = new EndAfterRecurrenceRange
                    {
                        Start = new DateTime(2018, 1, 1, 8, 0, 0), OccurrenceNumber = 9
                    },
                    Repetition = new DailyWorkRepetition {
                        RepetitionInterval = 1
                    }
                },
                Duration = project.GetDuration(1, TimeUnitType.Hour)
            };

            parameters.SetCalendar(project, "Standard");

            var task = project.RootTask.Children.Add(parameters);

            task.Set(Tsk.Start, new DateTime(2020, 4, 27, 8, 0, 0));

            // work with the project further...
            // ...
            // ExEnd
        }
Beispiel #3
0
        public void WorkWithDailyWorkRepetition()
        {
            try
            {
// ExStart
                // ExFor: DailyCalendarRepetition
                // ExFor: DailyCalendarRepetition.#ctor
                // ExSummary: Shows how to work with daily work repetition pattern repetitions and a '24 Hours' while create recurring tasks.
                var project  = new Project(DataDir + "Project1.mpp");
                var calendar = project.Calendars.Add("24 Hours");
                Calendar.Make24HourCalendar(calendar);
                var parameters = new RecurringTaskParameters
                {
                    TaskName          = "t1",
                    Duration          = project.GetDuration(1, TimeUnitType.Day),
                    RecurrencePattern = new DailyRecurrencePattern
                    {
                        Repetition = new DailyCalendarRepetition {
                            RepetitionInterval = 1
                        },
                        RecurrenceRange = new EndByRecurrenceRange
                        {
                            Start  = new DateTime(2018, 7, 2, 0, 0, 0),
                            Finish = new DateTime(2018, 7, 8, 16, 0, 0)
                        }
                    }
                };
                parameters.SetCalendar(project, "24 Hours");
                project.RootTask.Children.Add(parameters);

                // work with the project further...
                project.Save(OutDir + "CanAddRecurringTask_Days_CalendarDays_24h_Test_out.mpp", SaveFileFormat.MPP);

                // ExEnd
            }
            catch (NotSupportedException ex)
            {
                Console.WriteLine(
                    ex.Message
                    + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx.");
            }
        }