Beispiel #1
0
 protected virtual void OnMessageSending(string message)
 {
     if (MessageSending != null)
     {
         MessageSending.Invoke(message);
     }
 }
 /// <summary>
 /// Raises <see cref="MessageSending"/> event.
 /// </summary>
 protected virtual void OnMessageSending(RequestMessage message)
 {
     if (MessageSending != null)
     {
         var e = new MessageEventArgs(message);
         MessageSending?.Invoke(this, e);
     }
 }
Beispiel #3
0
        private void OnMessageEntered(string messageText, ref bool sendToOthers)
        {
            if (!sendToOthers)
            {
                return;
            }
            var consumed = false;

            MessageSending?.Invoke(messageText, ref consumed);
            sendToOthers = !consumed;
        }
        public void SendMessage(IPTZMessage message)
        {
            MessageSending?.Invoke(this, message.DataBytes);
            _logger.LogInfoMessage($"Send message. Data: {BitConverter.ToString(message.DataBytes)}");
            var sendResult = _serialPort.SendMessage(message.DataBytes);

            if (!sendResult)
            {
                _logger.LogError($"Send message fail.");
            }
        }
Beispiel #5
0
        public ViewerData()
        {
            Winner = -1;

            SendMessageCommand = new CustomCommand(item =>
            {
                MessageSending?.Invoke(PrintedText);
                PrintedText = "";
            })
            {
                CanBeExecuted = false
            };
        }
Beispiel #6
0
        public void SendMessage(IPTZMessage message)
        {
            MessageSending?.Invoke(this, message.DataBytes);
            _logger.LogInfoMessage($"Post message. Data: {BitConverter.ToString(message.DataBytes)}");


            // for debug
            //if (message.DataBytes[3] == 0x51)
            //{
            //    Task.Factory.StartNew(async () =>
            //    {
            //        await Task.Delay(1000);
            //        byte[] sendBuffer = new byte[] { 0xff, 0x01, 0x00, 0x59, 0x08, 0x9c, 0xfe };
            //        MessageReceived?.Invoke(this, sendBuffer);
            //    });
            //}

            var postResult = _udpClient.Post(message.DataBytes);

            if (!postResult)
            {
                _logger.LogError($"Post message fail.");
            }
        }
Beispiel #7
0
 protected virtual void OnMessageSending(Message message)
 {
     MessageSending?.Invoke(this, new MessageEvent(message));
 }