Пример #1
0
        public object GetViewModel()
        {
            WebTransferStatisticalDataAggregator.WebTransferAggregation Deserialize(string src)
            {
                return(JsonSerializer.Create()
                       .Deserialize <WebTransferStatisticalDataAggregator.WebTransferAggregation>(new JsonTextReader(new StringReader(src))));
            }

            var count = GetCount();

            var callCount       = new int[count];
            var requestLengths  = new long[count];
            var responseLengths = new long[count];

            foreach (var item in _timeLine)
            {
                var i    = GetIndex(item);
                var data = Deserialize(item.Data);
                callCount[i]       = data.CallCount;
                requestLengths[i]  = data.RequestLengths;
                responseLengths[i] = data.ResponseLengths;
            }

            return(new
            {
                DataType = "WebTransfer",
                Start = _startTime,
                End = _endTime,
                TimeWindow = _timeWindow.ToString(),
                Resolution = _resolution.ToString(),
                CallCount = callCount,
                RequestLengths = requestLengths,
                ResponseLengths = responseLengths,
            });
        }
Пример #2
0
        public async Task <SearchContainer <SearchPerson> > GetTrendingPeopleAsync(TimeWindow timeWindow, CancellationToken cancellationToken = default(CancellationToken))
        {
            RestRequest req = _client.Create("trending/person/{time_window}");

            req.AddUrlSegment("time_window", timeWindow.ToString());

            RestResponse <SearchContainer <SearchPerson> > resp = await req.ExecuteGet <SearchContainer <SearchPerson> >(cancellationToken).ConfigureAwait(false);

            return(resp);
        }
Пример #3
0
        /// <summary>
        /// Add Time window
        /// </summary>
        /// <param name="timeWindow">Source time window</param>
        /// <param name="second">Is second time window</param>
        /// <param name="inlines">Inlines to fill</param>
        /// <param name="bolded">Is need to be bold inline</param>
        private static void _AddTimeWindow(TimeWindow timeWindow, bool second, InlineCollection inlines, bool bolded)
        {
            string value             = timeWindow.ToString();
            string timewindowCaption = _timewindowCaption;

            if (second)
            {
                timewindowCaption += "2";
            }
            _AddLine(timewindowCaption, value, inlines, bolded);
        }
Пример #4
0
 protected override object GetResult()
 {
     return(new
     {
         DataType = "DatabaseUsage",
         Start = StartTime,
         End = EndTime,
         TimeWindow = TimeWindow.ToString(),
         Resolution = Resolution.ToString(),
         DatabaseUsage = _dbUsages
     });
 }
Пример #5
0
        public object GetViewModel()
        {
            WebHookAggregation Deserialize(string src)
            {
                return(JsonSerializer.Create()
                       .Deserialize <WebHookAggregation>(new JsonTextReader(new StringReader(src))));
            }

            var count = GetCount();

            var callCount       = new int[count];
            var requestLengths  = new long[count];
            var responseLengths = new long[count];
            var status100       = new int[count];
            var status200       = new int[count];
            var status300       = new int[count];
            var status400       = new int[count];
            var status500       = new int[count];

            foreach (var item in _timeLine)
            {
                var i    = GetIndex(item);
                var data = Deserialize(item.Data);
                callCount[i]       = data.CallCount;
                requestLengths[i]  = data.RequestLengths;
                responseLengths[i] = data.ResponseLengths;
                status100[i]       = data.StatusCounts[0];
                status200[i]       = data.StatusCounts[1];
                status300[i]       = data.StatusCounts[2];
                status400[i]       = data.StatusCounts[3];
                status500[i]       = data.StatusCounts[4];
            }

            return(new
            {
                DataType = "WebHook",
                Start = _startTime,
                End = _endTime,
                TimeWindow = _timeWindow.ToString(),
                Resolution = _resolution.ToString(),
                CallCount = callCount,
                RequestLengths = requestLengths,
                ResponseLengths = responseLengths,
                Status100 = status100,
                Status200 = status200,
                Status300 = status300,
                Status400 = status400,
                Status500 = status500,
            });
        }
Пример #6
0
        public async Task <SearchContainer <SearchTv> > GetTrendingTvAsync(TimeWindow timeWindow, int page = 0, CancellationToken cancellationToken = default(CancellationToken))
        {
            RestRequest req = _client.Create("trending/tv/{time_window}");

            req.AddUrlSegment("time_window", timeWindow.ToString());

            if (page >= 1)
            {
                req.AddQueryString("page", page.ToString());
            }

            RestResponse <SearchContainer <SearchTv> > resp = await req.ExecuteGet <SearchContainer <SearchTv> >(cancellationToken).ConfigureAwait(false);

            return(resp);
        }
Пример #7
0
        public async Task <SearchContainer <SearchPerson> > GetTrendingPeopleAsync(TimeWindow timeWindow, int page = 0, CancellationToken cancellationToken = default)
        {
            RestRequest req = _client.Create("trending/person/{time_window}");

            req.AddUrlSegment("time_window", timeWindow.ToString());

            if (page >= 1)
            {
                req.AddQueryString("page", page.ToString());
            }

            SearchContainer <SearchPerson> resp = await req.GetOfT <SearchContainer <SearchPerson> >(cancellationToken).ConfigureAwait(false);

            return(resp);
        }
Пример #8
0
        /// <summary>
        /// Gets TimeWindow property and update control's layout accordingly.
        /// </summary>
        /// <param name="tw"></param>
        protected void _TimeWindowToControlState(TimeWindow tw)
        {
            if (tw != null)
            {
                if (tw.IsWideOpen)
                {
                    _IsWideopen.IsChecked = true;
                }
            }

            _ToText.Time       = tw.To;
            _ToText.TimeSpan   = _ToText.Time;
            _FromText.Time     = tw.From;
            _FromText.TimeSpan = _FromText.Time;
            _CellLabel.Text    = tw.ToString();
        }
 /// <summary>
 /// Updates cell text block text.
 /// </summary>
 protected void _UpdateCellTextBlockText()
 {
     _cellTextBlock.Text = TimeWindow.ToString();
 }