Пример #1
0
        public T Get <T>(ProxyBase dto, string propertyName)
        {
            WebSocketMessage queryMessage = WebSocketMessageCreate(
                WebSocketMessage.WebSocketMessageType.Get,
                dto,
                propertyName,
                0
                );

            return(SendAndGetResponse <T>(queryMessage, null));
        }
Пример #2
0
        public T Query <T>(ProxyBase dto, string methodName, params object[] parameters)
        {
            WebSocketMessage queryMessage = WebSocketMessageCreate(
                WebSocketMessage.WebSocketMessageType.Query,
                dto,
                methodName,
                parameters.Length);

            return(SendAndGetResponse <T>(queryMessage, new WebSocketMessageArrayValue {
                Value = parameters
            }));
        }
Пример #3
0
        public void EventRemove(ProxyBase dto, string eventName)
        {
            WebSocketMessage queryMessage = WebSocketMessageCreate(
                WebSocketMessage.WebSocketMessageType.EventRemove,
                dto,
                eventName,
                0);

            if (_clientSocket.ReadyState == WebSocketState.Open)
            {
                _clientSocket.Send(queryMessage.ToByteArray(null));
            }
        }
Пример #4
0
        public T Get <T>(ProxyBase dto, string propertyName)
        {
            WebSocketMessage query = new WebSocketMessage()
            {
                DtoGuid     = dto.DtoGuid,
                MessageType = WebSocketMessage.WebSocketMessageType.Get,
                MemberName  = propertyName,
#if DEBUG
                DtoName = dto.ToString()
#endif
            };

            return(_send <T>(query));
        }
Пример #5
0
        public void Set(ProxyBase dto, object value, string propertyName)
        {
            WebSocketMessage queryMessage = WebSocketMessageCreate(
                WebSocketMessage.WebSocketMessageType.Set,
                dto,
                propertyName,
                1);

            if (_clientSocket.ReadyState == WebSocketState.Open)
            {
                using (var valueStream = Serialize(value))
                    _clientSocket.Send(queryMessage.ToByteArray(valueStream));
            }
        }
Пример #6
0
        public T Query <T>(ProxyBase dto, string methodName, params object[] parameters)
        {
            WebSocketMessage query = new WebSocketMessage()
            {
                DtoGuid     = dto.DtoGuid,
                MessageType = WebSocketMessage.WebSocketMessageType.Query,
                MemberName  = methodName,
                Parameters  = parameters,
#if DEBUG
                DtoName = dto.ToString()
#endif
            };

            return(_send <T>(query));
        }
Пример #7
0
        public void EventRemove(ProxyBase dto, string eventName)
        {
            WebSocketMessage query = new WebSocketMessage()
            {
                DtoGuid     = dto.DtoGuid,
                MessageType = WebSocketMessage.WebSocketMessageType.EventRemove,
                MemberName  = eventName,
#if DEBUG
                DtoName = dto.ToString()
#endif
            };

            if (_clientSocket.ReadyState == WebSocketState.Open)
            {
                _clientSocket.SendAsync(Serialize(query), null);
            }
        }
Пример #8
0
        public void Invoke(ProxyBase dto, string methodName, params object[] parameters)
        {
            WebSocketMessage queryMessage = WebSocketMessageCreate(
                WebSocketMessage.WebSocketMessageType.Invoke,
                dto,
                methodName,
                parameters.Length);

            if (_clientSocket.ReadyState == WebSocketState.Open)
            {
                using (var valueStream = Serialize(new WebSocketMessageArrayValue {
                    Value = parameters
                }))
                {
                    _clientSocket.Send(queryMessage.ToByteArray(valueStream));
                }
            }
        }
Пример #9
0
        public void Set(ProxyBase dto, object value, string propertyName)
        {
            WebSocketMessage query = new WebSocketMessage()
            {
                DtoGuid     = dto.DtoGuid,
                MessageType = WebSocketMessage.WebSocketMessageType.Set,
                MemberName  = propertyName,
                Parameters  = new object[] { value },
#if DEBUG
                DtoName = dto.ToString()
#endif
            };

            if (_clientSocket.ReadyState == WebSocketState.Open)
            {
                _clientSocket.Send(Serialize(query));
            }
        }
Пример #10
0
        public void Invoke(ProxyBase dto, string methodName, params object[] parameters)
        {
            WebSocketMessage query = new WebSocketMessage()
            {
                DtoGuid     = dto.DtoGuid,
                MessageType = WebSocketMessage.WebSocketMessageType.Invoke,
                MemberName  = methodName,
                Parameters  = parameters,
#if DEBUG
                DtoName = dto.ToString()
#endif
            };

            if (_clientSocket.ReadyState == WebSocketState.Open)
            {
                _clientSocket.SendAsync(Serialize(query), null);
            }
        }