Ejemplo n.º 1
0
        async Task GetUnknownJournals()
        {
            ServiceMonitor.RegisterOperation(unknownJournalOpName);
            string uri = $@"{BaseUri}/{Controller}/{UnknownJournalEndpoint}";

            var request = new HttpRequestMessage(HttpMethod.Get, uri);

            using (var response = await HttpClient.SendAsync(request))
            {
                var content = await response.Content.ReadAsStringAsync();

                var journals = JsonSerializer.Deserialize <List <UnknownJournalEventReport> >(content);
                JournalRepository.UpdateUnknownJournals(journals);
                ServiceMonitor.CompleteOperation(unknownJournalOpName);
            }
        }
Ejemplo n.º 2
0
        async Task GetApiStatus()
        {
            ServiceMonitor.RegisterOperation(apiStatusOpName);
            string uri     = $@"{BaseUri}/{Controller}/{StatusEndpoint}";
            var    request = new HttpRequestMessage(HttpMethod.Get, uri);

            request.SetBrowserRequestMode(BrowserRequestMode.Cors);
            try
            {
                using (var response = await HttpClient.SendAsync(request))
                {
                    var content = await response.Content.ReadAsStringAsync();

                    var status = JsonSerializer.Deserialize <bool>(content);
                    IsApiConnected = status;
                    ServiceMonitor.CompleteOperation(apiStatusOpName);
                }
            }
            catch (Exception ex)
            {
                ServiceMonitor.PropagateOperationError(apiStatusOpName, ex.Message);
            }
        }