示例#1
0
        private void DoStopNMonMessage(RequestMessage request)
        {
            ReturnMessage retMessage = new ReturnMessage();

            retMessage.Result    = true;
            retMessage.SessionID = SessionID;
            retMessage.Code      = 0;
            try
            {
                if (request.ListData == null ||
                    request.ListData.Count < 1)
                {
                    SendErrorMessage(request.Command, Defines.RET_PARAM_INVALID,
                                     string.Format("ListData is null or count invalid"));
                    return;
                }
                string strMonID = request.ListData[0];
                LogDebugMessage(request.Command,
                                string.Format("MonID:{0};", strMonID));
                if (mMonType != MonType.NMon)
                {
                    SendErrorMessage(request.Command, Defines.RET_CHECK_FAIL,
                                     string.Format("MonType invalid.\t{0}", mMonType));
                    return;
                }
                MonitorObject monObj = mListMonObjects.FirstOrDefault(o => o.MonID == strMonID);
                if (monObj == null)
                {
                    SendErrorMessage(request.Command, Defines.RET_NOT_EXIST,
                                     string.Format("Monitor object not in the monitor list"));
                    return;
                }
                if (mNMonCore == null)
                {
                    SendErrorMessage(request.Command, Defines.RET_OBJECT_NULL,
                                     string.Format("NMonCore is null"));
                    return;
                }
                var temp = mNMonCore.User as MonitorObject;
                if (temp == null || temp.MonID != monObj.MonID)
                {
                    SendErrorMessage(request.Command, Defines.RET_PARAM_INVALID,
                                     string.Format("MonitorObject invalid"));
                    return;
                }
                retMessage.Command = (int)Service10Command.ResStopNMon;
                retMessage.ListData.Add(strMonID);
                SendMessage(retMessage);
                mNMonCore.StopMon();
                mNMonCore = null;
            }
            catch (Exception ex)
            {
                SendErrorMessage(request.Command, Defines.RET_FAIL, ex.Message);
            }
        }
示例#2
0
 void UCNMonPanel_Unloaded(object sender, RoutedEventArgs e)
 {
     if (mNMonCore != null)
     {
         mNMonCore.StopMon();
         mNMonCore = null;
     }
     if (mMonitorClient != null)
     {
         mMonitorClient.Stop();
         mMonitorClient = null;
     }
 }
示例#3
0
 void MainWindow_Closing(object sender, CancelEventArgs e)
 {
     if (mNMonCore != null)
     {
         mNMonCore.StopMon();
         mNMonCore = null;
     }
     if (mMonClient != null)
     {
         mMonClient.Stop();
         mMonClient = null;
     }
     if (mNMonClient != null)
     {
         mNMonClient.Stop();
         mNMonClient = null;
     }
 }