void ConnectionButtonClique(object sender, EventArgs args)
        {
            var tabbedPage = new Xamarin.Forms.TabbedPage();

            tabbedPage.Children.Add(new Localisation());
            tabbedPage.Children.Add(new Paramètres());

            tabbedPage.BarBackgroundColor = Color.White;
            tabbedPage.BackgroundColor    = Color.White;
            tabbedPage.UnselectedTabColor = Color.FromHex("#5A5A5A");
            tabbedPage.SelectedTabColor   = Color.FromHex("#646BEB");
            tabbedPage.BarTextColor       = Color.FromHex("#5A5A5A");

            tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);

            // Unsubscribe events
            MessagingCenter.Unsubscribe <BLEService, BLEDevice>(this, "deviceDiscovered");
            MessagingCenter.Unsubscribe <BLEService>(this, "deviceConnected");
            MessagingCenter.Unsubscribe <BLEService>(this, "deviceConnectionLost");
            MessagingCenter.Unsubscribe <BLEService>(this, "deviceDisconnected");
            MessagingCenter.Unsubscribe <BLEService, BluetoothStateChangedArgs>(this, "stateChanged");
            MessagingCenter.Unsubscribe <BLEService>(this, "scanTimeoutElapsed");
            MessagingCenter.Unsubscribe <BLEService>(this, "characteristicUpdated");

            App.Current.MainPage = tabbedPage;
        }
        private void CreateTabedPageAsRoot()
        {
            var tab1 = CreateTab1();

            var tab2 = CreateTab2();

            var tab3 = CreateTab3();

            // The root page of your application
            _tabbedPage = new TabbedPage
            {
                Title    = "Tab badge sample",
                Children =
                {
                    tab1,
                    tab2,
                    tab3
                }
            };

            if (this._bootomPlacementSwitch.IsToggled)
            {
                _tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
            }

            _tabbedPage.ToolbarItems.Add(new ToolbarItem("Item1", "tabicon.png", () => { }, ToolbarItemOrder.Primary));
            MainPage = new NavigationPage(_tabbedPage);
        }
Beispiel #3
0
        public App()
        {
            InitializeComponent();
            var visualChallengePage = new VisualChallengePage()
            {
                Icon = "home.png"
            };
            var tabbedPage = new Xamarin.Forms.TabbedPage
            {
                Visual = VisualMarker.Material
            };

            tabbedPage.Effects.Add(Effect.Resolve("VisualChallenge.NoShiftEffect"));
            tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
            tabbedPage.Children.Add(visualChallengePage);
            NavigationPage.SetHasBackButton(visualChallengePage, false);
            tabbedPage.Children.Add(new ContentPage
            {
                Icon = "search.png"
            });
            tabbedPage.Children.Add(new ContentPage
            {
                Icon = "bell.png"
            });
            tabbedPage.Children.Add(new ContentPage
            {
                Icon = "message.png"
            });
            MainPage = new MasterDetailPage()
            {
                Master = new MasterPage(),
                Detail = tabbedPage
            };
            NavigationPage.SetHasNavigationBar(tabbedPage, false);
        }
