private async void SignInBtn_Click(object sender, RoutedEventArgs e) { MessageTB.Text = ""; Loader.Visibility = Visibility.Visible; var user = UserNameTB.Text; var password = PasswordTB.Password; try { User signedInUser = await UserConnection.AuthenticateUser(new User() { Username = user, Password = password }); SignedIn?.Invoke(this, new SignedInEventArgs() { User = signedInUser }); ApplicationRuntimeData.AuthUser = new WebApi.Models.AuthUser() { Username = user, Password = password }; ApplicationRuntimeData.CurrentUser = signedInUser; } catch (Exception ex) { MessageTB.Text = ex.Message; } Loader.Visibility = Visibility.Hidden; }
// Called when a sign-in with profile data completes. // void handleSignInWithSignInResult(Task<Firebase.Auth.SignInResult> task) // { // Debug.Log($"[handleSignInWithSignInResult]"); // SignedOut?.Invoke(task.Result.User); // } // Called when a sign-in without fetching profile data completes. void handleSignInWithUser(Task <FirebaseUser> task) { switch (task.Status) { case TaskStatus.Faulted: Debug.LogWarning($"[EmailAuth::handleSignInWithUser] Task faulted: {task.Exception.ToString()}"); handleFault(task.Exception); break; case TaskStatus.RanToCompletion: this.User = task.Result; Debug.Log($"[EmailAuth] Sign in complete {this.User.UserId}"); SignedIn?.Invoke(task.Result); break; default: Debug.LogWarning($"[EmailAuth::handleSignInWithUser] Unhandled task status: {task.Status}"); break; } }
internal async Task SignInAsync() { try { IsBusy = true; _hud.Show(LoginMessage); var credentials = new Credentials(UserName, Password); Result validationResult = await _credentialValidator.ValidateAsync(credentials) .ConfigureAwait(false); if (!validationResult.IsSuccessful) { _alerts.ShowError(validationResult.ErrorMessage); return; } var saveResult = await _credentialStorage.SaveCredentialsAsync(credentials) .ConfigureAwait(false); if (!saveResult.IsSuccessful) { _alerts.ShowError(saveResult.ErrorMessage); return; } _backgroundSync.Enable(); SignedIn?.Invoke(this, EventArgs.Empty); } finally { _hud.Dismiss(); IsBusy = false; } }
static Project0RepoLayer p0Context = new Project0RepoLayer(); // create the context here to acceess it in all methods of this class static void Main(string[] args) { // p0Context.ManualCreateFloor(); // variables Console.Clear(); string usrChoice; do //enter program //greet user and see where they need to go. quit if an option listed isn't inputted { Console.WriteLine ("Welcome to the Abstract Museum, where we abstract out abstract art! What would you like to do?\n" + "1. Create User \n2. Login\n-1. Quit"); usrChoice = Console.ReadLine();//get user choice //initializing user inputs string un = "0"; //globawe uname outside loop to use later while (usrChoice == "1") { //init ui string fn = "0"; string ln = "0"; while (usrChoice != "-2") { while ((un == "0" || fn == "0" || ln == "0") && (usrChoice != "-2")) { //loop create player until acceptable values are given ///prompt for information to create player Console.Clear(); Console.WriteLine("We need some information before we can proceed: " + "\nPlease make sure that that all three inputs contain at least 3 characters and no more than 20!"); Console.Write("\nEnter a unique username: "******"\nEnter your first name: "); fn = ValidationOptions.ValidateInput(Console.ReadLine()); Console.Write("\nEnter your last name: "); ln = ValidationOptions.ValidateInput(Console.ReadLine()); Console.Write("\nIf you entered less than 2 or more than 20 characters for any inputs, we will prompt you to enter your information again. \nPress enter to continue..."); Console.ReadLine(); Console.Clear(); Console.WriteLine("We are creating user with" + $"\nUsername: {un} \nFirst Name: {fn} \nLast Name: {ln}"); Console.Write("\nIf you'd like to cancel, enter -2:"); usrChoice = Console.ReadLine(); if (usrChoice == "-2") { un = "0"; ln = "0"; fn = "0"; } } usrChoice = "-2"; } if (un != "0" || fn != "0" || ln != "0") { User user = p0Context.CreateUser(un, fn, ln); usrChoice = SignedIn.FirstMenu(user); } }//end choice 1 while (usrChoice == "2") { Console.Write("Great to see you again! You can quit to the main menu by entering '-1'. Enter your unique username: "******"-1") { try { un = ValidationOptions.ValidateInput(un); User user = p0Context.FindUser(un); usrChoice = SignedIn.FirstMenu(user); } catch (System.Exception) { Console.Clear(); Console.WriteLine("We were not able to locate that user.\n We will return you to the previous screen. Press enter to continue: "); Console.ReadLine(); usrChoice = "2"; } } else { Console.Clear(); usrChoice = "-1"; } } }while(usrChoice != "-1");//end program Console.Clear(); Console.Write("Thank you for your virtual stay at the Abstract Museum!"); }//end main
protected void OnSignedIn() { SignedIn?.Invoke(this, null); }
protected override void BuildParameters() { base.BuildParameters(); SQLParam sqlparam = new SQLParam(); sqlparam.Name = "@UserID"; sqlparam.Type = System.Data.SqlDbType.Int; sqlparam.Value = UserId.ToString(); sqlparam.IntValue = UserId; sqlparam.ColumnName = "UserID"; m_sql.parameters.Add(sqlparam); sqlparam = new SQLParam(); sqlparam.Name = "@SignInDate"; sqlparam.Type = SqlDbType.Date; sqlparam.Value = SignInDate.ToString("yyyy-mm-dd"); sqlparam.dtValue = SignInDate; sqlparam.ColumnName = "SignInDate"; sqlparam.IncludeInModDT = true; m_sql.parameters.Add(sqlparam); sqlparam = new SQLParam(); sqlparam.Name = "@SignedIn"; sqlparam.Type = SqlDbType.Bit; sqlparam.Value = SignedIn.ToString(); if (SignedIn) { sqlparam.IntValue = 1; } else { sqlparam.IntValue = 0; } sqlparam.ColumnName = "SignedIn"; sqlparam.IncludeInModDT = false; m_sql.parameters.Add(sqlparam); sqlparam = new SQLParam(); sqlparam.Name = "@InTime"; sqlparam.Type = SqlDbType.DateTime; sqlparam.Value = InTime.ToString(); sqlparam.dtValue = InTime; sqlparam.ColumnName = "InTime"; sqlparam.IncludeInModDT = false; m_sql.parameters.Add(sqlparam); sqlparam = new SQLParam(); sqlparam.Name = "@OutTime"; sqlparam.Type = SqlDbType.DateTime; sqlparam.Value = OutTime.ToString(); sqlparam.dtValue = OutTime; sqlparam.ColumnName = "OutTime"; sqlparam.IncludeInModDT = false; m_sql.parameters.Add(sqlparam); if (m_IncludeIDInParameters) { sqlparam = new SQLParam(); sqlparam.Name = "@ID"; sqlparam.Type = SqlDbType.Int; sqlparam.Value = Convert.ToString(ID); sqlparam.IntValue = ID; sqlparam.ColumnName = m_primarykey; sqlparam.IsPrimaryKey = true; sqlparam.IncludeInModDT = true; m_sql.parameters.Add(sqlparam); } }
public void InvokeSignedIn(string email) { SignedIn?.Invoke(email); }
public async Task HandleAsync(SignedIn @event) => await CompleteAsync(@event);