Esempio n. 1
0
        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();
            }
        }
Esempio n. 2
0
        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 void Load()
        {
            _collectionView = new YouTubeCollectionView();
            var grouping = new C1GroupCollectionView <YouTubeVideo>(_collectionView, true);
            await grouping.GroupAsync("PublishedDay");

            RecyclerView.SetLayoutManager(new LinearLayoutManager(this));
            RecyclerView.SetAdapter(new YouTubeAdapter(grouping));
        }
        public OnDemand()
        {
            InitializeComponent();
            Title = AppResources.OnDemandTitle;
            search.Placeholder = AppResources.SearchPlaceholderText;
            _collectionView    = new YouTubeCollectionView();
            list.ItemsSource   = _collectionView;

            // start on demand loading
            list.LoadItemsOnDemand(_collectionView);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            SearchField.Changed += OnSearchChanged;

            _collectionView = new YouTubeCollectionView();
            var source = new C1TableViewSource(TableView);

            source.ItemsSource = _collectionView;
            TableView.Source   = source;
        }
Esempio n. 6
0
        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;
     }
 }
        private async void Load()
        {
            CollectionView.BackgroundColor = UIColor.White;
            SearchField.EditingChanged    += OnSearchEditingChanged;
            SearchField.ShouldReturn       = new UITextFieldCondition(tf => { tf.ResignFirstResponder(); return(true); });
            _collectionView          = new YouTubeCollectionView();
            _collectionView.PageSize = 50;
            var itemSize = 100;
            var grouping = new C1GroupCollectionView <YouTubeVideo>(_collectionView, false);
            await grouping.GroupAsync("PublishedDay");

            var source = new YouTubeCollectionViewSource(CollectionView);

            source.ItemsSource = grouping;
            source.EmptyMessageLabel.TextColor = UIColor.Black;
            source.EmptyMessageLabel.Text      = Foundation.NSBundle.MainBundle.LocalizedString("EmptyText", "");;
            var layout = new C1CollectionViewFlowLayout();

            layout.SectionHeadersPinToVisibleBounds = true;
            layout.EstimatedItemSize    = new CGSize(itemSize, itemSize);
            source.CollectionViewLayout = layout;
            CollectionView.Source       = source;
        }