private void button3_Click(object sender, EventArgs e) { try { var api = new Api.ClientApi(new Base.Configuration() { Username = usernameText.Text, Password = passwordText.Text }); var languages = api.Languages(); comboLanguage.DataSource = languages; comboLanguage.DisplayMember = "name"; comboLanguage.ValueMember = "code"; } catch (Exception ex) { MessageBox.Show("Try again. It's a network problem.", "Sorry!"); } }
private void LoadConfiguration() { var configuration = Base.Configuration.GetDefault(); if (configuration != null) { usernameText.Text = configuration.Username; passwordText.Text = configuration.Password; timeNumeric.Value = configuration.TimeBetweenTranslation; var api = new Api.ClientApi(configuration); var languages = api.Languages(); comboLanguage.DataSource = languages; comboLanguage.DisplayMember = "name"; comboLanguage.ValueMember = "code"; comboLanguage.SelectedValue = configuration.LanguadeCode; projectNameTextbox.Text = configuration.ActiveProject; isProjectRight = true; LoadResouces(); cmbResources.SelectedIndex = configuration.ActualIndexResource; } }