public override void OnDestroy(Action baseOnDestroy) { if (_preferenceChangeListener != null) { _preferenceChangeListener.Dispose(); _preferenceChangeListener = null; } base.OnDestroy(baseOnDestroy); }
public virtual void OnDestroy(Action baseOnDestroy) { var viewModel = DataContext as IViewModel; if (viewModel != null && !viewModel.IsDisposed && viewModel.IocContainer != null && !viewModel.IocContainer.IsDisposed) { Get <IViewManager>().CleanupViewAsync(viewModel); } if (_preferenceChangeListener != null) { _preferenceChangeListener.Dispose(); _preferenceChangeListener = null; } DataContext = null; DataContextChanged = null; _isDestroyed = true; baseOnDestroy(); }