Пример #1
0
        public Task TraceAsync(string data, DataOperation operation)
        {
            return(App.Current.Dispatcher.InvokeAsync(() =>
            {
                if (!string.IsNullOrWhiteSpace(data))
                {
                    DataLenght += data.Length;

                    var json = JObject.Parse(data);
                    json.ToString(Formatting.Indented);
                    var traceData = new TraceDataViewModel()
                    {
                        Operation = operation,
                        Data = json.ToString()
                    };

                    TraceLogs.Add(traceData);

                    while (TraceLogs.Count > TraceLimit)
                    {
                        TraceLogs.RemoveAt(0);
                    }
                }
            }).Task);
        }
Пример #2
0
        public Task TraceAsync(string data, DataOperation operation)
        {
            return App.Current.Dispatcher.InvokeAsync(() =>
            {
                if (!string.IsNullOrWhiteSpace(data))
                {
                    DataLenght += data.Length;

                    var json = JObject.Parse(data);
                    json.ToString(Formatting.Indented);
                    var traceData = new TraceDataViewModel()
                    {
                        Operation = operation,
                        Data = json.ToString()
                    };

                    TraceLogs.Add(traceData);

                    while (TraceLogs.Count > TraceLimit)
                    {
                        TraceLogs.RemoveAt(0);
                    }
                }
            }).Task;
        }