public ChannelRecommendPage()
        {
            this.InitializeComponent();
            this.Loaded += ChannelRecommendPage_Loaded;
            recommendListListView.LayoutUpdated += ChannelRecommendPage_Loaded;
            this.NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;

            _recommendChannelFactory = new RecommendListFactory();
            _recommendChannelFactory.HttpSucessHandler += recommendChannelFactory_GetChannelsSucceed;
            _recommendChannelFactory.HttpFailorTimeOut += http_FailorTimeOut;

            _recommendViewModel = new ChannelRecommendViewModel();
            _recommendViewModel.Groups = new ObservableCollection<ChannelRecommendGroup>();
            this.DefaultViewModel["RecommendListSource"] = _recommendViewModel.Groups;

            _groupNum = ScreenUtils.CreateColNum(160) * 2;
            _requestNum = ScreenUtils.CreateGroupRequestNum(372, 160, 2);
        }
        public ChannelRecommendPage()
        {
            InitializeComponent();
            this.Loaded += ChannelRecommendPage_Loaded;

            _coverNavFactory = new CoverNavFactory();
            _coverNavFactory.HttpSucessHandler += coverNav_Successed;
            _coverNavFactory.HttpFailorTimeOut += http_FailorTimeOut;

            _recommendChannelFactory = new RecommendListFactory();
            _recommendChannelFactory.HttpSucessHandler += recommendChannelFactory_GetChannelsSucceed;
            _recommendChannelFactory.HttpFailorTimeOut += http_FailorTimeOut;

            _coverViewModel = new ChannelCoverViewModel();
            _recommendChannelViewModel = new ChannelRecommendViewModel();

            coverList.ItemsSource = _coverViewModel;

            var navs = FirstPage.RecommandNavs;
            if (navs != null)
            {
                foreach (var nav in navs)
                {
                    var item = new PivotItem();
                    var head = new TextBlock();
                    head.Text = nav.Name;
                    head.Tag = nav.Navid;
                    head.Style = App.Current.Resources["PivotMasterTitleStyle"] as Style;
                    var content = new LongListSelector();
                    content.Style = App.Current.Resources["PivotListStyle"] as Style;
                    content.ItemTemplate = App.Current.Resources["CoverRecommendTemplate"] as DataTemplate;
                    content.ItemsSource = _recommendChannelViewModel;
                    content.SelectionChanged += recommend_SelectionChanged;
                    TiltEffect.SetIsTiltEnabled(content, true);
                    item.Header = head;
                    item.Content = content;
                    recommendPivot.Items.Add(item);
                }
            }
        }
Example #3
0
        void recommandNav_Successed(object sender, HttpFactoryArgs<List<RecommandNav>> args)
        {
            RecommandNavs = args.Result.Take(5).ToList();

            if (RecommandNavs.Count > 0)
            {
                _currentRecIndex = 0;
                _recommendChannelFactory = new RecommendListFactory();
                _recommendChannelFactory.HttpSucessHandler += recommandChannelFactory_GetChannelsSucceed;
                _recommendChannelFactory.HttpFailorTimeOut += http_FailorTimeOut;
                getRecommand();
            }
        }