Beispiel #4
0
        public App()
        {
            InitializeComponent();
            var tabbedPage = new Xamarin.Forms.TabbedPage();

            tabbedPage.On <Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
            tabbedPage.BarBackgroundColor = Color.White;
            tabbedPage.Children.Add(new MainPage()
            {
                Title = "标题", Icon = "Icon.png"
            });
            tabbedPage.Children.Add(new MainPage()
            {
                Title = "标题", Icon = "Icon.png"
            });
            tabbedPage.Children.Add(new MainPage()
            {
                Title = "标题", Icon = "Icon.png"
            });
            tabbedPage.Children.Add(new MainPage()
            {
                Title = "标题", Icon = "Icon.png"
            });
            tabbedPage.Children.Add(new MainPage()
            {
                Title = "标题", Icon = "Icon.png"
            });
            MainPage = tabbedPage;
        }
 private void btnLogout_Clicked(object sender, EventArgs e)
 {
     Xamarin.Forms.TabbedPage tabbedPage = new Xamarin.Forms.TabbedPage();
     tabbedPage.Children.Add(new LoginPage());
     tabbedPage.Children.Add(new SignUpPage());
     App.Current.MainPage = tabbedPage;
 }
        public void PageBehaviorFactorySetsTabbedPageTitle()
        {
            var app = CreateApp();
            var pageBehaviorFactory = app.Container.Resolve <IPageBehaviorFactory>();

            var tabbedPage = new TabbedPage();

            tabbedPage.Children.Add(new ContentPage {
                Title = "Page 1"
            });
            tabbedPage.Children.Add(new ContentPage {
                Title = "Page 2"
            });
            tabbedPage.Children.Add(new ContentPage {
                Title = "Page 3"
            });

            pageBehaviorFactory.ApplyPageBehaviors(tabbedPage);

            Assert.Equal("Page 1", tabbedPage.Title);

            tabbedPage.CurrentPage = tabbedPage.Children[1];

            Assert.Equal("Page 2", tabbedPage.Title);

            tabbedPage.CurrentPage = tabbedPage.Children[2];

            Assert.Equal("Page 3", tabbedPage.Title);
        }
Beispiel #7
0
        public App()
        {
            FFImageLoading.ImageService.Instance.Initialize(new FFImageLoading.Config.Configuration
            {
                HttpHeadersTimeout = 60
            });

            var tabbedPage = new Xamarin.Forms.TabbedPage
            {
                Title          = "My Weather",
                BindingContext = new WeatherViewModel(),
                Children       =
                {
                    new WeatherView(),
                    new ForecastView()
                }
            };

            tabbedPage.On <Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);

            if (Device.RuntimePlatform is Device.Android)
            {
                tabbedPage.BarBackgroundColor = Color.FromHex("1FAECE");
            }

            var navigationPage = new Xamarin.Forms.NavigationPage(tabbedPage)
            {
                BarBackgroundColor = Color.FromHex("1FAECE"),
                BarTextColor       = Color.White
            };

            navigationPage.On <iOS>().SetPrefersLargeTitles(true);

            MainPage = navigationPage;
        }
Beispiel #8
0
        public App()
        {
            var settingsNavigationPage = new Xamarin.Forms.NavigationPage(new SettingsPage())
            {
                Icon  = "Settings",
                Title = "Settings",
                BarBackgroundColor = Color.White,
                BarTextColor       = Color.Black
            };

            settingsNavigationPage.On <Xamarin.Forms.PlatformConfiguration.iOS>().SetPrefersLargeTitles(true);

            var tabbedPage = new Xamarin.Forms.TabbedPage
            {
                Children =
                {
                    new VotePage(),
                    settingsNavigationPage
                }
            };

            tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
            tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetBarItemColor(Color.Gray);
            tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetBarSelectedItemColor(Color.Black);

            MainPage = tabbedPage;
        }
        private void InitializeTabbed(TabPageInitializer[] pagesSet)
        {
            var tabbedPage = new TabbedPage();

            tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);

            foreach (var item in pagesSet)
            {
                if (item.IsNavigationPage)
                {
                    tabbedPage.Children.Add(new NavigationPage(GetInitializedPage(item.Page.ToString()))
                    {
                        Title = item.Title, Icon = item.Icon
                    });
                }
                else
                {
                    var page = GetInitializedPage(item.Page.ToString());
                    page.Title = item.Title;
                    page.Icon  = item.Icon;

                    tabbedPage.Children.Add(page);
                }
            }

            Application.Current.MainPage = tabbedPage;
        }
        private void InternalAddPageToTabbedPage(PageContainer pageContainer, TabbedPage tabbedPage)
        {
            var viewModelType = pageContainer.ViewModel;
            var page          = _resolve.CreatePage(viewModelType.GetType());

            tabbedPage.Children.Add(pageContainer.IsNavigationPage ? new NavigationPage(page) : page);
            pageContainer.ViewModel.InternalInitialize(pageContainer.Parameter);
        }
