private void FrmMain_Shown(object sender, EventArgs e) { actServiceState = (name, state) => { this.lvService.Items[name].SubItems[3].Text = state; }; actLog = (name, log) => { this.txtLog.AppendText(string.Format("{0} - {1}\r\n{2}\r\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), name, log)); }; var position = this.tabServer.Location; position.Offset(this.tabPerformance.Bounds.Location); this.viewerHost = new ViewerHost(); this.viewerHost.Visible = false; this.viewerHost.Location = position; this.viewerHost.Size = this.tabPerformance.Size; this.viewerHost.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; this.Controls.Add(this.viewerHost); this.viewerHost.BringToFront(); this.viewerHost.AppFileName = AppDomain.CurrentDomain.BaseDirectory + "Viewer\\FlowViewer.exe"; this.viewerHost.Start(Process.GetCurrentProcess().Id.ToString()); //handleCreate this.tabServer.SelectedTab = this.tabLog; this.tabServer.SelectedTab = this.tabMain; this.lvClient.ListViewItemSorter = new ListViewItemComparer <int>(0); this.InitService(); this.tsStart.PerformClick(); this.Close(); }
void InitializeViewerHost() { var position = this.tabServer.Location; position.Offset(this.tabPerformance.Bounds.Location); this.viewerHost = new ViewerHost(); this.viewerHost.Visible = false; this.viewerHost.Location = position; this.viewerHost.Size = this.tabPerformance.Size; this.viewerHost.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; this.Controls.Add(this.viewerHost); this.viewerHost.BringToFront(); this.viewerHost.AppFileName = AppDomain.CurrentDomain.BaseDirectory + "Viewer\\FlowViewer.exe"; this.viewerHost.Start(Process.GetCurrentProcess().Id.ToString()); }
private void FrmMain_Shown(object sender, EventArgs e) { RegInfo regInfo = null; if (Register.Validate.Check(true, out regInfo)) { if (regInfo.RegBase.OrganizationCode != ConfigurationManager.AppSettings["AreaNo"]) { MessageBox.Show("非授权的机构编码,请核对!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(0); } else { var strReg = string.Format("授权给:{0} 机构编码:{1} 到期时间:{2}", regInfo.RegBase.OrganizationName, regInfo.RegBase.OrganizationCode, Convert.ToDateTime(regInfo.RegBase.ExpiryDate).ToString("yyyy-MM-dd")); this.labRegInfo.Text = strReg; } } else { Environment.Exit(0); } new Thread(() => { while (true) { Thread.Sleep(1000 * 60 * 60 * 24); if (!Register.Validate.Check(false)) { Environment.Exit(0); } } }) { IsBackground = true }.Start(); actServiceState = (name, state) => { this.lvService.Items[name].SubItems[3].Text = state; }; actLog = (name, log) => { this.txtLog.AppendText(string.Format("{0} - {1}\r\n{2}\r\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), name, log)); }; var position = this.tabServer.Location; position.Offset(this.tabPerformance.Bounds.Location); this.viewerHost = new ViewerHost(); this.viewerHost.Visible = false; this.viewerHost.Location = position; this.viewerHost.Size = this.tabPerformance.Size; this.viewerHost.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; this.Controls.Add(this.viewerHost); this.viewerHost.BringToFront(); this.viewerHost.AppFileName = AppDomain.CurrentDomain.BaseDirectory + "Viewer\\FlowViewer.exe"; this.viewerHost.Start(Process.GetCurrentProcess().Id.ToString()); //handleCreate this.tabServer.SelectedTab = this.tabLog; this.tabServer.SelectedTab = this.tabMain; this.lvClient.ListViewItemSorter = new ListViewItemComparer <int>(0); this.InitService(); this.tsStart.PerformClick(); this.Close(); }