Пример #1
0
        void NMonMonitorClient_NotifyMessageReceived(object sender, NotifyMessageReceivedEventArgs e)
        {
            try
            {
                var notMessage = e.NotifyMessage;
                if (notMessage == null)
                {
                    return;
                }
                switch (notMessage.Command)
                {
                case (int)Service04Command.NotStateChanged:
                    ThreadPool.QueueUserWorkItem(a => DealChanStateChanged(notMessage));
                    break;

                case (int)Service04Command.NotNMonHead:
                    //需要委托主线程处理此消息
                    ThreadPool.QueueUserWorkItem(a => DealNMonHeadMessage(notMessage));
                    break;

                case (int)Service04Command.NotNMonData:
                    //需要委托主线程处理此消息
                    ThreadPool.QueueUserWorkItem(a => DealNMonDataMessage(notMessage));
                    break;
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Пример #2
0
        void MonClient_NotifyMessageReceived(object sender, NotifyMessageReceivedEventArgs e)
        {
            AppendMessage(string.Format("NotifyMessage\t{0}", ParseCommand(e.NotifyMessage.Command)));
            int command = e.NotifyMessage.Command;

            switch (command)
            {
            case (int)Service10Command.NotExtStateChanged:
                DealExtStateChangedMessage(e.NotifyMessage);
                break;
            }
        }
Пример #3
0
        void MediaClient_NotifyMessageReceived(object sender, NotifyMessageReceivedEventArgs e)
        {
            try
            {
                var    notify = e.NotifyMessage;
                string str    = string.Empty;
                if (notify.ListData != null)
                {
                    if (notify.ListData.Count >= 2)
                    {
                        string strPos  = notify.ListData[0];
                        string strFile = notify.ListData[1];
                        str += string.Format("{0}\t{1};", strPos, strFile);

                        if (!string.IsNullOrEmpty(strFile))
                        {
                            //string path = string.Format("http://192.168.6.27:8081/MediaData/{0}", notify.ListData[1]);
                            //Dispatcher.Invoke(new Action(() =>
                            //{
                            //    BitmapImage bitmap = new BitmapImage();
                            //    bitmap.BeginInit();
                            //    bitmap.UriSource = new Uri(path, UriKind.RelativeOrAbsolute);
                            //    bitmap.EndInit();
                            //    ImgVedio.Source = bitmap;
                            //}));
                            OperationReturn optReturn = DownloadImage(strFile);
                            if (!optReturn.Result)
                            {
                                AppendMessage(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                                return;
                            }
                            string path = optReturn.Data.ToString();
                            Dispatcher.Invoke(new Action(() =>
                            {
                                string strTemp     = path;
                                BitmapImage bitmap = new BitmapImage();
                                bitmap.BeginInit();
                                bitmap.UriSource = new Uri(strTemp, UriKind.RelativeOrAbsolute);
                                bitmap.EndInit();
                                ImgVedio.Source = bitmap;
                            }));
                        }
                    }
                }
                AppendMessage(str);
            }
            catch (Exception ex)
            {
                AppendMessage(string.Format("Fail.\t{0}", ex.Message));
            }
        }
Пример #4
0
        void NMonClient_NotifyMessageReceived(object sender, NotifyMessageReceivedEventArgs e)
        {
            AppendMessage(string.Format("NotifyMessage\t{0}", ParseCommand(e.NotifyMessage.Command)));
            int command = e.NotifyMessage.Command;

            switch (command)
            {
            case (int)Service10Command.NotNMonHeadReceived:
                ThreadPool.QueueUserWorkItem(a => DealNMonHeadMessage(e.NotifyMessage));
                break;

            case (int)Service10Command.NotNMonDataReceived:
                ThreadPool.QueueUserWorkItem(a => DealNMonDataMessage(e.NotifyMessage));
                break;
            }
        }
Пример #5
0
 void MonClient_NotifyMessageReceived(object sender, NotifyMessageReceivedEventArgs e)
 {
     try
     {
         CurrentApp.WriteLog("NotifyEvent", string.Format("{0}", ParseCommand(e.NotifyMessage.Command)));
         int command = e.NotifyMessage.Command;
         switch (command)
         {
         case (int)Service10Command.NotExtStateChanged:
             DealExtStateChangedMessage(e.NotifyMessage);
             break;
         }
     }
     catch (Exception ex)
     {
         CurrentApp.WriteLog("NotifyEvent", string.Format("Fail.\t{0}", ex.Message));
     }
 }