protected void Dispose(bool disposing) { if (!disposing) { return; } if (_cancel != null) { _cancel.Cancel(); _cancel.Token.WaitHandle.WaitOne(); _cancel.Dispose(); _cancel = null; } _factories.Clear(); _schedulers.Clear(); if (_scheduler != null) { _scheduler.Dispose(); _scheduler = null; } if (Background != null) { Background.Dispose(); Background = null; } if (Maintenance != null) { Maintenance.Dispose(); Maintenance = null; } }