public virtual void CancelMonitor(IMvxSetupMonitor setupMonitor) { lock (LockObject) { if (setupMonitor != _currentMonitor) { throw new MvxException("The specified IMvxSetupMonitor is not the one registered in MvxSetupSingleton"); } _currentMonitor = null; } }
protected override void Dispose(bool isDisposing) { if (isDisposing) { lock (LockObject) { _currentMonitor = null; } } base.Dispose(isDisposing); }
public virtual void InitializeAndMonitor(IMvxSetupMonitor setupMonitor) { lock (LockObject) { _currentMonitor = setupMonitor; // if the tcs is not null, it means the initialization is running if (IsInitialisedTaskCompletionSource != null) { // If the task is already completed at this point, let the monitor know it has finished. // but don't do it otherwise because it's done elsewhere if (IsInitialisedTaskCompletionSource.Task.IsCompleted) { _currentMonitor?.InitializationComplete(); } return; } StartSetupInitialization(); } }