Пример #1
1
		void SetupTabbedPage()
		{
			_tabbedNavigationPage = new FreshTabbedNavigationContainer ();
			_contactsPage = _tabbedNavigationPage.AddTab<ContactListPageModel> ("Contacts", "contacts.png");
			_quotesPage = _tabbedNavigationPage.AddTab<QuoteListPageModel> ("Quotes", "document.png");
			this.Detail = _tabbedNavigationPage;
		}
Пример #2
0
 public async Task LoadTabbedNav ()
 {
     var tabbedNavigation = new FreshTabbedNavigationContainer ();
     await tabbedNavigation.AddTab<ContactListPageModel> ("Contacts", "contacts.png", null);
     await tabbedNavigation.AddTab<QuoteListPageModel> ("Quotes", "document.png", null);
     MainPage = tabbedNavigation;
 }
Пример #3
0
        public App()
        {
            // The root page of your application
            var mainPage = new FreshTabbedNavigationContainer();

            mainPage.AddTab<TabOnePageModel>("Hello", null);
            mainPage.AddTab<TabTwoPageModel>("unicorn!", null);
            MainPage = mainPage;
        }
Пример #4
0
        public void Navigation()
        {
            var tabbedNavigation = new FreshTabbedNavigationContainer();

            tabbedNavigation.AddTab <HomePageModel>("Home", "Home1.png");
            tabbedNavigation.AddTab <TeamPageModel>("Team", "Team1.png");
            tabbedNavigation.AddTab <ContactPageModel>("Contacts", "Contact1.png");
            tabbedNavigation.AddTab <ResourcesPageModel>("Resources", "Other1.png");

            MainPage = tabbedNavigation;
        }
Пример #5
0
        private void InitializePages()
        {
            var tabbedNavigation = new FreshTabbedNavigationContainer();

            tabbedNavigation.AutomationId = "MainTab";
            tabbedNavigation.AddTab <HomeViewModel>("Home", "Home.png", null);
            //tabbedNavigation.AddTab<NotificationViewModel>("Notification", "Notification.png", null);
            tabbedNavigation.AddTab <AccountViewModel>("Account", "Account.png", null);

            MainPage = tabbedNavigation;
        }
Пример #6
0
        public App()
        {
            InitializeComponent();

            var tabbedPage = new FreshTabbedNavigationContainer();

            // Sorry about the horrible looking icon sizes...
            tabbedPage.AddTab <DncMvvmPageModel>("Home", "icon.png");
            tabbedPage.AddTab <AnotherPageModel>("Another", "anothericon.png");

            MainPage = tabbedPage;
        }
Пример #7
0
        public App()
        {
            InitializeComponent();

            var container = new FreshTabbedNavigationContainer();

            container.AddTab <CurrentTradePageModel>("Trades", "trades.png");
            container.AddTab <HistoryPageModel>("History", "history.png");
            container.AddTab <SettingsPageModel>("Settings", "settings.png");

            MainPage = container;
        }
        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");
        }
Пример #9
0
        public App()
        {
            InitializeComponent();

            FreshIOC.Container.Register <IDataService, SqlDataService>();
            FreshIOC.Container.Register <IRemoteService, RemoteService>();

            var tabs = new FreshTabbedNavigationContainer();

            tabs.AddTab <TareasViewModel>("Tareas", "tarea");
            tabs.AddTab <ClientesViewModel>("Clientes", "cliente");

            MainPage = tabs;
        }
Пример #10
0
        public App()
        {
            try
            {
                InitializeComponent();

                var tabbedNavigation = new FreshTabbedNavigationContainer();
                tabbedNavigation.AddTab <Detail1PageModel>("First Tab", null);
                tabbedNavigation.AddTab <Detail2PageModel>("Second Tab", null);
                MainPage = tabbedNavigation;
            }
            catch (Exception ex)
            {
            }
        }
