コード例 #1
0
        protected override async Task LoadData(bool isRefresh, bool add = false, int offset = 0)
        {
            if (ItemsLoaded && !add && !isRefresh)
            {
                return;
            }

            HasErrors = false;

            try
            {
                if (!add)
                {
                    SetProgressBar("Getting channels...");
                }

                IsLoadingMore = add;

                var response = await _vidMeClient.GetChannelsAsync();

                if (response != null)
                {
                    if (Items == null || !add)
                    {
                        Items = new ObservableCollection <ChannelItemViewModel>();
                    }

                    Items.AddRange(response.Select(x => new ChannelItemViewModel(x)));

                    CanLoadMore = false;
                    ItemsLoaded = true;
                }
            }
            catch (Exception ex)
            {
                HasErrors = true;
            }

            IsLoadingMore = false;
            SetProgressBar();
        }