Beispiel #11
0
        public override void ApplyTabbedPageBehaviors(Xamarin.Forms.TabbedPage page)
        {
            base.ApplyTabbedPageBehaviors(page);
            page.SetValue(Xamarin.Forms.NavigationPage.BarBackgroundColorProperty, Color.DarkBlue);

            // Platform specific
            page.On <Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
        }
Beispiel #12
0
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.TabbedPage> e)
        {
            base.OnElementChanged(e);

            if (!(GetChildAt(0) is ViewGroup layout))
            {
                return;
            }

            if (!(layout.GetChildAt(1) is BottomNavigationView bottomNavView))
            {
                return;
            }

            if (e.NewElement != null)
            {
                tabbedPage           = e.NewElement as CustomTabbedPage;
                bottomNavigationView = (GetChildAt(0) as Android.Widget.RelativeLayout).GetChildAt(1) as BottomNavigationView;
                bottomNavigationView.NavigationItemSelected += BottomNavigationView_NavigationItemSelected;

                //Call to remove animation
                SetShiftMode(bottomNavigationView, false, false);

                fontFamily = ((CustomTabbedPage)e.NewElement).FontFamily + ".ttf";
                //Call to change the font
                try { ChangeFont(); }
                catch (Exception) { }

                //Set shadow
                var topShadow    = LayoutInflater.From(Context).Inflate(Resource.Layout.view_shadow, null);
                var layoutParams = new Android.Widget.RelativeLayout.LayoutParams(LayoutParams.MatchParent, 15);
                layoutParams.AddRule(LayoutRules.Above, bottomNavView.Id);
                layout.AddView(topShadow, 2, layoutParams);
            }

            if (e.OldElement != null)
            {
                bottomNavigationView.NavigationItemSelected -= BottomNavigationView_NavigationItemSelected;
            }

            for (int i = 0; i < Element.Children.Count; i++)
            {
                var item = bottomNavigationView.Menu.GetItem(i);
                var icon = item.Icon;
                if (icon != null)
                {
                    icon = Android.Support.V4.Graphics.Drawable.DrawableCompat.Wrap(icon);
                    if (i == 0)
                    {
                        icon.SetColorFilter(tabbedPage.SelectedTabColor.ToAndroid(), PorterDuff.Mode.SrcIn);
                    }
                    else
                    {
                        icon.SetColorFilter(tabbedPage.UnselectedTabColor.ToAndroid(), PorterDuff.Mode.SrcIn);
                    }
                }
            }
        }
Beispiel #13
0
        Page BuildRootView()
        {
            var barBackgroundColor = Color.FromHex("#2196F3");

            var tabbed = new Xamarin.Forms.TabbedPage()
            {
                BarBackgroundColor = barBackgroundColor,
                BarTextColor       = Color.White,
                UnselectedTabColor = Color.FromHex("#184d79"),
                SelectedTabColor   = Color.White,
            };

            //Free
            var freeViewModel = new FreeFontsViewModel();

            var xamlFree = new XamlPage(freeViewModel);
            var codeFree = new CodePage(freeViewModel);

            var pages = new List <FontPageBase>
            {
                xamlFree,
                codeFree
            };

            if (ProFontsLoaded())
            {
                var proViewModel = new ProFontsViewModel();

                var xamlPro = new XamlPage(proViewModel);
                var codePro = new CodePage(proViewModel);

                pages.Add(xamlPro);
                pages.Add(codePro);
            }

            pages.Add(new MiscPage());

            foreach (var page in pages)
            {
                var nav = new NavigationPage(page)
                {
                    BarBackgroundColor = barBackgroundColor,
                    Title           = page.Title,
                    IconImageSource = new FontImageSource()
                    {
                        Glyph      = page.Glyph,
                        FontFamily = page.FontFamily,
                        Size       = Device.GetNamedSize(NamedSize.Medium, typeof(Xamarin.Forms.Button))
                    }
                };

                tabbed.Children.Add(nav);
            }

            tabbed.On <Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);

            return(tabbed);
        }