Пример #11
0
        private void HandleIOSSetup()
        {
            var tabs = new FreshTabbedNavigationContainer("RunkeeperTabs");

            tabs.AddTab <Page1ViewModel>("Page 1", "icon.png");
            tabs.AddTab <Page2ViewModel>("Page 2", "icon.png");
            tabs.AddTab <Page3ViewModel>("Page 3", "icon.png");
            tabs.AddTab <Page4ViewModel>("Page 4", "icon.png");
            tabs.AddTab <Page5ViewModel>("Page 5", "icon.png");

            // Set the selected tab to the middle one.
            tabs.SwitchSelectedRootPageModel <Page3ViewModel>();

            MainPage = tabs;
        }
 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;
     }
 }
Пример #13
0
 public void LoadTabbedNav()
 {
     try
     {
         var tabbedNavigation = new FreshTabbedNavigationContainer();
         tabbedNavigation.AddTab <WeeklyEventsPageModel>("WEEK", null, null);
         tabbedNavigation.AddTab <CategoriesPageModel>("CATEGORIES", null, null);
         tabbedNavigation.AddTab <ProfilePageModel>("PROFILE", null, null);
         NavigationPage.SetHasNavigationBar(tabbedNavigation as BindableObject, false);
         MainPage = tabbedNavigation;
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #14
0
 private void SetupTabbedPage()
 {
     _tabbedNavigations = new FreshTabbedNavigationContainer();
     _searchPage        = _tabbedNavigations.AddTab <SearchShopsPageModel>("Search", "");
     //      _shopServiceHistoryPage = _tabbedNavigations.AddTab<ServiceShopHistoryPageModel>("Previous Shops", "");
     this.Detail = _tabbedNavigations;
 }
Пример #15
0
        internal void AddProfilePage()
        {
            if (_tabbedPage.TabbedPages.FirstOrDefault(p => p is ProfilePage) != null)
            {
                return;
            }

            if (Device.OS == TargetPlatform.iOS)
            {
                _tabbedPage.AddTab <ProfilePageModel>("Profile", "profile");
            }
            else
            {
                _tabbedPage.AddTab <ProfilePageModel>("Profile", null);
            }
        }
Пример #16
0
        public App()
        {
            InitializeComponent();
            FlowListView.Init();

            FreshIOC.Container.Register <IGamesService, GamesService>();
            FreshIOC.Container.Register <IPlayersService, PlayersService>();

            var tabbedNavigation = new FreshTabbedNavigationContainer();

            tabbedNavigation.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
            tabbedNavigation.AddTab <GamesListPageModel>("Upcoming Games", null);
            tabbedNavigation.AddTab <PlayersListPageModel>("Players", null);
            tabbedNavigation.AddTab <PlayersCollectionPageModel>("Players Collection", null);
            tabbedNavigation.HeightRequest = 5;
            MainPage = tabbedNavigation;
        }
Пример #17
0
        public App()
        {
            FreshIOC.Container.Register <IActivityService, ActivityService> ();
            var tabbedNavigation = new FreshTabbedNavigationContainer();

            tabbedNavigation.AddTab <ActivityListPageModel> ("Activities", null);
            MainPage = tabbedNavigation;
        }
Пример #18
0
        public App()
        {
            InitializeComponent();

            /* create the navigation container */
            var tabbedNavigation = new FreshTabbedNavigationContainer();

            /* add in the pages for the tabes */
            tabbedNavigation.AddTab <HomePageModel>("Dashboard", null);
            tabbedNavigation.AddTab <AccountsPageModel>("Accounts", null);
            tabbedNavigation.AddTab <ReceivablesPageModel>("Receivables", null);
            tabbedNavigation.AddTab <PayablesPageModel>("Payables", null);
            tabbedNavigation.AddTab <CompanyPageModel>("Company", null);

            /* Set the main page */
            MainPage = tabbedNavigation;
        }
 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;
     }
 }
Пример #20
0
        public App()
        {
            InitializeComponent();

            // Registatie van de abstracte interfaces met een IoC Container
            FreshIOC.Container.Register <IMedicinesService>(new MedicinesInMemoryService());
            FreshIOC.Container.Register <ICompartmentsService>(new CompartmentsInMemoryService());
            FreshIOC.Container.Register <IUsersService>(new UsersInMemoryService());
            FreshIOC.Container.Register <ITimeslotsService>(new TimeslotInMemoryService());

            var mainPage = new FreshTabbedNavigationContainer();

            mainPage.AddTab <PillboxPageModel>("BOX", null);
            mainPage.AddTab <AddMedicinePageModel>("+MED", null);
            mainPage.AddTab <ContactsPageModel>("Contacts", null);
            mainPage.AddTab <SettingsPageModel>("Settings", null);
            MainPage = mainPage;
        }
