public static void ForwardAllResultsToCmdlet(ThrottlingJob throttlingJob, Cmdlet cmdlet, CancellationToken?cancellationToken) { using (var helper = new ForwardingHelper(throttlingJob)) { try { throttlingJob.ChildJobAdded += helper.ThrottlingJob_ChildJobAdded; try { throttlingJob.StateChanged += helper.ThrottlingJob_StateChanged; IDisposable cancellationTokenRegistration = null; if (cancellationToken.HasValue) { cancellationTokenRegistration = cancellationToken.Value.Register(helper.CancelForwarding); } try { Interlocked.MemoryBarrier(); ThreadPool.QueueUserWorkItem( delegate { helper.StartMonitoringJob(throttlingJob); foreach (Job childJob in throttlingJob.GetChildJobsSnapshot()) { helper.StartMonitoringJob(childJob); } helper.CheckIfThrottlingJobIsComplete(); }); helper.ForwardResults(cmdlet); } finally { if (cancellationTokenRegistration != null) { cancellationTokenRegistration.Dispose(); } } } finally { throttlingJob.StateChanged -= helper.ThrottlingJob_StateChanged; } } finally { throttlingJob.ChildJobAdded -= helper.ThrottlingJob_ChildJobAdded; } } }
public void AddForwardAddress(string address) { Forwarding(); ForwardingHelper.DeletAddreses(_driver); _forwardingPageModel.AddForwardingAddress.Click(); _forwardingPageModel.ForwardingAddressInput.SendKeys(address); _forwardingPageModel.ForwardingNextButton.Click(); _driver.SwitchTo().Window(_driver.WindowHandles.ToList().Last()); _forwardingPageModel.ProceedButton.Click(); _driver.SwitchTo().Window(_driver.WindowHandles.ToList().First()); _forwardingPageModel.ForwardingOkButton.Click(); _driver.WaitForAjax(); }
private void ForwardAllResultsToCmdlet(Cmdlet cmdlet, CancellationToken?cancellationToken) { base.AssertNotDisposed(); ForwardingHelper.ForwardAllResultsToCmdlet(this, cmdlet, cancellationToken); }
public static void ForwardAllResultsToCmdlet(ThrottlingJob throttlingJob, Cmdlet cmdlet, CancellationToken? cancellationToken) { using (var helper = new ForwardingHelper(throttlingJob)) { try { throttlingJob.ChildJobAdded += helper.ThrottlingJob_ChildJobAdded; try { throttlingJob.StateChanged += helper.ThrottlingJob_StateChanged; IDisposable cancellationTokenRegistration = null; if (cancellationToken.HasValue) { cancellationTokenRegistration = cancellationToken.Value.Register(helper.CancelForwarding); } try { Interlocked.MemoryBarrier(); ThreadPool.QueueUserWorkItem( delegate { helper.StartMonitoringJob(throttlingJob); foreach (Job childJob in throttlingJob.GetChildJobsSnapshot()) { helper.StartMonitoringJob(childJob); } helper.CheckIfThrottlingJobIsComplete(); }); helper.ForwardResults(cmdlet); } finally { if (cancellationTokenRegistration != null) { cancellationTokenRegistration.Dispose(); } } } finally { throttlingJob.StateChanged -= helper.ThrottlingJob_StateChanged; } } finally { throttlingJob.ChildJobAdded -= helper.ThrottlingJob_ChildJobAdded; } } }