public async Task LogIn() { try { _duringOperation = true; NotifyOfPropertyChange(() => CanLogIn); LoginInfoMessage = "Łączenie.."; AuthenticatedUser user = await _apiHelper.Authenticate(UserName, Password); LoginInfoMessage = ""; await _apiHelper.GetLoggedUserData(user.Access_Token); if (RemeberMe) { WindowsCredentials.SaveLoginPassword(UserName, Password); } else { WindowsCredentials.DeleteLoginPassword(); } await _eventAggregator.PublishOnUIThreadAsync(new LogOnEvent(reloadNeeded : true), new CancellationToken()); _duringOperation = false; NotifyOfPropertyChange(() => CanLogIn); } catch (Exception ex) { _logger.Error("Got exception", ex); LoginInfoMessage = ex.Message; _duringOperation = false; NotifyOfPropertyChange(() => CanLogIn); } }
public async Task LogIn() { try { ErrorMessage = string.Empty; var result = await _apiHelper.Authenticate(UserName, Password); //Capture more information about the user await _apiHelper.GetLoggedInUserInfo(result.Access_Token); await _events.PublishOnUIThreadAsync(new LogInOutEvent { IsLogin = true }); } catch (HttpRequestException ex) { ErrorMessage = "Connection to server failed"; Logger.LogError(ex, LogAction.LogOnly); } catch (Exception ex) { if (ex.Message.Equals("Bad Request")) { ErrorMessage = "Wrong Username or Password"; } else { ErrorMessage = ex.Message; } Logger.LogError(ex, LogAction.LogOnly); } }
private async Task AuthenticateUser() { AuthenticatedUser result = await _apiHelper.Authenticate(UserEmail, Password); await _apiHelper.GetLoggedInUserInfo(result.Token); await _events.PublishOnUIThreadAsync(new LogInEvent()); }
//Extended version of CanLogIn //public bool CanLogIn //{ // get // { // bool output = false; // if (UserName?.Length > 0 && Password?.Length > 0) // { // output = true; // } // return output; // } //} public async Task LogIn() { try { var result = await _apiHelper.Authenticate(UserName, Password); } catch (Exception ex) { throw new NotImplementedException(); } }
public async Task LogIn() { try { var result = await _apiHelper.Authenticate(UserName, Password); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public async Task LogIn() { try { ErrorMessage = ""; var result = await _apiHelper.Authenticate(UserName, Password); } catch (Exception ex) { ErrorMessage = ex.Message; } }
public async Task LogIn() { try { AuthenticatedUser result = await _APIHelper.Authenticate(UserName, Password); await _APIHelper.GetLoggedInUserInfo(result.access_token); } catch (Exception exc) { ErrorMsg = exc.Message.ToString(); } }
public async Task LogIn() { try { ErrorMessage = ""; var result = await _apiHelper.Authenticate(UserName, Password); } catch (Exception ex) { //TODO: Flush out different exception possibilities. ErrorMessage = ex.Message; throw; } }
public async Task LogIn() { try { ErrorMessage = ""; var result = await _apiHelper.Authenticate(UserName, Password); await _apiHelper.GetLoggedInUserInfo(result.Access_Token); } catch (Exception ex) { ErrorMessage = ex.Message; } }
public async Task LogIn( ) { try { ErrorMessage = ""; var result = await _apiHelper.Authenticate(UserName, Password); //Todo: here we need to put a bearer token so we know the info of the user like username and token. } catch (Exception ex) { //throw; ErrorMessage = ex.Message; } }
public async Task LogIn() { try { var result = await _apiHelper.Authenticate(UserName, Password); await _apiHelper.GetLoggedInUserInfo(result.Access_Token); _eventAggregator.PublishOnUIThread(new LogOnEvent()); } catch (Exception exception) { Console.WriteLine(exception.Message); } }
public async Task Submit() { dynamic settings = new ExpandoObject(); settings.WindowStartupLocationLocation = WindowStartupLocation.CenterOwner; settings.ResizeMode = ResizeMode.NoResize; try { RegisterModel registerModel = new RegisterModel { Email = Email, Password = Password, ConfirmPassword = ConfirmPassword }; //string createSuccess = await _apiHelper.RegisterUser(Email, Password, ConfirmPassword); string createSuccess = await _apiHelper.RegisterUser(registerModel); if (createSuccess == "success") { var result = await _apiHelper.Authenticate(Email, Password); UserModel user = new UserModel(); List <string> UInfor = await _apiHelper.GetUserId(result.Access_Token); user.Id = UInfor[0]; user.FirstName = FirstName; user.LastName = LastName; user.EmailAddress = Email; user.CreatedDate = DateTime.Now; await _apiHelper.PostUserInfo(user); settings.Title = "System Message"; _status.UpdateMessage("Account Created Successfully", $"{FirstName} Thank you for joining us!"); await _window.ShowDialogAsync(_status, null, settings); await _events.PublishOnUIThreadAsync(new LogInEvent()); } } catch (Exception ex) { settings.Title = "System Error"; _status.UpdateMessage("Fatal Exception", ex.Message); _window.ShowDialogAsync(_status, null, settings); } }
public async Task LogIn() { try { ErrorMessage = ""; var result = await _apiHelper.Authenticate(UserName, Password); await _apiHelper.GetLoggedInUserInfo(result.Access_Token); _events.PublishOnUIThread(new LogOnEvent()); } catch (Exception ex) { ErrorMessage = ex.Message + " Username or password are incorrect"; } }
public async Task Login() { try { ErrorMessage = string.Empty; var result = await _apiHelper.Authenticate(Username, Password); await _apiHelper.GetLoggedInUserInfo(result.Access_Token); await _eventAggregator.PublishOnUIThreadAsync(new LogOnEvent()); } catch (Exception ex) { ErrorMessage = ex.Message; } }
public async Task LogIn() { try { ErrorMessage = ""; var result = await _apiHelper.Authenticate(UserName, Password); await _apiHelper.GetLoggedInUserInfo(result.Access_Token); await _events.PublishOnUIThreadAsync(new LogOnEvent(), new CancellationToken()); } catch (Exception ex) { ErrorMessage = ex.Message; } }
public async Task LogIn() { try { var result = await _apiHelper.Authenticate(UserName, Password); // Capture more information bout user await _apiHelper.GetLogedInUserInfo(result.Access_Token); _events.PublishOnUIThread(new LogOnEvent()); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public async Task Login() { try { ErrorMessage = ""; var result = await _apiHelper.Authenticate(UserName, Password); // Capture more information about the user. await _apiHelper.GetLoggedInUserInfo(result.Access_Token); } catch (Exception ex) { ErrorMessage = ex.Message; } }
public async Task LogIn() { try { ErrorMessage = string.Empty; var result = await _apiHelper.Authenticate(UserName, Password); //Capture more info about the user await _apiHelper.GetLoggedInUserInfo(result.Access_Token); _events.PublishOnUIThread(new LogOnEvent()); } catch (Exception ex) { ErrorMessage = ex.Message; } }
public async Task LogIn() { try { ErrorMessage = ""; var result = await _apiHelper.Authenticate(UserName, Password); //Capture more information about user await _apiHelper.GetLoggedInUserInfo(result.AccessToken); _events.BeginPublishOnUIThread(new LogOnEventModel()); } catch (Exception ex) { ErrorMessage = ex.Message; } }
public async Task LogIn() //calling an api must be done asynchronously { try { ErrorMessage = ""; var result = await _apiHelper.Authenticate(UserName, Password); //capture more info about the user await _apiHelper.GetLoggedInUserInfo(result.Access_Token); _events.PublishOnUIThread(new LogOnEvent()); } catch (Exception ex) { ErrorMessage = ex.Message; } }
public async Task LogIn() { try { ErrorMessage = ""; var result = await _apiHelper.Authenticate(UserName, Password); //capture more information about the user. await _apiHelper.GetLoggedInUserInfo(result.Access_Token); _events.PublishOnUIThread(new LogOnEvent()); //this tells the user that the user has logged in. } catch (Exception ex) { ErrorMessage = ex.Message; } }
public async Task Login() { ErrorMessage = string.Empty; try { var result = await _apiHelper.Authenticate(UserName, Password); // capture user information await _apiHelper.GetLoggedInUserInfo(result.Access_Token); await _event.PublishOnUIThreadAsync(new LogOnEventModel()); } catch (Exception e) { ErrorMessage = e.Message; } }
public async Task <ActionResult> Login(string UserName, string Password) { try { var result = await _aPIHelper.Authenticate(UserName, Password); //capture more information about the user await _aPIHelper.GetLoggedInUserInfo(result.Access_Token); return(RedirectToAction("Sales", "RetailManagement")); } catch (Exception ex) { ViewBag.ErrorMsg = ex.Message; return(View()); } }
public async Task LogIn() { try { ErrorMessage = ""; var result = await _apiHelper.Authenticate(UserName, Password); // Capture more info about the logged in user await _apiHelper.GetLoggedInUserInfo(result.Access_Token); await _events.PublishOnUIThreadAsync(new LogOnEvent(), new CancellationToken()); // Does nothing just broadcasts that a login event happened. } catch (Exception ex) { ErrorMessage = ex.Message; } }
public async void LogIn(string userName, string password) { try { ErrorMessage = ""; var result = await _apiHelper.Authenticate(UserName, Password); await _apiHelper.GetLoggedInUserInfo(result.Access_Token); _events.PublishOnUIThread(new LogOnEvent()); } catch (Exception ex) { ErrorMessage = ex.Message; } }
public async Task Login() { try { ErrorMessage = ""; var result = await _apiHelper.Authenticate(UserName, Password); User = await _apiHelper.GetUserInfo(result.access_token); User.access_token = result.access_token; Console.WriteLine(Event.Name); } catch (Exception ex) { ErrorMessage = ex.Message; } }
public async Task Login() { try { ErrorMessage = string.Empty; AuthenticatedUser result = await _apiHelper.Authenticate(Username, Password); // Retrieve the additional information about the user await _apiHelper.GetLoggedInUserInfo(result.AccessToken); // Push the event for the login _events.PublishOnUIThread(new LogOnEvent()); } catch (Exception e) { ErrorMessage = e.Message; } }
// calling and api calls are asynchronous public async Task LogIn() { try { ErrorMessage = ""; var result = await _apiHelper.Authenticate(UserName, Password); //capture more information about user. await _apiHelper.GetLoggedInUserInfo(result.Access_Token); //event will be listend to UI thread.to avoid cross threading issues. Class is subscribing to logon events. _events.PublishOnUIThread(new LogOnEvent()); } catch (Exception ex) { ErrorMessage = ex.Message; } }
//public bool CanLogIn(string userName, string password) //{ // bool output = false; // if (userName?.Length > 0 && password?.Length > 0) // { // output = true; // } // return output; //} public async Task LogIn() { try { ErrorMessage = ""; var result = await _apiHelper.Authenticate(UserName, Password); // capture more info about the user await _apiHelper.GetLoggedInUserInfo(result.Access_Token); await _events.PublishOnUIThreadAsync(new LogOnEvent(), new CancellationToken()); } catch (Exception ex) { //Console.WriteLine(ex.Message); ErrorMessage = ex.Message; } }
/// <summary> /// Triggers an HTTP request to our API in order to make an authentication usgin the given UserName and Password. /// </summary> /// <returns></returns> public async Task LogIn() { try { ErrorMessage = ""; var result = await _apiHelper.Authenticate(UserName, Password); //Capture more information about the user await _apiHelper.GetLoggedInUserInfo(result.Access_Token); //Make sure that we're using the UI thread in order to prevent cross threading issues _events.PublishOnUIThread(new LogOnEvent()); } catch (Exception ex) { ErrorMessage = ex.Message; } }