public async Task GoBackToRootAsync_PopsToRoot()
        {
            var navigationService = new PageNavigationServiceMock(null, null, null);
            var rootPage          = new Xamarin.Forms.NavigationPage();

            ((IPageAware)navigationService).Page = rootPage;

            var page1 = new ContentPageMock()
            {
                Title = "Page 1"
            };
            await rootPage.Navigation.PushAsync(page1);

            await rootPage.Navigation.PushAsync(new ContentPageMock()
            {
                Title = "Page 2"
            });

            await rootPage.Navigation.PushAsync(new ContentPageMock()
            {
                Title = "Page 3"
            });

            await rootPage.Navigation.PushAsync(new ContentPageMock()
            {
                Title = "Page 4"
            });

            Assert.True(rootPage.Navigation.NavigationStack.Count == 4);

            await navigationService.GoBackToRootAsync();

            Assert.Equal(1, rootPage.Navigation.NavigationStack.Count);
            Assert.Equal(page1, rootPage.Navigation.NavigationStack[0]);
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:SigobMobile.App"/> class.
        /// </summary>
        public App()
        {
            InitializeComponent();
            //Settings.Token = Settings.DbToken = Settings.InstitutionLogo =  string.Empty;
            if (string.IsNullOrEmpty(Settings.Token))
            {
                var navPage = new Xamarin.Forms.NavigationPage(new LoginPage());
                navPage.On <Xamarin.Forms.PlatformConfiguration.iOS>().SetPrefersLargeTitles(true);
                navPage.On <Xamarin.Forms.PlatformConfiguration.iOS>().SetLargeTitleDisplay(LargeTitleDisplayMode.Automatic);
                this.MainPage = navPage;
            }
            else
            {
                var mainViewModel = MainViewModel.GetInstance();

                mainViewModel.Token   = Settings.Token;
                mainViewModel.DbToken = Settings.DbToken;

                //Load Master Detail with ApplicationsPage
                mainViewModel.Menu         = new MenuViewModel();
                mainViewModel.Applications = new ApplicationsViewModel()
                {
                    IsRefreshing = false
                };
                var mainSigobPage = new MasterDetailSigobPage();
                //NavigatePage properties IphoneX
                Xamarin.Forms.NavigationPage navDetailPage = (Xamarin.Forms.NavigationPage)mainSigobPage.Detail;
                navDetailPage.On <Xamarin.Forms.PlatformConfiguration.iOS>().SetPrefersLargeTitles(false);
                navDetailPage.On <Xamarin.Forms.PlatformConfiguration.iOS>().SetLargeTitleDisplay(LargeTitleDisplayMode.Never);
                Xamarin.Forms.Application.Current.MainPage = mainSigobPage;
            }
        }
Beispiel #3
0
        public App()
        {
            InitializeComponent();
            Debug.WriteLine("---> Application InitializeComponent");

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

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

            var tabbedPage = new Xamarin.Forms.TabbedPage
            {
                Children =
                {
                    accelerometerPage,
                    gyroscopePage,
                    settingsNavigationPage
                }
            };

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

            MainPage = tabbedPage;
        }
Beispiel #5
0
        public App()
        {
            InitializeComponent();

            var navigationPage = new Xamarin.Forms.NavigationPage(new MainPage());

            MainPage = navigationPage;
        }
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            View      itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.Card, parent, false);
            var       MainPage = new Xamarin.Forms.NavigationPage();
            ImageView img      = itemView.FindViewById <ImageView>(Resource.Id.thumbnail);

            return(new DestinationViewHolder(itemView, OnClick));
        }
Beispiel #7
0
 public App()
 {
     InitializeComponent();
     if (Xamarin.Forms.Device.OS == Xamarin.Forms.TargetPlatform.Windows)
     {
         Resources["TitleVisible"] = false;
     }
     MainPage = new Xamarin.Forms.NavigationPage(new FlexGridSamples());
 }
Beispiel #8
0
        public App()
        {
            InitializeComponent();

            var navigationPage = new Xamarin.Forms.NavigationPage(new Views.Clientes.ListagemView());

            navigationPage.On <Xamarin.Forms.PlatformConfiguration.iOS>().SetPrefersLargeTitles(true);
            //MainPage = navigationPage;
            MainPage = new MainPageView();
        }
Beispiel #9
0
        // Constructor de la clase
        public App()
        {
            InitializeComponent();

            // Asignacion de la propiedad "MainPage"
            var pagina = new Xamarin.Forms.NavigationPage(new MainPage());

            pagina.CurrentPage.Title = "Consola movil";

            MainPage = pagina;
        }
