public App() { InitializeComponent(); //var initialPage = FreshPageModelResolver.ResolvePageModel<MainViewModel>(); // MainPage = new FreshNavigationContainer(initialPage); /* Para empezar el freshMVVM * Descargar primero el noguts FreshMVVM, si se desea bajar bogus * bogus es para simular el llenado de datos * tambien las carpetas Models, View = Pages ahora se pone asi por el FreshMVVM * en el ViewModels ya no se usara el MainPageViewModel ahora es = MainViewModel * Tambien instalar el nuget para evitar poner el onChangePropertyChange nuget = " PropertyChanged.Fody - Version 2.5.13 " * y se agrega un xml llamado FodyWeavers.xml * */ var masterDetail = new FreshMasterDetailNavigationContainer(); masterDetail.AddPage <MainViewModel>("Contacts"); masterDetail.AddPage <AboutViewModel>("About"); masterDetail.Init("Menu"); MainPage = masterDetail; }
public void LoadMasterDetail() { var masterDetailNav = new FreshMasterDetailNavigationContainer (); masterDetailNav.Init ("Menu"); masterDetailNav.AddPage<ContactListPageModel> ("Contacts", null); masterDetailNav.AddPage<QuoteListPageModel> ("Quotes", null); MainPage = masterDetailNav; }
public async Task LoadMasterDetail () { var masterDetailNav = new FreshMasterDetailNavigationContainer (); masterDetailNav.Init ("Menu", "Menu.png"); await masterDetailNav.AddPage<ContactListPageModel> ("Contacts", null); await masterDetailNav.AddPage<QuoteListPageModel> ("Quotes", null); MainPage = masterDetailNav; }
private void SetupMasterDetail() { var masterDetail = new FreshMasterDetailNavigationContainer(); masterDetail.AddPage <ContactListPageModel>(PageNames.Contacts, null); masterDetail.AddPage <QuoteListPageModel>(PageNames.Quotes, null); masterDetail.Init(PageNames.Menu); this.MainPage = masterDetail; }
public void LoadMasterDetail() { var masterDetailNav = new FreshMasterDetailNavigationContainer(); masterDetailNav.Init("Menu", "Menu.png"); masterDetailNav.AddPage <ContactListPageModel>("Contacts", null); masterDetailNav.AddPage <QuoteListPageModel>("Quotes", null); MainPage = masterDetailNav; }
public void MasterDetailNavigation() { var masterDetailNav = new FreshMasterDetailNavigationContainer(); masterDetailNav.Init("Menu", "Menu.png"); masterDetailNav.AddPage <MainPageModel> ("Home", null); masterDetailNav.AddPage <TestPageModel> ("Test page", null); MainPage = masterDetailNav; }
public void SetNavigation() { var navContainer = new FreshMasterDetailNavigationContainer(); navContainer.Init("Menu", "hamburger.png"); navContainer.AddPage <DashBoardPageModel>("Dashboard"); navContainer.AddPage <CardsPageModel>("My Loyalty Cards"); MainPage = navContainer; }
public void pagemodel_should_be_link_to_when_created_firsttime() { //master detail navigation var masterDetailNavigation = new FreshMasterDetailNavigationContainer("TestingLinking"); masterDetailNavigation.AddPage <MockContentPageModel> ("Page1", null); masterDetailNavigation.AddPage <MockContentPageModel> ("Page2", null); var pageModel1 = masterDetailNavigation.Pages ["Page1"].GetPageFromNav().GetModel(); var pageModel2 = masterDetailNavigation.Pages ["Page2"].GetPageFromNav().GetModel(); pageModel1.CurrentNavigationServiceName.Should().Be("TestingLinking"); pageModel2.CurrentNavigationServiceName.Should().Be("TestingLinking"); if (FreshIOC.Container.Resolve <IFreshNavigationService> ("TestingLinking") == null) { throw new Exception("Should contain navigation service"); } //tabbed navigation var tabbedNavigation = new FreshTabbedNavigationContainer("TestingLinking2"); tabbedNavigation.AddTab <MockContentPageModel> ("Page1", null); tabbedNavigation.AddTab <MockContentPageModel> ("Page2", null); var tabbedPageModel1 = tabbedNavigation.TabbedPages.First().GetModel(); var tabbedPageModel2 = tabbedNavigation.TabbedPages.Skip(1).Take(1).First().GetModel(); tabbedPageModel1.CurrentNavigationServiceName.Should().Be("TestingLinking2"); tabbedPageModel2.CurrentNavigationServiceName.Should().Be("TestingLinking2"); if (FreshIOC.Container.Resolve <IFreshNavigationService> ("TestingLinking2") == null) { throw new Exception("Should contain navigation service"); } //standard navigation should set named navigation var page = FreshPageModelResolver.ResolvePageModel <MockContentPageModel>(); var pageModel = page.BindingContext as MockContentPageModel; new FreshNavigationContainer(page, "testingLinking3"); pageModel.CurrentNavigationServiceName.Should().Be("testingLinking3"); if (FreshIOC.Container.Resolve <IFreshNavigationService> ("testingLinking3") == null) { throw new Exception("Should contain navigation service"); } //standard navigation should throw exception when binding context isn't a FreshBasePageModel var pageEx = new Page(); Action standardNavExeption = () => new FreshNavigationContainer(pageEx, "testingLinking"); standardNavExeption.ShouldThrow <Exception> ().WithMessage("BindingContext was not a FreshBasePageModel on this Page"); }
public App() { // The root page of your application FreshIOC.Container.Register <IDatabaseService, DatabaseService>(); var masterDetailNav = new FreshMasterDetailNavigationContainer(); masterDetailNav.Init("Menu", "Menu.png"); masterDetailNav.AddPage <ActionListPageModel>("Actions", null); masterDetailNav.AddPage <ContactListPageModel>("Contacts", null); masterDetailNav.AddPage <QuoteListPageModel>("Quotes", null); MainPage = masterDetailNav; }
public App() { InitializeComponent(); FreshIOC.Container.Register <IPharmacyService, PharmacyService>(); var masterDetailNav = new FreshMasterDetailNavigationContainer(); masterDetailNav.Init("Меню"); masterDetailNav.AddPage <ProductListPageModel>("Главная страница", null); masterDetailNav.SwitchSelectedRootPageModel <ProductListPageModel>(); masterDetailNav.AddPage <LoginPageModel>("Войти", null); masterDetailNav.AddPage <RegisterPageModel>("Регистрация", null); MainPage = masterDetailNav; }
public void SwitchOnIdiom() { if (Device.Idiom == TargetIdiom.Phone) { var masterDetailNav = new FreshMasterDetailNavigationContainer (); masterDetailNav.Init ("Menu"); masterDetailNav.AddPage<ContactListPageModel> ("Contacts", null); masterDetailNav.AddPage<QuoteListPageModel> ("Quotes", null); MainPage = masterDetailNav; } else { var tabbedNavigation = new FreshTabbedNavigationContainer (); tabbedNavigation.AddTab<ContactListPageModel> ("Contacts", "contacts.png", null); tabbedNavigation.AddTab<QuoteListPageModel> ("Quotes", "document.png", null); MainPage = tabbedNavigation; } }
public App() { // Initialize the message queueing DependencyService.Get<IZoneMQ>().Init(); // The root page of your application //MainPage = new RootPage(); var masterDetailNav = new FreshMasterDetailNavigationContainer(); masterDetailNav.Init("Menu"); masterDetailNav.AddPage<SchedulePageModel>("Schedule"); masterDetailNav.AddPage<ManualPageModel>("Manual"); masterDetailNav.AddPage<ZonesPageModel>("Zones"); masterDetailNav.AddPage<SettingsPageModel>("Settings"); MainPage = masterDetailNav; }
public FreshMasterDetailNavigationContainer LoadMasterDetail() { try { var masterDetailNav = new FreshMasterDetailNavigationContainer(); masterDetailNav.Init("Menu", "hamburger.png"); masterDetailNav.AddPage <EventsPageModel>("Events", null); masterDetailNav.AddPage <DonorsPageModel>("Donors", null); masterDetailNav.AddPage <CollectionPageModel>("Collection", null); return(masterDetailNav); } catch (Exception e) { Console.WriteLine(e); throw; } }
public void SwitchOnIdiom() { if (Device.Idiom == TargetIdiom.Phone) { var masterDetailNav = new FreshMasterDetailNavigationContainer(); masterDetailNav.Init("Menu"); masterDetailNav.AddPage <ContactListPageModel> ("Contacts", null); masterDetailNav.AddPage <QuoteListPageModel> ("Quotes", null); MainPage = masterDetailNav; } else { var tabbedNavigation = new FreshTabbedNavigationContainer(); tabbedNavigation.AddTab <ContactListPageModel> ("Contacts", "contacts.png", null); tabbedNavigation.AddTab <QuoteListPageModel> ("Quotes", "document.png", null); MainPage = tabbedNavigation; } }
public static void LoadMasterDetail() { masterDetailNav = new FreshMasterDetailNavigationContainer(); masterDetailNav.Measure(130, 130, MeasureFlags.IncludeMargins); // masterDetailNav.Icon = "hamburger.png"; //masterDetailNav.Title = "eNotes"; masterDetailNav.Init("iApps Solutions", "hamburger.png"); masterDetailNav.AddPage <PurchasePageModel>("PurChase Notes", null); masterDetailNav.AddPage <ExpensesPageModel>("Expenses Notes", null); masterDetailNav.AddPage <SettingsPageModel>("Settings", null); var mainpage = FreshPageModelResolver.ResolvePageModel <MenuPageModel>(); masterDetailNav.Detail = new FreshNavigationContainer(mainpage, "NotesListPageNav"); //var mainpageq = FreshPageModelResolver.ResolvePageModel<MasterPageModel>(); // masterDetailNav.Master = mainpageq; App.Current.MainPage = masterDetailNav; }
public void pagemodel_should_be_link_to_when_created_firsttime() { //master detail navigation var masterDetailNavigation = new FreshMasterDetailNavigationContainer("TestingLinking"); masterDetailNavigation.AddPage<MockContentPageModel> ("Page1", null); masterDetailNavigation.AddPage<MockContentPageModel> ("Page2", null); var pageModel1 = masterDetailNavigation.Pages ["Page1"].GetPageFromNav().GetModel (); var pageModel2 = masterDetailNavigation.Pages ["Page2"].GetPageFromNav().GetModel(); pageModel1.CurrentNavigationServiceName.Should ().Be ("TestingLinking"); pageModel2.CurrentNavigationServiceName.Should ().Be ("TestingLinking"); if (FreshIOC.Container.Resolve<IFreshNavigationService> ("TestingLinking") == null) throw new Exception ("Should contain navigation service"); //tabbed navigation var tabbedNavigation = new FreshTabbedNavigationContainer("TestingLinking2"); tabbedNavigation.AddTab<MockContentPageModel> ("Page1", null); tabbedNavigation.AddTab<MockContentPageModel> ("Page2", null); var tabbedPageModel1 = tabbedNavigation.TabbedPages.First ().GetModel (); var tabbedPageModel2 = tabbedNavigation.TabbedPages.Skip (1).Take (1).First ().GetModel (); tabbedPageModel1.CurrentNavigationServiceName.Should ().Be ("TestingLinking2"); tabbedPageModel2.CurrentNavigationServiceName.Should ().Be ("TestingLinking2"); if (FreshIOC.Container.Resolve<IFreshNavigationService> ("TestingLinking2") == null) throw new Exception ("Should contain navigation service"); //standard navigation should set named navigation var page = FreshPageModelResolver.ResolvePageModel<MockContentPageModel>(); var pageModel = page.BindingContext as MockContentPageModel; var standardNavigation = new FreshNavigationContainer(page, "testingLinking3"); pageModel.CurrentNavigationServiceName.Should ().Be ("testingLinking3"); if (FreshIOC.Container.Resolve<IFreshNavigationService> ("testingLinking3") == null) throw new Exception ("Should contain navigation service"); //standard navigation should throw exception when binding context isn't a FreshBasePageModel var pageEx = new Page(); Action standardNavExeption = () => new FreshNavigationContainer(pageEx, "testingLinking"); standardNavExeption.ShouldThrow<Exception> ().WithMessage ("BindingContext was not a FreshBasePageModel on this Page"); }
public void SwitchNavigation(NavigationStacks navigationStacks, FreshBasePageModel page) { switch (navigationStacks) { case (NavigationStacks.Authentication): var loginPage = FreshPageModelResolver.ResolvePageModel <LoginViewModel>(); var authenticationNavContainer = new FreshNavigationContainer(loginPage, navigationStacks.ToString()); page.CoreMethods.SwitchOutRootNavigation(navigationStacks.ToString()); break; case (NavigationStacks.Main): var mainPage = FreshPageModelResolver.ResolvePageModel <MainViewModel>(); var mainNavContainer = new FreshNavigationContainer(mainPage, navigationStacks.ToString()); page.CoreMethods.SwitchOutRootNavigation(navigationStacks.ToString()); break; case (NavigationStacks.MasterDetail): var mainMasterDetailContainer = new FreshMasterDetailNavigationContainer(navigationStacks.ToString()); mainMasterDetailContainer.AddPage <MainViewModel>("Contacts"); mainMasterDetailContainer.AddPage <AboutViewModel>("About"); mainMasterDetailContainer.AddPage <LogoutViewModel>("Logout"); mainMasterDetailContainer.Init("Menu"); page.CoreMethods.SwitchOutRootNavigation(navigationStacks.ToString()); break; case (NavigationStacks.Tabbed): var tabbedContainer = new FreshTabbedNavigationContainer(navigationStacks.ToString()); tabbedContainer.AddTab <MainViewModel>("Contacts", null); tabbedContainer.AddTab <AboutViewModel>("About", null); page.CoreMethods.SwitchOutRootNavigation(navigationStacks.ToString()); break; case (NavigationStacks.TabbedFO): var tabbedFOContainer = new FreshTabbedFONavigationContainer(navigationStacks.ToString()); tabbedFOContainer.AddTab <MainViewModel>("Contacts", null); tabbedFOContainer.AddTab <AboutViewModel>("About", null); page.CoreMethods.SwitchOutRootNavigation(navigationStacks.ToString()); break; } }
public void LoadMasterDetail() { var masterDetailNav = new FreshMasterDetailNavigationContainer(); masterDetailNav.Init("Unit Convertor"); masterDetailNav.AddPage <LengthPageModel>("Length"); masterDetailNav.AddPage <ForcePageModel>("Force"); masterDetailNav.AddPage <MomentPageModel>("Moment"); masterDetailNav.AddPage <StressPageModel>("Stress"); masterDetailNav.AddPage <AccelerationPageModel>("Acceleration"); masterDetailNav.AddPage <AnglePageModel>("Angle"); masterDetailNav.AddPage <AreaPageModel>("Area"); masterDetailNav.AddPage <ForcePerLengthPageModel>("Force Per Length"); masterDetailNav.AddPage <ForcePerVolumePageModel>("Force Per Volume"); masterDetailNav.AddPage <InertiaPageModel>("Inertia"); Page master = FreshPageModelResolver.ResolvePageModel <MenuPageModel>(); Page detail = FreshPageModelResolver.ResolvePageModel <LengthPageModel>(); master.Title = "Unit Convertor"; masterDetailNav.Master = master; //masterDetailNav.Detail = detail; Application.Current.MainPage = masterDetailNav; }
public bool Login(string username, string password) { if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) { CoreMethods.DisplayAlert("Invalid User", "Please provide the right username and password", "OK"); return(false); } else { CoreMethods.DisplayAlert("Login Success", "Welcome", "OK"); var masterDetailNav = new FreshMasterDetailNavigationContainer(); masterDetailNav.Init("Dashboard"); masterDetailNav.AddPage <PlayerListPageModel>("Check-in/out Players", null); masterDetailNav.AddPage <QueueListPageModel>("Queues", null); masterDetailNav.AddPage <CourtListPageModel>("Courts", null); masterDetailNav.AddPage <UserListPageModel>("Admin Users", null); masterDetailNav.AddPage <HelpPageModel>("Help", null); Application.Current.MainPage = masterDetailNav; return(true); } }
void Handle_OnSuccessfulLogin(object sender, bool e) { LoggedIn = true; void action() { MasterDetailNav = new FreshMasterDetailNavigationContainer(); MasterDetailNav.Init(""); var page = FreshPageModelResolver.ResolvePageModel <MasterMenuPageModel>(); ((MasterMenuPageModel)page.BindingContext).OnLogout += (_sender, _e) => { var __page = FreshPageModelResolver.ResolvePageModel <LoginPageModel>(true); MainPage = __page; MasterDetailNav = null; MasterDetailContainer = null; UserName = null; ((LoginPageModel)__page.BindingContext).OnSuccessfulLogin += Handle_OnSuccessfulLogin; try { OnLoggedOut?.Invoke(this, true); } catch (Exception ex) { Crashes.TrackError(ex); } }; page.Title = "Menu"; MasterDetailNav.Master = page; MasterDetailNav.MasterBehavior = MasterBehavior.Popover; MasterDetailNav.AddPage <WelcomePageModel>("Home", null); CurrentPageModel = MasterDetailNav.Pages.Values.First().BindingContext as BaseDetailPage; MasterDetailNav.AddPage <MaintenanceTicketsPageModel>("Maintenance Tickets", null); this.MainPage = MasterDetailNav; MasterDetailContainer = MasterDetailNav; MasterDetailNav.IsPresentedChanged += (_sender, _e) => { if (_sender is FreshMasterDetailNavigationContainer) { foreach (var _page in ((FreshMasterDetailNavigationContainer)_sender).Pages.Values) { var nav = _page as NavigationPage; if (nav.CurrentPage is null || nav.CurrentPage.BindingContext is null) { return; } if (nav.CurrentPage.BindingContext is BaseDetailPage currentPageModel) { if (!currentPageModel.IsModal) { currentPageModel.HamburgerIsVisible = !MasterDetailNav.IsPresented; } else { currentPageModel.HamburgerIsVisible = false; } CurrentPageModel = currentPageModel; } } } }; } Xamarin.Forms.Device.BeginInvokeOnMainThread(action); }