public virtual void BindMobileMainView(IMobileMainView view) { // OnViewReady in IBaseView cannot be used anymore because the Android system can create activities by itself. // The NavMgr or presenter never have a chance to register to OnViewReady! So the activity needs to call the NavMgr to let it know a new view is available. // Fine for normal views, but what about details views (i.e. Edit an entity)? The system simply cannot create a details view by itself! // If an activity previously created with intent params is restored, the intent param values will also be restored. So these params will be sent to the presenter // when binding the view (i.e. INavigationManager.BindMarkerDetailsView(Guid markerId)) _mainView = view; _mainPresenter = Bootstrapper.GetContainer().Resolve<IMobileMainPresenter>(); _mainView.OnViewDestroy = (view2) => { _mainPresenter.ViewDestroyed(); _mainPresenter = null; _mainView = null; }; _mainPresenter.BindView(view); #if ANDROID var artistsView = CreateMobileLibraryBrowserView(MobileNavigationTabType.Artists, MobileLibraryBrowserType.Artists, new LibraryQuery()); _mainView.AddTab(MobileNavigationTabType.Artists, "Artists", MobileLibraryBrowserType.Artists, new LibraryQuery(), artistsView); #elif IOS var playlistsView = CreateMobileLibraryBrowserView(MobileNavigationTabType.Playlists, MobileLibraryBrowserType.Playlists, new LibraryQuery()); var artistsView = CreateMobileLibraryBrowserView(MobileNavigationTabType.Artists, MobileLibraryBrowserType.Artists, new LibraryQuery()); var albumsView = CreateMobileLibraryBrowserView(MobileNavigationTabType.Albums, MobileLibraryBrowserType.Albums, new LibraryQuery()); var songsView = CreateMobileLibraryBrowserView(MobileNavigationTabType.Songs, MobileLibraryBrowserType.Songs, new LibraryQuery()); var moreView = CreateOptionsMenuView(); _mainView.AddTab(MobileNavigationTabType.Playlists, "Playlists", MobileLibraryBrowserType.Playlists, new LibraryQuery(), playlistsView); _mainView.AddTab(MobileNavigationTabType.Artists, "Artists", MobileLibraryBrowserType.Artists, new LibraryQuery(), artistsView); _mainView.AddTab(MobileNavigationTabType.Albums, "Albums", MobileLibraryBrowserType.Albums, new LibraryQuery(), albumsView); _mainView.AddTab(MobileNavigationTabType.Songs, "Songs", MobileLibraryBrowserType.Songs, new LibraryQuery(), songsView); _mainView.AddTab(MobileNavigationTabType.More, "More", MobileLibraryBrowserType.Songs, new LibraryQuery(), moreView); #endif }
public virtual void CreateMobileMainView() { if (_mainView == null) _mainView = Bootstrapper.GetContainer().Resolve<IMobileMainView>(); // For details view: // .......Resolve<IMarkerDetailsView>(bla... markerId: 'guid'); // View implementation ctor: // ctor(...., Guid markerId) // (...) // BindMarkerDetailsView(markerId); // // // Q: Is it a problem if on some platforms where you can't add params to the ctor (for a view implementation)? // A: No, because mobile platforms that don't return the view instance need to have a way to add details // (i.e. intent params on Android, page params on Windows Store, etc.). // However... will TinyIoC crash if a namedparam cannot be resolved? }