Esempio n. 1
0
 public Task <GlobalLatencyModel> GetLatency(GlobalLatenctyRequestModel globalLatenctyRequest)
 {
     return(Task.FromResult(new GlobalLatencyModel()
     {
         Status = ServiceStatusEnum.WORKING,
         ElapsedTime = 12000,
         LocationsTested = new List <GlobalLocationModel>()
         {
             new GlobalLocationModel()
             {
                 Location = "Singapore",
                 Download = 20,
                 Tcp = 20,
                 Dns = 12,
                 ResponseCode = 200,
                 Status = true
             },
             new GlobalLocationModel()
             {
                 Location = "London",
                 Download = 25,
                 Tcp = 24,
                 Dns = 15,
                 ResponseCode = 202,
                 Status = true
             }
         },
         Url = "https://apichecker.com"
     }));
 }
        private async void StartUrlScanning()
        {
            IsBusy = true;
            try
            {
                var globalLatencyVerifierRequest = new GlobalLatenctyRequestModel(UrlForScanning.Value);
                var latencyResult = await _latencyRepository.GetLatency(globalLatencyVerifierRequest);

                NavigateToResultPage(latencyResult);
            }
            catch (GlobalLatencyFailedException ex)
            {
                _appLogger.Error(nameof(GlobalLatencyFailedException), ex);
                await _pageDialogService.DisplayAlertAsync("Error", "You probably reach your request limit for this URL or our service is unavalible", "OK");
            }
            catch (ServiceAuthenticationException ex)
            {
                _appLogger.Error(nameof(GlobalLatencyFailedException), ex);
                await _pageDialogService.DisplayAlertAsync("Error", "You don't have access to this feature", "OK");
            }
            finally
            {
                IsBusy = false;
            }
        }
Esempio n. 3
0
        //TODO add persistant results storage (with Realm)

        public async Task <GlobalLatencyModel> GetLatency(GlobalLatenctyRequestModel globalLatenctyRequest)
        {
            var globalLatency = await _requestProvider.PostAsync <GlobalLatenctyRequestModel, GlobalLatencyModel>(
                GlobalSettings.ApiCheckerEndpoint, globalLatenctyRequest);

            if (globalLatency == null)
            {
                throw new GlobalLatencyFailedException("GlobalLatency not avalible for your service or you already reach request limit");
            }
            return(globalLatency);
        }