Exemple #1
0
        private async Task RefreshData()
        {
            if (Xamarin.Essentials.Connectivity.NetworkAccess != Xamarin.Essentials.NetworkAccess.Internet)
            {
                Device.BeginInvokeOnMainThread(async() => await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorNoInternet, "OK"));
                return;
            }

            if (!isAll)
            {
                NewsInfos = await server.AllNews();

                Device.BeginInvokeOnMainThread(async() =>
                {
                    NotificationList.ItemsSource = null;
                    NotificationList.ItemsSource = NewsInfos;
                });
            }
            else
            {
                Settings.EventBlockData = await server.GetEventBlockData();

                if (Settings.EventBlockData.Error == null)
                {
                    NewsInfos = Settings.EventBlockData.News;
                    NotificationList.ItemsSource = null;
                    NotificationList.ItemsSource = NewsInfos;
                }
                else
                {
                    await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorNewsInfo, "OK");
                }
            }
        }