From 4fc48f2082559507765e88bd1dd92043c82902f3 Mon Sep 17 00:00:00 2001 From: David Hall Date: Tue, 6 Feb 2018 18:17:48 -0700 Subject: [PATCH] Added enums to triggers and cleaned up code. --- PInvoke/TaskSchd/MSTask.cs | 6 +- PInvoke/TaskSchd/TaskSchd.cs | 735 +++++++--------------------- UnitTests/PInvoke/TaskSchd/TaskSchdTests.cs | 26 + UnitTests/UnitTests.csproj | 1 + 4 files changed, 198 insertions(+), 570 deletions(-) create mode 100644 UnitTests/PInvoke/TaskSchd/TaskSchdTests.cs diff --git a/PInvoke/TaskSchd/MSTask.cs b/PInvoke/TaskSchd/MSTask.cs index 3869a91b..c8b81744 100644 --- a/PInvoke/TaskSchd/MSTask.cs +++ b/PInvoke/TaskSchd/MSTask.cs @@ -2,10 +2,12 @@ using System; using System.Diagnostics; using System.Runtime.InteropServices; using Vanara.InteropServices; +// ReSharper disable UnusedMember.Global +// ReSharper disable InconsistentNaming namespace Vanara.PInvoke { - public static partial class MSTask + public static class MSTask { /// Valid types of triggers public enum TASK_TRIGGER_TYPE @@ -856,7 +858,7 @@ namespace Vanara.PInvoke void Delete([In, MarshalAs(UnmanagedType.LPWStr)] string pwszName); /// The NewWorkItem method creates a new work item, allocating space for the work item and retrieving its address. - /// + /// /// A null-terminated string that specifies the name of the new work item. This name must conform to Windows NT file-naming conventions, but cannot /// include backslashes because nesting within the task folder object is not allowed. /// diff --git a/PInvoke/TaskSchd/TaskSchd.cs b/PInvoke/TaskSchd/TaskSchd.cs index 4f3fdc88..36ffea5e 100644 --- a/PInvoke/TaskSchd/TaskSchd.cs +++ b/PInvoke/TaskSchd/TaskSchd.cs @@ -3,12 +3,14 @@ using System.Collections; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Security; using Vanara.InteropServices; // ReSharper disable UnusedMember.Global +// ReSharper disable InconsistentNaming namespace Vanara.PInvoke { - public static partial class TaskSchd + public static class TaskSchd { /// Defines the type of actions that a task can perform. [PInvokeData("taskschd.h", MSDNShortId = "aa383553")] @@ -272,6 +274,27 @@ namespace Vanara.PInvoke TASK_STATE_RUNNING = 4 } + /// A bitwise mask that indicates the weeks of the month. + [PInvokeData("taskschd.h", MSDNShortId = "aa380733")] + [Flags] + public enum TaskWeeksOfMonth + { + /// The task will run between the first and seventh day of the month. + First = 1, + + /// The task will run between the eighth and 14th day of the month. + Second = 2, + + /// The task will run between the 15th and 21st day of the month. + Third = 4, + + /// The task will run between the 22nd and 28th of the month. + Fourth = 8, + + /// The task will run between the last seven days of the month. + Last = 16, + } + /// Defines the type of triggers that can be used by tasks. [PInvokeData("taskschd.h", MSDNShortId = "aa383915")] public enum TASK_TRIGGER_TYPE2 @@ -326,8 +349,7 @@ namespace Vanara.PInvoke } /// Provides the common properties inherited by all action objects. An action object is created by the IActionCollection::Create method. - [ComImport, Guid("BAE54997-48B1-4CBE-9965-D6BE263EBEA4"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("BAE54997-48B1-4CBE-9965-D6BE263EBEA4"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa446895")] public interface IAction { @@ -341,9 +363,8 @@ namespace Vanara.PInvoke } /// Contains the actions that are performed by the task. - /// - [ComImport, Guid("02820E19-7B98-4ED2-B2E8-FDCCCEFF619B"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + /// + [ComImport, Guid("02820E19-7B98-4ED2-B2E8-FDCCCEFF619B"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa446901")] public interface IActionCollection : IEnumerable { @@ -357,7 +378,7 @@ namespace Vanara.PInvoke IAction this[int index] { [return: MarshalAs(UnmanagedType.Interface)] get; } /// Returns an enumerator that iterates through a collection. - /// An object that can be used to iterate through the collection. + /// An object that can be used to iterate through the collection. [return: MarshalAs(UnmanagedType.Interface)] new IEnumerator GetEnumerator(); @@ -391,8 +412,7 @@ namespace Vanara.PInvoke /// Represents a trigger that starts a task when the system is started. /// - [ComImport, Guid("2A9C35DA-D357-41F4-BBC1-207AC1B1F3CB"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("2A9C35DA-D357-41F4-BBC1-207AC1B1F3CB"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa380607")] public interface IBootTrigger : ITrigger { @@ -411,13 +431,7 @@ namespace Vanara.PInvoke /// Gets or sets a value that indicates how often the task is run and how long the repetition pattern is repeated after the task is started. /// /// The repetition pattern for how often the task is run and how long the repetition pattern is repeated after the task is started. - new IRepetitionPattern Repetition - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + new IRepetitionPattern Repetition { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// Gets or sets the maximum amount of time that the task launched by this trigger is allowed to run. /// The maximum amount of time that the task launched by the trigger is allowed to run. @@ -426,13 +440,7 @@ namespace Vanara.PInvoke /// date/time separator, nH is the number of hours, nM is the number of minutes, and nS is the number of seconds (for example, PT5M specifies 5 /// minutes and P1M4DT2H5M specifies one month, four days, two hours, and five minutes). /// - new string ExecutionTimeLimit - { - [return: MarshalAs(UnmanagedType.BStr)] - get; - [param: In, MarshalAs(UnmanagedType.BStr)] - set; - } + new string ExecutionTimeLimit { [return: MarshalAs(UnmanagedType.BStr)] get; [param: In, MarshalAs(UnmanagedType.BStr)] set; } /// Gets or sets the date and time when the trigger is activated. /// The date and time when the trigger is activated. @@ -474,8 +482,7 @@ namespace Vanara.PInvoke /// Represents an action that fires a handler. /// - [ComImport, Guid("6D2FD252-75C5-4F66-90BA-2A7D8CC3039F"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("6D2FD252-75C5-4F66-90BA-2A7D8CC3039F"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa380613")] public interface IComHandlerAction : IAction { @@ -501,8 +508,7 @@ namespace Vanara.PInvoke /// third day, and so on. /// /// - [ComImport, InterfaceType(ComInterfaceType.InterfaceIsDual), Guid("126C5CD8-B288-41D5-8DBF-E491446ADC5C"), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsDual), Guid("126C5CD8-B288-41D5-8DBF-E491446ADC5C"), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa380656")] public interface IDailyTrigger : ITrigger { @@ -521,13 +527,7 @@ namespace Vanara.PInvoke /// Gets or sets a value that indicates how often the task is run and how long the repetition pattern is repeated after the task is started. /// /// The repetition pattern for how often the task is run and how long the repetition pattern is repeated after the task is started. - new IRepetitionPattern Repetition - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + new IRepetitionPattern Repetition { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// Gets or sets the maximum amount of time that the task launched by this trigger is allowed to run. /// The maximum amount of time that the task launched by the trigger is allowed to run. @@ -536,13 +536,7 @@ namespace Vanara.PInvoke /// date/time separator, nH is the number of hours, nM is the number of minutes, and nS is the number of seconds (for example, PT5M specifies 5 /// minutes and P1M4DT2H5M specifies one month, four days, two hours, and five minutes). /// - new string ExecutionTimeLimit - { - [return: MarshalAs(UnmanagedType.BStr)] - get; - [param: In, MarshalAs(UnmanagedType.BStr)] - set; - } + new string ExecutionTimeLimit { [return: MarshalAs(UnmanagedType.BStr)] get; [param: In, MarshalAs(UnmanagedType.BStr)] set; } /// Gets or sets the date and time when the trigger is activated. /// The date and time when the trigger is activated. @@ -595,8 +589,7 @@ namespace Vanara.PInvoke /// Send-MailMessage cmdlet as a workaround. /// /// - [ComImport, Guid("10F62C64-7E16-4314-A0C2-0C3683F99D40"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("10F62C64-7E16-4314-A0C2-0C3683F99D40"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa380693")] public interface IEmailAction : IAction { @@ -651,13 +644,7 @@ namespace Vanara.PInvoke /// Gets or sets the header information in the email message to send. /// The header information in the email message to send. - ITaskNamedValueCollection HeaderFields - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + ITaskNamedValueCollection HeaderFields { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// Gets or sets the body of the email that contains the email message. /// The body of the email that contains the email message. @@ -672,19 +659,12 @@ namespace Vanara.PInvoke /// Gets or sets the pointer to an array of attachments that is sent with the email message. /// An array of attachments that is sent with the email message. - object[] Attachments - { - [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] - get; - [param: In, MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] - set; - } + object[] Attachments { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] get; [param: In, MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] set; } } /// Represents a trigger that starts a task when a system event occurs. /// - [ComImport, Guid("D45B0167-9653-4EEF-B94F-0732CA7AF251"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("D45B0167-9653-4EEF-B94F-0732CA7AF251"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa380711")] public interface IEventTrigger : ITrigger { @@ -703,13 +683,7 @@ namespace Vanara.PInvoke /// Gets or sets a value that indicates how often the task is run and how long the repetition pattern is repeated after the task is started. /// /// The repetition pattern for how often the task is run and how long the repetition pattern is repeated after the task is started. - new IRepetitionPattern Repetition - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + new IRepetitionPattern Repetition { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// Gets or sets the maximum amount of time that the task launched by this trigger is allowed to run. /// The maximum amount of time that the task launched by the trigger is allowed to run. @@ -718,13 +692,7 @@ namespace Vanara.PInvoke /// date/time separator, nH is the number of hours, nM is the number of minutes, and nS is the number of seconds (for example, PT5M specifies 5 /// minutes and P1M4DT2H5M specifies one month, four days, two hours, and five minutes). /// - new string ExecutionTimeLimit - { - [return: MarshalAs(UnmanagedType.BStr)] - get; - [param: In, MarshalAs(UnmanagedType.BStr)] - set; - } + new string ExecutionTimeLimit { [return: MarshalAs(UnmanagedType.BStr)] get; [param: In, MarshalAs(UnmanagedType.BStr)] set; } /// Gets or sets the date and time when the trigger is activated. /// The date and time when the trigger is activated. @@ -787,8 +755,7 @@ namespace Vanara.PInvoke /// Represents an action that executes a command-line operation. /// - [ComImport, Guid("4C3D624D-FD6B-49A3-B9B7-09CB3CD3F047"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("4C3D624D-FD6B-49A3-B9B7-09CB3CD3F047"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa380715")] public interface IExecAction : IAction { @@ -815,20 +782,13 @@ namespace Vanara.PInvoke /// Gets or sets the directory that contains either the executable file or the files that are used by the executable file. /// The directory that contains either the executable file or the files that are used by the executable file. /// The path is checked to make sure it is valid when the task is registered, not when this property is set. - string WorkingDirectory - { - [return: MarshalAs(UnmanagedType.BStr)] - get; - [param: In, MarshalAs(UnmanagedType.BStr)] - set; - } + string WorkingDirectory { [return: MarshalAs(UnmanagedType.BStr)] get; [param: In, MarshalAs(UnmanagedType.BStr)] set; } } /// /// Specifies how the Task Scheduler performs tasks when the computer is in an idle condition. For information about idle conditions, see Task Idle Conditions. /// - [ComImport, Guid("84594461-0053-4342-A8FD-088FABF11F32"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("84594461-0053-4342-A8FD-088FABF11F32"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa380719")] public interface IIdleSettings { @@ -878,8 +838,7 @@ namespace Vanara.PInvoke /// Represents a trigger that starts a task when the computer goes into an idle state. For information about idle conditions, see Task Idle Conditions. /// /// - [ComImport, Guid("D537D2B0-9FB3-4D34-9739-1FF5CE7B1EF3"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("D537D2B0-9FB3-4D34-9739-1FF5CE7B1EF3"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa380724")] public interface IIdleTrigger : ITrigger { @@ -898,13 +857,7 @@ namespace Vanara.PInvoke /// Gets or sets a value that indicates how often the task is run and how long the repetition pattern is repeated after the task is started. /// /// The repetition pattern for how often the task is run and how long the repetition pattern is repeated after the task is started. - new IRepetitionPattern Repetition - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + new IRepetitionPattern Repetition { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// Gets or sets the maximum amount of time that the task launched by this trigger is allowed to run. /// The maximum amount of time that the task launched by the trigger is allowed to run. @@ -913,13 +866,7 @@ namespace Vanara.PInvoke /// date/time separator, nH is the number of hours, nM is the number of minutes, and nS is the number of seconds (for example, PT5M specifies 5 /// minutes and P1M4DT2H5M specifies one month, four days, two hours, and five minutes). /// - new string ExecutionTimeLimit - { - [return: MarshalAs(UnmanagedType.BStr)] - get; - [param: In, MarshalAs(UnmanagedType.BStr)] - set; - } + new string ExecutionTimeLimit { [return: MarshalAs(UnmanagedType.BStr)] get; [param: In, MarshalAs(UnmanagedType.BStr)] set; } /// Gets or sets the date and time when the trigger is activated. /// The date and time when the trigger is activated. @@ -955,8 +902,7 @@ namespace Vanara.PInvoke /// registered with logon triggers that match the logged on user are run. /// /// - [ComImport, Guid("72DADE38-FAE4-4B3E-BAF4-5D009AF02B1C"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("72DADE38-FAE4-4B3E-BAF4-5D009AF02B1C"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa380725")] public interface ILogonTrigger : ITrigger { @@ -975,13 +921,7 @@ namespace Vanara.PInvoke /// Gets or sets a value that indicates how often the task is run and how long the repetition pattern is repeated after the task is started. /// /// The repetition pattern for how often the task is run and how long the repetition pattern is repeated after the task is started. - new IRepetitionPattern Repetition - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + new IRepetitionPattern Repetition { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// Gets or sets the maximum amount of time that the task launched by this trigger is allowed to run. /// The maximum amount of time that the task launched by the trigger is allowed to run. @@ -990,13 +930,7 @@ namespace Vanara.PInvoke /// date/time separator, nH is the number of hours, nM is the number of minutes, and nS is the number of seconds (for example, PT5M specifies 5 /// minutes and P1M4DT2H5M specifies one month, four days, two hours, and five minutes). /// - new string ExecutionTimeLimit - { - [return: MarshalAs(UnmanagedType.BStr)] - get; - [param: In, MarshalAs(UnmanagedType.BStr)] - set; - } + new string ExecutionTimeLimit { [return: MarshalAs(UnmanagedType.BStr)] get; [param: In, MarshalAs(UnmanagedType.BStr)] set; } /// Gets or sets the date and time when the trigger is activated. /// The date and time when the trigger is activated. @@ -1055,8 +989,7 @@ namespace Vanara.PInvoke } /// Provides the settings that the Task Scheduler uses to perform task during Automatic maintenance. - [ComImport, Guid("A6024FA8-9652-4ADB-A6BF-5CFCD877A7BA"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("A6024FA8-9652-4ADB-A6BF-5CFCD877A7BA"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "hh832144")] public interface IMaintenanceSettings { @@ -1113,8 +1046,7 @@ namespace Vanara.PInvoke /// Represents a trigger that starts a task on a monthly day-of-week schedule. For example, the task starts on every first Thursday, May through October. /// /// - [ComImport, Guid("77D025A3-90FA-43AA-B52E-CDA5499B946A"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("77D025A3-90FA-43AA-B52E-CDA5499B946A"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa380728")] public interface IMonthlyDOWTrigger : ITrigger { @@ -1133,13 +1065,7 @@ namespace Vanara.PInvoke /// Gets or sets a value that indicates how often the task is run and how long the repetition pattern is repeated after the task is started. /// /// The repetition pattern for how often the task is run and how long the repetition pattern is repeated after the task is started. - new IRepetitionPattern Repetition - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + new IRepetitionPattern Repetition { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// Gets or sets the maximum amount of time that the task launched by this trigger is allowed to run. /// The maximum amount of time that the task launched by the trigger is allowed to run. @@ -1148,13 +1074,7 @@ namespace Vanara.PInvoke /// date/time separator, nH is the number of hours, nM is the number of minutes, and nS is the number of seconds (for example, PT5M specifies 5 /// minutes and P1M4DT2H5M specifies one month, four days, two hours, and five minutes). /// - new string ExecutionTimeLimit - { - [return: MarshalAs(UnmanagedType.BStr)] - get; - [param: In, MarshalAs(UnmanagedType.BStr)] - set; - } + new string ExecutionTimeLimit { [return: MarshalAs(UnmanagedType.BStr)] get; [param: In, MarshalAs(UnmanagedType.BStr)] set; } /// Gets or sets the date and time when the trigger is activated. /// The date and time when the trigger is activated. @@ -1186,15 +1106,15 @@ namespace Vanara.PInvoke /// Gets or sets the days of the week during which the task runs. /// A bitwise mask that indicates the days of the week during which the task runs. - short DaysOfWeek { get; [param: In] set; } + MSTask.TaskDaysOfTheWeek DaysOfWeek { get; [param: In] set; } /// Gets or sets the weeks of the month during which the task runs. /// A bitwise mask that indicates the weeks of the month during which the task runs. - short WeeksOfMonth { get; [param: In] set; } + TaskWeeksOfMonth WeeksOfMonth { get; [param: In] set; } /// Gets or sets the months of the year during which the task runs. /// A bitwise mask that indicates the months of the year during which the task runs. - short MonthsOfYear { get; [param: In] set; } + MSTask.TaskMonths MonthsOfYear { get; [param: In] set; } /// Gets or sets a Boolean value that indicates that the task runs on the last week of the month. /// True indicates that the task runs on the last week of the month; otherwise, False. @@ -1216,8 +1136,7 @@ namespace Vanara.PInvoke /// Represents a trigger that starts a job based on a monthly schedule. For example, the task starts on specific days of specific months. /// - [ComImport, Guid("97C45EF1-6B02-4A1A-9C0E-1EBFBA1500AC"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("97C45EF1-6B02-4A1A-9C0E-1EBFBA1500AC"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa380734")] public interface IMonthlyTrigger : ITrigger { @@ -1236,13 +1155,7 @@ namespace Vanara.PInvoke /// Gets or sets a value that indicates how often the task is run and how long the repetition pattern is repeated after the task is started. /// /// The repetition pattern for how often the task is run and how long the repetition pattern is repeated after the task is started. - new IRepetitionPattern Repetition - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + new IRepetitionPattern Repetition { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// Gets or sets the maximum amount of time that the task launched by this trigger is allowed to run. /// The maximum amount of time that the task launched by the trigger is allowed to run. @@ -1251,13 +1164,7 @@ namespace Vanara.PInvoke /// date/time separator, nH is the number of hours, nM is the number of minutes, and nS is the number of seconds (for example, PT5M specifies 5 /// minutes and P1M4DT2H5M specifies one month, four days, two hours, and five minutes). /// - new string ExecutionTimeLimit - { - [return: MarshalAs(UnmanagedType.BStr)] - get; - [param: In, MarshalAs(UnmanagedType.BStr)] - set; - } + new string ExecutionTimeLimit { [return: MarshalAs(UnmanagedType.BStr)] get; [param: In, MarshalAs(UnmanagedType.BStr)] set; } /// Gets or sets the date and time when the trigger is activated. /// The date and time when the trigger is activated. @@ -1293,7 +1200,7 @@ namespace Vanara.PInvoke /// Gets or sets the months of the year during which the task runs. /// A bitwise mask that indicates the months of the year during which the task runs. - short MonthsOfYear { get; [param: In] set; } + MSTask.TaskMonths MonthsOfYear { get; [param: In] set; } /// Gets or sets a Boolean value that indicates that the task runs on the last day of the month. /// True indicates that the task runs on the last day of the month, regardless of the actual date of that day; otherwise, False. @@ -1314,8 +1221,7 @@ namespace Vanara.PInvoke } /// Provides the settings that the Task Scheduler service uses to obtain a network profile. - [ComImport, Guid("9F7DEA84-C30B-4245-80B6-00E9F646F1B4"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("9F7DEA84-C30B-4245-80B6-00E9F646F1B4"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa380739")] public interface INetworkSettings { @@ -1331,8 +1237,7 @@ namespace Vanara.PInvoke /// /// Provides the security credentials for a principal. These security credentials define the security context for the tasks that are associated with the principal. /// - [ComImport, Guid("D98D51E5-C9B4-496A-A9C1-18980261CF0F"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("D98D51E5-C9B4-496A-A9C1-18980261CF0F"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa380742")] public interface IPrincipal { @@ -1374,8 +1279,7 @@ namespace Vanara.PInvoke /// Provides the extended settings applied to security credentials for a principal. These security credentials define the security context for the tasks /// that are associated with the principal. /// - [ComImport, Guid("248919AE-E345-4A6D-8AEB-E0D3165C904E"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("248919AE-E345-4A6D-8AEB-E0D3165C904E"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "ee695858")] public interface IPrincipal2 { @@ -1404,8 +1308,7 @@ namespace Vanara.PInvoke /// Provides the methods that are used to run the task immediately, get any running instances of the task, get or set the credentials that are used to /// register the task, and the properties that describe the task. /// - [ComImport, Guid("9C86F320-DEE3-4DD1-B972-A303F26B061E"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity, DefaultMember("Path")] + [ComImport, Guid("9C86F320-DEE3-4DD1-B972-A303F26B061E"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity, DefaultMember("Path")] [PInvokeData("taskschd.h", MSDNShortId = "aa380751")] public interface IRegisteredTask { @@ -1556,9 +1459,8 @@ namespace Vanara.PInvoke } /// Contains all the tasks that are registered. - /// - [ComImport, Guid("86627EB4-42A7-41E4-A4D9-AC33A72F2D52"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + /// + [ComImport, Guid("86627EB4-42A7-41E4-A4D9-AC33A72F2D52"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa380752")] public interface IRegisteredTaskCollection : IEnumerable { @@ -1572,7 +1474,7 @@ namespace Vanara.PInvoke IRegisteredTask this[object index] { [return: MarshalAs(UnmanagedType.Interface)] get; } /// Returns an enumerator that iterates through a collection. - /// An object that can be used to iterate through the collection. + /// An object that can be used to iterate through the collection. [return: MarshalAs(UnmanagedType.Interface)] new IEnumerator GetEnumerator(); } @@ -1581,8 +1483,7 @@ namespace Vanara.PInvoke /// Provides the administrative information that can be used to describe the task. This information includes details such as a description of the task, /// the author of the task, the date the task is registered, and the security descriptor of the task. /// - [ComImport, Guid("416D8B73-CB41-4EA1-805C-9BE9A5AC4A74"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("416D8B73-CB41-4EA1-805C-9BE9A5AC4A74"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa380773")] public interface IRegistrationInfo { @@ -1623,13 +1524,7 @@ namespace Vanara.PInvoke /// If a different security descriptor is supplied when a task is registered, then it will supersede the sddl parameter that is set through this property. /// If you try to pass an invalid security descriptor into the sddl parameter, then this method will return E_INVALIDARG. /// - object SecurityDescriptor - { - [return: MarshalAs(UnmanagedType.Struct)] - get; - [param: In, MarshalAs(UnmanagedType.Struct)] - set; - } + object SecurityDescriptor { [return: MarshalAs(UnmanagedType.Struct)] get; [param: In, MarshalAs(UnmanagedType.Struct)] set; } /// Gets or sets where the task originated from. For example, a task may originate from a component, service, application, or user. /// Where the task originated from. For example, from a component, service, application, or user. @@ -1639,8 +1534,7 @@ namespace Vanara.PInvoke /// Represents a trigger that starts a task when the task is registered or updated. /// - [ComImport, Guid("4C8FEC3A-C218-4E0C-B23D-629024DB91A2"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("4C8FEC3A-C218-4E0C-B23D-629024DB91A2"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa381104")] public interface IRegistrationTrigger : ITrigger { @@ -1659,13 +1553,7 @@ namespace Vanara.PInvoke /// Gets or sets a value that indicates how often the task is run and how long the repetition pattern is repeated after the task is started. /// /// The repetition pattern for how often the task is run and how long the repetition pattern is repeated after the task is started. - new IRepetitionPattern Repetition - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + new IRepetitionPattern Repetition { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// Gets or sets the maximum amount of time that the task launched by this trigger is allowed to run. /// The maximum amount of time that the task launched by the trigger is allowed to run. @@ -1674,13 +1562,7 @@ namespace Vanara.PInvoke /// date/time separator, nH is the number of hours, nM is the number of minutes, and nS is the number of seconds (for example, PT5M specifies 5 /// minutes and P1M4DT2H5M specifies one month, four days, two hours, and five minutes). /// - new string ExecutionTimeLimit - { - [return: MarshalAs(UnmanagedType.BStr)] - get; - [param: In, MarshalAs(UnmanagedType.BStr)] - set; - } + new string ExecutionTimeLimit { [return: MarshalAs(UnmanagedType.BStr)] get; [param: In, MarshalAs(UnmanagedType.BStr)] set; } /// Gets or sets the date and time when the trigger is activated. /// The date and time when the trigger is activated. @@ -1721,8 +1603,7 @@ namespace Vanara.PInvoke } /// Defines how often the task is run and how long the repetition pattern is repeated after the task is started. - [ComImport, Guid("7FB9ACF1-26BE-400E-85B5-294B9C75DFD6"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("7FB9ACF1-26BE-400E-85B5-294B9C75DFD6"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa381128")] public interface IRepetitionPattern { @@ -1752,8 +1633,7 @@ namespace Vanara.PInvoke } /// Provides the methods to get information from and control a running task. - [ComImport, Guid("653758FB-7B9A-4F1E-A471-BEEB8E9B834E"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity, DefaultMember("InstanceGuid")] + [ComImport, Guid("653758FB-7B9A-4F1E-A471-BEEB8E9B834E"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity, DefaultMember("InstanceGuid")] [PInvokeData("taskschd.h", MSDNShortId = "aa381157")] public interface IRunningTask { @@ -1789,9 +1669,8 @@ namespace Vanara.PInvoke } /// Provides a collection that is used to control running tasks. - /// - [ComImport, Guid("6A67614B-6828-4FEC-AA54-6D52E8F1F2DB"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + /// + [ComImport, Guid("6A67614B-6828-4FEC-AA54-6D52E8F1F2DB"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa381166")] public interface IRunningTaskCollection : IEnumerable { @@ -1805,15 +1684,14 @@ namespace Vanara.PInvoke IRunningTask this[object index] { [return: MarshalAs(UnmanagedType.Interface)] get; } /// Returns an enumerator that iterates through a collection. - /// An object that can be used to iterate through the collection. + /// An object that can be used to iterate through the collection. [return: MarshalAs(UnmanagedType.Interface)] new IEnumerator GetEnumerator(); } /// Triggers tasks for console connect or disconnect, remote connect or disconnect, or workstation lock or unlock notifications. /// - [ComImport, InterfaceType(ComInterfaceType.InterfaceIsDual), Guid("754DA71B-4385-4475-9DD9-598294FA3641"), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsDual), Guid("754DA71B-4385-4475-9DD9-598294FA3641"), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa381292")] public interface ISessionStateChangeTrigger : ITrigger { @@ -1832,13 +1710,7 @@ namespace Vanara.PInvoke /// Gets or sets a value that indicates how often the task is run and how long the repetition pattern is repeated after the task is started. /// /// The repetition pattern for how often the task is run and how long the repetition pattern is repeated after the task is started. - new IRepetitionPattern Repetition - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + new IRepetitionPattern Repetition { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// Gets or sets the maximum amount of time that the task launched by this trigger is allowed to run. /// The maximum amount of time that the task launched by the trigger is allowed to run. @@ -1847,13 +1719,7 @@ namespace Vanara.PInvoke /// date/time separator, nH is the number of hours, nM is the number of minutes, and nS is the number of seconds (for example, PT5M specifies 5 /// minutes and P1M4DT2H5M specifies one month, four days, two hours, and five minutes). /// - new string ExecutionTimeLimit - { - [return: MarshalAs(UnmanagedType.BStr)] - get; - [param: In, MarshalAs(UnmanagedType.BStr)] - set; - } + new string ExecutionTimeLimit { [return: MarshalAs(UnmanagedType.BStr)] get; [param: In, MarshalAs(UnmanagedType.BStr)] set; } /// Gets or sets the date and time when the trigger is activated. /// The date and time when the trigger is activated. @@ -1906,8 +1772,7 @@ namespace Vanara.PInvoke /// Windows scripting MsgBox function to show a message in the user session. /// /// - [ComImport, Guid("505E9E68-AF89-46B8-A30F-56162A83D537"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("505E9E68-AF89-46B8-A30F-56162A83D537"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa381302")] public interface IShowMessageAction : IAction { @@ -1951,8 +1816,7 @@ namespace Vanara.PInvoke } /// Defines all the components of a task, such as the task settings, triggers, actions, and registration information. - [ComImport, Guid("F5BC8FC5-536D-4F77-B852-FBC1356FDEB6"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("F5BC8FC5-536D-4F77-B852-FBC1356FDEB6"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa381313")] public interface ITaskDefinition { @@ -1964,33 +1828,15 @@ namespace Vanara.PInvoke /// The registration information that is used to describe a task, such as the description of the task, the author of the task, and the date the task /// is registered. /// - IRegistrationInfo RegistrationInfo - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + IRegistrationInfo RegistrationInfo { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// Gets or sets a collection of triggers that are used to start a task. /// The collection of triggers that are used to start a task. - ITriggerCollection Triggers - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + ITriggerCollection Triggers { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// Gets or sets the settings that define how the Task Scheduler service performs the task. /// The settings that define how the Task Scheduler service performs the task. - ITaskSettings Settings - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + ITaskSettings Settings { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// /// Gets or sets the data that is associated with the task. This data is ignored by the Task Scheduler service, but is used by third-parties who wish @@ -2001,23 +1847,11 @@ namespace Vanara.PInvoke /// Gets or sets the principal for the task that provides the security credentials for the task. /// The principal for the task that provides the security credentials for the task. - IPrincipal Principal - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + IPrincipal Principal { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// Gets or sets a collection of actions performed by the task. /// A collection of actions performed by the task. - IActionCollection Actions - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + IActionCollection Actions { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// Gets or sets the XML text. /// The XML text. @@ -2027,8 +1861,7 @@ namespace Vanara.PInvoke /// /// Provides the methods that are used to register (create) tasks in the folder, remove tasks from the folder, and create or remove subfolders from the folder. /// - [ComImport, Guid("8CFAC062-A080-4C15-9A88-AA7C2AF80DFC"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity, DefaultMember("Path")] + [ComImport, Guid("8CFAC062-A080-4C15-9A88-AA7C2AF80DFC"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity, DefaultMember("Path")] [PInvokeData("taskschd.h", MSDNShortId = "aa381330")] public interface ITaskFolder { @@ -2190,9 +2023,8 @@ namespace Vanara.PInvoke } /// Provides information and control for a collection of folders that contain tasks. - /// - [ComImport, Guid("79184A66-8664-423F-97F1-637356A5D812"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + /// + [ComImport, Guid("79184A66-8664-423F-97F1-637356A5D812"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa381332")] public interface ITaskFolderCollection : IEnumerable { @@ -2209,7 +2041,7 @@ namespace Vanara.PInvoke ITaskFolder this[object index] { [return: MarshalAs(UnmanagedType.Interface)] get; } /// Returns an enumerator that iterates through a collection. - /// An object that can be used to iterate through the collection. + /// An object that can be used to iterate through the collection. [return: MarshalAs(UnmanagedType.Interface)] new IEnumerator GetEnumerator(); } @@ -2220,7 +2052,7 @@ namespace Vanara.PInvoke /// /// This interface must be implemented for a task to perform a COM handler action. When the Task Scheduler performs a COM handler action, it creates and activates the handler and calls the methods of this interface as needed. For information on specifying a COM handler action, see the class. /// - [ComImport, Guid("839D7762-5121-4009-9234-4F0D19394F04"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("839D7762-5121-4009-9234-4F0D19394F04"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa381370")] public interface ITaskHandler { @@ -2253,7 +2085,7 @@ namespace Vanara.PInvoke /// /// Provides the methods that are used by COM handlers to notify the Task Scheduler about the status of the handler. /// - [ComImport, Guid("EAEC7A8F-27A0-4DDC-8675-14726A01A38A"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("EAEC7A8F-27A0-4DDC-8675-14726A01A38A"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa381373")] public interface ITaskHandlerStatus { @@ -2272,9 +2104,8 @@ namespace Vanara.PInvoke } /// Contains a collection of ITaskNamedValuePair interface name-value pairs. - /// - [ComImport, Guid("B4EF826B-63C3-46E4-A504-EF69E4F7EA4D"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + /// + [ComImport, Guid("B4EF826B-63C3-46E4-A504-EF69E4F7EA4D"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa381392")] public interface ITaskNamedValueCollection : IEnumerable { @@ -2288,7 +2119,7 @@ namespace Vanara.PInvoke ITaskNamedValuePair this[int index] { [return: MarshalAs(UnmanagedType.Interface)] get; } /// Returns an enumerator that iterates through a collection. - /// An object that can be used to iterate through the collection. + /// An object that can be used to iterate through the collection. [return: MarshalAs(UnmanagedType.Interface)] new IEnumerator GetEnumerator(); @@ -2309,8 +2140,7 @@ namespace Vanara.PInvoke } /// Creates a name-value pair in which the name is associated with the value. - [ComImport, Guid("39038068-2B46-4AFD-8662-7BB6F868D221"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity, DefaultMember("Name")] + [ComImport, Guid("39038068-2B46-4AFD-8662-7BB6F868D221"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity, DefaultMember("Name")] [PInvokeData("taskschd.h", MSDNShortId = "aa381804")] public interface ITaskNamedValuePair { @@ -2324,8 +2154,7 @@ namespace Vanara.PInvoke } /// Provides access to the Task Scheduler service for managing registered tasks. - [ComImport, DefaultMember("TargetServer"), Guid("2FABA4C7-4DA9-4013-9697-20CC3FD40F85"), - System.Security.SuppressUnmanagedCodeSecurity, CoClass(typeof(TaskSchedulerClass))] + [ComImport, DefaultMember("TargetServer"), Guid("2FABA4C7-4DA9-4013-9697-20CC3FD40F85"), SuppressUnmanagedCodeSecurity, CoClass(typeof(TaskSchedulerClass))] [PInvokeData("taskschd.h", MSDNShortId = "aa381832")] public interface ITaskService { @@ -2438,8 +2267,7 @@ namespace Vanara.PInvoke } /// Provides the settings that the Task Scheduler service uses to perform the task. - [ComImport, Guid("8FD4711D-2D02-4C8C-87E3-EFF699DE127E"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("8FD4711D-2D02-4C8C-87E3-EFF699DE127E"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa381843")] public interface ITaskSettings { @@ -2456,13 +2284,7 @@ namespace Vanara.PInvoke /// be set. The format for this string is P<days>DT<hours>H<minutes>M<seconds>S (for example, "PT5M" is 5 minutes, "PT1H" is /// 1 hour, and "PT20M" is 20 minutes). The maximum time allowed is 31 days, and the minimum time allowed is 1 minute. /// - string RestartInterval - { - [return: MarshalAs(UnmanagedType.BStr)] - get; - [param: In, MarshalAs(UnmanagedType.BStr)] - set; - } + string RestartInterval { [return: MarshalAs(UnmanagedType.BStr)] get; [param: In, MarshalAs(UnmanagedType.BStr)] set; } /// Gets or sets the number of times that the Task Scheduler will attempt to restart the task. /// @@ -2525,13 +2347,7 @@ namespace Vanara.PInvoke /// change this by changing this setting. /// /// The amount of time that is allowed to complete the task. When this parameter is set to NULL, the execution time limit is infinite. - string ExecutionTimeLimit - { - [return: MarshalAs(UnmanagedType.BStr)] - get; - [param: In, MarshalAs(UnmanagedType.BStr)] - set; - } + string ExecutionTimeLimit { [return: MarshalAs(UnmanagedType.BStr)] get; [param: In, MarshalAs(UnmanagedType.BStr)] set; } /// Gets or sets a Boolean value that indicates that the task is enabled. The task can be performed only when this setting is True. /// If True, the task is enabled. If False, the task is not enabled. @@ -2551,13 +2367,7 @@ namespace Vanara.PInvoke /// A task expires after the end boundary has been exceeded for all triggers associated with the task. The end boundary for a trigger is specified by /// the EndBoundary property inherited by all trigger interfaces. /// - string DeleteExpiredTaskAfter - { - [return: MarshalAs(UnmanagedType.BStr)] - get; - [param: In, MarshalAs(UnmanagedType.BStr)] - set; - } + string DeleteExpiredTaskAfter { [return: MarshalAs(UnmanagedType.BStr)] get; [param: In, MarshalAs(UnmanagedType.BStr)] set; } /// Gets or sets the priority level of the task. /// The priority level (0-10) of the task. The default is 7. @@ -2571,66 +2381,18 @@ namespace Vanara.PInvoke /// Priority Level values. /// /// - /// - /// Task priority - /// Priority Class - /// Priority Level - /// - /// - /// 0 - /// REALTIME_PRIORITY_CLASS - /// THREAD_PRIORITY_TIME_CRITICAL - /// - /// - /// 1 - /// HIGH_PRIORITY_CLASS - /// THREAD_PRIORITY_HIGHEST - /// - /// - /// 2 - /// ABOVE_NORMAL_PRIORITY_CLASS - /// THREAD_PRIORITY_ABOVE_NORMAL - /// - /// - /// 3 - /// ABOVE_NORMAL_PRIORITY_CLASS - /// THREAD_PRIORITY_ABOVE_NORMAL - /// - /// - /// 4 - /// NORMAL_PRIORITY_CLASS - /// THREAD_PRIORITY_NORMAL - /// - /// - /// 5 - /// NORMAL_PRIORITY_CLASS - /// THREAD_PRIORITY_NORMAL - /// - /// - /// 6 - /// NORMAL_PRIORITY_CLASS - /// THREAD_PRIORITY_NORMAL - /// - /// - /// 7 - /// BELOW_NORMAL_PRIORITY_CLASS - /// THREAD_PRIORITY_BELOW_NORMAL - /// - /// - /// 8 - /// BELOW_NORMAL_PRIORITY_CLASS - /// THREAD_PRIORITY_BELOW_NORMAL - /// - /// - /// 9 - /// IDLE_PRIORITY_CLASS - /// THREAD_PRIORITY_LOWEST - /// - /// - /// 10 - /// IDLE_PRIORITY_CLASS - /// THREAD_PRIORITY_IDLE - /// + /// Task priorityPriority ClassPriority Level + /// 0REALTIME_PRIORITY_CLASSTHREAD_PRIORITY_TIME_CRITICAL + /// 1HIGH_PRIORITY_CLASSTHREAD_PRIORITY_HIGHEST + /// 2ABOVE_NORMAL_PRIORITY_CLASSTHREAD_PRIORITY_ABOVE_NORMAL + /// 3ABOVE_NORMAL_PRIORITY_CLASSTHREAD_PRIORITY_ABOVE_NORMAL + /// 4NORMAL_PRIORITY_CLASSTHREAD_PRIORITY_NORMAL + /// 5NORMAL_PRIORITY_CLASSTHREAD_PRIORITY_NORMAL + /// 6NORMAL_PRIORITY_CLASSTHREAD_PRIORITY_NORMAL + /// 7BELOW_NORMAL_PRIORITY_CLASSTHREAD_PRIORITY_BELOW_NORMAL + /// 8BELOW_NORMAL_PRIORITY_CLASSTHREAD_PRIORITY_BELOW_NORMAL + /// 9IDLE_PRIORITY_CLASSTHREAD_PRIORITY_LOWEST + /// 10IDLE_PRIORITY_CLASSTHREAD_PRIORITY_IDLE /// /// int Priority { get; [param: In] set; } @@ -2654,28 +2416,16 @@ namespace Vanara.PInvoke /// /// When battery saver is on, Windows Task Scheduler tasks are triggered only if the task is: /// - /// - /// Not set to Start the task only if the computer is idle... (task doesn't use IdleSettings) - /// - /// - /// Not set to run during automatic maintenance (task doesn't use MaintenanceSettings) - /// - /// - /// Is set to Run only when user is logged on (task LogonType is TASK_LOGON_INTERACTIVE_TOKEN or TASK_LOGON_GROUP) - /// + /// Not set to Start the task only if the computer is idle... (task doesn't use IdleSettings) + /// Not set to run during automatic maintenance (task doesn't use MaintenanceSettings) + /// Is set to Run only when user is logged on (task LogonType is TASK_LOGON_INTERACTIVE_TOKEN or TASK_LOGON_GROUP) /// /// /// All other triggers are delayed until battery saver is off. For more information about accessing battery saver status in your application, see /// SYSTEM_POWER_STATUS. For general information about battery saver, see battery saver (in the hardware component guidelines). /// /// - IIdleSettings IdleSettings - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + IIdleSettings IdleSettings { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// Gets or sets a Boolean value that indicates that the Task Scheduler will run the task only if the computer is in an idle condition. /// @@ -2707,18 +2457,11 @@ namespace Vanara.PInvoke /// profile is available. /// /// A pointer to an INetworkSettings object that contains a network profile identifier and name. - INetworkSettings NetworkSettings - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + INetworkSettings NetworkSettings { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } } /// Provides the extended settings that the Task Scheduler uses to run the task. - [ComImport, Guid("2C05C3F0-6EED-4c05-A15F-ED7D7A98A369"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("2C05C3F0-6EED-4c05-A15F-ED7D7A98A369"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "ee695863")] public interface ITaskSettings2 { @@ -2736,8 +2479,7 @@ namespace Vanara.PInvoke /// Provides the extended settings that the Task Scheduler uses to run the task. /// - [ComImport, Guid("0AD9D0D7-0C7F-4EBB-9A5F-D1C648DCA528"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("0AD9D0D7-0C7F-4EBB-9A5F-D1C648DCA528"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "hh832148")] public interface ITaskSettings3 : ITaskSettings { @@ -2754,13 +2496,7 @@ namespace Vanara.PInvoke /// be set. The format for this string is P<days>DT<hours>H<minutes>M<seconds>S (for example, "PT5M" is 5 minutes, "PT1H" is /// 1 hour, and "PT20M" is 20 minutes). The maximum time allowed is 31 days, and the minimum time allowed is 1 minute. /// - new string RestartInterval - { - [return: MarshalAs(UnmanagedType.BStr)] - get; - [param: In, MarshalAs(UnmanagedType.BStr)] - set; - } + new string RestartInterval { [return: MarshalAs(UnmanagedType.BStr)] get; [param: In, MarshalAs(UnmanagedType.BStr)] set; } /// Gets or sets the number of times that the Task Scheduler will attempt to restart the task. /// @@ -2823,13 +2559,7 @@ namespace Vanara.PInvoke /// change this by changing this setting. /// /// The amount of time that is allowed to complete the task. When this parameter is set to NULL, the execution time limit is infinite. - new string ExecutionTimeLimit - { - [return: MarshalAs(UnmanagedType.BStr)] - get; - [param: In, MarshalAs(UnmanagedType.BStr)] - set; - } + new string ExecutionTimeLimit { [return: MarshalAs(UnmanagedType.BStr)] get; [param: In, MarshalAs(UnmanagedType.BStr)] set; } /// Gets or sets a Boolean value that indicates that the task is enabled. The task can be performed only when this setting is True. /// If True, the task is enabled. If False, the task is not enabled. @@ -2849,13 +2579,7 @@ namespace Vanara.PInvoke /// A task expires after the end boundary has been exceeded for all triggers associated with the task. The end boundary for a trigger is specified by /// the EndBoundary property inherited by all trigger interfaces. /// - new string DeleteExpiredTaskAfter - { - [return: MarshalAs(UnmanagedType.BStr)] - get; - [param: In, MarshalAs(UnmanagedType.BStr)] - set; - } + new string DeleteExpiredTaskAfter { [return: MarshalAs(UnmanagedType.BStr)] get; [param: In, MarshalAs(UnmanagedType.BStr)] set; } /// Gets or sets the priority level of the task. /// The priority level (0-10) of the task. The default is 7. @@ -2869,66 +2593,18 @@ namespace Vanara.PInvoke /// Priority Level values. /// /// - /// - /// Task priority - /// Priority Class - /// Priority Level - /// - /// - /// 0 - /// REALTIME_PRIORITY_CLASS - /// THREAD_PRIORITY_TIME_CRITICAL - /// - /// - /// 1 - /// HIGH_PRIORITY_CLASS - /// THREAD_PRIORITY_HIGHEST - /// - /// - /// 2 - /// ABOVE_NORMAL_PRIORITY_CLASS - /// THREAD_PRIORITY_ABOVE_NORMAL - /// - /// - /// 3 - /// ABOVE_NORMAL_PRIORITY_CLASS - /// THREAD_PRIORITY_ABOVE_NORMAL - /// - /// - /// 4 - /// NORMAL_PRIORITY_CLASS - /// THREAD_PRIORITY_NORMAL - /// - /// - /// 5 - /// NORMAL_PRIORITY_CLASS - /// THREAD_PRIORITY_NORMAL - /// - /// - /// 6 - /// NORMAL_PRIORITY_CLASS - /// THREAD_PRIORITY_NORMAL - /// - /// - /// 7 - /// BELOW_NORMAL_PRIORITY_CLASS - /// THREAD_PRIORITY_BELOW_NORMAL - /// - /// - /// 8 - /// BELOW_NORMAL_PRIORITY_CLASS - /// THREAD_PRIORITY_BELOW_NORMAL - /// - /// - /// 9 - /// IDLE_PRIORITY_CLASS - /// THREAD_PRIORITY_LOWEST - /// - /// - /// 10 - /// IDLE_PRIORITY_CLASS - /// THREAD_PRIORITY_IDLE - /// + /// Task priorityPriority ClassPriority Level + /// 0REALTIME_PRIORITY_CLASSTHREAD_PRIORITY_TIME_CRITICAL + /// 1HIGH_PRIORITY_CLASSTHREAD_PRIORITY_HIGHEST + /// 2ABOVE_NORMAL_PRIORITY_CLASSTHREAD_PRIORITY_ABOVE_NORMAL + /// 3ABOVE_NORMAL_PRIORITY_CLASSTHREAD_PRIORITY_ABOVE_NORMAL + /// 4NORMAL_PRIORITY_CLASSTHREAD_PRIORITY_NORMAL + /// 5NORMAL_PRIORITY_CLASSTHREAD_PRIORITY_NORMAL + /// 6NORMAL_PRIORITY_CLASSTHREAD_PRIORITY_NORMAL + /// 7BELOW_NORMAL_PRIORITY_CLASSTHREAD_PRIORITY_BELOW_NORMAL + /// 8BELOW_NORMAL_PRIORITY_CLASSTHREAD_PRIORITY_BELOW_NORMAL + /// 9IDLE_PRIORITY_CLASSTHREAD_PRIORITY_LOWEST + /// 10IDLE_PRIORITY_CLASSTHREAD_PRIORITY_IDLE /// /// new int Priority { get; [param: In] set; } @@ -2952,28 +2628,16 @@ namespace Vanara.PInvoke /// /// When battery saver is on, Windows Task Scheduler tasks are triggered only if the task is: /// - /// - /// Not set to Start the task only if the computer is idle... (task doesn't use IdleSettings) - /// - /// - /// Not set to run during automatic maintenance (task doesn't use MaintenanceSettings) - /// - /// - /// Is set to Run only when user is logged on (task LogonType is TASK_LOGON_INTERACTIVE_TOKEN or TASK_LOGON_GROUP) - /// + /// Not set to Start the task only if the computer is idle... (task doesn't use IdleSettings) + /// Not set to run during automatic maintenance (task doesn't use MaintenanceSettings) + /// Is set to Run only when user is logged on (task LogonType is TASK_LOGON_INTERACTIVE_TOKEN or TASK_LOGON_GROUP) /// /// /// All other triggers are delayed until battery saver is off. For more information about accessing battery saver status in your application, see /// SYSTEM_POWER_STATUS. For general information about battery saver, see battery saver (in the hardware component guidelines). /// /// - new IIdleSettings IdleSettings - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + new IIdleSettings IdleSettings { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// Gets or sets a Boolean value that indicates that the Task Scheduler will run the task only if the computer is in an idle condition. /// @@ -3001,17 +2665,11 @@ namespace Vanara.PInvoke /// /// Gets or sets the network settings object that contains a network profile identifier and name. If the RunOnlyIfNetworkAvailable property of - /// ITaskSettings is true and a network propfile is specified in the NetworkSettings property, then the task will run only if the specified network + /// ITaskSettings is true and a network profile is specified in the NetworkSettings property, then the task will run only if the specified network /// profile is available. /// /// A pointer to an INetworkSettings object that contains a network profile identifier and name. - new INetworkSettings NetworkSettings - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + new INetworkSettings NetworkSettings { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// /// Gets or sets a Boolean value that specifies that the task will not be started if triggered to run in a Remote Applications Integrated Locally @@ -3029,48 +2687,30 @@ namespace Vanara.PInvoke /// /// When battery saver is on, Windows Task Scheduler tasks are triggered only if the task is: /// - /// - /// Not set to Start the task only if the computer is idle... (task doesn't use IdleSettings) - /// - /// - /// Not set to run during automatic maintenance (task doesn't use MaintenanceSettings) - /// - /// - /// Is set to Run only when user is logged on (task LogonType is TASK_LOGON_INTERACTIVE_TOKEN or TASK_LOGON_GROUP) - /// + /// Not set to Start the task only if the computer is idle... (task doesn't use IdleSettings) + /// Not set to run during automatic maintenance (task doesn't use MaintenanceSettings) + /// Is set to Run only when user is logged on (task LogonType is TASK_LOGON_INTERACTIVE_TOKEN or TASK_LOGON_GROUP) + /// /// /// All other triggers are delayed until battery saver is off. For more information about accessing battery saver status in your application, see /// SYSTEM_POWER_STATUS. For general information about battery saver, see battery saver (in the hardware component guidelines). /// - /// /// - IMaintenanceSettings MaintenanceSettings - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + IMaintenanceSettings MaintenanceSettings { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// Creates a new instance an IMaintenanceSettings object and associates it with this ITaskSettings3 object. /// A pointer to a pointer to the IMaintenanceSettings object this method creates. /// /// When battery saver is on, Windows Task Scheduler tasks are triggered only if the task is: /// - /// - /// Not set to Start the task only if the computer is idle... (task doesn't use IdleSettings) - /// - /// - /// Not set to run during automatic maintenance (task doesn't use MaintenanceSettings) - /// - /// - /// Is set to Run only when user is logged on (task LogonType is TASK_LOGON_INTERACTIVE_TOKEN or TASK_LOGON_GROUP) - /// + /// Not set to Start the task only if the computer is idle... (task doesn't use IdleSettings) + /// Not set to run during automatic maintenance (task doesn't use MaintenanceSettings) + /// Is set to Run only when user is logged on (task LogonType is TASK_LOGON_INTERACTIVE_TOKEN or TASK_LOGON_GROUP) + /// /// /// All other triggers are delayed until battery saver is off. For more information about accessing battery saver status in your application, see /// SYSTEM_POWER_STATUS. For general information about battery saver, see battery saver (in the hardware component guidelines). /// - /// /// [return: MarshalAs(UnmanagedType.Interface)] IMaintenanceSettings CreateMaintenanceSettings(); @@ -3084,8 +2724,7 @@ namespace Vanara.PInvoke /// Defines task variables that can be passed as parameters to task handlers and external executables that are launched by tasks. Task handlers that need /// to input and output data to job variables should do a query interface on the services pointer for ITaskVariables. /// - [ComImport, Guid("3E4C9351-D966-4B8B-BB87-CEBA68BB0107"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("3E4C9351-D966-4B8B-BB87-CEBA68BB0107"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa381868")] public interface ITaskVariables { @@ -3109,8 +2748,7 @@ namespace Vanara.PInvoke /// Represents a trigger that starts a task at a specific date and time. /// - [ComImport, Guid("B45747E0-EBA7-4276-9F29-85C5BB300006"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("B45747E0-EBA7-4276-9F29-85C5BB300006"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa381885")] public interface ITimeTrigger : ITrigger { @@ -3129,13 +2767,7 @@ namespace Vanara.PInvoke /// Gets or sets a value that indicates how often the task is run and how long the repetition pattern is repeated after the task is started. /// /// The repetition pattern for how often the task is run and how long the repetition pattern is repeated after the task is started. - new IRepetitionPattern Repetition - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + new IRepetitionPattern Repetition { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// Gets or sets the maximum amount of time that the task launched by this trigger is allowed to run. /// The maximum amount of time that the task launched by the trigger is allowed to run. @@ -3144,13 +2776,7 @@ namespace Vanara.PInvoke /// date/time separator, nH is the number of hours, nM is the number of minutes, and nS is the number of seconds (for example, PT5M specifies 5 /// minutes and P1M4DT2H5M specifies one month, four days, two hours, and five minutes). /// - new string ExecutionTimeLimit - { - [return: MarshalAs(UnmanagedType.BStr)] - get; - [param: In, MarshalAs(UnmanagedType.BStr)] - set; - } + new string ExecutionTimeLimit { [return: MarshalAs(UnmanagedType.BStr)] get; [param: In, MarshalAs(UnmanagedType.BStr)] set; } /// Gets or sets the date and time when the trigger is activated. /// The date and time when the trigger is activated. @@ -3195,8 +2821,7 @@ namespace Vanara.PInvoke } /// Provides the common properties that are inherited by all trigger objects. - [ComImport, Guid("09941815-EA89-4B5B-89E0-2A773801FAC3"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("09941815-EA89-4B5B-89E0-2A773801FAC3"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa381887")] public interface ITrigger { @@ -3215,13 +2840,7 @@ namespace Vanara.PInvoke /// Gets or sets a value that indicates how often the task is run and how long the repetition pattern is repeated after the task is started. /// /// The repetition pattern for how often the task is run and how long the repetition pattern is repeated after the task is started. - IRepetitionPattern Repetition - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + IRepetitionPattern Repetition { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// Gets or sets the maximum amount of time that the task launched by this trigger is allowed to run. /// The maximum amount of time that the task launched by the trigger is allowed to run. @@ -3230,13 +2849,7 @@ namespace Vanara.PInvoke /// date/time separator, nH is the number of hours, nM is the number of minutes, and nS is the number of seconds (for example, PT5M specifies 5 /// minutes and P1M4DT2H5M specifies one month, four days, two hours, and five minutes). /// - string ExecutionTimeLimit - { - [return: MarshalAs(UnmanagedType.BStr)] - get; - [param: In, MarshalAs(UnmanagedType.BStr)] - set; - } + string ExecutionTimeLimit { [return: MarshalAs(UnmanagedType.BStr)] get; [param: In, MarshalAs(UnmanagedType.BStr)] set; } /// Gets or sets the date and time when the trigger is activated. /// The date and time when the trigger is activated. @@ -3268,9 +2881,8 @@ namespace Vanara.PInvoke } /// Provides the methods that are used to add to, remove from, and get the triggers of a task. - /// - [ComImport, Guid("85DF5081-1B24-4F32-878A-D9D14DF4CB77"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + /// + [ComImport, Guid("85DF5081-1B24-4F32-878A-D9D14DF4CB77"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa381889")] public interface ITriggerCollection : IEnumerable { @@ -3284,7 +2896,7 @@ namespace Vanara.PInvoke ITrigger this[int index] { [return: MarshalAs(UnmanagedType.Interface)] get; } /// Returns an enumerator that iterates through a collection. - /// An object that can be used to iterate through the collection. + /// An object that can be used to iterate through the collection. [return: MarshalAs(UnmanagedType.Interface)] new IEnumerator GetEnumerator(); @@ -3310,8 +2922,7 @@ namespace Vanara.PInvoke /// week or every other week. /// /// - [ComImport, Guid("5038FC98-82FF-436D-8728-A512A57C9DC1"), InterfaceType(ComInterfaceType.InterfaceIsDual), - System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, Guid("5038FC98-82FF-436D-8728-A512A57C9DC1"), InterfaceType(ComInterfaceType.InterfaceIsDual), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa381904")] public interface IWeeklyTrigger : ITrigger { @@ -3330,13 +2941,7 @@ namespace Vanara.PInvoke /// Gets or sets a value that indicates how often the task is run and how long the repetition pattern is repeated after the task is started. /// /// The repetition pattern for how often the task is run and how long the repetition pattern is repeated after the task is started. - new IRepetitionPattern Repetition - { - [return: MarshalAs(UnmanagedType.Interface)] - get; - [param: In, MarshalAs(UnmanagedType.Interface)] - set; - } + new IRepetitionPattern Repetition { [return: MarshalAs(UnmanagedType.Interface)] get; [param: In, MarshalAs(UnmanagedType.Interface)] set; } /// Gets or sets the maximum amount of time that the task launched by this trigger is allowed to run. /// The maximum amount of time that the task launched by the trigger is allowed to run. @@ -3345,13 +2950,7 @@ namespace Vanara.PInvoke /// date/time separator, nH is the number of hours, nM is the number of minutes, and nS is the number of seconds (for example, PT5M specifies 5 /// minutes and P1M4DT2H5M specifies one month, four days, two hours, and five minutes). /// - new string ExecutionTimeLimit - { - [return: MarshalAs(UnmanagedType.BStr)] - get; - [param: In, MarshalAs(UnmanagedType.BStr)] - set; - } + new string ExecutionTimeLimit { [return: MarshalAs(UnmanagedType.BStr)] get; [param: In, MarshalAs(UnmanagedType.BStr)] set; } /// Gets or sets the date and time when the trigger is activated. /// The date and time when the trigger is activated. @@ -3383,7 +2982,7 @@ namespace Vanara.PInvoke /// Gets or sets the days of the week in which the task runs. /// A bitwise mask that indicates the days of the week on which the task runs. - short DaysOfWeek { get; [param: In] set; } + MSTask.TaskDaysOfTheWeek DaysOfWeek { get; [param: In] set; } /// Gets or sets the interval between the weeks in the schedule. /// @@ -3406,7 +3005,7 @@ namespace Vanara.PInvoke } /// Provides access to the Task Scheduler service for managing registered tasks. - [ComImport, DefaultMember("TargetServer"), Guid("0F87369F-A4E5-4CFC-BD3E-73E6154572DD"), ClassInterface((short)0), System.Security.SuppressUnmanagedCodeSecurity] + [ComImport, DefaultMember("TargetServer"), Guid("0F87369F-A4E5-4CFC-BD3E-73E6154572DD"), ClassInterface((short)0), SuppressUnmanagedCodeSecurity] [PInvokeData("taskschd.h", MSDNShortId = "aa381832")] public class TaskSchedulerClass { diff --git a/UnitTests/PInvoke/TaskSchd/TaskSchdTests.cs b/UnitTests/PInvoke/TaskSchd/TaskSchdTests.cs new file mode 100644 index 00000000..0a0b0483 --- /dev/null +++ b/UnitTests/PInvoke/TaskSchd/TaskSchdTests.cs @@ -0,0 +1,26 @@ +using NUnit.Framework; +using System; +using System.Runtime.InteropServices; +using static Vanara.PInvoke.TaskSchd; + +namespace Vanara.PInvoke.Tests +{ + [TestFixture] + public class TaskSchdTests + { + [Test] + public void SettingsTest() + { + var ts = new ITaskService(); + var t = ts.NewTask(0); + var settings = t.Settings; + //settings.DeleteExpiredTaskAfter = TimeSpan.FromDays(1); + //Assert.That(settings.DeleteExpiredTaskAfter, Is.EqualTo(TimeSpan.FromDays(1))); + //settings.DeleteExpiredTaskAfter = TimeSpan.Zero; + //Assert.That(settings.DeleteExpiredTaskAfter, Is.Null); + Marshal.ReleaseComObject(settings); + Marshal.ReleaseComObject(t); + Marshal.ReleaseComObject(ts); + } + } +} \ No newline at end of file diff --git a/UnitTests/UnitTests.csproj b/UnitTests/UnitTests.csproj index de1ff24b..4a9aa819 100644 --- a/UnitTests/UnitTests.csproj +++ b/UnitTests/UnitTests.csproj @@ -109,6 +109,7 @@ +