public virtual void BindSyncView(ISyncView view) { _syncView = view; _syncView.OnViewDestroy = (view2) => { _syncPresenter.ViewDestroyed(); _syncPresenter = null; _syncView = null; }; _syncPresenter = Bootstrapper.GetContainer().Resolve<ISyncPresenter>(); _syncPresenter.BindView(view); }
public virtual ISyncView CreateSyncView() { // If the view is still visible, just make it the top level window if(_syncView != null) { _syncView.ShowView(true); return _syncView; } // The view invokes the OnViewReady action when the view is ready. This means the presenter can be created and bound to the view. Action<IBaseView> onViewReady = (view) => { _syncPresenter = Bootstrapper.GetContainer().Resolve<ISyncPresenter>(); _syncPresenter.BindView((ISyncView)view); }; // Create view and manage view destruction _syncView = Bootstrapper.GetContainer().Resolve<ISyncView>(new NamedParameterOverloads() { { "onViewReady", onViewReady } }); _syncView.OnViewDestroy = (view) => { _syncPresenter.ViewDestroyed(); _syncPresenter = null; _syncView = null; }; return _syncView; }