private void backgroundLoadWorker_DoWork(object sender, DoWorkEventArgs e) { // 测试网络连接 netWorkDelay = TestNetwork(); isNetworkTestingFinished = true; if (netWorkDelay == -1) { ApplicationStatus.isInternetConnected = false; while (isNetworkTestingFinished == false || netWorkDelay == -1) { Thread.Sleep(500); // 等待其他线程尝试恢复网络 if (this.Visible == false) // LaunchForm已隐藏,说明通过无网络方式进入主界面 { return; } } } // 成功连接网络 progressTimer.Enabled = true; // 如果是初次运行,发送统计信息邮件 if (ApplicationStatus.isFirstRun) { LaunchFormUtil.SendStatisticMail("New User: "******"Hard Disk Id: " + Hardware.GetHardDiskID() + "\n Version: " + ApplicationStatus.version); } // 更新后发送统计信息邮件 else if (ApplicationStatus.isVersionUpdated) { LaunchFormUtil.SendStatisticMail("User App Version Updated: " + LaunchFormUtil.GetClientIpInfo(), "Hard Disk Id: " + Hardware.GetHardDiskID() + "\n Current Version: " + ApplicationStatus.version + "\n Previous Version: " + ApplicationStatus.previousVersion); } // 第一次启动时网络故障,现在重新发送统计信息邮件 else if (ApplicationStatus.isFirstRunNoInternet) { LaunchFormUtil.SendStatisticMail("New User: "******"Hard Disk Id: " + Hardware.GetHardDiskID() + "\n Version: " + ApplicationStatus.version + "\n Note: FirstRunNoInternet"); // 删除记录初次运行网络故障的flag文件 File.Delete(Path.Combine(ApplicationStatus.applicationDataFolderPath, ApplicationStatus.firstRunNoInternetFlagFileName)); } // 加载主窗口资源 // 刷新DateInfoDatabase OnlineDateInfoDatabase.Refresh(DateTime.Today.Year, DateTime.Today.Month); // 初始化PrepcalWebInfoService isPrepcalWebInfoServiceInitializating = true; Thread.Sleep(10); // 给infoTimer提供反应时间 PrepcalWebInfoService.Initializate(); isPrepcalWebInfoServiceInitializating = false; isPrepcalWebInfoServiceInitialized = true; isLoadFinished = true; }
private void submitButtonPanel_MouseClick(object sender, MouseEventArgs e) { if (feedbackContentTextBox.Text.Trim() == "") { MessageBox.Show("请输入您要反馈的信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } string feedbackInfo = feedbackContentTextBox.Text; string contactsInfo = contactsTextBox.Text == "" ? "None" : contactsTextBox.Text; string mailBody = "Hard Disk Id: " + Hardware.GetHardDiskID() + "\n" + "Contacts: " + contactsInfo + "\n\n" + "Feedback: " + feedbackInfo; LaunchFormUtil.SendStatisticMail("User Feedback: " + LaunchFormUtil.GetClientIpInfo(), mailBody); MessageBox.Show("感谢您的反馈,祝您生活愉快 :-)", "提交成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.FadeOutToCloseForm(); }