private async void LoginOnClick(Object sender, RoutedEventArgs e) { using (ButtonEnableWrapper wrapper = new ButtonEnableWrapper(LoginButton)) { PastebinHelper.ApplyDevKey(); if (await AuthorizationManager.TryLogInAsync(Username.Text, Password.Password)) { Close(); } } }
public static async Task <Boolean> TryLogInAsync(String username, String password) { PastebinHelper.ApplyDevKey(); try { CurrentUser = await Pastebin.LoginAsync(username, password); return(true); } catch (Exception e) { MessageBox.Show(e.Message, PastebinHelper.DefaultCaption); return(false); } }