Beispiel #14
0
 private void Cleanup(TabbedPage page)
 {
     if (page == null)
     {
         return;
     }
     _bottomTabStrip       = null;
     _bottomNavigationView = null;
 }
Beispiel #15
0
        protected override bool OnBackButtonPressed()
        {
            Xamarin.Forms.TabbedPage tabbedPage = new Xamarin.Forms.TabbedPage();
            tabbedPage.Children.Add(new LoginPage());
            tabbedPage.Children.Add(new SignUpPage());
            App.Current.MainPage = tabbedPage;

            //return base.OnBackButtonPressed();
            return(true);
        }
        public static Page GetChildPageWithTransform(this Xamarin.Forms.TabbedPage parentTabbedPage, int tabIndex)
        {
            if (tabIndex < 0)
            {
                return(null);
            }

            var element = parentTabbedPage.Children[tabIndex];

            return(GetPageWithTransform(element));
        }
        public void SetUseBottomTabs()
        {
            Xamarin.Forms.Mocks.MockForms.Init(Device.Android);
            var _ = new Xamarin.Forms.Application();
            IPageBehaviorFactory factory = new ExtendedPageBehaviorFactory(new DefaultPageBehaviorFactoryOptions());

            var page = new TabbedPage();

            ConfigurePage(page);
            factory.ApplyPageBehaviors(page);

            Assert.Equal(ToolbarPlacement.Bottom, AndroidTabbedPage.GetToolbarPlacement(page));
        }
        public void AddsChildTitleBehavior()
        {
            Xamarin.Forms.Mocks.MockForms.Init();
            var _ = new Xamarin.Forms.Application();
            IPageBehaviorFactory factory = new ExtendedPageBehaviorFactory(new DefaultPageBehaviorFactoryOptions());

            var page = new TabbedPage();

            ConfigurePage(page);
            factory.ApplyPageBehaviors(page);

            Assert.Contains(page.Behaviors, b => b.GetType() == typeof(TabbedPageChildTitleBehavior));
        }
Beispiel #19
0
        public App()
        {
            InitializeComponent();

            Xamarin.Forms.TabbedPage tabbedPage = new Xamarin.Forms.TabbedPage();
            tabbedPage.Children.Add(new LoginPage());
            tabbedPage.Children.Add(new SignUpPage());
            tabbedPage.On <Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
            MainPage = new NavigationPage(tabbedPage);
            //MainPage = new MainMasterDetailPage();


            //MainPage = new NavigationPage( new ClientSearchPage() );
        }