Beispiel #10
0
        public App()
        {
            var navigationPage = new Xamarin.Forms.NavigationPage(new NewsPage())
            {
                BarBackgroundColor = ColorConstants.NavigationBarBackgroundColor,
                BarTextColor       = ColorConstants.NavigationBarTextColor
            };

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

            MainPage = navigationPage;
        }
        public App()
        {
            var navigationPage = new Xamarin.Forms.NavigationPage(new GraphQLPage())
            {
                BarBackgroundColor = Xamarin.Forms.Color.FromHex("#3498db"),
                BarTextColor       = Xamarin.Forms.Color.White
            };

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

            MainPage = navigationPage;
        }
Beispiel #12
0
        public App()
        {
            Xamarin.Forms.Device.SetFlags(new[] { "Markup_Experimental" });

            var navigationPage = new Xamarin.Forms.NavigationPage(new GraphQLPage())
            {
                BarBackgroundColor = Xamarin.Forms.Color.FromHex("#3498db"),
                BarTextColor       = Xamarin.Forms.Color.White
            };

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

            MainPage = navigationPage;
        }
Beispiel #13
0
        public App()
        {
            Xamarin.Forms.Device.SetFlags(new[] { "Markup_Experimental" });

            var navigationPage = new Xamarin.Forms.NavigationPage(new NewsPage())
            {
                BarBackgroundColor = ColorConstants.NavigationBarBackgroundColor,
                BarTextColor       = ColorConstants.NavigationBarTextColor
            };

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

            MainPage = navigationPage;
        }
Beispiel #14
0
        public App()
        {
            InitializeComponent();

            //            var page = new NavigationPageClientesViews();
            //            page.On<Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true);
            //            MainPage = new Xamarin.Forms.NavigationPage(new NavigationPageClientesView()); ;

            var navigationPage = new Xamarin.Forms.NavigationPage(new MasterDetailPageView());

            navigationPage.On <Xamarin.Forms.PlatformConfiguration.iOS>().SetPrefersLargeTitles(true);
            navigationPage.BarBackgroundColor = Color.Red;
            navigationPage.BarTextColor       = Color.White;

            MainPage = navigationPage;
        }
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            //net.azurewebsites.aiscm.WebService1 w = new net.azurewebsites.aiscm.WebService1();
            //string s = w.HelloWorld();
            //System.Diagnostics.Debug.WriteLine(s);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            OxyPlot.Xamarin.Forms.Platform.Android.PlotViewRenderer.Init();
            LoadApplication(new App());
            System.Diagnostics.Debug.WriteLine("Email===");
            System.Diagnostics.Debug.WriteLine(Global_portable.email);
            // Global_portable.email = "*****@*****.**";
            //Global_portable.email = "*****@*****.**";
            if (Global_portable.email != null)
            {
                var intent = new Intent(this, typeof(RegistrationIntentService));
                StartService(intent);
                switch (Global_portable.user_id)
                {
                //system admin
                case 1:
                    //Xamarin.Forms.NavigationPage np1 = new Xamarin.Forms.NavigationPage(new homepage());

                    break;

                //farmer login
                case 2:
                    Xamarin.Forms.NavigationPage np2 = new Xamarin.Forms.NavigationPage(new index());
                    break;

                //manufacturing company login
                case 3:
                    Xamarin.Forms.NavigationPage np3 = new Xamarin.Forms.NavigationPage(new CropMarketView());
                    break;
                    //market admin login
                }
            }
            else
            {
                StartActivity(typeof(Login));
            }
        }
Beispiel #16
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            OxyPlot.Xamarin.Forms.Platform.Android.PlotViewRenderer.Init();
            LoadApplication(new App());
            System.Diagnostics.Debug.WriteLine("Email===");
            System.Diagnostics.Debug.WriteLine(Global_portable.email);
            if (Global_portable.email != null)
            {
                var intent = new Intent(this, typeof(RegistrationIntentService));
                StartService(intent);
                switch (Global_portable.user_id)
                {
                //system admin
                case 1:
                    //Xamarin.Forms.NavigationPage np1 = new Xamarin.Forms.NavigationPage(new homepage());
                    break;

                //farmer login
                case 2:
                    System.Diagnostics.Debug.WriteLine("inside...");
                    Xamarin.Forms.NavigationPage np2 = new Xamarin.Forms.NavigationPage(new index());
                    break;

                //manufacturing company login
                case 3:
                    System.Diagnostics.Debug.WriteLine("here");
                    Xamarin.Forms.NavigationPage np3 = new Xamarin.Forms.NavigationPage(new CropMarketView());
                    break;
                    //market admin login
                }
            }
            else
            {
                StartActivity(typeof(Login));
            }
        }
