示例#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;
        }