Beispiel #20
0
        protected async Task ConfigureApplication(IServiceFactory container)
        {
            var tabbed = new Xamarin.Forms.TabbedPage();

            tabbed.SelectedTabColor = Utility.PRIMARYBRIGHT_COLOR;
            tabbed.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);

            tabbed.Children.Add(CreateTab(container.GetInstance <HuntsView>(), "Jaktloggen", "Tabbar/gevir.png"));
            tabbed.Children.Add(CreateTab(container.GetInstance <SetupView>(), "Oppsett", "Tabbar/hunters.png"));
            tabbed.Children.Add(CreateTab(container.GetInstance <StatsView>(), "Statistikk", "Tabbar/stats.png"));
            tabbed.Children.Add(CreateTab(container.GetInstance <InfoView>(), "Info", "Tabbar/info.png"));

            _application.MainPage = tabbed;
            await Task.CompletedTask;
        }
        public void SetsTitleBinding()
        {
            Xamarin.Forms.Mocks.MockForms.Init();
            var _ = new Xamarin.Forms.Application();
            IPageBehaviorFactory factory = new ExtendedPageBehaviorFactory(new DefaultPageBehaviorFactoryOptions());

            var page = new TabbedPage
            {
                BindingContext = new DefaultViewModel()
            };

            ConfigurePage(page);
            factory.ApplyPageBehaviors(page);

            Assert.True(page.IsSet(Xamarin.Forms.Page.TitleProperty));
        }
 private static ElementHandler CreateHandler(XF.Element parent, MobileBlazorBindingsRenderer renderer)
 {
     return(parent switch
     {
         XF.ContentPage contentPage => new ContentPageHandler(renderer, contentPage),
         XF.ContentView contentView => new ContentViewHandler(renderer, contentView),
         XF.Label label => new LabelHandler(renderer, label),
         XF.FlyoutPage flyoutPage => new FlyoutPageHandler(renderer, flyoutPage),
         XF.ScrollView scrollView => new ScrollViewHandler(renderer, scrollView),
         XF.ShellContent shellContent => new ShellContentHandler(renderer, shellContent),
         XF.Shell shell => new ShellHandler(renderer, shell),
         XF.ShellItem shellItem => new ShellItemHandler(renderer, shellItem),
         XF.ShellSection shellSection => new ShellSectionHandler(renderer, shellSection),
         XF.TabbedPage tabbedPage => new TabbedPageHandler(renderer, tabbedPage),
         _ => new ElementHandler(renderer, parent),
     });
        private async Task InternalNavigateToTabbedAsync(IList <PageContainer> pageContainers, TabbedPage tabbedPage = null, bool hasNavBar = true)
        {
            if (pageContainers.Count > 1)
            {
                if (tabbedPage == null)
                {
                    tabbedPage = new TabbedPage();
                }
                tabbedPage.CurrentPageChanged += async(sender, args) =>
                {
                    var currentPage = ((TabbedPage)sender).CurrentPage;
                    if (currentPage is NavigationPage navigationPage)
                    {
                        var firstPage = navigationPage.Navigation.NavigationStack.FirstOrDefault();
                        if (firstPage == null)
                        {
                            return;
                        }
                        currentPage = firstPage;
                    }
                    if (!(currentPage.BindingContext is BaseViewModel viewModel))
                    {
                        return;
                    }
                    var pageContainer = pageContainers.FirstOrDefault(x => x.ViewModel.GetType() == viewModel.GetType());
                    var parameter     = pageContainer?.Parameter;
                    viewModel.InternalInitialize(parameter);
                };
                foreach (var pageContainer in pageContainers)
                {
                    var viewModelType = pageContainer.ViewModel;
                    var page          = _resolve.CreatePage(viewModelType.GetType());
                    tabbedPage.Children.Add(pageContainer.IsNavigationPage ? new NavigationPage(page) : page);
                }
                var navigation = Application.Current.MainPage;
                if (navigation != null)
                {
                    await navigation.Navigation.PushModalAsync(hasNavBar?(Page) new NavigationPage(tabbedPage) : tabbedPage);
                }

                else
                {
                    Application.Current.MainPage = tabbedPage;
                }
            }
        }
        public App()
        {
            InitializeComponent();

            Xamarin.Forms.TabbedPage tabbedPage = new Xamarin.Forms.TabbedPage();
            tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
            // On<Xamarin.Forms.PlatformConfiguration.Android>).SetToolbarPlacement(ToolbarPlacement.Bottom);
            //var mainPage = new MainPage();
            NavigationPage navigationPage = new NavigationPage(new MainPage());

            navigationPage.IconImageSource = "phone_icon.ico";
            navigationPage.Title           = "Phone";
            tabbedPage.Children.Add(navigationPage);
            tabbedPage.Children.Add(new WoundPage());
            tabbedPage.Children.Add(new SmartWatchPage());
            tabbedPage.Children.Add(new BluetoothList());
            MainPage = tabbedPage;
        }
        protected override void OnElementChanged(ElementChangedEventArgs <TabbedPage> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                tabbedPage           = e.NewElement as Xamarin.Forms.TabbedPage;
                bottomNavigationView = (GetChildAt(0) as Android.Widget.RelativeLayout).GetChildAt(1) as BottomNavigationView;
                bottomNavigationView.NavigationItemSelected += BottomNavigationView_NavigationItemSelected;

                //Call to change the font
                ChangeFont();
            }

            if (e.OldElement != null)
            {
                bottomNavigationView.NavigationItemSelected -= BottomNavigationView_NavigationItemSelected;
            }
        }