Beispiel #17
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            OxyPlot.Xamarin.Forms.Platform.Android.PlotViewRenderer.Init();
            LoadApplication(new App());
            if (Global_portable.email != null)
            {
                Xamarin.Forms.NavigationPage np = new Xamarin.Forms.NavigationPage(new homepage());
            }
            else
            {
                StartActivity(typeof(Login));
            }
            //StartActivity(typeof(Login));
        }
Beispiel #18
0
        /// <summary>
        /// Navigate to Detail Page selected in MenuPage
        /// </summary>
        private async Task Navigate()
        {
            App.Master.IsPresented = false;
            var mainViewModel = MainViewModel.GetInstance();
            await App.Navigator.PopToRootAsync(false);

            switch (this.PageName)
            {
            case "SecurityPage":
                mainViewModel.Security = new SecurityViewModel();
                await App.Navigator.PushAsync(new SecurityPage(), true);

                break;

            case "WebViewHelpPage":
            case "WebViewTermsPage":
            case "WebViewContactPage":
                mainViewModel.UrlViewer = new UrlViewerViewModel(this.Url);
                await App.Navigator.PushAsync(new UrlViewerPage()
                {
                    Title = this.Title
                }, true);

                break;

            case "LoginPage":
                //Delete persist token values
                Settings.Token      = Settings.DbToken = Settings.InstitutionLogo = Settings.FullName = Settings.OfficeCode = string.Empty;
                mainViewModel.Token = mainViewModel.DbToken = string.Empty;
                //Navigate to Login
                mainViewModel.Login = new LoginViewModel();
                var navLoginPage = new Xamarin.Forms.NavigationPage(new LoginPage());
                navLoginPage.On <Xamarin.Forms.PlatformConfiguration.iOS>().SetPrefersLargeTitles(true);
                navLoginPage.On <Xamarin.Forms.PlatformConfiguration.iOS>().SetLargeTitleDisplay(LargeTitleDisplayMode.Automatic);
                Xamarin.Forms.Application.Current.MainPage = navLoginPage;
                break;

            default:
                break;
            }
        }
Beispiel #19
0
        public static FPage ToPage(this View view, bool allowNav = true)
        {
            var handler = view.GetOrCreateViewHandler();

            var vc = new HotUIPage {
                Content = new HotUIContainerView(view),
            };

            if (view.BuiltView is NavigationView nav && allowNav)
            {
                var navController = new Xamarin.Forms.NavigationPage(vc);
                nav.PerformNavigate = (toView) => {
                    //Since iOS doesn't allow nested navigations, pass the navigate along
                    if (toView is NavigationView newNav)
                    {
                        newNav.PerformNavigate = nav.PerformNavigate;
                    }
                    navController.PushAsync(toView.ToPage(false), true);
                };
                return(navController);
            }
            return(vc);
        }
Beispiel #20
0
        public App(RestApiStatusPage restApiStatusPage, GraphQLApiStatusPage graphQLApiStatusPage)
        {
            var restStatusNavigationPage = new Xamarin.Forms.NavigationPage(restApiStatusPage);

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

            var graphQLStatusNavigationPage = new Xamarin.Forms.NavigationPage(graphQLApiStatusPage);

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

            var tabbedPage = new Xamarin.Forms.TabbedPage
            {
                Children =
                {
                    restApiStatusPage,
                    graphQLApiStatusPage
                }
            };

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

            MainPage = tabbedPage;
        }
Beispiel #21
0
 public App()
 {
     MainPage = new Xamarin.Forms.NavigationPage(new CollectionViewSamples());
 }
Beispiel #22
0
            static async Task navigateToSettingsPage(Xamarin.Forms.NavigationPage mainNavigationPage, SettingsPage settingsPage)
            {
                await mainNavigationPage.PopToRootAsync();

                await mainNavigationPage.PushAsync(settingsPage);
            }
