예제 #1
0
        public void ExitApp()
        {
            LogData.EventHandlerSendParm SendParm = new LogData.EventHandlerSendParm();
            SendParm.Node1NameIndex = (int)LogData.Node1Name.System_security;
            SendParm.LevelIndex     = (int)LogData.Node2Level.MESSAGE;
            SendParm.EventID        = ((int)LogData.Node2Level.MESSAGE).ToString();
            SendParm.Keywords       = "软件退出";
            SendParm.EventData      = "用户:" + SetForm.LogInUserName;
            SCADA.MainForm.m_Log.AddLogMsgHandler.Invoke(this, SendParm);

            LogSaveRunning = false;
            SaveData2Xml_threaFucEvent.Set();
        }
예제 #2
0
        private void SaveFuc()
        {
            while (LogSaveRunning)
            {
                if (SaveLogXmlDoc_Flag)
                {
                    if (LogXmlDoc.Element(LogDataNode0Name[(int)Node0Name.Root]).Descendants().Count() > MAXLogDataNode)//记录超过10000条时保存为历史记录
                    {
                        string s = DateTime.Now.ToString();
                        s = s.Replace(" ", "");
                        s = s.Replace(":", "");
                        s = s.Replace("/", "");
                        string[] arr = FileNmae.Split('\\');
                        s = s + arr[arr.Length - 1];
                        s = FileNmae.Replace(arr[arr.Length - 1], s);
                        LogXmlDoc.Save(s);
                        MakeXMLDefaultstructure();
                        LogData.EventHandlerSendParm SendParm = new LogData.EventHandlerSendParm();
                        SendParm.Node1NameIndex = (int)LogData.Node1Name.System_security;
                        SendParm.LevelIndex     = (int)LogData.Node2Level.MESSAGE;
                        SendParm.EventID        = ((int)LogData.Node2Level.MESSAGE).ToString();
                        SendParm.Keywords       = "保存历史日志";
                        SendParm.EventData      = "历史日志文件:" + s;
                        SCADA.MainForm.m_Log.AddLogMsgHandler.BeginInvoke(this, SendParm, null, null);
                    }

                    LogXmlDoc.Save(FileNmae);
                    SaveLogXmlDoc_Flag = false;
                }
                else
                {
                    SaveData2Xml_threaFucEvent.WaitOne();
                }
//                System.Threading.Thread.Sleep(2000);
            }
            LogXmlDoc.Save(FileNmae);//退出最后保存
        }
예제 #3
0
 private void button_ClreaLine_Click(object sender, EventArgs e)//清线
 {
     if (SetForm.LogIn)
     {
         if (MessageBox.Show("是否确定执行清线操作!", "警告", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             for (int ii = 0; ii < MainForm.cnclist.Count; ii++)
             {
                 MainForm.cnclist[ii].NcTaskManage.ClearNCTask();
             }
             LogData.EventHandlerSendParm SendParm = new LogData.EventHandlerSendParm();
             SendParm.Node1NameIndex = (int)LogData.Node1Name.System_security;
             SendParm.LevelIndex     = (int)LogData.Node2Level.MESSAGE;
             SendParm.EventID        = ((int)LogData.Node2Level.MESSAGE).ToString();
             SendParm.Keywords       = "清线操作";
             SendParm.EventData      = "用户:" + SetForm.LogInUserName;
             SCADA.MainForm.m_Log.AddLogMsgHandler.Invoke(this, SendParm);
         }
     }
     else
     {
         MessageBox.Show(MessageString.SetForms_RightNotEnough, MessageString.SetForms_Information, MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }