예제 #1
0
        internal static V1Interop.ITask GetTask(V1Interop.ITaskScheduler iSvc, string name)
        {
            Guid ITaskGuid = Marshal.GenerateGuidForType(typeof(V1Interop.ITask));

            try { return(iSvc.Activate(name, ref ITaskGuid)); } catch {}
            return(null);
        }
 internal static V1Interop.ITask GetTask(V1Interop.ITaskScheduler iSvc, string name)
 {
     if (string.IsNullOrEmpty(name))
     {
         throw new ArgumentNullException("name");
     }
     try
     {
         return(iSvc.Activate(name, ref ITaskGuid));
     }
     catch (System.UnauthorizedAccessException)
     {
         // TODO: Take ownership of the file and try again
         throw;
     }
     catch (System.ArgumentException)
     {
         return(iSvc.Activate(name + ".job", ref ITaskGuid));
     }
     catch { throw; }
 }
예제 #3
0
 internal static V1Interop.ITask GetTask([NotNull] V1Interop.ITaskScheduler iSvc, [NotNull] string name)
 {
     if (string.IsNullOrEmpty(name))
     {
         throw new ArgumentNullException(nameof(name));
     }
     try
     {
         return(iSvc.Activate(name, IID_ITask));
     }
     catch (UnauthorizedAccessException)
     {
         // TODO: Take ownership of the file and try again
         throw;
     }
     catch (ArgumentException)
     {
         return(iSvc.Activate(name + ".job", IID_ITask));
     }
     catch (FileNotFoundException)
     {
         return(null);
     }
 }