示例#1
0
 public void Flow()
 {
     if (MovieList != null)
     {
         CurrentMovieListHideOrChanged?.Invoke(this, EventArgs.Empty); //停止下载
         int DisPlayNum = Properties.Settings.Default.DisplayNumber;
         int SetFlowNum = Properties.Settings.Default.FlowNum;
         Movies = new List <Movie>();
         for (int i = (CurrentPage - 1) * DisPlayNum + FlowNum * SetFlowNum; i < (CurrentPage - 1) * DisPlayNum + (FlowNum + 1) * SetFlowNum; i++)
         {
             if (CurrentMovieList.Count < DisPlayNum)
             {
                 if (i <= MovieList.Count - 1)
                 {
                     Movie movie = MovieList[i];
                     if (!Properties.Settings.Default.AsyncShowImage)
                     {
                         LoadImageAndInfo(ref movie);
                     }
                     if (!string.IsNullOrEmpty(movie.id))
                     {
                         Movies.Add(movie);
                     }
                 }
                 else
                 {
                     break;
                 }
             }
             else
             {
                 FlowNum = 0;
             }
         }
         CurrentMovieList.AddRange(Movies);
         CurrentCount = CurrentMovieList.Count;
         App.Current.Dispatcher.Invoke((Action) delegate
         {
             CurrentMovieListChangedCompleted?.Invoke(this, EventArgs.Empty);
             Main main = App.Current.Windows[0] as Main;
             if (Properties.Settings.Default.ShowImageMode == "预览图")
             {
                 main.ImageSlideTimer.Start();                                                    //0.5s后开始展示预览图
             }
             IsFlipOvering = false;
             main.AsyncLoadImage(); //异步加载图片
             main.IsFlowing = false;
             main.SetSelected();
         });
     }
 }
示例#2
0
        public void Flow()
        {
            if (MovieList != null)
            {
                CurrentMovieListHideOrChanged?.Invoke(this, EventArgs.Empty); //停止下载
                int DisPlayNum = Properties.Settings.Default.DisplayNumber;
                int SetFlowNum = Properties.Settings.Default.FlowNum;
                for (int i = (CurrentPage - 1) * DisPlayNum + FlowNum * SetFlowNum; i < (CurrentPage - 1) * DisPlayNum + (FlowNum + 1) * SetFlowNum; i++)
                {
                    if (CurrentMovieList.Count < DisPlayNum)
                    {
                        if (i <= MovieList.Count - 1)
                        {
                            Movie movie = MovieList[i];

                            //加载图片
                            if (Properties.Settings.Default.ShowImageMode == "海报图")
                            {
                                movie.bigimage = StaticClass.GetBitmapImage(movie.id, "BigPic");
                            }
                            else if (Properties.Settings.Default.ShowImageMode == "缩略图")
                            {
                                movie.smallimage = StaticClass.GetBitmapImage(movie.id, "SmallPic");
                            }
                            CurrentMovieList.Add(movie);
                        }
                        else
                        {
                            break;
                        }
                    }
                    else
                    {
                        //Main main = App.Current.Windows[0] as Main;
                        //main.FLowNum = 0;
                        FlowNum = 0;
                    }
                }
            }
            MovieCount = $"本页有 {CurrentMovieList.Count} 个,总计{MovieList.Count} 个";
            CurrentMovieListChanged?.Invoke(this, EventArgs.Empty);
        }