public static Account FromRegistry() { // Attempt to open the key RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\Flare", true); // If the return value is null, the key doesn't exist if (key == null) // The key doesn't exist; create it / open it key = Registry.CurrentUser.CreateSubKey("Software\\Flare"); var account = new Account(); account.Name = key.GetValue("accountname", string.Empty).ToString(); if (string.IsNullOrEmpty(account.Name)) return null; account.UseSsl = (key.GetValue("usessl", "0").ToString() == "1"); key.Close(); account.User = User.FromRegistry(); return account; }
public SetupDialog( Account account ) { Account = account; InitializeComponent(); AcceptButton = _okButton; CancelButton = _cancelButton; }
private void OnLoaded(object sender, EventArgs e) { if (Account != null) { _accountNameTextBox.Text = Account.Name; // display account name _nicknameTextBox.Text = Account.User.Nickname; _notificationWindowDelayTextBox.Text = Account.User.NotifyWindowDelay.ToString(); _alertOnNicknameCheckBox.Checked = Account.User.NotifyOnlyWhenNicknameIsFound; _useSslCheckBox.Checked = Account.UseSsl; _minimiseFlareOnStartupCheckBox.Checked = Account.User.MinimiseDuringStartup; _startFlareOnStartUpCheckbox.Checked = GetStartupSituation(); _minimizeFlareWhenUserClosesWindowCheckBox.Checked = Account.User.MinimiseInsteadOfQuitting; } else { Account = new Account(); } }