Пример #21
0
        public App()
        {
            InitializeComponent();

            _mapper = new MainViewModelMapper();

            FreshPageModelResolver.PageModelMapper = _mapper;

            RegisterServices();
            RegisterPages();

            var tabbedPage = new FreshTabbedNavigationContainer();

            tabbedPage.AddTab <ImagesViewModel>(Strings.All, "");
            tabbedPage.AddTab <FavoritesViewModel>(Strings.Favorites, "");

            MainPage = tabbedPage;
        }
Пример #22
0
        public App()
        {
            InitializeComponent();

            FreshIOC.Container.Register <IAzureService, AzureService>();

            var tabbedNavigation = new FreshTabbedNavigationContainer();

            //tabbedNavigation.AddTab<PoofPageModel>("Poof", Device.OnPlatform("poofTab.png", "poofTab.png", "Assets/poofTab.png") );
            //tabbedNavigation.AddTab<PoofListPageModel>("Poofs", Device.OnPlatform("poofListTab.png", "poofListTab.png", "Assets/poofListTab.png"));

            tabbedNavigation.AddTab <PoofPageModel>("Poof", Device.OnPlatform("poofTab.png", "", ""));
            tabbedNavigation.AddTab <PoofListPageModel>("Poofs", Device.OnPlatform("poofListTab.png", "", ""));

            //tabbedNavigation.BarBackgroundColor = (Color)Resources[@"BarTint"];
            //tabbedNavigation.BarTextColor = (Color)Resources[@"Back"];
            //tabbedNavigation.Title = "POOF";
            MainPage = tabbedNavigation;
        }
Пример #23
0
        public App()
        {
            InitializeComponent();

            // Load resources
            App.Settings = SettingsLoader.ImprovedLoad();

            // Register dependencies.
            FreshIOC.Container.Register <IBookManager, BookManager>();
            FreshIOC.Container.Register <IValidator, BookValidator>();

            // The root page of your application
            var mainPage = new FreshTabbedNavigationContainer();

            mainPage.AddTab <SquareRootPageModel>("SquareRoot", "Calculator.png");
            mainPage.AddTab <FluentPageModel>("Fluent", "Edit.png");
            mainPage.AddTab <BookListPageModel>("BookList", "Contacts.png");

            MainPage = mainPage;
        }
Пример #24
0
        public App()
        {
            InitializeComponent();

            //var tabsXaml = new TabbedPage();
            //tabsXaml.Children.Add(new TracksPage { Title = "Tracks", Icon = "tracks.png" });
            //tabsXaml.Children.Add(new PlayHistoryPage { Title = "Queue", Icon = "queue.png" });
            //tabsXaml.Children.Add(new SettingsPage { Title = "Settings", Icon = "settings.png" });
            //MainPage = FreshPageModelResolver.ResolvePageModel<TracksPageModel>();
            ////MainPage = tabsXaml;

            //FreshMvvm Tabbed Page
            //https://forums.xamarin.com/discussion/65571/freshmvvm-nagivation-with-tabbedpage
            var tabbedNavigation = new FreshTabbedNavigationContainer("MediaFarmer Mobile");

            tabbedNavigation.AddTab <TracksPageModel>("Track Search", "tracks.png");
            tabbedNavigation.AddTab <PlayHistoryPageModel>("Queue", "queue.png");
            tabbedNavigation.AddTab <SettingsPageModel>("Settings", "settings.png");
            MainPage = tabbedNavigation;
        }
Пример #25
0
        public App()
        {
            InitializeComponent();

            var tabbedNavigation = new FreshTabbedNavigationContainer(NavContainerName);

            tabbedNavigation.AddTab <CategoriesPageModel> ("Categories", null);
            MainPage = tabbedNavigation;

            //MainPage = new MainPage();
        }
