Ejemplo n.º 1
0
        public App ()
		{
            InitializeComponent();


			//Eventsfired from the LoginPage to trigger actions here
			LoginPage.FacebookLoginSucceeded += LoginPage_LoginSucceeded;
            LoginPage.LoginCancelled += LoginPage_LoginCancelled;
			LoginPage.HowlOutLoginAttempted += SetHowlOutLogin;

            //This loads a user token if existent, or else it will load "null" 
            StoredToken = DependencyService.Get<HowlOut.App.ISaveAndLoad>().LoadText("token");
			StoredUserFacebookId = DependencyService.Get<HowlOut.App.ISaveAndLoad> ().LoadText ("userFacebookId");
			StoredApiKey = DependencyService.Get<HowlOut.App.ISaveAndLoad>().LoadText("StoredApiKey");

			System.Diagnostics.Debug.WriteLine ("STORED FACEBOOK ID");
			System.Diagnostics.Debug.WriteLine (StoredUserFacebookId);
            
			_dataManager = new DataManager();
			_dataManager.UtilityManager.updateLastKnownPosition ();

            if (!App.IsLoggedIn)
            {
				MainPage = new SignIn();
            }
            else
            {
				//CrossLocalNotifications.Current.Show ("Notifications works!!", "Nice",99,DateTime.Now.AddSeconds(30));
				coreView = new CoreView();
				MainPage = coreView;
				startProgram(coreView);
            }
		}
Ejemplo n.º 2
0
		private async Task startProgram(CoreView coreView)
		{
			userProfile = await _dataManager.ProfileApiManager.GetLoggedInProfile ();
			coreView.startCoreView ();
			//coreView.setContentView (new EventView(), "Event");

		}
Ejemplo n.º 3
0
		private async void LoginPage_LoginSucceeded(object sender, EventArgs e)
        {

           // await storeToken();

			var success = false;
			int tries = 0;

			while (!success)
			{

				Profile profile = new Profile() { ProfileId = StoredUserFacebookId, Name = StoredUserFacebookName, Age = 0, 
					SmallImageSource = "https://graph.facebook.com/v2.5/" + StoredUserFacebookId + "/picture?height=500&width=50",
					ImageSource = "https://graph.facebook.com/v2.5/" + StoredUserFacebookId + "/picture?height=100&width=100",
					LargeImageSource = "https://graph.facebook.com/v2.5/" + StoredUserFacebookId + "/picture?height=300&width=300"
				};
				success = await _dataManager.ProfileApiManager.CreateUpdateProfile(profile, true);

			}
			_dataManager = new DataManager();
			success = false;
			while (!success)
			{
				success = await _dataManager.ProfileApiManager.RegisterForNotifications(StoredNotificationToken);
				tries++;
				if (tries > 5) break;
			}


			coreView = new CoreView();
			coreView.token = StoredNotificationToken.DeviceToken + ", " + success;
			MainPage = coreView;
			startProgram(coreView);
			/*
			coreView = new CoreView();
			MainPage = coreView;
			coreView.setContentView (null, "SearchEvent");
			*/
        }