Example #1
0
        void client_OnMessage(QueueMessage.Message obj)
        {
            switch (obj.GetType().Name)
            {
            case MessageName.ClientQueryMessage:
            {
                var msg = obj as ClientQueryMessage;
                if (msg.ClientList.ContainsKey(windowNo))
                {
                    userId = msg.ClientList[windowNo];
                }
                else
                {
                    userId = "";
                }
            }
            break;

            case MessageName.ClientChangedMessage:
            {
                var msg = obj as ClientChangedMessage;
                if (msg.ChangedType == ClientChangedType.Add)
                {
                    userId = msg.UserID;
                }
                else
                {
                    userId = "";
                }
            }
            break;
            }
        }
Example #2
0
        void client_OnMessage(QueueMessage.Message obj)
        {
            var callMsg = obj as CallMessage;

            if (callMsg != null)
            {
                this.Log("Message:" + callMsg.TicketNo);
            }
        }
Example #3
0
 void client_OnMessage(QueueMessage.Message obj)
 {
     this.txtSoundMesInfo.Invoke(new Action(() =>
     {
         if (isOk)
         {
             this.txtSoundMesInfo.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\r\n" + obj.ToString() + "。\r\n");
         }
         else
         {
             this.txtSoundMesInfo.AppendText("因语音包初始化失败,该条语音播放未成功:" + obj.ToString() + "。\r\n");
         }
         LogService.Info(obj.ToString());
     }));
     if (isOk)
     {
         PlaySound(obj.ToString());
     }
 }
Example #4
0
        void client_OnMessage(QueueMessage.Message message)
        {
            switch (message.GetType().Name)
            {
            case MessageName.CallMessage:
            {
                var msg = message as CallMessage;
                if (msg.IsLEDMessage)
                {
                    var win = this.listLedWin.Find(m => m.WindowNumber == msg.WindowNo);
                    if (win != null)
                    {
                        var ctl = this.listLedControl.Find(m => m.ID == win.ControllerID);
                        if (ctl != null)
                        {
                            if (!callDic.ContainsKey(win.WindowNumber))
                            {
                                callDic.TryAdd(win.WindowNumber, DateTime.Now);
                            }
                            //频繁呼叫直接取消
                            else if (DateTime.Now - callDic[win.WindowNumber] < callSpan)
                            {
                                return;
                            }
                            Task.Factory.StartNew(arg =>
                                {
                                    var sendInfo = arg as ledSendInfo;
                                    //LED闪烁
                                    sendInfo.isFlash = true;
                                    this.trySend(sendInfo);
                                    Thread.Sleep(3000);
                                    sendInfo.isFlash = false;
                                    this.trySend(sendInfo);
                                }, new ledSendInfo()
                                {
                                    ip         = ctl.IP,
                                    port       = ctl.Port,
                                    colorMode  = fullColorList.Contains(win.WindowNumber) ? 4 : 3,
                                    deviceAddr = ctl.DeviceAddress,
                                    position   = win.Position,
                                    text       = win.DisplayText.Replace("{Number}", msg.TicketNo)
                                });
                            callDic.AddOrUpdate(win.WindowNumber, DateTime.Now, (k, v) =>
                                {
                                    return(DateTime.Now);
                                });
                        }
                    }
                }
            }
            break;

            case MessageName.RateMessage:
            {
                var msg = message as RateMessage;
                var win = this.listLedWin.Find(m => m.WindowNumber == msg.WindowNo);
                if (win != null)
                {
                    var ctl = this.listLedControl.Find(m => m.ID == win.ControllerID);
                    if (ctl != null)
                    {
                        Task.Factory.StartNew(arg =>
                            {
                                this.trySend(arg as ledSendInfo);
                            }, new ledSendInfo()
                            {
                                ip         = ctl.IP,
                                port       = ctl.Port,
                                colorMode  = fullColorList.Contains(win.WindowNumber) ? 4 : 3,
                                deviceAddr = ctl.DeviceAddress,
                                position   = win.Position,
                                text       = this.resumeText
                            });
                    }
                }
            }
            break;

            case MessageName.OperateMessage:
            {
                var msg = message as OperateMessage;
                var win = this.listLedWin.Find(m => m.WindowNumber == msg.WindowNo);
                if (win != null)
                {
                    var ctl = this.listLedControl.Find(m => m.ID == win.ControllerID);
                    if (ctl != null)
                    {
                        var sendInfo = new ledSendInfo()
                        {
                            ip         = ctl.IP,
                            port       = ctl.Port,
                            colorMode  = fullColorList.Contains(win.WindowNumber) ? 4 : 3,
                            deviceAddr = ctl.DeviceAddress,
                            position   = win.Position
                        };
                        if (msg.Operate == Operate.Pause)
                        {
                            sendInfo.text = this.pauseText;
                        }
                        else if (msg.Operate == Operate.Reset)
                        {
                            sendInfo.text = this.resumeText;
                        }
                        Task.Factory.StartNew(arg =>
                            {
                                this.trySend(arg as ledSendInfo);
                            }, sendInfo);
                    }
                }
            }
            break;
            }
            this.txtSoundMesInfo.Invoke(new Action(() =>
            {
                this.messageIndicator1.SetState(StateType.Success, "收到消息:" + message.ToString());
                this.txtSoundMesInfo.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\r\n" + message.ToString() + "。\r\n");
                LogService.Info(message.ToString());
            }));
        }