Example #1
0
        async Task addMonitorRequestAsync()
        {
            if (!Validate())
            {
                return;
            }

            MonitorModel addMonitor = new MonitorModel {
                Name   = Name.Value.Trim(),
                URL    = URL.Value.Trim(),
                UserId = Settings.UserId,
            };

            try
            {
                await _monitorService.AddMonitorAsync(addMonitor);

                await DialogService.ShowAlertAsync(AppResources.MonitorAdded, AppResources.Added
                                                   , AppResources.OK);

                await NavigationService.PopAsync();
            }
            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);
            }
        }