示例#1
0
        private void Client_NotificationReceived(CPNotification notification)
        {
            var method = notification.Method;
            var obj    = notification.ObjectName;

            if (obj == ObjectName)
            {
                if (method == "WindowsState")
                {
                    var data    = notification.ValueList;
                    var windows = new TWindowStateList(data);

                    WindowStateEvent?.Invoke(windows);
                }
            }
        }
示例#2
0
        public static CPResponseBase Parse(string _resp)
        {
            if (string.IsNullOrEmpty(_resp))
            {
                throw new ArgumentException("_resp == null");
            }

            if (!_resp.EndsWith("\r\n"))
            {
                throw new FormatException("Invalid response format: " + _resp);
            }


            CPResponseBase response = null;

            if (_resp.StartsWith("="))
            {// ответ на запрос от сервера
                response = new CPResponse(_resp);
            }
            else if (_resp.StartsWith(":"))
            {// события сервера
                response = new CPNotification(_resp);
            }
            else
            {
                if (_resp.StartsWith("OK") || _resp.StartsWith("ER"))
                {// ответ от Galileo Connect
                    response = new GCResponse(_resp);
                }
                else
                {
                    throw new FormatException("Invalid response format: " + _resp);
                }
            }


            return(response);
        }
示例#3
0
 private void CpClient_NotificationReceived(CPNotification obj)
 {
     logger.Debug("CpClient_NotificationReceived(...)");
 }