/// <summary> /// Event invoked for each process in <see cref="PowerShellOperations.Example1"/> and /// <see cref="PowerShellOperations.Example2Task"/> /// /// The method <see cref="PowerShellOperations.Example2Task"/> requires <see cref="ControlExtensions.InvokeIfRequired"/> /// to prevent cross threading violation while <see cref="PowerShellOperations.Example1"/> does not cause a violation /// /// </summary> /// <param name="sender"></param> private void PowerShellOperationsOnProcessItemHandler(ProcessItem sender) { ResultsTextBox.InvokeIfRequired(tb => { tb.AppendTextWithNewLines($"{sender}".RemoveExtraSpaces().Beautify()); }); }