static bool IsFirstRun() { FoeClientRegistryEntry firstRunKey = FoeClientRegistry.GetEntry("firstrun"); if ((firstRunKey == null) || (firstRunKey.Value == "T")) { return(true); } return(false); }
static bool IsRegistered() { FoeClientRegistryEntry userIdKey = FoeClientRegistry.GetEntry("userid"); if (userIdKey == null) { return(false); } return(true); }
private void timerCheckRegistration_Tick(object sender, EventArgs e) { try { // Stop timer timerCheckRegistration.Stop(); // Check messages lblStatus.Text = "Checking registration status..."; FoeClientMessage.DownloadMessages(); // Check if user ID is now set FoeClientRegistryEntry userId = FoeClientRegistry.GetEntry("userid"); if ((userId == null) || (userId.Value.Trim().Length == 0)) { lblStatus.Text = "[" + DateTime.Now.ToString("HH:mm:ss") + "] registration still processing. Wait 15 seconds."; timerCheckRegistration.Start(); return; } // Registration is completed lblStatus.Text = "Registration completed."; _result = DialogResult.OK; Close(); } catch (Exception) { MessageBox.Show("Error checking registration request. Make sure your computer is connected to the Internet and the POP3 servers " + "settings are correct. You can click the Email Settings button to reconfigure SMTP and POP3 settings.", "Foe", MessageBoxButtons.OK, MessageBoxIcon.Error); // re-enable buttons btnRegister.Enabled = true; btnEmailSettings.Enabled = true; // Update status lblStatus.Text = "Error checking registration request."; } }
public EmailInfo() { InitializeComponent(); // Try to load existing email address, SMTP and POP3 information FoeClientRegistryEntry smtpServer = FoeClientRegistry.GetEntry("smtpserver"); FoeClientRegistryEntry smtpPort = FoeClientRegistry.GetEntry("smtpport"); FoeClientRegistryEntry smtpRequireAuth = FoeClientRegistry.GetEntry("smtpauthrequired"); FoeClientRegistryEntry smtpRequireSsl = FoeClientRegistry.GetEntry("smtpsslenabled"); FoeClientRegistryEntry smtpUsername = FoeClientRegistry.GetEntry("smtpusername"); FoeClientRegistryEntry smtpPassword = FoeClientRegistry.GetEntry("smtppassword"); FoeClientRegistryEntry popServer = FoeClientRegistry.GetEntry("popserver"); FoeClientRegistryEntry popPort = FoeClientRegistry.GetEntry("popport"); FoeClientRegistryEntry popRequireSsl = FoeClientRegistry.GetEntry("popsslenabled"); FoeClientRegistryEntry popUsername = FoeClientRegistry.GetEntry("popusername"); FoeClientRegistryEntry popPassword = FoeClientRegistry.GetEntry("poppassword"); FoeClientRegistryEntry userEmail = FoeClientRegistry.GetEntry("useremail"); // Pre-fill info tbxEmail.Text = ((userEmail == null) ? "" : userEmail.Value); tbxSmtpServer.Text = ((smtpServer == null) ? "" : smtpServer.Value); tbxSmtpPort.Text = ((smtpPort == null) ? "" : smtpPort.Value); cbxSmtpRequireAuth.Checked = ((smtpRequireAuth == null) || (smtpRequireAuth.Value.ToUpper() == "T")); cbxSmtpRequireSsl.Checked = ((smtpRequireSsl != null) && (smtpRequireSsl.Value.ToUpper() == "T")); tbxSmtpUsername.Text = ((smtpUsername == null) ? "" : smtpUsername.Value); tbxSmtpPassword.Text = ((smtpPassword == null) ? "" : smtpPassword.Value); tbxPopServer.Text = ((popServer == null) ? "" : popServer.Value); tbxPopPort.Text = ((popPort == null) ? "" : popPort.Value); cbxPopRequireSsl.Checked = ((popRequireSsl != null) && (popRequireSsl.Value.ToUpper() == "T")); tbxPopUsername.Text = ((popUsername == null) ? "" : popUsername.Value); tbxPopPassword.Text = ((popPassword == null) ? "" : popPassword.Value); }