Beispiel #23
0
 public App()
 {
     MainPage = new Xamarin.Forms.NavigationPage(new GaugeSamples());
 }
 public App()
 {
     MainPage = new Xamarin.Forms.NavigationPage(new GaugeSamples());
 }
 public App()
 {
     InitializeComponent();
     MainPage = new Xamarin.Forms.NavigationPage(new CollectionViewSamples());
 }
 public App()
 {
     InitializeComponent();
     MainPage = new Xamarin.Forms.NavigationPage(new GaugeSamples());
 }
        public async Task GoBackToRootAsync_PopsToRoot_INavigationAware_Destroy()
        {
            var recorder          = new PageNavigationEventRecorder();
            var navigationService = new PageNavigationServiceMock(null, null, null);
            var rootPage          = new Xamarin.Forms.NavigationPage();

            ((IPageAware)navigationService).Page = rootPage;

            var page1 = new ContentPageMock(recorder)
            {
                Title = "Page 1"
            };
            await rootPage.Navigation.PushAsync(page1);

            var page2 = new ContentPageMock(recorder)
            {
                Title = "Page 2"
            };
            var page2ViewModel = page2.BindingContext;
            await rootPage.Navigation.PushAsync(page2);

            var page3 = new ContentPageMock(recorder)
            {
                Title = "Page 3"
            };
            var page3ViewModel = page3.BindingContext;
            await rootPage.Navigation.PushAsync(page3);

            var page4 = new ContentPageMock(recorder)
            {
                Title = "Page 4"
            };
            var page4ViewModel = page4.BindingContext;
            await rootPage.Navigation.PushAsync(page4);

            Assert.True(rootPage.Navigation.NavigationStack.Count == 4);

            await navigationService.GoBackToRootAsync();

            Assert.Equal(1, rootPage.Navigation.NavigationStack.Count);
            Assert.Equal(page1, rootPage.Navigation.NavigationStack[0]);
            Assert.Equal(16, recorder.Records.Count);

            //root
            var record = recorder.TakeFirst();

            Assert.Equal(page1, record.Sender);
            Assert.Equal(PageNavigationEvent.OnNavigatingTo, record.Event);

            record = recorder.TakeFirst();
            Assert.Equal(page1.BindingContext, record.Sender);
            Assert.Equal(PageNavigationEvent.OnNavigatingTo, record.Event);

            //page 4
            record = recorder.TakeFirst();
            Assert.Equal(page4, record.Sender);
            Assert.Equal(PageNavigationEvent.OnNavigatedFrom, record.Event);

            record = recorder.TakeFirst();
            Assert.Equal(page4ViewModel, record.Sender);
            Assert.Equal(PageNavigationEvent.OnNavigatedFrom, record.Event);

            record = recorder.TakeFirst();
            Assert.Equal(page4, record.Sender);
            Assert.Equal(PageNavigationEvent.Destroy, record.Event);

            record = recorder.TakeFirst();
            Assert.Equal(page4ViewModel, record.Sender);
            Assert.Equal(PageNavigationEvent.Destroy, record.Event);

            //page 3
            record = recorder.TakeFirst();
            Assert.Equal(page3, record.Sender);
            Assert.Equal(PageNavigationEvent.OnNavigatedFrom, record.Event);

            record = recorder.TakeFirst();
            Assert.Equal(page3ViewModel, record.Sender);
            Assert.Equal(PageNavigationEvent.OnNavigatedFrom, record.Event);

            record = recorder.TakeFirst();
            Assert.Equal(page3, record.Sender);
            Assert.Equal(PageNavigationEvent.Destroy, record.Event);

            record = recorder.TakeFirst();
            Assert.Equal(page3ViewModel, record.Sender);
            Assert.Equal(PageNavigationEvent.Destroy, record.Event);

            //page 2
            record = recorder.TakeFirst();
            Assert.Equal(page2, record.Sender);
            Assert.Equal(PageNavigationEvent.OnNavigatedFrom, record.Event);

            record = recorder.TakeFirst();
            Assert.Equal(page2ViewModel, record.Sender);
            Assert.Equal(PageNavigationEvent.OnNavigatedFrom, record.Event);

            record = recorder.TakeFirst();
            Assert.Equal(page2, record.Sender);
            Assert.Equal(PageNavigationEvent.Destroy, record.Event);

            record = recorder.TakeFirst();
            Assert.Equal(page2ViewModel, record.Sender);
            Assert.Equal(PageNavigationEvent.Destroy, record.Event);

            //root
            record = recorder.TakeFirst();
            Assert.Equal(page1, record.Sender);
            Assert.Equal(PageNavigationEvent.OnNavigatedTo, record.Event);

            record = recorder.TakeFirst();
            Assert.Equal(page1.BindingContext, record.Sender);
            Assert.Equal(PageNavigationEvent.OnNavigatedTo, record.Event);
        }
Beispiel #28
0
 public App()
 {
     MainPage = new Xamarin.Forms.NavigationPage(new FlexGridSamples());
 }