private void SwipeRefreshLayoutOnRefresh(object sender, EventArgs e) { try { //Get Data Api MAdapter.VideoList.Clear(); MAdapter.NotifyDataSetChanged(); MainScrollEvent.IsLoading = false; StartApiService(); } catch (Exception exception) { Console.WriteLine(exception); } }
public void LoadDataAsync(ObservableCollection <VideoObject> listNextTo) { try { MAdapter.VideoList.Clear(); MAdapter.NotifyDataSetChanged(); ListNextTo = listNextTo; if (Methods.CheckConnectivity()) { if (listNextTo.Count > 0) { MAdapter.VideoList = listNextTo; MAdapter.NotifyDataSetChanged(); } Activity.RunOnUiThread(ShowEmptyPage); } else { Inflated = EmptyStateLayout.Inflate(); EmptyStateInflater x = new EmptyStateInflater(); x.InflateLayout(Inflated, EmptyStateInflater.Type.NoConnection); if (!x.EmptyStateButton.HasOnClickListeners) { x.EmptyStateButton.Click += null; x.EmptyStateButton.Click += EmptyStateButtonOnClick; } Toast.MakeText(Context, Context.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } } catch (Exception e) { Console.WriteLine(e); } }
private void SharedVideos() { try { if (Methods.CheckConnectivity()) { MAdapter.VideoList.Clear(); var sqlEntity = new SqLiteDatabase(); var likedVideos = sqlEntity.Get_SharedVideos(); if (likedVideos.Count > 0) { MAdapter.VideoList = new ObservableCollection <VideoObject>(AppTools.ListFilter(new List <VideoObject>(likedVideos))); MAdapter.NotifyDataSetChanged(); } sqlEntity.Dispose(); GlobalContext.LibrarySynchronizer.AddToShareVideo(MAdapter.VideoList.FirstOrDefault(), MAdapter.VideoList.Count); ShowEmptyPage(); } else { Inflated = EmptyStateLayout.Inflate(); EmptyStateInflater x = new EmptyStateInflater(); x.InflateLayout(Inflated, EmptyStateInflater.Type.NoConnection); if (!x.EmptyStateButton.HasOnClickListeners) { x.EmptyStateButton.Click += null; x.EmptyStateButton.Click += EmptyStateButtonOnClick; } Toast.MakeText(Context, Context.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } } catch (Exception exception) { Console.WriteLine(exception); } }