コード例 #1
0
ファイル: Movie.xaml.cs プロジェクト: DXChinaTE/VideoTemplate
        private void InitFilmsInfo()
        {
            if (Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily.Equals("Windows.Mobile"))//Windows.Desktop
            {
                videoInfoPicWidth  = (Window.Current.Bounds.Width - 50) / 2;
                videoInfoPicHeight = videoInfoPicWidth * 102 / 180;
            }
            ObservableCollection <FilmOverView> films = new ObservableCollection <FilmOverView>();

            for (int i = 0; i < 10; i++)
            {
                FilmOverView info            = new FilmOverView();
                double       count           = 2.5;
                Random       indexRandomizer = new Random(i);
                count         += indexRandomizer.Next(0, 20) * 0.1;
                info.picWidth  = videoInfoPicWidth;
                info.picHeight = videoInfoPicHeight;
                info.playCount = Convert.ToString(count) + "万";
                info.filmId    = Convert.ToString(i);
                info.filmName  = string.Format("电影名称{0}", i + 1);
                info.picURL    = string.Format("/Assets/FilmImages/film{0}.jpg", i + 1);
                films.Add(info);
            }
            filmsGrid.ItemsSource = films;
        }
コード例 #2
0
ファイル: home.xaml.cs プロジェクト: DXChinaTE/VideoTemplate
        public home()
        {
            if (Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily.Equals("Windows.Mobile"))//Windows.Desktop
            {
                isMobile           = true;
                videoInfoPicWidth  = (Window.Current.Bounds.Width - 50) / 2;
                videoInfoPicHeight = videoInfoPicWidth * 102 / 180;
            }

            this.InitializeComponent();
            var sampleData = new SampleDataSource();

            flipviewItemsCount    = sampleData.Items.Count;
            flipView2.ItemsSource = sampleData.Items;
            flipView1.ItemsSource = sampleData.Items;
            flipView3.ItemsSource = sampleData.Items;
            for (int i = 0; i < sampleData.Items.Count - 2; i++)
            {
                toolList.Add(i);
            }
            ContextControl.ItemsSource  = toolList;
            flipView2.SelectionChanged += FlipView_SelectionChanged;
            flipView1.SelectionChanged += FlipView1_SelectionChanged;
            flipView3.SelectionChanged += FlipView3_SelectionChanged;
            flipViewSelectedIndexs.Add(flipView2, 1);
            flipViewSelectedIndexs.Add(flipView1, flipviewItemsCount - 2);
            flipViewSelectedIndexs.Add(flipView3, 2);
            flipView2.SelectedIndex          = 1;
            flipView1.SelectedIndex          = flipviewItemsCount - 2;
            flipView3.SelectedIndex          = 2;
            ContextControl.SelectedIndex     = 0;
            ContextControl.SelectionChanged += ContextControl_SelectionChanged;

            //ObservableCollection<FilmData> films = new ObservableCollection<FilmData>();
            //for(int i=0; i<10; i++)
            //{
            //    FilmData data = new FilmData();
            //    data.amount = "3.1万";
            //    data.picUri = "/Assets/FilmImages/movie.png";
            //    films.Add(data);
            //}
            //FilmsCVS.Source = films;
            ObservableCollection <SitcomsOverview> sitcoms = new ObservableCollection <SitcomsOverview>();

            for (int i = 0; i < 10; i++)
            {
                SitcomsOverview info            = new SitcomsOverview();
                double          count           = 2.5;
                Random          indexRandomizer = new Random(i);
                count           += indexRandomizer.Next(0, 20) * 0.1;
                info.playCount   = Convert.ToString(count) + "万";
                info.sitcomsId   = indexRandomizer.Next(0, 2);
                info.picHeight   = videoInfoPicHeight;
                info.picWidth    = videoInfoPicWidth;
                info.sitcomsName = string.Format("电视剧名称{0}", i + 1);
                info.picURL      = string.Format("/Assets/SitcomsImages/sitcoms{0}.jpg", i + 1);//"/Assets/FilmImages/sitcom.png";
                sitcoms.Add(info);
            }
            sitcomsGrid.ItemsSource = sitcoms;
            ObservableCollection <FilmOverView> films = new ObservableCollection <FilmOverView>();

            for (int i = 0; i < 10; i++)
            {
                FilmOverView info            = new FilmOverView();
                double       count           = 2.5;
                Random       indexRandomizer = new Random(i);
                count         += indexRandomizer.Next(0, 20) * 0.1;
                info.picWidth  = videoInfoPicWidth;
                info.picHeight = videoInfoPicHeight;
                info.playCount = Convert.ToString(count) + "万";
                info.filmId    = Convert.ToString(i);
                info.filmName  = string.Format("电影名称{0}", i + 1);
                info.picURL    = string.Format("/Assets/FilmImages/film{0}.jpg", i + 1);
                films.Add(info);
            }
            filmsGrid.ItemsSource = films;
        }