/// <summary> /// Starts the process. /// </summary> public void StartProcess() { // Asynchronously start the process StartProcessAsync startProcessAsync = new StartProcessAsync(PerformStartProcess); startProcessAsync.BeginInvoke(new AsyncCallback(ProcessStartCompleted), null); }
/// <summary> /// Serves as a callback method that is invoked when the asynchronous /// process start operation is completed. /// </summary> private void ProcessStartCompleted(IAsyncResult result) { StartProcessAsync spa = (result.AsyncState as StartProcessAsync); if (spa.EndInvoke(result)) { BeginMonitoring(); } else { throw new Exception("Process could not be started."); } }