public virtual IMainView CreateMainView() { // 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) => { _mainPresenter = Bootstrapper.GetContainer().Resolve<IMainPresenter>(); _mainPresenter.BindView((IMainView)view); _playerPresenter = Bootstrapper.GetContainer().Resolve<IPlayerPresenter>(); _playerPresenter.BindView((IPlayerView)view); _libraryBrowserPresenter = Bootstrapper.GetContainer().Resolve<ILibraryBrowserPresenter>(); _libraryBrowserPresenter.BindView((ILibraryBrowserView)view); _songBrowserPresenter = Bootstrapper.GetContainer().Resolve<ISongBrowserPresenter>(); _songBrowserPresenter.BindView((ISongBrowserView)view); _markersPresenter = Bootstrapper.GetContainer().Resolve<IMarkersPresenter>(); _markersPresenter.BindView((IMarkersView)view); _markerDetailsPresenter = Bootstrapper.GetContainer().Resolve<IMarkerDetailsPresenter>(new NamedParameterOverloads() { { "markerId", Guid.Empty } }); _markerDetailsPresenter.BindView((IMarkerDetailsView)view); _loopsPresenter = Bootstrapper.GetContainer().Resolve<ILoopsPresenter>(); _loopsPresenter.BindView((ILoopsView)view); _loopDetailsPresenter = Bootstrapper.GetContainer().Resolve<ILoopDetailsPresenter>(new NamedParameterOverloads() { { "loopId", Guid.Empty } }); _loopDetailsPresenter.BindView((ILoopDetailsView)view); _segmentDetailsPresenter = Bootstrapper.GetContainer().Resolve<ISegmentDetailsPresenter>(new NamedParameterOverloads() { { "segmentId", Guid.Empty } }); _segmentDetailsPresenter.BindView((ISegmentDetailsView)view); _timeShiftingPresenter = Bootstrapper.GetContainer().Resolve<ITimeShiftingPresenter>(); _timeShiftingPresenter.BindView((ITimeShiftingView)view); _pitchShiftingPresenter = Bootstrapper.GetContainer().Resolve<IPitchShiftingPresenter>(); _pitchShiftingPresenter.BindView((IPitchShiftingView)view); _updateLibraryPresenter = Bootstrapper.GetContainer().Resolve<IUpdateLibraryPresenter>(); _updateLibraryPresenter.BindView((IUpdateLibraryView)view); }; _mainView = Bootstrapper.GetContainer().Resolve<IMainView>(new NamedParameterOverloads() { { "onViewReady", onViewReady } }); _mainView.OnViewDestroy = (view) => { _mainView = null; _mainPresenter.ViewDestroyed(); _mainPresenter = null; _playerPresenter.ViewDestroyed(); _playerPresenter = null; _libraryBrowserPresenter.ViewDestroyed(); _libraryBrowserPresenter = null; _songBrowserPresenter.ViewDestroyed(); _songBrowserPresenter = null; _markersPresenter.ViewDestroyed(); _markersPresenter = null; _markerDetailsPresenter.ViewDestroyed(); _markerDetailsPresenter = null; _loopsPresenter.ViewDestroyed(); _loopsPresenter = null; _loopDetailsPresenter.ViewDestroyed(); _loopDetailsPresenter = null; _segmentDetailsPresenter.ViewDestroyed(); _segmentDetailsPresenter = null; _timeShiftingPresenter.ViewDestroyed(); _timeShiftingPresenter = null; _pitchShiftingPresenter.ViewDestroyed(); _pitchShiftingPresenter = null; _updateLibraryPresenter.ViewDestroyed(); _updateLibraryPresenter = null; }; return _mainView; }