// If a radiobuttons gets checked, load username and password of a profile. private void radioButtonAccount_CheckedChanged(object sender, EventArgs e) { int index = GetSelectedAccountProfileRadiobuttonIndex(); IniFiles.Config.Set("Login", "uActiveAccountProfile", index); if (index == 0) { this.textBoxUserName.Text = IniFiles.GetString("Login", "s76UserName", ""); this.textBoxPassword.Text = IniFiles.GetString("Login", "s76Password", ""); } else { this.textBoxUserName.Text = IniFiles.Config.GetString("Login", $"s76UserName{index}", ""); this.textBoxPassword.Text = IniFiles.Config.GetString("Login", $"s76Password{index}", ""); } }
// Gets current account profile and sets the according radiobutton private void LoadAccountProfile() { //int index = IniFiles.Config.GetInt("Login", "uActiveAccountProfile", 0); int index = 0; string username = IniFiles.GetString("Login", "s76UserName", ""); string password = IniFiles.GetString("Login", "s76Password", ""); if (username != "" && password != "") { for (int i = 1; i <= accountProfileRadioButtons.Count(); i++) { if (username == IniFiles.Config.GetString("Login", $"s76UserName{i}", "") && password == IniFiles.Config.GetString("Login", $"s76Password{i}", "")) { index = i; break; } } } SetSelectedAccountProfileRadiobuttonIndex(index); }
private void radioButtonAccountNone_CheckedChanged(object sender, EventArgs e) { this.textBoxUserName.Text = IniFiles.GetString("Login", "s76UserName", ""); this.textBoxPassword.Text = IniFiles.GetString("Login", "s76Password", ""); }