Exemplo n.º 1
0
        void recommandChannelFactory_GetChannelsSucceed(object sender, HttpFactoryArgs <VodChannelListInfo> args)
        {
            if (args.Result.Channels.Count <= 0)
            {
                _currentRecIndex++; return;
            }

            var group = new ChannelRecommendGroup();

            group.RecommendIndex = _currentRecIndex;
            group.GroupName      = _recommandNavs[_currentRecIndex].Name;
            group.ItemsGroup     = new ObservableCollection <ChannelRecommendListItem>();
            _recommendChannelViewModel.Groups.Add(group);

            for (var i = 0; i < args.Result.Channels.Count; i++)
            {
                var dataItem = new ChannelRecommendListItem()
                {
                    ChannelId   = args.Result.Channels[i].Id,
                    ChannelFlag = args.Result.Channels[i].ChannelFlag,
                    ImageUri    = args.Result.Channels[i].ImageUri,
                    Title       = args.Result.Channels[i].Title,
                    Mark        = args.Result.Channels[i].Mark
                };
                group.ItemsGroup.Add(dataItem);
            }

            _currentRecIndex++;
            if (_currentRecIndex < _recommandNavs.Count)
            {
                getRecommand();
            }
            else
            {
                CloseTips();
            }
        }
Exemplo n.º 2
0
        void recommandChannelFactory_GetChannelsSucceed(object sender, HttpFactoryArgs<VodChannelListInfo> args)
        {
            if (args.Result.Channels.Count <= 0) { _currentRecIndex++; return; }

            var count = args.Result.Channels.Count;
            if (count < _recCount)
                count = Convert.ToInt32(Math.Ceiling(count / 3.0) * 3);
            for (var i = 0; i < count; i++)
            {
                ChannelRecommendListItem dataItem = null;
                if (i < args.Result.Channels.Count)
                    dataItem = new ChannelRecommendListItem()
                    {
                        Index = i == 0 ? _currentRecIndex + 1 : -1,
                        GruopName = RecommandNavs[_currentRecIndex].Name,
                        GroupCount = args.Result.ChannelCount,
                        ChannelId = args.Result.Channels[i].Id,
                        ChannelFlag = args.Result.Channels[i].ChannelFlag,
                        ImageUri = args.Result.Channels[i].ImageUri,
                        Title = args.Result.Channels[i].Title,
                        Mark = args.Result.Channels[i].Mark
                    };
                else
                    dataItem = new ChannelRecommendListItem { Index = -2 };
                _recommendChannelViewModel.Add(dataItem);
            }

            _currentRecIndex++;
            if (_currentRecIndex < RecommandNavs.Count)
                getRecommand();
            else
                loadingTip.Visibility = Visibility.Collapsed;
        }
Exemplo n.º 3
0
        void recommandChannelFactory_GetChannelsSucceed(object sender, HttpFactoryArgs <VodChannelListInfo> args)
        {
            if (args.Result.Channels.Count <= 0)
            {
                _currentRecIndex++; return;
            }

            var count = args.Result.Channels.Count;

            if (count < _recCount)
            {
                count = Convert.ToInt32(Math.Ceiling(count / 3.0) * 3);
            }
            for (var i = 0; i < count; i++)
            {
                ChannelRecommendListItem dataItem = null;
                if (i < args.Result.Channels.Count)
                {
                    dataItem = new ChannelRecommendListItem()
                    {
                        Index       = i == 0 ? _currentRecIndex + 1 : -1,
                        GruopName   = RecommandNavs[_currentRecIndex].Name,
                        GroupCount  = args.Result.ChannelCount,
                        ChannelId   = args.Result.Channels[i].Id,
                        ChannelFlag = args.Result.Channels[i].ChannelFlag,
                        ImageUri    = args.Result.Channels[i].ImageUri,
                        Title       = args.Result.Channels[i].Title,
                        Mark        = args.Result.Channels[i].Mark
                    }
                }
                ;
                else
                {
                    dataItem = new ChannelRecommendListItem {
                        Index = -2
                    }
                };
                _recommendChannelViewModel.Add(dataItem);
            }

            _currentRecIndex++;
            if (_currentRecIndex < RecommandNavs.Count)
            {
                getRecommand();
            }
            else
            {
                loadingTip.Visibility = Visibility.Collapsed;
            }
        }

        void http_FailorTimeOut()
        {
            loadingTip.Visibility = Visibility.Collapsed;
            Utils.CommonUtils.ShowMessageConfirm(Utils.Constants.HttpFailTipText, RequestDatas);
        }

        void getRecommand()
        {
            _recommendChannelFactory.DownLoadDatas(_recCount, 1, RecommandNavs[_currentRecIndex].Navid);
        }

        void cloudRecentGetFactory_HttpSucess(object sender, HttpFactoryArgs <CloudArgs> args)
        {
            LocalRecentFactory.Instance.InsertCloudRecords(args.Result.Datas);
        }

        void cloudFavolitenGetFactory_HttpSucess(object sender, HttpFactoryArgs <CloudArgs> args)
        {
            LocalFavoritesFactory.Instance.InsertCloudRecords(args.Result.Datas);
        }

        #endregion

        #region AppBar

        void RecommendPivotItemBarInit()
        {
            _refreshBar         = new ApplicationBarIconButton();
            _refreshBar.IconUri = new Uri("/Images/AppBar/refresh.png", UriKind.Relative);
            _refreshBar.Text    = "刷新";
            _refreshBar.Click  += ApplicationBarRefresh_Click;
        }

        void RecommendPivotItemBarActive()
        {
            Utils.CommonUtils.ClearApplicationBar(this);
            ApplicationBar.Mode = ApplicationBarMode.Minimized;
            ApplicationBar.Buttons.Add(_refreshBar);
        }

        void TypePivotItemInit()
        {
            _selectBar         = new ApplicationBarIconButton();
            _selectBar.IconUri = new Uri("/Images/AppBar/select.png", UriKind.Relative);
            _selectBar.Text    = "选择";
            _selectBar.Click  += selectBar_Click;

            _unPinBar         = new ApplicationBarIconButton();
            _unPinBar.IconUri = new Uri("/Images/AppBar/unpin.png", UriKind.Relative);
            _unPinBar.Text    = "取消固定";
            _unPinBar.Click  += unPinBar_Click;
        }

        void TypePivotItemActive()
        {
            ApplicationBar.Mode = ApplicationBarMode.Default;
            if (typeList.IsSelectionEnabled)
            {
                typeList.EnforceIsSelectionEnabled = false;
            }
            else
            {
                SetUpTypePivotItemBar();
            }
        }

        void SetUpTypePivotItemBar()
        {
            Utils.CommonUtils.ClearApplicationBar(this);
            if (typeList.IsSelectionEnabled)
            {
                ApplicationBar.Buttons.Add(_unPinBar);
                UpdateTypePivotItemBar();
            }
            else
            {
                ApplicationBar.Buttons.Add(_selectBar);
            }
        }

        void UpdateTypePivotItemBar()
        {
            _unPinBar.IsEnabled = typeList.SelectedItems != null && typeList.SelectedItems.Count > 0;
        }

        void TypePivotItemBackPress(CancelEventArgs e)
        {
            if (typeList.IsSelectionEnabled)
            {
                typeList.EnforceIsSelectionEnabled = false;
                e.Cancel = true;
            }
        }

        void personPivotItemActive()
        {
            ApplicationBar.Mode = ApplicationBarMode.Minimized;
            Utils.CommonUtils.ClearApplicationBar(this);
        }