Esempio n. 1
0
        public Form1()
        {
            InitializeComponent();
            autoCopyPwd.Checked = bool.Parse(ConfigAppSettings.GetValue("AutoCopyPwd", "false"));
            msPath.Text         = ConfigAppSettings.GetValue("msPath", "");
            if (msPath.Text == "")
            {
                string dir_reg_0 = dir_reg.Replace("HKEY_LOCAL_MACHINE\\", "").Replace("HKEY_CURRENT_USER\\", "");

                try
                {
                    ModifyRegistry myRegistry = new ModifyRegistry();
                    myRegistry.BaseRegistryKey = Registry.CurrentUser;
                    myRegistry.SubKey          = dir_reg_0;
                    if (myRegistry.Read(dir_value_name) != "")
                    {
                        ConfigAppSettings.SetValue("msPath", myRegistry.Read(dir_value_name));
                        msPath.Text = myRegistry.Read(dir_value_name);
                    }
                    else
                    {
                        myRegistry.BaseRegistryKey = Registry.LocalMachine;
                        myRegistry.SubKey          = dir_reg_0;
                        if (myRegistry.Read(dir_value_name) != "")
                        {
                            ConfigAppSettings.SetValue("msPath", myRegistry.Read(dir_value_name));
                            msPath.Text = myRegistry.Read(dir_value_name);
                        }
                    }
                }
                catch
                {
                }
            }
        }
Esempio n. 2
0
        private void autoCopyPwd_CheckedChanged(object sender, EventArgs e)
        {
            bool config = bool.Parse(ConfigAppSettings.GetValue("AutoCopyPwd", "false"));

            if (autoCopyPwd.Checked != config)
            {
                ConfigAppSettings.SetValue("AutoCopyPwd", autoCopyPwd.Checked.ToString());
            }
        }