private void tsmiStationConfigInfo_Click(object sender, EventArgs e) { //A_FrmStationConfigInfo if (Searcher.FindFormByName("A_FrmStationConfigInfo")) { return; } ILogger.Write(EnumLogType.OperateLog, strLogPath + DateTime.Now.ToString("yyyy-MM-dd") + ".xml", LoginBLL.user, "打开实时分站状态菜单"); A_FrmStationConfigInfo frm = new A_FrmStationConfigInfo(dockPanel1); frm.Show(dockPanel1, DockState.Document); }
private void A_FrmMain_Load(object sender, EventArgs e) { dockPanel1.AllowEndUserDocking = false; #region 实时报警信息 A_FrmRTAlarm frmrta = new A_FrmRTAlarm(dockPanel1); this.AlarmFrm = frmrta; frmrta.Show(dockPanel1, DockState.Document); #endregion #region 分站状态信息 A_FrmStationConfigInfo frm = new A_FrmStationConfigInfo(dockPanel1); frm.Show(dockPanel1, DockState.Document); #endregion #region 实时下井人员名单 //RealTime.FrmRealTimeInMineEmp frmE = new FrmRealTimeInMineEmp(dockPanel1); //frmE.Show(dockPanel1, DockState.Document); #endregion #region 判断主、备机、客户端 string configPath = Application.StartupPath + @"\HostIPConfig.xml"; XmlDocument docConfig = new XmlDocument(); if (File.Exists(configPath)) { //MessageBox.Show("HostIPConfig.xml文件不存在,配置文件后会自动生成此文件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); docConfig.Load(configPath); string isStartHost = docConfig.ChildNodes[1].ChildNodes[0].ChildNodes[0].InnerText; if (isStartHost.ToUpper() == "TRUE") { string isHost = docConfig.ChildNodes[1].ChildNodes[0].ChildNodes[1].InnerText; if (isHost.ToUpper() == "TRUE") { this.Text = "KJ128A型矿用人员管理系统--[主机]"; } else { this.Text = "KJ128A型矿用人员管理系统--[备机]"; timer_Clear.Enabled = false; //qyz备机功能全开 tsmiSystem.Enabled = true; //登录菜单 tsmiConfiguration.Enabled = false; //配置菜单 tsmiTools.Enabled = false; //工具菜单 tsbtnLogin.Enabled = true; //状态栏-登录 DataTable stationdt = this.GetStationTable(); ReplaceStationXml(stationdt, Application.StartupPath + "\\Station.xml"); } } else { if (New_DBAcess.blIsClient) { this.Text = "KJ128A型矿用人员管理系统--[客户端]"; tsmiOuterProject.Visible = false; timer_Clear.Enabled = false; } } } #endregion #region 关闭欢迎画面 FrmWelcome frmWelcome = (FrmWelcome)Application.OpenForms["FrmWelcome"]; if (frmWelcome != null) { frmWelcome.Close(); } #endregion #region 是否是客户端程序 if (New_DBAcess.blIsClient) { tsmiSystem.Enabled = true; //登录菜单 //Czlt-2010-10-9 - 客户端打包时使用 tsmiConfiguration.Visible = false; //配置菜单 //Czlt-2010-10-9 - 主机和客户端(可配置) 使用 //tsmiConfiguration.Visible = true; //配置菜单 tsmiTools.Enabled = false; //工具菜单 tsmiTools.Visible = false; tsbtnLogin.Enabled = true; //状态栏-登录 tsmiHolidayClass.Visible = false; tsmiHolidayManage.Visible = false; tsmiRealTimeAdd.Visible = false; tsmiAddHistoryAttendance.Visible = false; toolStripSeparator12.Visible = false; timer_Clear.Enabled = false; } #endregion #region[] FlashTsmi(); #endregion #region[状态栏信息] int width = this.stsMes.Width / 5; for (int i = 0; i < this.stsMes.Items.Count; i++) { this.stsMes.Items[i].Width = width - 5; } this.stsUsername.Text = "用户名:来宾"; this.stsLoginTime.Text = "登录时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); ; if (this.Text.Contains("--")) { this.stsBak.Text = this.Text.Substring(this.Text.IndexOf("--") + 2); } else { this.stsBak.Text = "[单机]"; } this.stsBeginTime.Text = "运行时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); if (AlarmFrm.BlIsAlarm) { stsAlarm.ForeColor = Color.Red; stsAlarm.Text = "报警显示:报警"; timeShow.Enabled = true; } else { stsAlarm.ForeColor = Color.Black; stsAlarm.Text = "报警显示:无报警"; timeShow.Enabled = false; } #endregion timer_Alarm.Interval = RefReshTime._rtTime; #region[判断是否删除数据] if (mbll.DeleteSql()) { if (MessageBox.Show("由于您设置了定时删除历史数据,选择“Yes”自动执行,选择“No”取消删除(您可以在系统配置中重新设置自动删除数据时间)", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { if (MessageBox.Show("准备执行自动删除历史数据,请确认备份了数据库以防止不可逆转的数据丢失,确定删除?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { mbll.DeleteSql1(); } } catch { } } } #endregion if (!File.Exists(Application.StartupPath + "\\PowerManager.xml")) { FileStream fs = new FileStream(Application.StartupPath + "\\PowerManager.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite); StreamWriter ws = new StreamWriter(fs); ws.WriteLine("<Root>"); ws.WriteLine("<IsOpen>False</IsOpen>"); ws.WriteLine("</Root>"); ws.Close(); ws.Dispose(); fs.Close(); fs.Dispose(); } //#region 【Czlt-2011-12-26 软件启动时修改配置信息,并启动KJ128诊断软件】 //CzltSaveChkXml(false, true); ////打开KJ128检测系统 //int iCount = 0; //foreach (Process process in Process.GetProcesses()) //{ // if (process.ProcessName.Equals("Kj128ChkHost")) // { // iCount++; // } //} ////Czlt-2011-01-25 删除打开多个程序控制 ////qyz-2011-11-27 加入多开限制 //if (iCount > 0) //{ // // MessageBox.Show("已经有一个KJ128A桌面程序在运行,请勿重复打开!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); //} //else //{ // //打开KJ128检测系统 // if (File.Exists(Application.StartupPath + "\\Kj128ChkHost.exe")) // { // try // { // string strPath = @"Kj128ChkHost.exe"; // Process TongXun = new Process(); // TongXun.StartInfo.FileName = strPath; // TongXun.Start(); // //给提示信息 // } // catch { } // } //} //#endregion }