public void Test5() { _codeControl.JTF2 = _f.JTF2; _codeControl.SourceText = ""; var w = new Window(); _window = w; w.Content = _codeControl; JoinableTask jt1 = null; w.Loaded += (sender, args) => { jt1 = _codeControl.JTF.RunAsync(() => TestHelper.DoInput1Async(this)); }; try { w.ShowDialog(); } catch (Exception ex) { _f.Debugfn(ex.ToString()); } jt1.Join(); if (_spans != null) { foreach (var timeSpans in _spans) { _outputHelper.WriteLine(string.Join("\t", timeSpans.Select(z => z.TotalMilliseconds))); } } }
public void Test5_1() { var jt = _codeControl.JTF.RunAsync(() => TestHelper.DoInput1Async(this)); var continueWith = jt.JoinAsync().ContinueWith(async t => { if (_codeControl.IsFaulted) { _f.OutputHelper.WriteLine("faulted"); } await _codeControl.ShutdownAsync(); _f.OutputHelper.WriteLine("shut down secondary"); _codeControl.SecondaryDispatcher.InvokeShutdown(); _f.OutputHelper.WriteLine("DONE"); }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext()); while (!jt.IsCompleted) { TestHelper.DoEvents(); Thread.Sleep(0); } _f.OutputHelper.WriteLine("end of test"); }