Пример #26
0
        public void SetUpMainNavigation()
        {
            if (!string.IsNullOrEmpty(Preferences.Get("accesstoken", "")))
            {
                var tabbedNavigation = new FreshTabbedNavigationContainer("secondNavPage");
                tabbedNavigation.AddTab <HomePageModel>("Home", "Home1.png", null);
                tabbedNavigation.AddTab <TeamPageModel>("Team", "Team1.png", null);
                tabbedNavigation.AddTab <EventsPageModel>("Events", "Contact1.png", null);
                tabbedNavigation.AddTab <ResourcesPageModel>("Resources", "Other1.png", null);
                MainPage = tabbedNavigation;
            }

            else if (string.IsNullOrEmpty(Preferences.Get("useremail", "")) && string.IsNullOrEmpty(Preferences.Get("password", "")))
            {
                //StartPageModel
                var mainPage            = FreshPageModelResolver.ResolvePageModel <LoginPageModel>();
                var navigationContainer = new FreshNavigationContainer(mainPage, "login");
                MainPage = navigationContainer;
            }
        }
Пример #27
0
        public App()
        {
            InitializeComponent();

            var masterDetailsMultiple = new MasterDetailPage();

            var menuPage = FreshPageModelResolver.ResolvePageModel <MenuPageModel>();

            masterDetailsMultiple.Master = menuPage;

            var container = new FreshTabbedNavigationContainer();

            container.AddTab <MainPageModel>("", "icon_home.png", null);
            container.AddTab <MainPageModel>("", "icon_search.png", null);
            container.AddTab <MainPageModel>("", "icon_bell.png", null);
            container.AddTab <MainPageModel>("", "icon_dm.png", null);

            masterDetailsMultiple.Detail = container;

            MainPage = masterDetailsMultiple;
        }
        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");
        }
Пример #29
0
        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;
            }
        }
Пример #30
0
        public App()
        {
            FreshIOC.Container.Register<IActivityService, ActivityService> ();

            //var page = FreshPageModelResolver.ResolvePageModel<ActivityListPageModel> ();
            //var basicNavContainer = new FreshNavigationContainer (page);
            //MainPage = basicNavContainer;

            var tabbedNavigation = new FreshTabbedNavigationContainer ();
            tabbedNavigation.AddTab<ActivityListPageModel> ("Activities", null);
            MainPage = tabbedNavigation;

            //			MainPage = new NavigationPage(page);
        }
Пример #31
0
        // This is called after database is downloaded and extracted
        private void DisplayMainPage()
        {
            FreshIOC.Container.Register <IStorehouseService, StorehouseService>();

            Device.BeginInvokeOnMainThread(() =>
            {
                if (Device.RuntimePlatform != Device.iOS)
                {
                    MainPage = new SplitViewPage();
                    MainPage.On <Windows>().SetToolbarPlacement(ToolbarPlacement.Top);
                }
                else
                {
                    var tabbedNavigation = new FreshTabbedNavigationContainer(Guid.NewGuid().ToString());
                    tabbedNavigation.AddTab <BiblePageModel>(GetLanguageValue("Bible", "圣经"), "TabBible.png", null);
                    tabbedNavigation.AddTab <SongBookPageModel>(GetLanguageValue("“Sing Out Joyfully”", "高声欢唱"), "TabSongbook.png", null);
                    tabbedNavigation.AddTab <PublicationsPageModel>(GetLanguageValue("Publications", "出版物"), "TabPublications.png", null);
                    tabbedNavigation.AddTab <DictionaryPageModel>(GetLanguageValue("Dictionary", "字典"), "TabDictionary.png", null);
                    tabbedNavigation.AddTab <SettingsPageModel>(GetLanguageValue("Settings", "设置"), "TabSettings.png", null);
                    MainPage = tabbedNavigation;
                }
            });
        }
