private async Task UpdateVideos() { var indicator = new ProgressBar(this); try { indicator.Activated = true; var videos = new ObservableCollection <YouTubeVideo>((await YouTubeCollectionView.LoadVideosAsync("Xamarin Android", "relevance", null, 50)).Item2); _collectionView = new C1CollectionView <YouTubeVideo>(videos).AsPlain(); await _collectionView.GroupAsync("ChannelTitle"); RecyclerView.SetLayoutManager(new LinearLayoutManager(this)); RecyclerView.SetAdapter(new YouTubeAdapter(_collectionView)); } catch { var builder = new Android.App.AlertDialog.Builder(this); builder.SetMessage(Resources.GetString(Resource.String.InternetConnectionError)); var alert = builder.Create(); alert.Show(); } finally { indicator.Activated = false; } }
private async Task UpdateVideos() { var indicator = new UIActivityIndicatorView(new CGRect(0, 0, 40, 40)); indicator.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray; indicator.Center = View.Center; View.AddSubview(indicator); try { indicator.StartAnimating(); var videos = (await YouTubeCollectionView.LoadVideosAsync("Xamarin iOS", "relevance", null, 50)).Item2; _source = new YouTubeTableViewSource(TableView) { ItemsSource = videos }; TableView.Source = _source; } catch { var alert = new UIAlertView("", Foundation.NSBundle.MainBundle.LocalizedString("InternetConnectionError", ""), null, "OK"); alert.Show(); } finally { indicator.StopAnimating(); } }
private async void Load() { var videos = await YouTubeCollectionView.LoadVideosAsync("Xamarin.Mac", "relevance", null, 50); var source = new CustomTableViewSource(TableView); source.AutoGenerateColumns = false; source.ItemsSource = videos.Item2; await source.CollectionView.GroupAsync("ChannelTitle"); TableView.Source = source; }
private async Task UpdateVideos() { //var collectionView = new YouTubeCollectionView(); //await collectionView.SearchAsync("Xamarin.Mac"); var videos = await YouTubeCollectionView.LoadVideosAsync("Xamarin.Mac", "relevance", null, 50); var source = new C1TableViewSource(TableView); source.ItemsSource = videos.Item2; await source.CollectionView.GroupAsync("ChannelTitle"); TableView.Source = source; }
private async Task UpdateVideos() { try { message.IsVisible = false; list.IsVisible = false; activityIndicator.IsRunning = true; var _videos = new ObservableCollection <YouTubeVideo>((await YouTubeCollectionView.LoadVideosAsync("Xamarin Forms", "relevance", null, 50)).Item2); _collectionView = new C1CollectionView <YouTubeVideo>(_videos); list.ItemsSource = _collectionView; list.IsVisible = true; } catch { message.Text = AppResources.InternetConnectionError; message.IsVisible = true; } finally { activityIndicator.IsRunning = false; } }