Example #1
0
        public App()
        {
            InitializeComponent();

            // Configure and register the MVVM Light NavigationService
            var nav = new ViewNavigationService();

            SimpleIoc.Default.Register <IViewNavigationService>(() => nav);

            nav.Configure(ViewModelLocator.HomePageKey, typeof(HomePage));

            nav.Configure(ViewModelLocator.DashboardPageKey, typeof(DashboardPage));

            //nav.Configure(ViewModelLocator.TabOnePageKey, typeof(TabOnePage));

            var locator = new ViewModelLocator();

            SimpleIoc.Default.Register <ViewModelLocator>(() => locator);

            var mainPage = nav.SetRootPage(ViewModelLocator.HomePageKey);

            //var mainPage = nav.SetRootPage(ViewModelLocator.TabOnePageKey);

            MainPage = mainPage;
        }
Example #2
0
        public App()
        {
            try
            {
                InitializeComponent();
                Constants.InitConstatns();
                InitCryptMethod();

                CrossMultilingual.Current.CurrentCultureInfo = new CultureInfo(SelectedLanguage.ToLower());
                AppResources.Culture = CrossMultilingual.Current.CurrentCultureInfo;

                NavigationService.Configure("MainPage", typeof(MainPage));
                NavigationService.Configure("DetailsPage", typeof(DetailsPage));
                NavigationService.Configure("SettingsPage", typeof(SettingsPage));
                NavigationService.Configure("LoginPage", typeof(LoginPage));
                NavigationService.Configure("PasswordChangePage", typeof(PasswordChangePage));
                NavigationService.Configure("PasswordSetPage", typeof(PasswordSetPage));
                NavigationService.Configure("AboutPage", typeof(AboutPage));
                NavigationService.Configure("HelpPage", typeof(HelpPage));

                if (!IsUserLoggedIn)
                {
                    if (!string.IsNullOrWhiteSpace(UserPassword))
                    {
                        MainPage = NavigationService.SetRootPage("LoginPage");
                    }
                    else
                    {
                        MainPage = NavigationService.SetRootPage("PasswordSetPage");
                    }
                }
                else
                {
                    MainPage = NavigationService.SetRootPage("MainPage");
                }
            }
            catch (Exception ex)
            {
                UserDialogsService.DisplayException(ex);
            }
        }