// Token: 0x06001082 RID: 4226 RVA: 0x00032783 File Offset: 0x00030983 internal void PipelineStateChanged(object sender, PSInvocationStateChangedEventArgs e) { if (e.InvocationStateInfo.State == PSInvocationState.Failed || e.InvocationStateInfo.State == PSInvocationState.Stopped || e.InvocationStateInfo.State == PSInvocationState.Completed) { this.UnblockWaitOne(); } }
private void StateChanged(object sender, PSInvocationStateChangedEventArgs e) { if (e.InvocationStateInfo.State == PSInvocationState.Completed) { StoppableInvoke(synchComplete, new object[] { this }); } }
protected virtual void OnInvocationStateChanged(PSInvocationStateChangedEventArgs e) { if (InvocationStateChanged != null) { InvocationStateChanged(this, e); } }
/// <summary> /// This event handler is called when the pipeline state is changed. /// If the state change is to Completed, it issues a message /// asking the user to exit the program. /// </summary> /// <param name="sender">Unused</param> /// <param name="e">The PowerShell state information.</param> static void Powershell_InvocationStateChanged(object sender, PSInvocationStateChangedEventArgs e) { Console.WriteLine("PowerShell state changed: state: {0}\n", e.InvocationStateInfo.State); if (e.InvocationStateInfo.State == PSInvocationState.Completed) { Console.WriteLine("Processing completed, press a key to exit!"); } }
private void InvocationStateChanged(object sender, PSInvocationStateChangedEventArgs e) { if (e.InvocationStateInfo.State != this.InvocationState.State || e.InvocationStateInfo.Reason != this.InvocationState.Reason) { NotifyOfPropertyChange(() => InvocationState); } }
private void Ps_InvocationStateChanged(object sender, PSInvocationStateChangedEventArgs e) { log.WriteInfo(e.InvocationStateInfo.State.ToString()); string comments = string.Empty; if (e.InvocationStateInfo.State == PSInvocationState.Completed) { comments = GetMetalogixJobLogResults(currentPs, "Failed"); } log.WriteToCVS(Environment.MachineName, currentPs, e.InvocationStateInfo.State.ToString(), DateTime.Now.ToLongTimeString(), DateTime.Today.ToShortDateString(), comments); }
/** * <summary> * Executa o método após a execução do comando, powershell, ter sido concluído. * <para><paramref name="sender"/> - Instância do método que chamou esse método.</para> * <para><paramref name="e"/> - Parâmetro que representa a invocação do método.</para> * <para>Método Assíncrono</para> * </summary> */ public void BeginInvoke_Concluido(object sender, PSInvocationStateChangedEventArgs e) { try { //string Result = ""; } catch (Exception ex) { TratadorErros(ex, this.GetType().Name); } }
// Token: 0x06000F27 RID: 3879 RVA: 0x0002BB98 File Offset: 0x00029D98 internal void PipelineStateChanged(object sender, PSInvocationStateChangedEventArgs e) { ExTraceGlobals.VerboseTracer.Information((long)this.GetHashCode(), "-->MonadAsyncResult.PipelineStateChanged()"); this.SetIsCompleted(e.InvocationStateInfo.State); if (this.IsCompleted && this.callback != null) { ExTraceGlobals.VerboseTracer.Information((long)this.GetHashCode(), "\tInvoking callback."); this.callback(this); } ExTraceGlobals.VerboseTracer.Information((long)this.GetHashCode(), "<--MonadAsyncResult.PipelineStateChanged()"); }
private void Powershell_InvocationStateChanged(object sender, PSInvocationStateChangedEventArgs e) { switch (e.InvocationStateInfo.State) { case PSInvocationState.Failed: AddError("Errored out: " + e.InvocationStateInfo.Reason.Message); break; default: AddInfo(e.InvocationStateInfo.State.ToString()); break; } }
static void handler(object self, PSInvocationStateChangedEventArgs e) { if (e.InvocationStateInfo.State is not PSInvocationState.Completed and not PSInvocationState.Failed and not PSInvocationState.Stopped) { return; } PowerShell pwsh = (PowerShell)self; pwsh.InvocationStateChanged -= handler; pwsh.Dispose(); }
private void PowerShellOnInvocationStateChanged(object sender, PSInvocationStateChangedEventArgs psInvocationStateChangedEventArgs) { switch (psInvocationStateChangedEventArgs.InvocationStateInfo.State) { case PSInvocationState.Stopped: ReleasePowerShell(); _pool.ReportStopped(this); break; case PSInvocationState.Completed: case PSInvocationState.Failed: ResetPowerShell(); _pool.ReportAvailable(this); break; } }
/// <summary> /// Synchronizes Job State with Background Runspace /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void powerShellCommand_InvocationStateChanged(object sender, PSInvocationStateChangedEventArgs e) { try { if (e.InvocationStateInfo.State == PSInvocationState.Completed) { runspace.Close(); } if (e.InvocationStateInfo.State == PSInvocationState.Failed) { ErrorRecord err = new ErrorRecord(e.InvocationStateInfo.Reason, "JobFailed", ErrorCategory.OperationStopped, this); Error.Add(err); runspace.Close(); } JobState js = (JobState)Enum.Parse(typeof(JobState), e.InvocationStateInfo.State.ToString(), true); this.SetJobState(js); } catch {} }
private void Powershell_InvocationStateChanged(object sender, PSInvocationStateChangedEventArgs e) { switch (e.InvocationStateInfo.State) { case PSInvocationState.Failed: AddError(null, new MessageEventArgs { Message = $"Errored out: {e.InvocationStateInfo.Reason.Message}" }); break; default: AddInfo(null, new MessageEventArgs { Message = e.InvocationStateInfo.State.ToString() }); break; } }
private void PowerShellInstance_InvocationStateChanged(object sender, PSInvocationStateChangedEventArgs e) { switch (e.InvocationStateInfo.State) { case PSInvocationState.Completed: case PSInvocationState.Disconnected: case PSInvocationState.Failed: case PSInvocationState.NotStarted: case PSInvocationState.Stopped: base.StatusHandler.TaskCompleted(e.InvocationStateInfo.Reason != null ? e.InvocationStateInfo.Reason.HResult : 0); break; //case PSInvocationState.Running: //case PSInvocationState.Stopping: default: break; } }
private void HandleStateChanged(PSInvocationStateChangedEventArgs stateChangeInfo) { if (_dataStreamWriter != null) { // Treat any terminating exception as a non-terminating error record var newStateInfo = stateChangeInfo.InvocationStateInfo; if (newStateInfo.Reason != null) { var errorRecord = new ErrorRecord( newStateInfo.Reason, "PSTaskException", ErrorCategory.InvalidOperation, this); _dataStreamWriter.Add( new PSStreamObject(PSStreamObjectType.Error, errorRecord)); } } RaiseStateChangedEvent(stateChangeInfo); }
private void OnExecutingCommandInvocationStateChanged(object sender, PSInvocationStateChangedEventArgs e) { bool flag = false; lock (this.sessionStateLock) { if (this.State != PowwaSession.SessionState.Closed) { PSInvocationState state = e.InvocationStateInfo.State; if (state == PSInvocationState.Completed || state == PSInvocationState.Failed || state == PSInvocationState.Stopped) { if (state == PSInvocationState.Failed) { this.WriteException(e.InvocationStateInfo.Reason); } flag = true; if (state == PSInvocationState.Completed) { //Ouput Stuff... } } } else { return; } } if (flag) { string powerShellPrompt = this.GetPowerShellPrompt(); lock (this.sessionStateLock) { if (this.State != PowwaSession.SessionState.Closed) { this.PostClientMessage(new CommandCompletedMessage(powerShellPrompt), false); this.State = PowwaSession.SessionState.Available; } } } }
void powerShellCommand_InvocationStateChanged(object sender, PSInvocationStateChangedEventArgs e) { if (e.InvocationStateInfo.State == PSInvocationState.Failed) { ErrorRecord err = new ErrorRecord(e.InvocationStateInfo.Reason, "PowerShellDataSource.TerminatingError", ErrorCategory.InvalidOperation, powerShellCommand); powerShellCommand.Streams.Error.Add(err); } if (Dispatcher != null) { RunOnUIThread( new DispatcherOperationCallback( delegate { NotifyInvocationStateChanged(); return(null); }), true); } else { NotifyInvocationStateChanged(); } }
internal void RaiseStateChangedEvent(PSInvocationStateChangedEventArgs args) { StateChanged.SafeInvoke(this, args); }
private void HandleStateChanged(PSInvocationStateChangedEventArgs stateChangeInfo) { RaiseStateChangedEvent(stateChangeInfo); }
private void PowerShellPipeLine_InvocationStateChanged(object sender, PSInvocationStateChangedEventArgs e) { _pipeLineState = e.InvocationStateInfo.State.ToString(); }
private void Powershell_InvocationStateChanged(object sender, PSInvocationStateChangedEventArgs e) { OnInvocationStateChanged(e); }
void powerShell_InvocationStateChanged(object sender, PSInvocationStateChangedEventArgs e) { SessionStateChangedEventArgs eventArgs = TranslateInvocationStateInfo(e.InvocationStateInfo); this.OnSessionStateChanged(this, eventArgs); }
private void OnStateChanged(object sender, PSInvocationStateChangedEventArgs args) { lock (_sync) { switch (args.InvocationStateInfo.State) { case PSInvocationState.Completed: { foreach (var observer in _observers) { _isCompleted = true; observer.OnCompleted(); } foreach (var observer in _psObservers) { observer.OnCompleted(); } } break; case PSInvocationState.Disconnected: { _isCompleted = true; var ex = new PSTerminalStateException(PSInvocationState.Disconnected, "The PowerShell invocation state indicated disconnection.", args.InvocationStateInfo.Reason); var er = new ErrorRecord(ex, "PSTerminalState", ErrorCategory.NotSpecified, _powerShell); foreach (var observer in _observers) { observer.OnError(ex); } foreach (var observer in _psObservers) { observer.OnFailed(er); } } break; case PSInvocationState.Failed: { _isCompleted = true; var ex = new PSTerminalStateException(PSInvocationState.Failed, "The PowerShell invocation state indicated failure.", args.InvocationStateInfo.Reason); var er = new ErrorRecord(ex, "PSTerminalState", ErrorCategory.NotSpecified, _powerShell); _exception = ex; foreach (var observer in _observers) { observer.OnError(ex); } foreach (var observer in _psObservers) { observer.OnFailed(er); } } break; case PSInvocationState.Stopped: { _isCompleted = true; var ex = new PSTerminalStateException(PSInvocationState.Stopped, "The PowerShell invocation state indicated cancellation.", args.InvocationStateInfo.Reason); var er = new ErrorRecord(ex, "PSTerminalState", ErrorCategory.NotSpecified, _powerShell); _exception = ex; foreach (var observer in _observers) { observer.OnError(ex); } foreach (var observer in _psObservers) { observer.OnFailed(er); } } break; default: return; } _observers.Clear(); _psObservers.Clear(); Output.DataAdded -= OnOutputAdded; _powerShell.Streams.Error.DataAdded -= OnErrorAdded; _powerShell.Streams.Warning.DataAdded -= OnWarningAdded; _powerShell.Streams.Verbose.DataAdded -= OnVerboseAdded; _powerShell.Streams.Debug.DataAdded -= OnDebugAdded; _powerShell.Streams.Progress.DataAdded -= OnProgressAdded; _powerShell.Streams.Information.DataAdded -= OnInformationAdded; Dispose(); } }
private void Ps_InvocationStateChanged(object sender, PSInvocationStateChangedEventArgs e) { }
private static void Powershell_InvocationStateChanged(object sender, PSInvocationStateChangedEventArgs e) { Console.WriteLine("PowerShell object state changed: state: {0}\n", e.InvocationStateInfo.State); }
void StateChanged(object sender, PSInvocationStateChangedEventArgs e) { var x = e.InvocationStateInfo.State; }