示例#1
0
        public static void RegisterApplicationRestart(string command, RestartCondition condition)
        {
            if (!IsPlatformSupported)
            {
                throw new PlatformNotSupportedException("Requires Windows Vista or later");
            }

            if (command == null)
            {
                throw new ArgumentNullException(nameof(command));
            }

            int hr = NativeMethods.RegisterApplicationRestart(command, condition);

            if (hr != 0)
            {
                Marshal.ThrowExceptionForHR(hr);
            }
        }
 public ProgramRestartPolicy(RestartCondition condition, TimeSpan?delay)
 {
     Condition = condition;
     Delay     = delay;
 }
示例#3
0
 internal static extern int RegisterApplicationRestart([MarshalAs(UnmanagedType.BStr)] string commandLine, RestartCondition flags);