protected override void OnExecute()
        {
            using (Traffic.AcquireLock())
            {
                Traffic.Clear();
            }
            ErrorText = String.Empty;

            try
            {
                /*var commandDocument = XDocument.Parse(UserCommandText);
                 *
                 * var cookie = string.Empty;
                 * var cookieAttribute = commandDocument.Root.Attribute("Cookie");
                 * if (cookieAttribute != null)
                 * {
                 *  cookie = cookieAttribute.Value;
                 * }*/

                EventAggregatorContext.Current.GetEvent <SendDataEvent>().Publish(new SendDataEventArgs(UserCommandText, this, string.Empty));
            }
            catch (Exception exception)
            {
                ErrorText = exception.Message;
            }
        }
        /// <summary>
        /// We are being asked to disconnect from Cornerstone.
        /// </summary>
        private void OnDisconnect()
        {
            using (Traffic.AcquireLock())
            {
                Traffic.Clear();
            }

            if (Connected)
            {
                _communicationEngine.Disconnect();
                Connected = false;
            }
        }
        private void AddTraffic(String direction, XDocument data)
        {
            using (Traffic.AcquireLock())
            {
                var trafficData = new TrafficData(direction, data.ToString());

                if (Traffic.Count == 100)
                {
                    Traffic.RemoveAt(0);
                }

                Traffic.Add(trafficData);
            }
        }
        protected virtual void OnExecute()
        {
            using (Traffic.AcquireLock())
            {
                Traffic.Clear();
            }
            ErrorText = String.Empty;

            if (CurrentCommand != null)
            {
                var commandDocument = CurrentCommand.GetCommand();
                EventAggregatorContext.Current.GetEvent <SendDataEvent>().Publish(new SendDataEventArgs(commandDocument.ToString(), this, CurrentCommand.Cookie));
            }
        }
Example #5
0
        protected override void OnExecute()
        {
            using (Traffic.AcquireLock())
            {
                Traffic.Clear();
            }
            ErrorText = String.Empty;

            try
            {
                var commandDocument = XDocument.Parse(UserCommandText);
                EventAggregatorContext.Current.GetEvent <SendDataEvent>().Publish(new SendDataEventArgs(commandDocument, this));
            }
            catch (Exception exception)
            {
                ErrorText = exception.Message;
            }
        }
        private void AddTraffic(String direction, object obj)
        {
            using (Traffic.AcquireLock())
            {
                if (obj is XDocument)
                {
                    var data        = obj as XDocument;
                    var trafficData = new TrafficData(direction, data.ToString());

                    if (Traffic.Count == 100)
                    {
                        Traffic.RemoveAt(0);
                    }

                    Traffic.Add(trafficData);
                }
                else
                {
                    var trafficData = new TrafficData(direction, obj.ToString());
                    Traffic.Add(trafficData);
                }
            }
        }