public SocketClient GetSocketClient()
        {
            if (SocketClient == null)
            {
                SocketClient = new SocketClient(_errorMessageHandling);
                SocketClient.ConnectionLogUpdated +=
                    (sender, args) =>
                {
                    ConnectionLog.Append(args);
                    ConnectionLogUpdated?.Invoke(this, EventArgs.Empty);
                };
                SocketClient.IsReconnecting += (sender, b) => { IsReconnecting = b; };
            }

            return(SocketClient);
        }
Пример #2
0
        public void AddToConnectionLog(string message)
        {
            lock (lockObj)
            {
                // Filter out the header
                string header = SocketUtilities.ParseHeaderStringFromResponse(message);
                if (!string.IsNullOrEmpty(header))
                {
                    message = message.Replace(header, string.Empty);
                }

                // Filter out the msg tag
                message = message.Replace("\"msg\",", string.Empty);

                // Limit the message length
                if (message.Length > 2000)
                {
                    message = message.Substring(0, 2000);
                }

                Log.Info(message);
                ConnectionLogUpdated.Invoke(this, message + Environment.NewLine);
            }
        }