Beispiel #1
0
        public bool Redirect(RootPage root)
        {
            var lastPage = root?.VisitedPages.GetPreviousMenuType();

            if (lastPage != null)
            {
                root.NavigateAsync(lastPage.MenuType, true).GetAwaiter();
                return(true);
            }

            return(Exit());
        }
 private async Task OnExecuteAddContactCommand()
 {
     if (null == addContactMenuItem)
     {
         addContactMenuItem = new HomeMenuItem()
         {
             Id    = MenuItemType.AddContact,
             Title = UIConstants.AddContact
         };
     }
     await RootPage.NavigateFromMenu(addContactMenuItem);
 }
Beispiel #3
0
        public App()
        {
            InitializeComponent();

            var menuPage = new MenuPage();

            NavigationPage  = new NavigationPage(new HomePage());
            RootPage        = new RootPage();
            RootPage.Master = menuPage;
            RootPage.Detail = NavigationPage;
            MainPage        = RootPage;
        }
Beispiel #4
0
        async void ItemSelectedMethod(object itemSelected)
        {
            if (itemSelected == null)
            {
                return;
            }

            int id = (int)((HomeMenuItem)itemSelected).Id;

            RootPage = Application.Current.MainPage as MainPage;
            await RootPage.NavigateFromMenu(id);
        }
 public AudioPlayerPage(RootPage rootPage)
 {
     try
     {
         InitializeComponent();
         Init(rootPage);
     }
     catch (Exception ex)
     {
         var exceptionHandler = new ExceptionHandler(TAG, ex);
     }
 }
Beispiel #6
0
        /// <summary>
        ///     Handles the ListViewMenu selection changed event.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">The selected item changed event arguments.</param>
        /// <returns>A task to await.</returns>
        // ReSharper disable once UnusedParameter.Local
        protected async Task ListViewMenuOnItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            if (!(e?.SelectedItem is HomeMenuItem item))
            {
                return;
            }

            if (RootPage != null)
            {
                await RootPage.NavigateFromMenu(item.Id).ConfigureAwait(false);
            }
        }
 public RewardsPage(RootPage root)
 {
     try
     {
         InitializeComponent();
         Init(root);
     }
     catch (Exception)
     {
         //
     }
 }
    }                                                             //DON'T DO THIS,
                                                                  //FIND A BETTER WAY
    public App()
    {
        InitializeComponent();

        //NavigationPage = new NavigationPage(new MainPage());
        RootPage = new RootPage();
        MenuPage menuPage = new MenuPage(RootPage.vm);

        RootPage.Master = menuPage;
        RootPage.Detail = new NavigationPage(new MainPage());        // NavigationPage;
        MainPage        = RootPage;
    }
Beispiel #9
0
        //RootPage masterPage = new RootPage();
        public App()
        {
            //// The root page of your application
            //MainPage = new ContentPage
            //{
            //    Content = new StackLayout
            //    {
            //        VerticalOptions = LayoutOptions.Center,
            //        Children = {
            //            new Label {
            //                HorizontalTextAlignment = TextAlignment.Center,
            //                Text = "Welcome to Xamarin Forms!"
            //            }
            //        }
            //    }
            //};


            //
            //MainPage = new MapPage { Title = "Map/Zoom", Icon = "glyphish_74_location.png" };
            var tabs = new TabbedPage();

            // demonstrates the map control with zooming and map-types
            tabs.Children.Add(new MapPage {
                Title = "Map/Zoom", Icon = "glyphish_74_location.png"
            });

            // demonstrates the map control with zooming and map-types
            tabs.Children.Add(new PinPage {
                Title = "Pins", Icon = "glyphish_07_map_marker.png"
            });

            // demonstrates the Geocoder class
            tabs.Children.Add(new GeocoderPage {
                Title = "Geocode", Icon = "glyphish_13_target.png"
            });

            // opens the platform's native Map app
            //tabs.Children.Add(new MapAppPage { Title = "Map App", Icon = "glyphish_103_map.png" });

            //MainPage = tabs;
            //MainPage = new MainPage1();



            //var detailPage = new NavigationPage(new HomePage());
            //MainPage = new MasterPage();

            //var masterPage = MainPage as MasterDetailPage;
            //masterPage.Detail = detailPage;
            MainPage = new RootPage();
        }
