public void SendKeyEvent(ushort code, bool alt, bool control, bool shift)
        {
            var eventMessage = new KeyboardEventMessage(code,
                (byte) (alt ? 1 : 0),
                (byte) (control ? 1 : 0),
                (byte) (shift ? 1 : 0)
                );
            var messageRdap = new RdapMessage(RdapMessageType.KeyboardEventMessage, eventMessage.ToBytes());
            var dataToSend = messageRdap.ToBytes();

            if (subscriber != null)
                subscriber.Send(dataToSend, 0, dataToSend.Length);
        }
        private void OnMouseUp(object sender, MouseEventArgs e)
        {
            switch (e.Button)
            {
                case MouseButtons.Left:
                    dragEndMouseEventType = MouseEventType.Left;
                    break;
                case MouseButtons.Middle:
                    dragEndMouseEventType = MouseEventType.Middle;
                    break;
                case MouseButtons.Right:
                    dragEndMouseEventType = MouseEventType.Right;
                    break;
                default:
                    return;
            }

            dragEndX = e.X;
            dragEndY = e.Y;

            byte[] dataToSend;
            if (dragEndX == dragStartX && dragEndY == dragStartY)
            {
                var message = new MouseClickEventMessage(dragEndMouseEventType, (uint)e.X, (uint)e.Y);
                var messageRdap = new RdapMessage(RdapMessageType.MouseClickEventMessage, message.ToBytes());
                dataToSend = messageRdap.ToBytes();
            }
            else
            {
                var message = new MouseDragEventMesssage(dragEndMouseEventType, (uint)dragStartX, (uint)dragStartY, (uint)dragEndX, (uint)dragEndY);
                var messageRdap = new RdapMessage(RdapMessageType.MouseClickEventMessage, message.ToBytes());
                dataToSend = messageRdap.ToBytes();
            }

            if (subscriber != null)
                subscriber.Send(dataToSend, 0, dataToSend.Length);
        }