Пример #32
0
        public App()
        {
            FreshIOC.Container.Register <IActivityService, ActivityService> ();

            //var page = FreshPageModelResolver.ResolvePageModel<ActivityListPageModel> ();
            //var basicNavContainer = new FreshNavigationContainer (page);
            //MainPage = basicNavContainer;

            var tabbedNavigation = new FreshTabbedNavigationContainer();

            tabbedNavigation.AddTab <ActivityListPageModel> ("Activities", null);
            MainPage = tabbedNavigation;

//			MainPage = new NavigationPage(page);
        }
Пример #33
0
        protected override void OnStart()
        {
            //xlarge screens are at least 960dp x 720dp
            //large screens are at least 640dp x 480dp
            //normal screens are at least 470dp x 320dp
            //small screens are at least 426dp x 320dp

            float dens = DependencyService.Get <IDisplaySize>().GetDensity();
            int   wd = DependencyService.Get <IDisplaySize>().GetWidthDiP();
            int   hd = DependencyService.Get <IDisplaySize>().GetHeightDiP();
            int   bigger, smaller;

            if (wd > hd) //landscape
            {
                bigger  = wd;
                smaller = hd;
            }
            else //portrait
            {
                bigger  = hd;
                smaller = wd;
            }

            if (Device.Idiom == TargetIdiom.Tablet)
            {
                if (smaller >= 500 && smaller < 700) //SW500
                {
                    StatusPageSW500 sp = new StatusPageSW500();
                    sp.Title = Translation.GetString("Status");
                    FreshMvvm.FreshPageModelResolver.BindingPageModel(null, sp, StatusVM);
                    MainPage = new NavigationPage(sp);

                    TorLogPageSW500 tlp = new TorLogPageSW500();
                    tlp.Title = Translation.GetString("Tor log");
                    FreshMvvm.FreshPageModelResolver.BindingPageModel(null, tlp, TorLogVM);

                    CountriesPageSW500 cap = new CountriesPageSW500();
                    cap.Title = Translation.GetString("Countries");
                    FreshMvvm.FreshPageModelResolver.BindingPageModel(null, cap, CountriesVM);

                    CitiesPageSW500 cip = new CitiesPageSW500();
                    cip.Title = Translation.GetString("Cities");
                    FreshMvvm.FreshPageModelResolver.BindingPageModel(null, cip, CitiesVM);
                }
            }

            if (Device.Idiom == TargetIdiom.Phone)
            {
                if (smaller >= 500) //SW500
                {
                    StatusPageSW500 sp = new StatusPageSW500();
                    sp.Title = Translation.GetString("Status");
                    FreshMvvm.FreshPageModelResolver.BindingPageModel(null, sp, StatusVM);
                    MainPage = new NavigationPage(sp);

                    TorLogPageSW500 tlp = new TorLogPageSW500();
                    tlp.Title = Translation.GetString("Tor log");
                    FreshMvvm.FreshPageModelResolver.BindingPageModel(null, tlp, TorLogVM);

                    CountriesPageSW500 cap = new CountriesPageSW500();
                    cap.Title = Translation.GetString("Countries");
                    FreshMvvm.FreshPageModelResolver.BindingPageModel(null, cap, CountriesVM);

                    CitiesPageSW500 cip = new CitiesPageSW500();
                    cip.Title = Translation.GetString("Cities");
                    FreshMvvm.FreshPageModelResolver.BindingPageModel(null, cip, CitiesVM);

                    AboutPage ap = new AboutPage();
                    ap.Title = Translation.GetString("About");
                    FreshMvvm.FreshPageModelResolver.BindingPageModel(null, ap, AboutVM);
                }
                else
                {
                    if (smaller >= 400) //SW400
                    {
                        if (wd > hd)
                        {
                            StatusPagePhoneL       = new StatusPageSW400();
                            StatusPagePhoneL.Title = Translation.GetString("Status");
                            FreshMvvm.FreshPageModelResolver.BindingPageModel(null, StatusPagePhoneL, StatusVM);
                            Application.Current.MainPage.Navigation.PopAsync();
                            MainPage = new NavigationPage(StatusPagePhoneL);
                            StatusPagePhoneL.DisplayPosition = DisplayPos.Landscape;
                        }
                        else
                        {
                            /*
                             * StatusPagePhoneP = new StatusPageSW400p();
                             * StatusPagePhoneP.Title = Translation.GetString("Status");
                             * FreshMvvm.FreshPageModelResolver.BindingPageModel(null, StatusPagePhoneP, StatusVM);
                             * Application.Current.MainPage.Navigation.PopAsync();
                             * MainPage = new NavigationPage(StatusPagePhoneP);
                             * StatusPagePhoneP.DisplayPosition = DisplayPos.Portrait;
                             */
                            var tabbedNavigation = new FreshTabbedNavigationContainer();

                            StatusPageSW400p tab1 = new StatusPageSW400p();
                            FreshMvvm.FreshPageModelResolver.BindingPageModel(null, tab1, StatusVM);

                            tabbedNavigation.AddTab()
                            tabbedNavigation.AddTab <CountriesViewModel>("Countries", null);
                            MainPage = tabbedNavigation;
                        }

                        TorLogPageSW400 tlp = new TorLogPageSW400();
                        tlp.Title = Translation.GetString("Tor log");
                        FreshMvvm.FreshPageModelResolver.BindingPageModel(null, tlp, TorLogVM);

                        CountriesPageSW400 cap = new CountriesPageSW400();
                        cap.Title = Translation.GetString("Countries");
                        FreshMvvm.FreshPageModelResolver.BindingPageModel(null, cap, CountriesVM);

                        CitiesPageSW400 cip = new CitiesPageSW400();
                        cip.Title = Translation.GetString("Cities");
                        FreshMvvm.FreshPageModelResolver.BindingPageModel(null, cip, CitiesVM);

                        AboutPageSW400 ap = new AboutPageSW400();
                        ap.Title = Translation.GetString("About");
                        FreshMvvm.FreshPageModelResolver.BindingPageModel(null, ap, AboutVM);
                    }
                    else
                    {
                        if (smaller >= 300) //SW300
                        {
                            if (wd > hd)
                            {
                                StatusPagePhoneL       = new StatusPageSW300();
                                StatusPagePhoneL.Title = Translation.GetString("Status");
                                FreshMvvm.FreshPageModelResolver.BindingPageModel(null, StatusPagePhoneL, StatusVM);
                                Application.Current.MainPage.Navigation.PopAsync();
                                MainPage = new NavigationPage(StatusPagePhoneL);
                                StatusPagePhoneL.DisplayPosition = DisplayPos.Landscape;
                            }
                            else
                            {
                                /*
                                 * StatusPagePhoneP = new StatusPageSW300p();
                                 * StatusPagePhoneP.Title = Translation.GetString("Status");
                                 * FreshMvvm.FreshPageModelResolver.BindingPageModel(null, StatusPagePhoneP, StatusVM);
                                 * Application.Current.MainPage.Navigation.PopAsync();
                                 */
                                var tabbedNavigation = new FreshTabbedNavigationContainer();
                                tabbedNavigation.AddTab <StatusViewModel>("Status", null);
                                tabbedNavigation.AddTab <CountriesViewModel>("Countries", null);
                                MainPage = tabbedNavigation;
                                //MainPage = new NavigationPage(StatusPagePhoneP);
                                //StatusPagePhoneP.DisplayPosition = DisplayPos.Portrait;
                            }

                            /*
                             * StatusPageSW300 sp = new StatusPageSW300();
                             * sp.Title = Translation.GetString("Status");
                             * FreshMvvm.FreshPageModelResolver.BindingPageModel(null, sp, StatusVM);
                             * MainPage = new NavigationPage(sp);*/

                            TorLogPageSW300 tlp = new TorLogPageSW300();
                            tlp.Title = Translation.GetString("Tor log");
                            FreshMvvm.FreshPageModelResolver.BindingPageModel(null, tlp, TorLogVM);

                            CountriesPageSW300 cap = new CountriesPageSW300();
                            cap.Title = Translation.GetString("Countries");
                            FreshMvvm.FreshPageModelResolver.BindingPageModel(null, cap, CountriesVM);

                            CitiesPageSW300 cip = new CitiesPageSW300();
                            cip.Title = Translation.GetString("Cities");
                            FreshMvvm.FreshPageModelResolver.BindingPageModel(null, cip, CitiesVM);

                            AboutPageSW300 ap = new AboutPageSW300();
                            ap.Title = Translation.GetString("About");
                            FreshMvvm.FreshPageModelResolver.BindingPageModel(null, ap, AboutVM);
                        }
                        else //small (< 300) SW200
                        {
                            //
                        }
                    }
                }
            }
            if (Device.Idiom != TargetIdiom.Tablet && Device.Idiom != TargetIdiom.Phone) //something strange
            {
                if (smaller < 700)
                {
                    if (smaller >= 500) //SW500
                    {
                        StatusPageSW500 sp = new StatusPageSW500();
                        sp.Title = Translation.GetString("Status");
                        FreshMvvm.FreshPageModelResolver.BindingPageModel(null, sp, StatusVM);
                        MainPage = new NavigationPage(sp);

                        TorLogPageSW500 tlp = new TorLogPageSW500();
                        tlp.Title = Translation.GetString("Tor log");
                        FreshMvvm.FreshPageModelResolver.BindingPageModel(null, tlp, TorLogVM);

                        CountriesPageSW500 cap = new CountriesPageSW500();
                        cap.Title = Translation.GetString("Countries");
                        FreshMvvm.FreshPageModelResolver.BindingPageModel(null, cap, CountriesVM);

                        CitiesPageSW500 cip = new CitiesPageSW500();
                        cip.Title = Translation.GetString("Cities");
                        FreshMvvm.FreshPageModelResolver.BindingPageModel(null, cip, CitiesVM);
                    }
                    else
                    {
                        if (smaller >= 400) //SW400
                        {
                            if (wd > hd)
                            {
                                StatusPagePhoneL       = new StatusPageSW400();
                                StatusPagePhoneL.Title = Translation.GetString("Status");
                                FreshMvvm.FreshPageModelResolver.BindingPageModel(null, StatusPagePhoneL, StatusVM);
                                Application.Current.MainPage.Navigation.PopAsync();
                                MainPage = new NavigationPage(StatusPagePhoneL);
                                StatusPagePhoneL.DisplayPosition = DisplayPos.Landscape;
                            }
                            else
                            {
                                StatusPagePhoneP       = new StatusPageSW400p();
                                StatusPagePhoneP.Title = Translation.GetString("Status");
                                FreshMvvm.FreshPageModelResolver.BindingPageModel(null, StatusPagePhoneP, StatusVM);
                                Application.Current.MainPage.Navigation.PopAsync();
                                MainPage = new NavigationPage(StatusPagePhoneP);
                                StatusPagePhoneP.DisplayPosition = DisplayPos.Portrait;
                            }

                            TorLogPageSW400 tlp = new TorLogPageSW400();
                            tlp.Title = Translation.GetString("Tor log");
                            FreshMvvm.FreshPageModelResolver.BindingPageModel(null, tlp, TorLogVM);

                            CountriesPageSW400 cap = new CountriesPageSW400();
                            cap.Title = Translation.GetString("Countries");
                            FreshMvvm.FreshPageModelResolver.BindingPageModel(null, cap, CountriesVM);

                            CitiesPageSW400 cip = new CitiesPageSW400();
                            cip.Title = Translation.GetString("Cities");
                            FreshMvvm.FreshPageModelResolver.BindingPageModel(null, cip, CitiesVM);

                            AboutPageSW400 ap = new AboutPageSW400();
                            ap.Title = Translation.GetString("About");
                            FreshMvvm.FreshPageModelResolver.BindingPageModel(null, ap, AboutVM);
                        }
                        else
                        {
                            if (smaller >= 300) //SW300
                            {
                                if (wd > hd)
                                {
                                    StatusPagePhoneL       = new StatusPageSW300();
                                    StatusPagePhoneL.Title = Translation.GetString("Status");
                                    FreshMvvm.FreshPageModelResolver.BindingPageModel(null, StatusPagePhoneL, StatusVM);
                                    Application.Current.MainPage.Navigation.PopAsync();
                                    MainPage = new NavigationPage(StatusPagePhoneL);
                                    StatusPagePhoneL.DisplayPosition = DisplayPos.Landscape;
                                }
                                else
                                {
                                    StatusPagePhoneP       = new StatusPageSW300p();
                                    StatusPagePhoneP.Title = Translation.GetString("Status");
                                    FreshMvvm.FreshPageModelResolver.BindingPageModel(null, StatusPagePhoneP, StatusVM);
                                    Application.Current.MainPage.Navigation.PopAsync();
                                    MainPage = new NavigationPage(StatusPagePhoneP);
                                    StatusPagePhoneP.DisplayPosition = DisplayPos.Portrait;
                                }

                                /*
                                 * StatusPageSW300 sp = new StatusPageSW300();
                                 * sp.Title = Translation.GetString("Status");
                                 * FreshMvvm.FreshPageModelResolver.BindingPageModel(null, sp, StatusVM);
                                 * MainPage = new NavigationPage(sp);*/

                                TorLogPageSW300 tlp = new TorLogPageSW300();
                                tlp.Title = Translation.GetString("Tor log");
                                FreshMvvm.FreshPageModelResolver.BindingPageModel(null, tlp, TorLogVM);

                                CountriesPageSW300 cap = new CountriesPageSW300();
                                cap.Title = Translation.GetString("Countries");
                                FreshMvvm.FreshPageModelResolver.BindingPageModel(null, cap, CountriesVM);

                                CitiesPageSW300 cip = new CitiesPageSW300();
                                cip.Title = Translation.GetString("Cities");
                                FreshMvvm.FreshPageModelResolver.BindingPageModel(null, cip, CitiesVM);

                                AboutPageSW300 ap = new AboutPageSW300();
                                ap.Title = Translation.GetString("About");
                                FreshMvvm.FreshPageModelResolver.BindingPageModel(null, ap, AboutVM);
                            }
                            else //small (< 300) SW200
                            {
                                //
                            }
                        }
                    }
                }
            }
        }
