示例#1
0
 private bool SavePreferencesBeforeClose()
 {
     if (this.cbRequirePassword.Checked && this.txtPassword.Text.Length < 4)
     {
         Program.Exclaim("הסיסמה חייבת להיות לפחות 4 תוים");
         return(false);
     }
     else
     {
         this._regKey.SetValue("Entry", GeneralUtils.Encrypt(this.txtPassword.Text, "kedoshimteeheeyoo"), RegistryValueKind.String);
         this._regKey.SetValue("Straight", this.cbRequirePassword.Checked ? "0" : "1", RegistryValueKind.String);
         this._regKey.Close();
         //the form closing method checks to see if the regKey was nullified to determine if preferences were already saved.
         this._regKey = null;
     }
     Program.CurrentLocation = ((Location)this.cbPlaces.SelectedItem);
     Properties.Settings.Default.LocationName = Program.CurrentLocation.Name;
     Properties.Settings.Default.Save();
     ((FrmMain)this.Owner).AfterChangePreferences();
     return(true);
 }
 private void btnEnter_Click(object sender, EventArgs e)
 {
     this.DialogResult = GeneralUtils.Encrypt(this.textBox1.Text, "kedoshimteeheeyoo") == this._password ? DialogResult.Yes : DialogResult.No;
 }