//private void UsernameInput_KeyUp(object sender, KeyEventArgs e) //{ // if (e.Key == Key.Enter) // { // ParseInput(UsernameInput.Text.Trim(), PasswordInput.Password.Trim()); // } //} private async void ParseInput(string Username, string Password) { if (string.IsNullOrWhiteSpace(Password) || string.IsNullOrWhiteSpace(Username)) { // UsernameInput.Text = "Must enter a username"; PasswordInput.Clear(); } else if (!string.IsNullOrWhiteSpace(Password) && !string.IsNullOrWhiteSpace(Username)) { //login or create account depending on context var outcome = await Task <bool> .Factory.StartNew(() => authenticateLogin(Username, Password)); if (outcome) { ConferenceListWindow main = new ConferenceListWindow(Username, Password, PubKey, loginSpace); App.Current.MainWindow = main; this.Close(); main.Show(); } else { UsernameInput.Clear(); PasswordInput.Clear(); LoginErrorText = "Incorrect user/\npassword"; Keyboard.ClearFocus(); } } }
public CreateConferenceWindow(RemoteSpace ConferenceRequests, string Username, ConferenceListWindow conferenceListWindow, string Password, RemoteSpace LoginSpace) { DataContext = this; this.conferenceListWindow = conferenceListWindow; this.ConferenceRequests = ConferenceRequests; this.LoginSpace = LoginSpace; this.Username = Username; this.Password = Password; InitializeComponent(); NewConferenceName.Focus(); NewConferenceName.KeyUp += EnterPressed; NewConferenceName.KeyDown += EnterPressed; CreateButton.Click += CreateButton_Click; cancelButton.Click += CancelClick; }