private void loadWithCreds() { var creds = CredsFile.readConfig(); txtUsername.Text = creds.username; txtApikey.Text = creds.apikey; MainWindow.credentials = creds; }
private void btnSave_Click(object sender, RoutedEventArgs e) { try { CredsFile.writeConfig(txtUsername.Text, txtApikey.Text); } catch (Exception ex) { MessageBox.Show("There was a problem saving the configuration." + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } this.Close(); }
private static void load_creds() { try { creds = CredsFile.readConfig(); } catch (Exception) { creds = new Credentials(); } if (String.IsNullOrEmpty(creds.apikey) || String.IsNullOrEmpty(creds.username)) { CredsWindow cw = new CredsWindow(); cw.Show(); MainWindow.ErrorMessage("Credentials are required.", "Credentials Required"); } }