예제 #1
0
        public async Task <MonitorContainer> GetMonitorsAsync()
        {
            UriBuilder       builder          = new UriBuilder($"{GlobalRoutingSettings.Instance.GetMonitors}/{Settings.UserName}");
            string           uri              = builder.ToString();
            MonitorContainer monitorContainer = await _request.GetAsync <MonitorContainer>(uri);

            return(monitorContainer);
        }
예제 #2
0
        public void OnUpdate(MonitorContainer monitorContainer)
        {
            MonitorContainers = new ObservableCollection <MonitorModel>();

            foreach (MonitorModel model in monitorContainer.monitor)
            {
                MonitorContainers.Add(new MonitorModel {
                    Name        = model.Name,
                    Description = model.Description,
                    StatusCode  = (model.StatusCode == "200") ? "success.png" : "error.png",
                    Id          = model.Id,
                    UserId      = model.UserId,
                    URL         = model.URL,
                    EmailAlert  = model.EmailAlert,
                    PushAlert   = model.PushAlert,
                    SMSAlert    = model.SMSAlert
                });
            }
        }
예제 #3
0
        public override async Task InitializeAsync(object navigationData)
        {
            try
            {
                IsBusy = true;
                MonitorContainer alertContainer = await _monitorService.GetMonitorsAsync();

                OnUpdate(alertContainer);
                IsBusy = false;
            }
            catch (ServiceAuthenticationException e)
            {
                await DialogService.ShowAlertAsync(AppResources.GenericError, AppResources.Error, AppResources.OK);
            }
            catch (HttpRequestExceptionEx e)
            {
                await DialogService.ShowAlertAsync(AppResources.GenericError, AppResources.Error, AppResources.OK);
            }
            catch (Exception e)
            {
                await DialogService.ShowAlertAsync(AppResources.GenericError, AppResources.Error, AppResources.OK);
            }
        }
예제 #4
0
        private async Task RefreshMonitorCommandAsync()
        {
            try
            {
                IsListViewRefreshing = true;
                MonitorContainer alertContainer = await _monitorService.GetMonitorsAsync();

                OnUpdate(alertContainer);
            }
            catch (ServiceAuthenticationException e)
            {
                await DialogService.ShowAlertAsync(AppResources.GenericError, AppResources.Error, AppResources.OK);
            }
            catch (HttpRequestExceptionEx e)
            {
                await DialogService.ShowAlertAsync(AppResources.GenericError, AppResources.Error, AppResources.OK);
            }
            catch (Exception e)
            {
                await DialogService.ShowAlertAsync(AppResources.GenericError, AppResources.Error, AppResources.OK);
            }finally{
                IsListViewRefreshing = false;
            }
        }