Beispiel #26
0
        private void Cleanup(TabbedPage page)
        {
            if (page == null)
            {
                return;
            }

            foreach (var tab in page.Children.Select(c => c.GetPageWithBadge()))
            {
                tab.PropertyChanged -= OnTabbedPagePropertyChanged;
            }

            page.ChildRemoved -= OnTabRemoved;
            page.ChildAdded   -= OnTabAdded;

            BadgeViews.Clear();
            _topTabLayout   = null;
            _topTabStrip    = null;
            _bottomTabStrip = null;
        }
Beispiel #27
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            ViewModels.SplashScreenViewModel splashScreenViewModel = new ViewModels.SplashScreenViewModel();

            var isLoggedIn = await splashScreenViewModel.Login();

            if (isLoggedIn)
            {
                App.Current.MainPage = new MainMasterDetailPage();
            }
            else
            {
                Xamarin.Forms.TabbedPage tabbedPage = new Xamarin.Forms.TabbedPage();
                tabbedPage.Children.Add(new LoginPage());
                tabbedPage.Children.Add(new SignUpPage());
                tabbedPage.On <Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
                App.Current.MainPage = new NavigationPage(tabbedPage);
            }
        }
Beispiel #28
0
        private void Cleanup(Xamarin.Forms.TabbedPage page)
        {
            if (page == null)
            {
                return;
            }

            foreach (var tab in page.Children.Select(c => c.GetPageWithBadge()))
            {
                if (tab != null)
                {
                    tab.PropertyChanged -= OnTabbedPagePropertyChanged;
                }
            }

            page.ChildRemoved -= OnTabRemoved;
            page.ChildAdded   -= OnTabAdded;
            BadgeViews.Clear();
            _bottomTabStrip       = null;
            _bottomNavigationView = null;
        }
        protected override void ApplyTabbedPageBehaviors(TabbedPage page)
        {
            base.ApplyTabbedPageBehaviors(page);

            if (page.BindingContext is DefaultViewModel)
            {
                page.SetBinding(Page.TitleProperty, new Binding {
                    Path = "Title"
                });
            }

            if (_options.UseBottomTabs && !PlatformSpecifics.GetUseExplicit(page))
            {
                AndroidTabbedPage.SetToolbarPlacement(page, Xamarin.Forms.PlatformConfiguration.AndroidSpecific.ToolbarPlacement.Bottom);
            }

            if (_options.UseChildTitle)
            {
                page.Behaviors.Add(new TabbedPageChildTitleBehavior());
            }
        }
        private void CreateTabedPageWithNavigationPageChildren()
        {
            var tab1 = CreateTab1();
            var tab2 = CreateTab2();
            var tab3 = CreateTab3();

            var tab1NavigationPage = new NavigationPage(tab1)
            {
                Title = tab1.Title, IconImageSource = tab1.IconImageSource
            };
            var tab2NavigationPage = new NavigationPage(tab2)
            {
                Title = tab2.Title, IconImageSource = tab2.IconImageSource
            };
            var tab3NavigationPage = new NavigationPage(tab3)
            {
                Title = tab3.Title, IconImageSource = tab3.IconImageSource
            };


            // The root page of your application
            _tabbedPage = new TabbedPage
            {
                Title    = "Tab badge sample",
                Children =
                {
                    tab1NavigationPage,
                    tab2NavigationPage,
                    tab3NavigationPage,
                }
            };

            if (this._bootomPlacementSwitch.IsToggled)
            {
                _tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
            }

            MainPage = _tabbedPage;
        }