private void StartSetupInitialization() { IsInitialisedTaskCompletionSource = new TaskCompletionSource <bool>(); _setup.InitializePrimary(); Task.Run(async() => { ExceptionDispatchInfo setupException = null; try { _setup.InitializeSecondary(); } catch (Exception ex) { setupException = ExceptionDispatchInfo.Capture(ex); } IMvxSetupMonitor monitor; lock (LockObject) { if (setupException == null) { IsInitialisedTaskCompletionSource.SetResult(true); } else { IsInitialisedTaskCompletionSource.SetException(setupException.SourceException); } monitor = _currentMonitor; } if (monitor != null) { var dispatcher = Mvx.IoCProvider.GetSingleton <IMvxMainThreadAsyncDispatcher>(); await dispatcher.ExecuteOnMainThreadAsync(async() => { if (monitor != null) { await monitor.InitializationComplete(); } }); } }); }
private void StartSetupInitialization() { IsInitialisedTaskCompletionSource = new TaskCompletionSource <bool>(); _setup.InitializePrimary(); Task.Run(() => { _setup.InitializeSecondary(); lock (LockObject) { IsInitialisedTaskCompletionSource.SetResult(true); var dispatcher = Mvx.GetSingleton <IMvxMainThreadDispatcher>(); dispatcher.RequestMainThreadAction(() => { if (_currentMonitor != null) { _currentMonitor?.InitializationComplete(); } }); } }); }