Beispiel #10
0
        public App()
        {
            InitializeComponent();

            if (IsAuthenticated)
            {
                MainPage = new RootPage();
            }
            else
            {
                MainPage = new NavigationPage(new LoginView());
            }
        }
Beispiel #11
0
        public App()
        {
            InitializeComponent();

            if (Settings.LoggedIn)
            {
                MainPage = new RootPage();
            }
            else
            {
                MainPage = new LoginPage();
            }
        }
Beispiel #12
0
        private async void DisplayAlert()
        {
            RootPage Root = (RootPage)(Xamarin.Forms.Application.Current.MainPage);

            if (await Root.DisplayAlert(
                    StringResources.dialog_notconfigured_title,
                    String.Format(StringResources.dialog_notconfigured_message, serviceName),
                    StringResources.button_showdocs_caption,
                    StringResources.button_close_caption))
            {
                Root.MoveTo(serviceDocPage);
            }
        }
Beispiel #13
0
 public AudioPlayerPage(RootPage rootPage)
 {
     try
     {
         InitializeComponent();
         _devicePermissionServices = DependencyService.Get <IDevicePermissionServices>();
         Init(rootPage);
     }
     catch (Exception ex)
     {
         var exceptionHandler = new ExceptionHandler(TAG, ex);
     }
 }
 public FileExplorerPage(RootPage root)
 {
     try
     {
         InitializeComponent();
         this._model      = new FileExplorerViewModel();
         this._model.Root = root;
     }
     catch (Exception exception)
     {
         throw new NotImplementedException(exception.Message);
     }
 }
Beispiel #15
0
        public MenuPage(RootPage root)
        {
            this.root = root;
            InitializeComponent();
            if (!App.IsWindows10)
            {
                BackgroundColor = Color.FromHex("#03A9F4");
                ListViewMenu.BackgroundColor = Color.FromHex("#F5F5F5");
            }
            BindingContext = new BaseViewModel
            {
                Title    = "$safeprojectname$",
                Subtitle = "$safeprojectname$",
                Icon     = "slideout.png"
            };

            ListViewMenu.ItemsSource = menuItems = new List <HomeMenuItem>
            {
                new HomeMenuItem {
                    Title = "About", MenuType = MenuType.About, Icon = "about.png"
                },
                new HomeMenuItem {
                    Title = "Blog", MenuType = MenuType.Blog, Icon = "blog.png"
                },
                new HomeMenuItem {
                    Title = "Twitter", MenuType = MenuType.Twitter, Icon = "twitternav.png"
                },
                new HomeMenuItem {
                    Title = "Hanselminutes", MenuType = MenuType.Hanselminutes, Icon = "hm.png"
                },
                new HomeMenuItem {
                    Title = "Ratchet", MenuType = MenuType.Ratchet, Icon = "ratchet.png"
                },
                new HomeMenuItem {
                    Title = "Developers Life", MenuType = MenuType.DeveloperLife, Icon = "tdl.png"
                },
            };

            ListViewMenu.SelectedItem = menuItems[0];

            ListViewMenu.ItemSelected += async(sender, e) =>
            {
                if (ListViewMenu.SelectedItem == null)
                {
                    return;
                }

                await this.root.NavigateAsync(((HomeMenuItem)e.SelectedItem).MenuType);
            };
        }
Beispiel #16
0
        public App()
        {
            InitializeComponent();
            var menuPage = new MenuPage();

            NavigationPage = new NavigationPage(new HomePage())
            {
                BarBackgroundColor = Color.FromHex("#0ba5ff")
            };
            RootPage        = new RootPage();
            RootPage.Master = menuPage;
            RootPage.Detail = NavigationPage;
            MainPage        = RootPage;
        }
Beispiel #17
0
        private async void Button_Clicked(object sender, EventArgs e)
        {
            try
            {
                await viewModel.CadastraAsync();

                var root = new RootPage();
                App.Current.MainPage = root;
            }
            catch (AppException ex)
            {
                await ex.HandleAsync(this);
            }
        }
