private async void LoginButton_Click(object sender, RoutedEventArgs e) { LoginButton.IsEnabled = false; LoginButton.Content = "Logowanie..."; var identifier = IdentifierBox.Text; var password = PasswordBox.Password; var data = await Task.Factory.StartNew(() => Client.Login(identifier, password)); if (data == null) { MessageBox.Show("Wpisano nieprawdiłowe dane logowania lub wystąpił problem z połączeniem.", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error); } else { LoginButton.Content = "Pobieranie danych..."; this.Title = $"Frekwencja {Version} | {identifier}"; ListBoxSubjects.Items.Clear(); await ProcessAttendances(); } GlobalStatsButton.IsEnabled = true; LoginButton.IsEnabled = true; LoginButton.Content = "Zaloguj się"; }
private static void PromptLogin() { LoginCredentials credentials = new LoginCredentials(); Console.Write("Identyfikator: "); credentials.Username = Console.ReadLine(); Console.Write("Hasło: "); credentials.Password = Console.ReadLine(); Client.Login(credentials.Username, credentials.Password); Properties.Settings.Default.LoginCredentials = JsonConvert.SerializeObject(credentials); }
static void Login() { Console.WriteLine("Zaloguj się"); Console.Write("Login: "******"Hasło: "); var password = Console.ReadLine(); Console.WriteLine("Trwa logowanie..."); client.Login(username, password); Console.Clear(); }
static void Main(string[] args) { // Display header and get user credentials displayHeader(); Console.Write("Username: "******"Password: "); var password = Console.ReadLine(); // Create a new instance and login to Synergia client.Login(username, password); // Display main screen displayHeader(); displayMenu(); }