public async void OnLoginClicked() { if (string.IsNullOrEmpty(Username) || string.IsNullOrEmpty(Password)) { DisplayCompleteFields(); } IsBusy = true; RestService userRestService = new RestService(); if (await userRestService.AuthWithCredentialsAsync(Username, Password)) { ApplicationUser user = await userRestService.GetUser(Username, Password); if (user != null) { Location loc = await GetCurrentLocation(); //user.UserLocLatitude = loc.Latitude; //user.UserLocLongitude = loc.Longitude; user.UserLocLatitude = 46.0733; user.UserLocLongitude = 23.5805; Preferences.Set("User", JsonConvert.SerializeObject(user)); await App.Current.MainPage.Navigation.PushAsync(new MainPage()); } else { DisplayApplicationError(); } } else { DisplayFailedLogin(); IsBusy = false; } }