Пример #34
0
        protected virtual void CreateMenuPage(string menuPageTitle, string menuIcon = null)
        {
            _masterView = new MasterView();
            _listView   = _masterView.FindByName <ListView>("ListView");

            var source = Pages.GroupBy(item => item.Group).Select(item => new Grouping <string, LazyLoadedPage>(item.Key, item.ToList())).ToList();

            _listView.ItemTapped += (sender, args) =>
            {
                var lazyLoadedPage = args.Item as LazyLoadedPage;

                if (Pages.Contains(lazyLoadedPage))
                {
                    Page page          = lazyLoadedPage.Page;
                    int  tabGroupIndex = lazyLoadedPage.TabGroupIndex;

                    if (page == null)
                    {
                        page = ResolvePage(lazyLoadedPage);
                    }

                    Detail = page;

                    if (tabGroupIndex > 0)
                    {
                        var tabbedNavigationPage = new FreshTabbedNavigationContainer();

                        switch (tabGroupIndex)
                        {
                        case 1:
                            tabbedNavigationPage.AddTab <ContactListViewModel>("Contacts 1", "Icon.png");
                            tabbedNavigationPage.AddTab <BlankViewModel>("Contacts 2", "Icon.png");
                            tabbedNavigationPage.AddTab <BlankViewModel>("Contacts 3", "Icon.png");
                            Detail = tabbedNavigationPage;
                            break;

                        case 2:
                            tabbedNavigationPage.AddTab <TabViewModel>("Tab 1", "Icon.png");
                            tabbedNavigationPage.AddTab <BlankViewModel>("Tab 2", "Icon.png");
                            Detail = tabbedNavigationPage;
                            break;
                        }
                    }
                }

                IsPresented = false;
            };

            var navPage = new NavigationPage(_masterView)
            {
                Title = menuPageTitle
            };

            //adding an actual icon does't seem to work. The unicode here is a temporarily solution

            if (!string.IsNullOrEmpty(menuIcon))
            {
                navPage.Icon = menuIcon;
                Icon         = menuIcon;
            }

            Master = navPage;
        }