Ejemplo n.º 1
0
        internal async Task RefreshData(IServiceControl serviceControl)
        {
            //TODO: Consider moving this into ServiceControl e.g. GetSageMessageBody or something, models should be just about data
            if (Data != null)
            {
                return;
            }

            var url        = string.Format("/messages/{0}/body", MessageId);
            var bodyString = await serviceControl.GetBody(url);

            if (bodyString != null)
            {
                if (IsXml(bodyString))
                {
                    Data = GetXmlData(bodyString.Replace("\\\"", "\"").Replace("\\r", "\r").Replace("\\n", "\n"));
                }
                else
                {
                    Data = JsonPropertiesHelper.ProcessValues(bodyString, CleanupBodyString);
                }
            }
            else
            {
                Data = new List <KeyValuePair <string, string> >();
            }
        }
        private async Task <bool> LoadMessageBody()
        {
            if (FocusedRow == null || !ShouldLoadMessageBody || FocusedRow.BodyUrl.IsEmpty())
            {
                return(false);
            }

            _eventAggregator.Publish(new WorkStarted("Loading message body..."));

            var body = await _serviceControl.GetBody(FocusedRow.BodyUrl);

            FocusedRow.Body = body;

            _eventAggregator.Publish(new WorkFinished());

            return(true);
        }
Ejemplo n.º 3
0
        internal async Task RefreshData(IServiceControl serviceControl)
        {
            //TODO: Consider moving this into ServiceControl e.g. GetSageMessageBody or something, models should be just about data
            if (Data != null) return;

            var url = string.Format("/messages/{0}/body", MessageId);
            var bodyString = await serviceControl.GetBody(url);
            if (bodyString != null)
            {
                if (IsXml(bodyString))
                {
                    Data = GetXmlData(bodyString.Replace("\\\"", "\"").Replace("\\r", "\r").Replace("\\n", "\n"));
                }
                else
                {
                    Data = JsonPropertiesHelper.ProcessValues(bodyString, CleanupBodyString);
                }
            }
            else
            {
                Data = new List<KeyValuePair<string, string>>();
            }
        }