private void CheckReg() { bool _isReg = true; string _errorInfo; int _infoType; bool isTrial = false; CheckRegInfo.CheckReg(ref _isReg, out _errorInfo, out _infoType, out isTrial); if (isTrial) { MessageBox.Show(string.Format(@"当前版本为试用版,可免费试用{0}次!", 11 - CheckRegInfo.GetLoginTimes()), @"提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (!_isReg) { MessageBox.Show(_errorInfo, @"错误", MessageBoxButtons.OK, MessageBoxIcon.Error); var frm = new FrmRegister(); DialogResult loginDiaSul = frm.ShowDialog(); if (loginDiaSul == DialogResult.OK) { _isReg = frm.RegSuccess; frm.Dispose(); if (_isReg) { return; } } } }
private void GetVersion() { try { // WebRequest request = WebRequest.Create(url); // WebResponse response = request.GetResponse(); // Stream resStream = response.GetResponseStream(); // StreamReader sr = new StreamReader(resStream, System.Text.Encoding.Default); // //lbVersion.Text = sr.ReadToEnd(); // string version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); string versionInfo = ""; if (CheckRegInfo.IsNewVersion()) { versionInfo = string.Format(@"当前系统版本为最新版本V{0}", CheckRegInfo.NowVersion); } else { versionInfo = string.Format("当前系统版本为V{0},目前系统最新版本为V{1}", CheckRegInfo.NowVersion, CheckRegInfo.GetNewVersionInfo()); } lbVersion.Text = versionInfo; } catch (Exception) { lbVersion.Text = @"无法获取到最新版本信息,请检查网络是否连接正常!"; } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); Application.DoEvents(); try { BaseFunction.GetConfig(); delayLoadTimer.Interval = 80; delayLoadTimer.Enabled = true; bsiSetting.Caption = @"当前系统计算的板宽为:【" + BaseFunction.Area + @"mm】"; barStaticItem2.Caption = CheckRegInfo.GetOAuthInfo(); if (!File.Exists(imageConfig)) { XmlHelper.CreateImageXml(imageConfig); PiEncryptHelper.EncFile(imageConfig); } if (!PiEncryptHelper.IsFileEnc(imageConfig, ref nKeyID)) { MessageBox.Show(@"系统文件错误!", @"提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } catch (Exception) { Cursor.Current = Cursors.Default; } }
private static void StartMain() { Application.EnableVisualStyles(); Application.DoEvents(); if (!CheckRegInfo.IsNewVersion()) { MessageBox.Show(@"当前系统版本不是最新版本!"); } #if DEBUG StartFrmMain(); return; #endif RegisterClass.CreateSubKey(); bool isTrial = true; CheckRegInfo.CheckReg(ref _isReg, out _errorInfo, out _infoType, out isTrial); if (isTrial) { MessageBox.Show(string.Format(@"当前版本为试用版,可免费试用{0}次!", 11 - CheckRegInfo.GetLoginTimes()), @"提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (!_isReg) { MessageBox.Show(_errorInfo, @"错误", MessageBoxButtons.OK, MessageBoxIcon.Error); var frm = new Bussiness.FrmRegister(); DialogResult loginDiaSul = frm.ShowDialog(); if (loginDiaSul == DialogResult.OK) { _isReg = frm.RegSuccess; frm.Dispose(); if (_isReg) { StartFrmMain(); return; } } } if (_isReg) { StartFrmMain(); } else { Application.Exit(); } }
private void InitStatusBar() { var version = Assembly.GetExecutingAssembly().GetName().Version; #if !DEBUG //CheckReg(); #endif if (CheckRegInfo.GetSoftRegFlg() == "NO") { this.bsiVersion.Caption = string.Format(@"【软件未注册可免费使用10次,当前已使用({0})次】", CheckRegInfo.GetLoginTimes()); } else { this.bsiVersion.Caption = string.Format(@"【软件已注册,当前版本为:V{0}】", version); } #if DEBUG this.bsiVersion.Caption = string.Format(@"【软件测试版本,当前版本为:测试V{0}】", version); #endif bsiSetting.Caption = @"当前系统计算的板宽为:【" + BaseFunction.Area + @"mm】"; }