Beispiel #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);
 }
Beispiel #2
0
        private void btnReload_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.Reload();
            this.SetRadioButtons();
            Program.CurrentLocation = Locations.GetPlace(Properties.Settings.Default.LocationName);
            for (int i = 0; i < this.cbPlaces.Items.Count; i++)
            {
                var place = (Location)this.cbPlaces.Items[i];
                if (place.Name == Program.CurrentLocation.Name)
                {
                    this.cbPlaces.SelectedIndex = i;
                    break;
                }
            }

            this._regKey = Registry.CurrentUser.OpenSubKey("Software").OpenSubKey("Chashavshavon", true);
            this.cbRequirePassword.Checked = (this._regKey.GetValue("Straight").ToString() == "0");
            string pw = Convert.ToString(this._regKey.GetValue("Entry"));

            if (!string.IsNullOrEmpty(pw))
            {
                this.txtPassword.Text = GeneralUtils.Decrypt(pw, "kedoshimteeheeyoo");
            }
        }
 private void btnEnter_Click(object sender, EventArgs e)
 {
     this.DialogResult = GeneralUtils.Encrypt(this.textBox1.Text, "kedoshimteeheeyoo") == this._password ? DialogResult.Yes : DialogResult.No;
 }
Beispiel #4
0
 private void cmbYear_Format(object sender, ListControlConvertEventArgs e)
 {
     e.Value = GeneralUtils.ToJNum((int)e.Value % 1000);
 }