private void Init(UserRegistryData data) { string lang; RegistryHelper.GetLanguage(out lang); if (string.IsNullOrEmpty(lang)) { lang = "en"; } this.Text = LanguagesHelper.Text("cStCredentials", lang); this.lblInterfaceLang.Text = LanguagesHelper.Text("cLang", lang); this.bOK.Text = LanguagesHelper.Text("c*K", lang); this.bCancel.Text = LanguagesHelper.Text("cCancel", lang); this.tbUsername.Text = data.UserName; this.tbPassword.Text = data.Password; this.cbLang.Items.AddRange(new object[] { "Български [bg]", "English [en]", "Deutsch [de]", "French [fr]", "Italiano [it]", }); if (string.IsNullOrEmpty(data.Language)) { this.cbLang.SelectedIndex = LangIndxAbbr["en"]; } this.cbLang.SelectedIndex = LangIndxAbbr[data.Language]; }
public fCredentials() { InitializeComponent(); UserRegistryData ud = new UserRegistryData() { Language = "en" }; Init(ud); }
public static bool GetUserSettings(out UserRegistryData userSettings) { userSettings = new UserRegistryData(); bool isOk = true; try { using (RegistryKey ieAddinKey = Registry.CurrentUser.OpenSubKey(registryPath)) { var un = ieAddinKey.GetValue(userName) as string; if (!string.IsNullOrEmpty(un)) { userSettings.UserName = un; } else { isOk = false; } var pw = ieAddinKey.GetValue(password) as string; if (!string.IsNullOrEmpty(pw)) { var xorpw = XorPassword(pw); userSettings.Password = xorpw; } else { isOk = false; } var ln = ieAddinKey.GetValue(language) as string; if (!string.IsNullOrEmpty(ln)) { userSettings.Language = ln; } else { isOk = false; } } } catch (Exception ex) { isOk = false; } return isOk; }
public fCredentials(UserRegistryData data) { InitializeComponent(); Init(data); }