Exemplo n.º 1
0
 private void Invoke(object sender, EventArgs e)
 {
     if (PSInvocationState.Completed == _powerShellCommand.InvocationStateInfo.State ||
         PSInvocationState.Stopped == _powerShellCommand.InvocationStateInfo.State ||
         PSInvocationState.NotStarted == _powerShellCommand.InvocationStateInfo.State ||
         PSInvocationState.Failed == _powerShellCommand.InvocationStateInfo.State)
     {
         Console.WriteLine("Tick");
         Invoke(null);
     }
     else
     {
         Console.WriteLine("No Tick");
         // string invocationSkipped = "Skipped Invocation Because the current InvocationState is " + _powerShellCommand.InvocationStateInfo.State + " (" + _powerShellCommand.InvocationStateInfo.Reason + ")";
         if (Warning.CanAddNew)
         {
             var w = Warning.AddNew();
             Console.WriteLine(w.GetType().FullName);
             Warning.CancelNew();
         }
     }
 }