Esempio n. 1
0
        public static void ShowConfirm(string MessageId, MsgBuilder MessageBuilder, WebControl cntrlName)
        {
            RawMessage theMsg = MsgRepository.GetMessage(MessageId);

            MessageBuilder.MsgRepository[MessageId] = theMsg.ToString();
            string theDynamicMsg = MessageBuilder.BuildMessage(MessageId);

            ShowConfirm(theDynamicMsg, theMsg.Type.ToString(), theMsg.Buttons.ToString(), cntrlName);
        }
Esempio n. 2
0
        public static void ShowforUpdatePanel(string MessageId, MsgBuilder MessageBuilder, Control frmName)
        {
            RawMessage theMsg = MsgRepository.GetMessage(MessageId);

            MessageBuilder.MsgRepository[MessageId] = theMsg.ToString();
            string theDynamicMsg = MessageBuilder.BuildMessage(MessageId);

            ShowforUpdatePanel(theDynamicMsg, theMsg.Type.ToString(), theMsg.Buttons.ToString(), frmName);
        }
Esempio n. 3
0
        public static string GetMessage(string MessageId, MsgBuilder MessageBuilder, Control frmName = null)
        {
            RawMessage theMsg = MsgRepository.GetMessage(MessageId);

            MessageBuilder.MsgRepository[MessageId] = theMsg.ToString();
            string theDynamicMsg = MessageBuilder.BuildMessage(MessageId);

            return(theDynamicMsg.ToString());
        }
Esempio n. 4
0
        public static void ShowfromPage(string MessageId, MsgBuilder MessageBuilder, Page frmName)
        {
            RawMessage theMsg = MsgRepository.GetMessage(MessageId);

            MessageBuilder.MsgRepository[MessageId] = theMsg.ToString();
            string theDynamicMsg = MessageBuilder.BuildMessage(MessageId);

            Showfrompage(theDynamicMsg, theMsg.Type.ToString(), theMsg.Buttons.ToString(), frmName);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="MessageId">For retrieving message from xml file corresponding to MessageId</param>
        /// <param name="MessageBuilder">Send user defined message</param>
        /// <param name="frmName">The form control on which message will be shown</param>
        public static DialogResult ShowWindowConfirm(string MessageId, MsgBuilder MessageBuilder, System.Windows.Forms.Control frmName)
        {
            RawMessage theMsg = MsgRepository.GetMessage(MessageId);

            MessageBuilder.MsgRepository[MessageId] = theMsg.ToString();
            string theDynamicMsg = MessageBuilder.BuildMessage(MessageId);

            //ShowConfirm(theDynamicMsg, theMsg.Type.ToString(), theMsg.Buttons.ToString(), cntrlName);
            return(ShowWindow(theDynamicMsg, theMsg.Type.ToString(), theMsg.Buttons.ToString(), frmName));
        }
Esempio n. 6
0
        public override void ChannelRead(IChannelHandlerContext context, object message)
        {
            var sender = ((UdpMessage)message).Sender;

            if (message is Message msg)
            {
                // var json = JsonConvert.SerializeObject(msg,Formatting.None);
                GkParser.ParseCore(ref msg);
                Logger.Info($"收到设备消息, msg:{msg.Bodies[0].IdType.ToString()}");
//                MsgBuilder.BuildResp(context, msg);
                var header = msg.Header;
                var body   = msg.Bodies[0];
                if (IdType.HeartBeat.Equals(body.IdType) && HeartBeatType.Online.Equals(body.HeartBeatInfo.HeartBeatType))
                {
                    //下发查询设备类型指令
                    var content = MsgBuilder.BuildContent(IdType.ReadDeviceInfo, MsgType.Configure, OpsType.ReadCommand,
                                                          0, 1, null);
                    var cmd    = MsgBuilder.BuildMessage(header.Src, header.Dst, header.Ver, false, 1, 0, content);
                    var buffer = Unpooled.WrappedBuffer(cmd);
                    var packet = new DatagramPacket(buffer, sender);
                    context.WriteAndFlushAsync(packet);
                }
            }
        }