Beispiel #18
0
        public App()
        {
            InitializeComponent();
            SetInitialUser();

/*#if DEBUG
 *          AdminPrivilegies = true;
 #endif*/
            CrossConnectivity.Current.ConnectivityChanged += ConnectivityChanged;


            RootPage = new RootPage();
            MainPage = RootPage;// new TestPage();
        }
 public TrainingVideoPage(RootPage root)
 {
     try
     {
         InitializeComponent();
         this._model      = new TrainingVideoViewModel();
         this._model.Root = root;
         this.Init();
     }
     catch (Exception ex)
     {
         var m = ex;
     }
 }
Beispiel #20
0
        public App()
        {
            InitializeComponent();

            if (Properties.ContainsKey("FirstUse"))
            {
                MainPage = new RootPage();
            }
            else
            {
                Properties.Add("FirstUse", false);
                MainPage = new IntroHostPage();
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public async Task UpdateAsync()
        {
            await RootPage.SetParametersAsync(ParameterView.FromDictionary(new Dictionary <string, object>()
            {
                [nameof(RootPage.IsFullSide)]    = IsFullSide,
                [nameof(RootPage.IsFixedFooter)] = IsFixedFooter && ShowFooter,
                [nameof(RootPage.IsFixedHeader)] = IsFixedHeader,
                [nameof(RootPage.ShowFooter)]    = ShowFooter,
                [nameof(RootPage.UseTabSet)]     = UseTabSet
            }));

            // 获得 Razor 示例代码
            RootPage.Update();
        }
Beispiel #22
0
        public void ShowPopup(PopupExtended popup)
        {
            try
            {
                if (CurrentPopup != null)
                {
                    return;
                }

                if (popup.IsVisible == false)
                {
                    CurrentPopup = popup;
                    BackgroundLayout.BackgroundColor = popup.BackgroundLayerColor;



                    PopupControls.Add(popup.Content);



                    PopupContentLayout = popup.Content;

                    popup.Content = null;
                    grid.Children.Add(PopupControls[0]);



                    if (popup.CloseOnBackGroundClicked)
                    {
                        TapGestureRecognizer tapGestureRecognizer = new TapGestureRecognizer();
                        tapGestureRecognizer.Tapped += TapGestureRecognizer_Tapped;

                        boxView.GestureRecognizers.Add(tapGestureRecognizer);
                    }



                    popup.IsVisible            = true;
                    BackgroundLayout.IsVisible = true;
                    ShowEnterAnimation();

                    CurrentPopup.IsOpen = true;
                }
            }
            catch (Exception ex)
            {
                RootPage.DisplayAlert("Exception", ex.Message, "OK");
            }
        }
Beispiel #23
0
        /*
         * private static async void verificarLoja() {
         *  var lojaPage = await LojaUtils.gerarLoja();
         *  lojaPage.Appearing += (sender, e) => {
         *      PermissaoUtils.pedirPermissao();
         *  };
         *  if (lojaPage is ProdutoListaPage)
         *  {
         *      App.Current.MainPage = gerarRootPage(lojaPage);
         *  }
         *  else {
         *      App.Current.MainPage = new NavigationPage(lojaPage) {
         *          BarBackgroundColor = Estilo.Current.BarBackgroundColor,
         *          BarTextColor = Estilo.Current.BarTitleColor
         *      };
         *  }
         * }
         */

        public static Page gerarRootPage(Page mainPage)
        {
            var rootPage = new RootPage
            {
                NomeApp     = "Emagine Loja",
                PaginaAtual = mainPage,
                Menus       = gerarMenu()
            };

            rootPage.AoAtualizarMenu += (sender, e) =>
            {
                ((RootPage)sender).Menus = gerarMenu();
            };
            return(rootPage);
        }
		public App ()
		{
			var sqliteFilename = "phoenix_imperator_" + Version.Replace(".","_") + ".db3";
			string documentsPath = GetDocumentPath ();
			#if __ANDROID__
			var path = Path.Combine(documentsPath, sqliteFilename);
			#else
			string libraryPath = Path.Combine (documentsPath, "..", "Library"); // Library folder
			var path = Path.Combine(libraryPath, sqliteFilename);
			#endif
			_dbConnection = new SQLiteConnectionWithLock (DatabasePlatform, new SQLiteConnectionString (path, storeDateTimeAsTicks: true));
			Console.WriteLine("SQL Database: " + path);
			Phoenix.Application.Initialize (this, this, this, this);
			MainPage = new RootPage ();
		}
 public OgxSystemPage(RootPage root)
 {
     try
     {
         InitializeComponent();
         _model = new OGXViewModel()
         {
             Root = root
         };
         Init();
     }
     catch (Exception)
     {
     }
 }
Beispiel #26
0
        private async Task GoToContactList()
        {
            await RootPage.DisplayAlert("Add Contact", $"Contact '{Name.Value}' saved", "Hmmmm");

            if (null == contactListMenuItem)
            {
                contactListMenuItem = new HomeMenuItem()
                {
                    Id    = MenuItemType.ContactList,
                    Title = UIConstants.ContactList
                };
            }
            ResetForm();
            await RootPage.NavigateFromMenu(contactListMenuItem);
        }
Beispiel #27
0
        public MenuPage(RootPage root)
        {
            this.root = root;
            InitializeComponent();
            BackgroundColor = Color.FromHex("#03A9F4");
            ListViewMenu.BackgroundColor = Color.FromHex("#F5F5F5");
            Title          = "Home";
            BindingContext = new BaseViewModel
            {
                //Subtitle = App.User.FirstName + " " + App.User.LastName,
                //Title = App.User.SchoolName,
                Icon = "slideout.png"
            };
            // icon.Source = App.User.Image;

            ListViewMenu.ItemsSource = menuItems = new List <Models.MenuItem>
            {
                new Models.MenuItem {
                    Title = "Home", MenuType = MenuType.Home, Icon = "home.png"
                },
                //new Models.MenuItem { Title = "Time Table", MenuType = MenuType.TimeTable, Icon = "Attendance.png" },
                new Models.MenuItem {
                    Title = "Create CI Cards", MenuType = MenuType.CICards, Icon = "home.png"
                },
                ////new Models.MenuItem { Title = "Attendance", MenuType = MenuType.Attendance, Icon = "attendanceicon.png" },
                new Models.MenuItem {
                    Title = "My Cards", MenuType = MenuType.MyCards, Icon = "home.png"
                },
                new Models.MenuItem {
                    Title = "Profile", MenuType = MenuType.Profile, Icon = "ic_account_circle_black_24dp.png"
                },

                // new Models.MenuItem { Title = "Alerts", MenuType = MenuType.Alert, Icon = "AlertIcon.png" },
                new Models.MenuItem {
                    Title = "Sign Out", MenuType = MenuType.Signout, Icon = "signout.png"
                },
            };

            ListViewMenu.SelectedItem  = menuItems[0];
            ListViewMenu.ItemSelected += async(sender, e) =>
            {
                if (ListViewMenu.SelectedItem == null)
                {
                    return;
                }
                await this.root.NavigateAsync(((Models.MenuItem)e.SelectedItem).MenuType);
            };
        }
Beispiel #28
0
        public App(string databasePath)
        {
            InitializeComponent();

            DatabasePath = databasePath;

            NavigationPage = new NavigationPage(new OverviewPage());

            MenuPage = new MenuPage();
            RootPage = new RootPage
            {
                Master = MenuPage,
                Detail = NavigationPage
            };
            MainPage = RootPage;
        }
Beispiel #29
0
        public App()
        {
            var    sqliteFilename = "phoenix_imperator_" + Version.Replace(".", "_") + ".db3";
            string documentsPath  = GetDocumentPath();

                        #if __ANDROID__
            var path = Path.Combine(documentsPath, sqliteFilename);
                        #else
            string libraryPath = Path.Combine(documentsPath, "..", "Library");              // Library folder
            var    path        = Path.Combine(libraryPath, sqliteFilename);
                        #endif
            _dbConnection = new SQLiteConnectionWithLock(DatabasePlatform, new SQLiteConnectionString(path, storeDateTimeAsTicks: true));
            Console.WriteLine("SQL Database: " + path);
            Phoenix.Application.Initialize(this, this, this, this);
            MainPage = new RootPage();
        }
 public TestimonialPage(RootPage rootPage)
 {
     try
     {
         InitializeComponent();
         _model         = new TestimonialViewModel(App.CurrentApp.MainPage.Navigation);
         _model.Root    = rootPage;
         BindingContext = _model;
         Init();
     }
     catch (Exception ex)
     {
         DependencyService.Get <IMessage>().AlertAsync(TextResources.Alert,
                                                       ex.InnerException != null ? ex.InnerException.Message : ex.Message, TextResources.Ok);
     }
 }
Beispiel #31
0
        public App()
        {
            var service  = DependencyService.Get <ILoginService>();
            var dataUser = service.GetUserData();

            if (string.IsNullOrEmpty(dataUser))
            {
                MainPage = new LoginPage();
            }
            else
            {
                MainPage = new RootPage();
                var casheValue = JsonConvert.DeserializeObject <TokenModel>(dataUser.ToString());
                App.SetAuth(casheValue);
            }
        }
        private void RegisterBrainTreeHandlers()
        {
            Handle.GET("/braintree", () =>
            {
                RootPage master = (RootPage)Self.GET("/braintree/rootpage");
                return master;
            });

            Handle.GET("/braintree/rootpage", () =>
            {
                Session session = Session.Current;

                if (session != null && session.Data != null)
                    return session.Data;

                var standalone = new RootPage();

                if (session == null)
                {
                    session = new Session(SessionOptions.PatchVersioning);
                    standalone.Html = "/BrainTree/RootPage.html";
                }

                standalone.Session = session;
                return standalone;
            });

            Handle.GET("/braintree/settings", () =>
            {
                return Db.Scope(() =>
                {
                    RootPage master = (RootPage)Self.GET("/braintree/rootpage");

                    var page = new AppSettingsPage();

                    var settings = Db.SQL<BrainTreeSettings>("SELECT i FROM BrainTreeSettings i").First;

                    page.Settings.Enviroment.Items.Add(
                        new AppSettingsPage.SettingsJson.EnviromentJson.ItemsElementJson
                        {
                            Value = "Sandbox",
                            Text = "Sandbox"
                        });

                    page.Settings.Enviroment.Items.Add(
                        new AppSettingsPage.SettingsJson.EnviromentJson.ItemsElementJson
                        {
                            Value = "Production",
                            Text = "Production"
                        });

                    if (settings != null)
                    {
                        page.Settings.Enviroment.Selected = settings.Enviroment;
                        page.Settings.MerchantId = settings.MerchantId;
                        page.Settings.PrivateKey = settings.PrivateKey;
                        page.Settings.PublicKey = settings.PublicKey;
                    }

                    master.CurrentPage = page;

                    return master;
                });
            }, new HandlerOptions { SelfOnly = true });
        }
Beispiel #33
0
        public void RegisterWebShopHandlers()
        {
            var app = Application.Current;
            app.Use(new HtmlFromJsonProvider());
            app.Use(new PartialToStandaloneHtmlProvider());

            Handle.GET("/webshop/rootpage", () =>
            {
                Session session = Session.Current;

                if (session != null && session.Data != null)
                    return session.Data;

                var standalone = new RootPage();

                if (session == null)
                {
                    session = new Session(SessionOptions.PatchVersioning);
                    standalone.Html = "/Webshop/RootPage.html";
                }

                standalone.Session = session;
                return standalone;
            });

            Handle.GET("/webshop", () =>
            {
                RootPage master = (RootPage)Self.GET("/webshop/rootpage");
                master.CurrentPage = Db.Scope(() => {
                    var page = new ProductListPage
                    {
                        Html = "/Webshop/Partials/ProductsList/ProductListPage.html",
                        Data = new Order
                        {
                            Buyer = new Simplified.Ring1.Somebody
                            {
                                Name = "Buyer name"
                            },
                            Seller = new Simplified.Ring1.Somebody
                            {
                                Name = "Seller name"
                            },
                        }
                    };
                    page.RefreshProducts();
                    return page;
                });

                return master;
            });

            Handle.GET("/webshop/{?}", (long objectNo) => {

                RootPage master = (RootPage)Self.GET("/webshop/rootpage");

                master.CurrentPage = Db.Scope(() => {

                    var page = new ProductListPage
                    {
                        Html = "/Webshop/Partials/ProductsList/ProductListPage.html",
                        Data = Db.SQL<Order>("SELECT i FROM Simplified.Ring6.\"Order\" i WHERE i.ObjectNo = ?", objectNo).First,
                        ObjectNo = objectNo,
                        Products = Db.SQL<Product>("SELECT jk FROM Simplified.Ring3.Product jk")
                    };
                    return page;
                });

                return master;
            });

            Handle.GET("/webshop/basket/{?}", (long objectNo) => {

                RootPage master = (RootPage)Self.GET("/webshop/rootpage");

                master.CurrentPage = Db.Scope(() => {

                    var page = new BasketPage
                    {
                        Html = "/Webshop/Partials/BasketPages/BasketPage.html",
                        ObjectNo = objectNo,
                        Data = Db.SQL<Order>("SELECT i FROM Simplified.Ring6.\"Order\"  i WHERE i.ObjectNo = ?", objectNo).First
                    };

                    return page;

                });

                return master;
            });

            Handle.GET("/checkout/shipping/{?}", (long objectNo) =>
            {
                RootPage master = (RootPage)Self.GET("/webshop/rootpage");

                master.CurrentPage = Db.Scope(() =>
                {
                    var page = new ShippingInformationPage
                    {
                        Html = "/Webshop/Partials/CheckoutPages/ShippingInformationPage.html",
                        ObjectNo = objectNo,
                        Data = Db.SQL<Order>("SELECT i FROM Simplified.Ring6.\"Order\"  i WHERE i.ObjectNo = ?", objectNo).First
                    };

                    return page;
                });

                return master;
            });

            Handle.GET("/checkout/payment/{?}", (long objectNo) =>
            {

                RootPage master = (RootPage)Self.GET("/webshop/rootpage");

                master.CurrentPage = Db.Scope(() =>
                {
                    var page = new PaymentMethodsPage
                    {
                        Html = "/Webshop/Partials/CheckoutPages/PaymentMethodsPage.html",
                        Data = Db.SQL<Order>("SELECT i FROM Simplified.Ring6.\"Order\"  i WHERE i.ObjectNo = ?", objectNo).First,
                        ObjectNo = objectNo
                    };

                    return page;
                });

                return master;
            });

            Handle.GET("/checkout/summary/{?}", (long objectNo) =>
            {
                RootPage master = (RootPage)Self.GET("/webshop/rootpage");

                master.CurrentPage = Db.Scope(() =>
                {
                    var page = new CheckoutSummaryPage();
                    var order = Db.SQL<Order>("SELECT i FROM Simplified.Ring6.\"Order\" i WHERE i.ObjectNo = ?", objectNo).First;
                    page.Data = order;
                    if (order.IsPayed)
                    {
                        page.Result.Message = "Order is processing. Your payment was paid.";
                        page.Result.IsSuccessful = true;
                    }
                    else
                    {
                        page.Result.Message = "Order waiting for your payment.";
                        page.Result.IsSuccessful = false;
                    }

                    return page;
                });

                return master;
            });

            Handle.GET("/webshop/settings", () =>
            {
                RootPage master = (RootPage)Self.GET("/webshop/rootpage");
                master.CurrentPage = Db.Scope(() =>
                {
                    var page = new SettingPage
                    {
                        Html = "/Webshop/Partials/Settings/SettingPage.html"
                    };
                    page.LoadDefaultData();
                    return page;
                });
                return master;
            });
        }
		public App ()
		{
			// The root page of your application
			MainPage = new RootPage();
		}