コード例 #1
0
        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];
        }
コード例 #2
0
 public fCredentials()
 {
     InitializeComponent();
     UserRegistryData ud = new UserRegistryData()
     {
         Language = "en"
     };
     Init(ud);
 }
コード例 #3
0
        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;
        }
コード例 #4
0
 public fCredentials(UserRegistryData data)
 {
     InitializeComponent();
     Init(data);
 }