示例#1
0
        public async Task OnGet()
        {
            newStamp = DateTime.Now.ToUniversalTime();
            List <Http_Request> addOn = await FetchDataService.getData <Http_Request>(oldStamp, newStamp); // Get data

            foreach (Http_Request h in addOn)
            {
                // When there is start event, create a new Client_Http_Request object and add it to httpTracker
                if (h.type.Equals("Start"))
                {
                    Client_Http_Request clientH = new Client_Http_Request(h);
                    httpTracker[h.activityID] = clientH;
                    http.Add(clientH);
                }
                // When there is a stop event, remove associated http request (by looking at id) from httpTracker,
                // update the Client_Http_Request to include stop event and update http list
                else if (h.type.Equals("Stop"))
                {
                    if (httpTracker.ContainsKey(h.activityID))
                    {
                        Client_Http_Request clientH = httpTracker[h.activityID];
                        http.Remove(clientH);
                        clientH.updateEndTimestamp(h.timestamp);
                        http.Add(clientH);
                    }
                }
            }

            http.OrderBy(h => h.StartTimestamp).ToList(); // Updating http so that is sorted by time
            http.Reverse();                               // Updating http so that the most current http requests are shown first

            totalHttpRequest = http.Count;
            updateAvg();
        }
        public async Task OnGet()
        {
            newStamp = DateTime.Now.ToUniversalTime();
            List <Http_Request> addOn = await FetchDataService.getUpdatedData <Http_Request>(oldStamp, newStamp);

            foreach (Http_Request h in addOn)
            {
                if (h.type.Equals("Start"))
                {
                    Client_Http_Request clientH = new Client_Http_Request(h);
                    httpTracker[h.activityID] = clientH;
                    http.Add(clientH);
                }
                else if (h.type.Equals("Stop"))
                {
                    if (httpTracker.ContainsKey(h.activityID))
                    {
                        Client_Http_Request clientH = httpTracker[h.activityID];
                        http.Remove(clientH);
                        clientH.updateEndTimestamp(h.timestamp);
                        http.Add(clientH);
                    }
                }
            }

            http.OrderBy(h => h.StartTimestamp).ToList(); // updating http so that is sorted by time
            http.Reverse();                               // updating http so that the most current http requests are shown first

            totalHttpRequest = http.Count;
            updateAvg();
        }