public PurposeMasterDetailPage()
        {
            try
            {
                App.Navigator = Navigation;
                NavigationPage.SetHasNavigationBar(this, false);
                Master = new MenuPage();

                PurposeColor.Database.ApplicationSettings AppSettings = App.Settings;
                PurposeColor.Model.GlobalSettings globalSettings = null;

				if (AppSettings != null )
				{
					globalSettings = AppSettings.GetAppGlobalSettings();
				}
				bool isUserLoggedIn = false;
				if(App.Current.Properties.ContainsKey("IsLoggedIn"))
				{
					isUserLoggedIn = (bool)App.Current.Properties["IsLoggedIn"];
				}

				if(isUserLoggedIn)
				{
					App.IsLoggedIn = true;
					UpdateBurgerMenuList();
					Detail = new NavigationPage(new FeelingNowPage());
				}
				else if ( AppSettings.GetUser() != null && AppSettings.GetUser().UserId != null)
				{
					App.IsLoggedIn = true;
					UpdateBurgerMenuList();
					Detail = new NavigationPage(new FeelingNowPage());
				}
				else if ( (globalSettings == null || globalSettings.IsLoggedIn)  && AppSettings.GetUser() == null)
				{
					App.IsLoggedIn = false;
					UpdateBurgerMenuList();
					Detail = new NavigationPage(new LogInPage());
				}
				else if (globalSettings.ShowRegistrationScreen)
				{
					App.IsLoggedIn = false;
					UpdateBurgerMenuList();
					Detail = new NavigationPage(new RegistrationPageOne());
				}
				else
				{
					App.IsLoggedIn = false;
					UpdateBurgerMenuList();
					Detail = new NavigationPage(new LogInPage());
				}
            }
            catch (Exception ex)
            {
                var test = ex.Message;

                Detail = new NavigationPage(new LogInPage());
            }
        }
Пример #2
0
		public App()
		{


			deviceSpec = DependencyService.Get<IDeviceSpec>();
			screenHeight = deviceSpec.ScreenHeight;
			screenWidth = deviceSpec.ScreenWidth;
			screenDensity = deviceSpec.ScreenDensity;
			MediaArray = new List<MediaItem>();
			ContactsArray = new List<string>();
			ExtentionArray = new List<string>();
			NavigationPage.SetHasNavigationBar(this, false);
			nearByLocationsSource = new List<CustomListViewItem>();
			if (applicationSettings == null)
			{
				applicationSettings = new ApplicationSettings();
			}
			MenuPage menuPage = new MenuPage();
			burgerMenuItems = new ObservableCollection<MenuItems> ();
			masterPage = new PurposeMasterDetailPage();
			MainPage = masterPage;

		}