private void MainForm_Load(object sender, EventArgs e) { string dbSrc = ConfigurationManager.AppSettings["DBSource"]; string mtdbSrc = ConfigurationManager.AppSettings["MTDBConn"]; string dcirdbSrc = ConfigurationManager.AppSettings["DCIRDBConn"]; string fxjSrc = ConfigurationManager.AppSettings["FXJDBConn"]; string aLineScrewDBConn = ConfigurationManager.AppSettings["ALineScrewDBConn"]; //CtlDBAccess.DBUtility.PubConstant.ConnectionString = string.Format(@"{0}Initial Catalog=ACEcams;User ID=sa;Password=123456;", dbSrc); string dbConn1 = string.Format(@"{0}Initial Catalog=MingmeiMES;User ID=sa;Password=123456;", dbSrc); FTDataAccess.DBUtility.DbHelperSQL.SetConnstr(dbConn1); MTDBAccess.PubConstant.ConnectionString = @"Provider = Microsoft.ACE.OLEDB.12.0;" + mtdbSrc + ";Persist Security Info = False;"; DCIRDBAccess.PubConstant.ConnectionString = @"Provider = Microsoft.ACE.OLEDB.12.0;" + dcirdbSrc + ";Persist Security Info = False;"; ALineScrewDB.PubConstant.ConnectionString = @"Provider = Microsoft.ACE.OLEDB.12.0;" + aLineScrewDBConn + ";Persist Security Info = False;"; string fxjDbConn = string.Format(@"{0}Initial Catalog=HL_JBF;User ID=sa;Password=123456;", fxjSrc); FXJDatabase.DbHelperSQL.SetConnstr(fxjDbConn); // string dbSrcFenxuan = ConfigurationManager.AppSettings["FenxuanDBSource"]; // CtlDBAccess.DBUtility.PubConstant.ConnectionString2 = string.Format(@"{0}Initial Catalog=HL_LWN;User ID=sa;Password=123456;", dbSrcFenxuan); this.labelVersion.Text = this.version; this.MainTabControl.DrawMode = TabDrawMode.OwnerDrawFixed; this.MainTabControl.Padding = new System.Drawing.Point(CLOSE_SIZE, CLOSE_SIZE); this.MainTabControl.DrawItem += new DrawItemEventHandler(this.tabControlMain_DrawItem); this.MainTabControl.MouseDown += new System.Windows.Forms.MouseEventHandler(this.tabControlMain_MouseDown); Console.SetOut(new TextBoxWriter(this.richTextBoxLog)); // corePresenter = new CtlcorePresenter(); this.labelUser.Text = "当前用户:" + this.userName; ModuleAttach();//加载子模块 string licenseFile = AppDomain.CurrentDomain.BaseDirectory + @"\NBSSLicense.lic"; this.licenseMonitor = new LicenseMonitor(this, 2000, licenseFile, "zzkeyFT1"); if (!this.licenseMonitor.StartMonitor()) { throw new Exception("license 监控失败"); } string reStr = ""; if (!this.licenseMonitor.IslicenseValid(ref reStr)) { MessageBox.Show(reStr); return; } this.bt_StartSystem.Enabled = true; this.bt_StopSystem.Enabled = false; // this.label12.Text = "系统待启动!"; }
private void buttonRemoveLicense_Click(object sender, System.EventArgs e) { if (File.Exists(LicenseMonitor.LicenseFilePath)) { File.Delete(LicenseMonitor.LicenseFilePath); LicenseMonitor.Reset(); Populate(); } }
private void MainForm_Load(object sender, EventArgs e) { string dbSrc = ConfigurationManager.AppSettings["DBSource"]; //CtlDBAccess.DBUtility.PubConstant.ConnectionString = string.Format(@"{0}Initial Catalog=ACEcams;User ID=sa;Password=123456;", dbSrc); string dbConn1 = string.Format(@"{0}Initial Catalog=JKEcams;User ID=sa;Password=123456;", dbSrc); CtlDBAccess.DBUtility.DbHelperSQL.SetConnstr(dbConn1); string dbConn2 = string.Format(@"{0}Initial Catalog=JKMes;User ID=sa;Password=123456;", dbSrc); MesDBAccess.DBUtility.DbHelperSQL.SetConnstr(dbConn2); string xweConn = string.Format(@"{0}Initial Catalog=JK_XWE;User ID=sa;Password=123456;", dbSrc); XWEDBAccess.DBUtility.DbHelperSQL.SetConnstr(xweConn); // string dbSrcFenxuan = ConfigurationManager.AppSettings["FenxuanDBSource"]; // CtlDBAccess.DBUtility.PubConstant.ConnectionString2 = string.Format(@"{0}Initial Catalog=HL_LWN;User ID=sa;Password=123456;", dbSrcFenxuan); this.labelVersion.Text = this.version; this.MainTabControl.DrawMode = TabDrawMode.OwnerDrawFixed; this.MainTabControl.Padding = new System.Drawing.Point(CLOSE_SIZE, CLOSE_SIZE); this.MainTabControl.DrawItem += new DrawItemEventHandler(this.tabControlMain_DrawItem); this.MainTabControl.MouseDown += new System.Windows.Forms.MouseEventHandler(this.tabControlMain_MouseDown); Console.SetOut(new TextBoxWriter(this.richTextBoxLog)); // corePresenter = new CtlcorePresenter(); this.labelUser.Text = "当前用户:" + this.userName; ModuleAttach();//加载子模块 string licenseFile = AppDomain.CurrentDomain.BaseDirectory + @"\NBSSLicense.lic"; this.licenseMonitor = new LicenseMonitor(this, 2000, licenseFile, "zzkeyFT1"); if (!this.licenseMonitor.StartMonitor()) { throw new Exception("license 监控失败"); } string reStr = ""; if (!this.licenseMonitor.IslicenseValid(ref reStr)) { MessageBox.Show(reStr); return; } }
private void MainView_Load(object sender, EventArgs e) { this.ribbon_Title.ApplicationCaption = LoginView.WMSName; string licenseFile = AppDomain.CurrentDomain.BaseDirectory + @"\JCJLicense.lic"; this.licenseMonitor = new LicenseMonitor(this, 2000, licenseFile, "zzkeyFT1"); if (!this.licenseMonitor.StartMonitor()) { throw new Exception("license 监控失败"); } string reStr = ""; if (!this.licenseMonitor.IslicenseValid(ref reStr)) { MessageBox.Show(reStr); return; } }
private void frmLicenseWizard_FormClosing(object sender, FormClosingEventArgs e) { LicenseMonitor.Reset(); switch (LicenseMonitor.CurrentLicense.LicenseStatus) { case LicenseMonitor.LicenseStates.EvaluationMode: Result = Licensing.LicenseWizard.ScreenStart.Actions.Trial; break; case LicenseMonitor.LicenseStates.Licensed: Result = Licensing.LicenseWizard.ScreenStart.Actions.Activate; break; default: Result = Licensing.LicenseWizard.ScreenStart.Actions.None; //Application.Exit(); break; } }
private void MainForm_Load(object sender, EventArgs e) { try { this.WindowState = FormWindowState.Maximized; this.btnPause.Enabled = false; this.labelVersion.Text = this.version; #region 数据库配置 string dbSrc = ConfigurationManager.AppSettings["DBSource"]; //CtlDBAccess.DBUtility.PubConstant.ConnectionString = string.Format(@"{0}Initial Catalog=ACEcams;User ID=sa;Password=123456;", dbSrc); string dbConn1 = string.Format(@"{0}Initial Catalog=AoyouEcams;User ID=sa;Password=123456;", dbSrc); CtlDBAccess.DBUtility.DbHelperSQL.SetConnstr(dbConn1); string dbConn2 = string.Format(@"{0}Initial Catalog=AoyouLocalMes;User ID=sa;Password=123456;", dbSrc); MesDBAccess.DBUtility.DbHelperSQL.SetConnstr(dbConn2); AsrsStorDBAcc.DbHelperSQL.SetConnstr(string.Format(@"{0}Initial Catalog=AoyouWMSDB;User ID=sa;Password=123456;", dbSrc)); #endregion string mesAddr = ConfigurationManager.AppSettings["MesSvcAddr"]; PrcsCtlModelsAoyou.WShelper.url = mesAddr; presenter = new MainPresenter(this); childList = new List <string>(); childViews = new List <BaseChildView>(); Console.SetOut(new TextBoxWriter(this.richTextBoxLog)); // corePresenter = new CtlcorePresenter(); this.labelUser.Text = "当前用户:" + this.userName; this.MainTabControl.DrawMode = TabDrawMode.OwnerDrawFixed; this.MainTabControl.Padding = new System.Drawing.Point(CLOSE_SIZE, CLOSE_SIZE); this.MainTabControl.DrawItem += new DrawItemEventHandler(this.tabControlMain_DrawItem); this.MainTabControl.MouseDown += new System.Windows.Forms.MouseEventHandler(this.tabControlMain_MouseDown); if (!presenter.SysCtlInit()) { return; } if (!LoadModules())//加载子模块 { MessageBox.Show("子模块加载错误"); return; } this.configView.BatteryCfgView.dlgtSndPalletCfg = presenter.SendDevlinePalletCfg; this.configView.BatteryCfgView.dlgtGetPalletCfg = presenter.ReadPalletCfgFromPlc; List <string> logSrcs = new List <string>(); logSrcs.AddRange(presenter.GetLogSrcList()); List <string> storLogSrcs = storageView.GetLogsrcList(); if (storLogSrcs != null) { logSrcs.AddRange(storLogSrcs); } logView.SetLogsrcList(logSrcs); presenter.SetLogRecorder(logView.GetLogrecorder()); AllocateModuleInface(); nodeMonitorView.Init(); this.nodeMonitorView.InitDevDic(presenter.DevCommManager.GetPLCConnStatDic()); this.nodeMonitorView.DevMonitorView.devCommMonitor = presenter.DevCommManager; string[] taskNodeIDS = new string[] { "1001", "1002", "1003", "1004", "1005", "1006", "6001", "6002", "6003" }; IDictionary <string, string> taskNodeMap = new Dictionary <string, string>(); foreach (string nodeID in taskNodeIDS) { FlowCtlBaseModel.CtlNodeBaseModel node = presenter.CtlNodeManager.GetNodeByID(nodeID); if (node != null) { taskNodeMap[nodeID] = node.NodeName; } } asrsCtlView.SetTaskNodeNames(taskNodeMap); string licenseFile = AppDomain.CurrentDomain.BaseDirectory + @"\NBSSLicense.lic"; this.licenseMonitor = new LicenseMonitor(this, 60000, licenseFile, "zzkeyFT1"); if (!this.licenseMonitor.StartMonitor()) { throw new Exception("license 监控失败"); } string reStr = ""; if (!this.licenseMonitor.IslicenseValid(ref reStr)) { MessageBox.Show(reStr); return; } presenter.LoadAsrsExtSvc(); //宿主状态监控服务 PublicMonitorSvc(); Console.WriteLine("系统初始化完成!"); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
private SlyceAuthorizer.LicenseStates GetNewTrialLicenseAuto() { if (SelectedPanel == panelContinueTrial) // Trial { string errorMessage; List <string> machineIds = SlyceAuthorizer.GetMachineIds(out errorMessage); if (machineIds.Count == 0) { ShowMessageBox(errorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(SlyceAuthorizer.LicenseStates.HardwareNotMatched); } ShowMessage("Fetching trial license..."); string message; if (SlyceAuthorizer.ActivateViaInternet("", machineIds[0], textBoxEmail.Text, false, out message)) { int daysRemaining; bool errorOccurred; bool demo; SlyceAuthorizer.LockTypes lockType; SlyceAuthorizer.LicenseStates status; Licensing.SlyceAuthorizer.Reset(); bool licensed = Licensing.SlyceAuthorizer.IsLicensed("Visual NHibernate License.SlyceLicense", out message, out daysRemaining, out errorOccurred, out demo, out lockType, out status); if (licensed) { ShowMessage("Trial started"); ShowMessageBox("License installed.", "License Installed", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (demo && daysRemaining >= 0) { ShowMessage("Trial running"); ShowMessageBox(string.Format("{0} days remaining.", daysRemaining), "Trial Installed", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { SetRenewButtonsVisibility(true); ShowMessage("Trial expired"); ShowMessageBox("Your trial has expired. Re-downloading won't help.\n\nGet a new serial when you purchase.", "Trial Expired", MessageBoxButtons.OK, MessageBoxIcon.Warning); } return(status); } ShowMessage("Activation failed"); ShowMessageBox("Can't unlock.\n" + message, "Activation Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); return(SlyceAuthorizer.LicenseStates.ServerValidationFailed); } else // Full { if (!SlyceAuthorizer.IsValidLicenseNumber(textBoxSerial.Text)) { ShowMessageBox("Please enter a valid serial number.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(SlyceAuthorizer.LicenseStates.LicenseFileNotFound); } ShowMessage("Fetching license..."); string message; if (SlyceAuthorizer.ActivateViaInternet(textBoxSerial.Text, "", "", true, out message)) { LicenseMonitor.Reset(); if (LicenseMonitor.CurrentLicense.LicenseStatus == LicenseMonitor.LicenseStates.EvaluationExpired) { SetRenewButtonsVisibility(true); ShowMessage("License expired"); ShowMessageBox("Your license has expired. Re-downloading won't help.\n\nGet a new serial when you purchase.", "Expired", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(SlyceAuthorizer.LicenseStates.EvaluationExpired); } else { ShowMessageBox("Your license was installed successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); return(SlyceAuthorizer.LicenseStates.Licensed); } } ShowMessageBox("Can't unlock.\n" + message, "Activation Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); return(SlyceAuthorizer.LicenseStates.ServerValidationFailed); } }
private bool InstallAuto() { #region Activate Full License if (ScreenStart.Action == ScreenStart.Actions.Activate) { if (!SlyceAuthorizer.IsValidLicenseNumber(LicenseNumber)) { ShowMessageBox("Please enter a valid serial number.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } string message; if (SlyceAuthorizer.ActivateViaInternet(LicenseNumber, "", "", true, out message)) { LicenseMonitor.Reset(); ShowMessageBox("Your license was installed successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); return(true); } ShowMessageBox("Can't unlock.\n" + message, "Activation Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } #endregion #region Activate Trial License if (ScreenStart.Action == ScreenStart.Actions.Trial) { string errorMessage; List <string> machineIds = SlyceAuthorizer.GetMachineIds(out errorMessage); if (machineIds.Count == 0) { ShowMessageBox(errorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } string message; //throw new NotImplementedException("WTF!"); if (SlyceAuthorizer.ActivateViaInternet("", machineIds[0], "oops", false, out message)) { int daysRemaining; bool errorOccurred; bool demo; SlyceAuthorizer.LockTypes lockType; SlyceAuthorizer.LicenseStates status; Licensing.SlyceAuthorizer.Reset(); bool licensed = Licensing.SlyceAuthorizer.IsLicensed("Visual NHibernate License.SlyceLicense", out message, out daysRemaining, out errorOccurred, out demo, out lockType, out status); if (licensed) { ShowMessageBox("License installed.", "License Installed", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (demo && daysRemaining >= 0) { ShowMessageBox(string.Format("{0} days remaining.", daysRemaining), "Trial Installed", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { ShowMessageBox("Your trial has expired.", "Trial Expired", MessageBoxButtons.OK, MessageBoxIcon.Warning); } return(true); } ShowMessageBox("Can't unlock.\n" + message, "Activation Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } #endregion return(false); }