private void HardwareButtons_BackPressed(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e)
 {
     if (this.GoBackCommand.CanExecute(null) && this.Frame.BackStack.Count() >= 1)
     {
         e.Handled = true;
         this.GoBackCommand.Execute(null);
     }
     else
     {
         if (SettingsStore.GetValueOrDefault <bool>(AppCommonConst.IS_SURE_TOGGLLESWITCH_ON, true))
         {
             if (!WPToastBox.Instance.IsWPToastNotice)
             {
                 WPToastBox.Instance.ShowWPToastNotice("再按一次返回键退出视野");
                 e.Handled = true;
             }
             else
             {
                 //应用是否退出
                 Application.Current.Exit();
             }
         }
         else
         {
             //应用是否退出
             Application.Current.Exit();
         }
     }
 }
Beispiel #2
0
        private async void szPC_ViewChangeCompleted(object sender, SemanticZoomViewChangedEventArgs e)
        {
            if (e.IsSourceZoomedInView)
            {
                if (!AppEnvironment.IsPhone)
                {
                    Messenger.Default.Send <bool>(true, AppMessengerTokenConst.IS_ZOOMSEMANTIC_BUTTON_VISIBLE);
                    ViewModelLocator.Instance.VideoFullScreenHandler += VideoFullScreenHandler;
                }

                ViewModelLocator.Instance.VideoVolumeToMuteHandler += VideoVolumeToMuteHandler;

                var model = DicStore.GetValueOrDefault <ModelPropertyBase>(AppCommonConst.CURRENT_SELECTED_ITEM
                                                                           , null);
                if (model != null)
                {
                    this.szPCDailyFlipView.SelectedItem = model;

                    this.videoMediaPlayer.Stop();
                    this.videoMediaPlayer.Source = null;

                    this.videoMediaPlayer.DataContext = model;

                    this.videoMediaPlayer.Volume = SettingsStore.GetValueOrDefault <double>(AppCommonConst.CURRETN_VIDEO_VOLUME_VALUE, 0.5);
                    var playUrl = await CommonHelper.Instance.DecidePlayUrl(model);

                    if (!string.IsNullOrEmpty(playUrl))
                    {
                        this.videoMediaPlayer.Source = new Uri(playUrl, UriKind.RelativeOrAbsolute);
                        this.videoMediaPlayer.Tag    = model.title;
                    }
                    else
                    {
                        await new MessageDialog(AppNetworkMessageConst.VIDEO_URL_IS_ERROR, "提示").ShowAsyncQueue();

                        szPC.IsZoomedInViewActive = true;
                    }
                }

                //this.videoMediaPlayer.Play();

                //var ctrl = CoreVisualTreeHelper.Instance.FindVisualChildByName<Control>(this.videoMediaPlayer, "pro");
            }
            else
            {
                if (!AppEnvironment.IsPhone)
                {
                    Messenger.Default.Send <bool>(false, AppMessengerTokenConst.IS_ZOOMSEMANTIC_BUTTON_VISIBLE);
                    appBarFullScreenBtn = null;
                    ViewModelLocator.Instance.VideoFullScreenHandler -= VideoFullScreenHandler;
                }

                appBarVolumeBtn = null;
                ViewModelLocator.Instance.VideoVolumeToMuteHandler -= VideoVolumeToMuteHandler;

                this.videoMediaPlayer.Stop();
                this.videoMediaPlayer.Source = null;
            }
        }
Beispiel #3
0
        private async void szPC_ViewChangeCompleted(object sender, SemanticZoomViewChangedEventArgs e)
        {
            if (e.IsSourceZoomedInView)
            {
                if (!AppEnvironment.IsPhone)
                {
                    ViewModelLocator.Instance.VideoFullScreenHandler += VideoFullScreenHandler;
                }

                ViewModelLocator.Instance.VideoVolumeToMuteHandler += VideoVolumeToMuteHandler;

                var model = DicStore.GetValueOrDefault <ModelPropertyBase>(AppCommonConst.CURRENT_SELECTED_ITEM
                                                                           , null);
                if (model != null)
                {
                    this.szCategoryDetailFlipView.SelectedItem = model;

                    this.videoMediaPlayer.Stop();
                    this.videoMediaPlayer.Source = null;

                    this.videoMediaPlayer.DataContext = model;
                    this.videoMediaPlayer.Volume      = SettingsStore.GetValueOrDefault <double>(AppCommonConst.CURRETN_VIDEO_VOLUME_VALUE, 0.5);
                    var playUrl = await CommonHelper.Instance.DecidePlayUrl(model);

                    if (!string.IsNullOrEmpty(playUrl))
                    {
                        this.videoMediaPlayer.Source = new Uri(playUrl, UriKind.RelativeOrAbsolute);
                    }
                    else
                    {
                        await new MessageDialog(AppNetworkMessageConst.VIDEO_URL_IS_ERROR, "提示").ShowAsyncQueue();

                        szPC.IsZoomedInViewActive = true;
                    }
                }

                //this.videoMediaPlayer.Play();
            }
            else
            {
                if (!AppEnvironment.IsPhone)
                {
                    appBarFullScreenBtn = null;
                    ViewModelLocator.Instance.VideoFullScreenHandler -= VideoFullScreenHandler;
                }

                appBarVolumeBtn = null;
                ViewModelLocator.Instance.VideoVolumeToMuteHandler -= VideoVolumeToMuteHandler;

                this.videoMediaPlayer.Stop();
                this.videoMediaPlayer.Source = null;
            }
        }
Beispiel #4
0
 private void VideoMediaPlayer_PlayerStateChanged(object sender, RoutedPropertyChangedEventArgs <Microsoft.PlayerFramework.PlayerState> e)
 {
     if (e.NewValue == PlayerState.Ending)
     {
         if (SettingsStore.GetValueOrDefault <bool>(AppCommonConst.IS_AUTOBACK_TOGGLLESWITCH_ON, true))
         {
             if (this.videoMediaPlayer.IsFullScreen)
             {
                 this.videoMediaPlayer.IsFullScreen = false;
                 ViewModelLocator.Instance.VideoFullScreen(this.videoMediaPlayer.IsFullScreen);
             }
             videoMediaPlayer_DoubleTapped(null, null);
         }
     }
 }
        public SettingPage()
        {
            this.InitializeComponent();

            this.navigationHelper = new NavigationHelper(this);

            if (AppEnvironment.IsPhone)
            {
                this.sureGrid.Visibility = Visibility.Visible;
                this.contentGrid.Width   = Window.Current.Bounds.Width;
            }
            else
            {
                this.contentGrid.Width = 450;
            }

            this.autoPlayToggle.IsOn             = SettingsStore.GetValueOrDefault <bool>(AppCommonConst.IS_AUTOPLAY_TOGGLLESWITCH_ON, true);
            this.autoBackToggle.IsOn             = SettingsStore.GetValueOrDefault <bool>(AppCommonConst.IS_AUTOBACK_TOGGLLESWITCH_ON, true);
            this.hightQualityToggle.IsOn         = SettingsStore.GetValueOrDefault <bool>(AppCommonConst.IS_HIGHQUALITY_TOGGLLESWITCH_ON, true);
            this.downloadToggle.IsOn             = SettingsStore.GetValueOrDefault <bool>(AppCommonConst.IS_AUTO_DOWNLOAD_HIGHT_QUALITY_VIDEO, true);
            this.downloadWhenFavoriteToggle.IsOn = SettingsStore.GetValueOrDefault <bool>(AppCommonConst.IS_AUTO_DOWNLOAD_WHEN_FAVORITE_VIDEO, false);
            this.tileToggle.IsOn = SettingsStore.GetValueOrDefault <bool>(AppCommonConst.IS_TILE_ACTIVE, true);
            this.sureToggle.IsOn = SettingsStore.GetValueOrDefault <bool>(AppCommonConst.IS_SURE_TOGGLLESWITCH_ON, true);

            this.Loaded += (s, e) =>
            {
                this.autoPlayToggle.Toggled             += ToggleSwitch_Toggled;
                this.autoBackToggle.Toggled             += ToggleSwitch_Toggled;
                this.hightQualityToggle.Toggled         += ToggleSwitch_Toggled;
                this.downloadToggle.Toggled             += ToggleSwitch_Toggled;
                this.downloadWhenFavoriteToggle.Toggled += ToggleSwitch_Toggled;
                this.tileToggle.Toggled += ToggleSwitch_Toggled;
                this.sureToggle.Toggled += ToggleSwitch_Toggled;
            };

            this.Unloaded += (s, e) =>
            {
                this.autoPlayToggle.Toggled             -= ToggleSwitch_Toggled;
                this.autoBackToggle.Toggled             -= ToggleSwitch_Toggled;
                this.hightQualityToggle.Toggled         -= ToggleSwitch_Toggled;
                this.downloadToggle.Toggled             -= ToggleSwitch_Toggled;
                this.downloadWhenFavoriteToggle.Toggled -= ToggleSwitch_Toggled;
                this.tileToggle.Toggled -= ToggleSwitch_Toggled;
                this.sureToggle.Toggled -= ToggleSwitch_Toggled;
            };
        }
Beispiel #6
0
        private void InvokeRefresh()
        {
            isReadyToRefresh = false;
            VisualStateManager.GoToState(this, VisualStateNormal, true);

            if (RefreshContent != null)
            {
                RefreshContent(this, EventArgs.Empty);
            }

            var paramter = GetCommandParameter(this);

            if (RefreshCommand != null && RefreshCommand.CanExecute(paramter))
            {
                RefreshCommand.Execute(paramter);
            }

            //SettingsStore.AddOrUpdateValue<string>(AppCommonConst.LAST_UPDATE_TIME, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            RefreshTime = "最后更新:" + SettingsStore.GetValueOrDefault <string>(AppCommonConst.LAST_UPDATE_TIME, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
        }
Beispiel #7
0
        private async Task <bool> InitSplashScreenImage()
        {
            string splashScreenScreenUrl = AppEnvironment.IsPhone ? "ms-appx:///Assets/SplashDefault/Mobile/1.jpg" : "ms-appx:///Assets/SplashDefault/PC/2.jpg";

            if (AppEnvironment.IsPhone)
            {
                var phoneFolder = await ApplicationData.Current.LocalFolder.CreateFolderAsync(CacheConfig.Instance.PhoneSplashScreenImageCacheRelativePath, CreationCollisionOption.OpenIfExists);

                var phoneFile = await phoneFolder.TryGetItemAsync("phone.jpg");

                if (phoneFile != null)
                {
                    //因为手机端始终都是一张图片名称永远都是phone.jpg,所以直接指定路径就可以了
                    splashScreenScreenUrl = "ms-appdata:///local/" + CacheConfig.Instance.PhoneSplashScreenImageCacheRelativePath + "/phone.jpg";
                }

                //都要转换成东八区北京时间来计算
                var saveDate = SettingsStore.GetValueOrDefault <long>(AppCommonConst.DATE_HAS_SAVE, DateTime.Now.ToChinaStandardTime().AddDays(-1).ToUnixTime());
                if ((DateTime.Now.ToChinaStandardTime().Date - saveDate.ToDateTime().Date).Days >= 1)
                {
                    await Task.Run(async() =>
                    {
                        var backJson = await WebDataHelper.Instance.GetFromUrlWithAuthReturnString(ApiSplashScreenRoot.Instance.SplashScreenUrl, null, 20);
                        if (backJson != null)
                        {
                            var model = JsonConvertHelper.Instance.DeserializeObject <PhoneSplashScreenModel>(backJson);
                            if (model != null)
                            {
                                //专题数据处理
                                if (model.campaignInFeed != null && AppEnvironment.IsMemoryLimitMoreThan185)
                                {
                                    SettingsStore.AddOrUpdateValue <bool>(AppCommonConst.IS_CAMPAIGN_AVAILABLE, model.campaignInFeed.available);
                                    SettingsStore.AddOrUpdateValue <string>(AppCommonConst.CAMPAIGN_IMAGE_URL, model.campaignInFeed.imageUrl);
                                    SettingsStore.AddOrUpdateValue <string>(AppCommonConst.CAMPAIGN_ACTION_URL, model.campaignInFeed.actionUrl);
                                }

                                WebDownFileHelper.Instance.SaveAsyncWithHttp(model.startPage.imageUrl, "phone.jpg", phoneFolder);
                            }
                        }
                    });
                }
            }
            else
            {
                var pcFolder = await ApplicationData.Current.LocalFolder.CreateFolderAsync(CacheConfig.Instance.PCSplashScreenImageCacheRelativePath, CreationCollisionOption.OpenIfExists);

                var pcFiles = await pcFolder.GetAllFilesAsync();

                if (pcFiles.Count != 0)
                {
                    var randomIndex = new Random().Next(0, pcFiles.Count);
                    splashScreenScreenUrl = "ms-appdata:///local/" + CacheConfig.Instance.PCSplashScreenImageCacheRelativePath + "/" + pcFiles[randomIndex].Name;
                }
            }

            var bitmapImage = await CommonHelper.Instance.LoadImageSource(splashScreenScreenUrl);

            if (bitmapImage != null)
            {
                DicStore.AddOrUpdateValue <BitmapImage>(AppCommonConst.SPLASH_BITMAPIMAGE, bitmapImage);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #8
0
        public AuthorDetailPage()
        {
            this.InitializeComponent();

            this.videoMediaPlayer.AutoPlay = SettingsStore.GetValueOrDefault <bool>(AppCommonConst.IS_AUTOPLAY_TOGGLLESWITCH_ON, true);

            if (authorDetailViewModel == null)
            {
                if (!SimpleIoc.Default.IsRegistered <AuthorDetailViewModel>())
                {
                    SimpleIoc.Default.Register <AuthorDetailViewModel>();
                }

                authorDetailViewModel = SimpleIoc.Default.GetInstance <AuthorDetailViewModel>();
            }

            this.DataContext = authorDetailViewModel;

            this.navigationHelper = new NavigationHelper(this);

            this.videoMediaPlayer.ControlPanelTemplate = AppEnvironment.IsPhone ? Application.Current.Resources["ControlPanelControlTemplatePhone"] as ControlTemplate : Application.Current.Resources["ControlPanelControlTemplatePC"] as ControlTemplate;

            this.szListView.ItemContainerStyle = AppEnvironment.IsPhone ? Application.Current.Resources["PhoneListViewItemStyle"] as Style : Application.Current.Resources["PCPastCategoryListViewItemStyle"] as Style;
            this.szListView.Padding            = AppEnvironment.IsPhone ? new Thickness(0, 0, 0, 0) : new Thickness(0, 0, 0, 3);

            this.Loaded += (ss, ee) =>
            {
                if (AppEnvironment.IsPhone)
                {
                    videoMediaPlayer.IsFullScreenVisible = false;
                    this.videoMediaPlayer.DoubleTapped  += videoMediaPlayer_DoubleTapped;

                    TopTapGuestureBox.Instance.ShowTopTapGuestureUIControl();
                }
                else
                {
                    videoMediaPlayer.IsFullScreenVisible = true;

                    this.KeyUp += PastDetailPage_KeyUp;
                    //szPCDailyFlipView.SelectionChanged += szPCDailyFlipView_SelectionChanged;
                }

                szListPC.IsZoomedInViewActive = true;

                szListPC.ViewChangeStarted   -= szListPC_ViewChangeStarted;
                szListPC.ViewChangeCompleted -= szListPC_ViewChangeCompleted;
                szListPC.ViewChangeStarted   += szListPC_ViewChangeStarted;
                szListPC.ViewChangeCompleted += szListPC_ViewChangeCompleted;

                if (authorDetailViewModel != null)
                {
                    authorDetailViewModel.GetAthorDetailCollection(authorDetailViewModel.AuthorDetailCollection, ApiAuthorRoot.Instance.AuthorDetailUrl);
                }
            };

            this.Unloaded += (ss, ee) =>
            {
                //这里是用来即可激发ZoomSemanticButtonMessenger,使zoomSemanticButton马上隐藏
                if (!AppEnvironment.IsPhone)
                {
                    Messenger.Default.Send <bool>(false, AppMessengerTokenConst.IS_ZOOMSEMANTIC_BUTTON_VISIBLE);
                }

                if (AppEnvironment.IsPhone)
                {
                    videoMediaPlayer.IsFullScreenVisible = false;
                    this.videoMediaPlayer.DoubleTapped  -= videoMediaPlayer_DoubleTapped;

                    //TopTapGuestureBox.Instance.HideTopTapGuestureUIControl();
                }
                else
                {
                    videoMediaPlayer.IsFullScreenVisible = true;

                    this.KeyUp -= PastDetailPage_KeyUp;

                    //szPCDailyFlipView.SelectionChanged -= szPCDailyFlipView_SelectionChanged;
                    //szPCDailyFlipView.SelectedIndex = -1;
                }

                szListPC.IsZoomedInViewActive = true;
            };
        }
Beispiel #9
0
        public DailyPage()
        {
            this.InitializeComponent();

            this.videoMediaPlayer.AutoPlay = SettingsStore.GetValueOrDefault <bool>(AppCommonConst.IS_AUTOPLAY_TOGGLLESWITCH_ON, true);

            if (dailyViewModel == null)
            {
                if (!SimpleIoc.Default.IsRegistered <DailyViewModel>())
                {
                    SimpleIoc.Default.Register <DailyViewModel>();
                }

                dailyViewModel = SimpleIoc.Default.GetInstance <DailyViewModel>();
            }

            this.DataContext = dailyViewModel;

            this.navigationHelper = new NavigationHelper(this);

            this.videoMediaPlayer.ControlPanelTemplate = AppEnvironment.IsPhone ? Application.Current.Resources["ControlPanelControlTemplatePhone"] as ControlTemplate : Application.Current.Resources["ControlPanelControlTemplatePC"] as ControlTemplate;

            this.Loaded += (ss, ee) =>
            {
                if (AppEnvironment.IsPhone)
                {
                    szPhone.IsZoomedInViewActive         = true;
                    videoMediaPlayer.IsFullScreenVisible = false;

                    this.videoMediaPlayer.DoubleTapped += videoMediaPlayer_DoubleTapped;

                    szPhone.ViewChangeStarted   -= szPhone_ViewChangeStarted;
                    szPhone.ViewChangeCompleted -= szPhone_ViewChangeCompleted;
                    szPhone.ViewChangeStarted   += szPhone_ViewChangeStarted;
                    szPhone.ViewChangeCompleted += szPhone_ViewChangeCompleted;

                    TopTapGuestureBox.Instance.ShowTopTapGuestureUIControl();
                }
                else
                {
                    szPhone.IsZoomedInViewActive         = false;
                    videoMediaPlayer.IsFullScreenVisible = true;

                    szPC.ViewChangeStarted   -= szPC_ViewChangeStarted;
                    szPC.ViewChangeCompleted -= szPC_ViewChangeCompleted;
                    szPC.ViewChangeStarted   += szPC_ViewChangeStarted;
                    szPC.ViewChangeCompleted += szPC_ViewChangeCompleted;

                    this.KeyUp += DailyPage_KeyUp;
                    //szPCDailyFlipView.SelectionChanged += szPCDailyFlipView_SelectionChanged;
                }

                if (dailyViewModel != null)
                {
                    bool hasCollection = true;
                    if (AppEnvironment.IsPhone)
                    {
                        if (dailyViewModel.DailyCollection.Count == 0)
                        {
                            hasCollection = false;
                        }
                    }
                    else
                    {
                        if (dailyViewModel.DailyFlipViewCollection.Count == 0)
                        {
                            hasCollection = false;
                        }
                    }

                    if (!hasCollection)
                    {
                        dailyViewModel.GetDaily(dailyViewModel.DailyCollection, dailyViewModel.DailyFlipViewCollection, ApiDailyRoot.Instance.DailyUrl, AppCacheNewsFileNameConst.CACHE_DAILY_FILENAME, false);
                    }
                }
            };

            this.Unloaded += (ss, ee) =>
            {
                //这里是用来即可激发ZoomSemanticButtonMessenger,使zoomSemanticButton马上隐藏
                if (!AppEnvironment.IsPhone)
                {
                    Messenger.Default.Send <bool>(false, AppMessengerTokenConst.IS_ZOOMSEMANTIC_BUTTON_VISIBLE);
                }

                if (AppEnvironment.IsPhone)
                {
                    szPhone.IsZoomedInViewActive         = true;
                    videoMediaPlayer.IsFullScreenVisible = false;

                    this.videoMediaPlayer.DoubleTapped -= videoMediaPlayer_DoubleTapped;

                    //TopTapGuestureBox.Instance.HideTopTapGuestureUIControl();
                }
                else
                {
                    szPC.IsZoomedInViewActive            = true;
                    videoMediaPlayer.IsFullScreenVisible = true;

                    this.KeyUp -= DailyPage_KeyUp;

                    //szPCDailyFlipView.SelectionChanged -= szPCDailyFlipView_SelectionChanged;
                    //szPCDailyFlipView.SelectedIndex = -1;
                }
            };
        }
Beispiel #10
0
        public async void GetDaily(ObservableCollection <Videolist> collection, ObservableCollection <Videolist> flipViewCollection, string url, string cacheFileName = null, bool isRefresh = false)
        {
            //这里是为了异步,在无网络加载读取本地缓存文本的时候不会卡界面
            DispatcherHelper.RunAsync(async() =>
            {
                IsBusy = true;

                bool is_Campaign_Available = SettingsStore.GetValueOrDefault <bool>(AppCommonConst.IS_CAMPAIGN_AVAILABLE, false);
                string campaign_Image_Url  = SettingsStore.GetValueOrDefault <string>(AppCommonConst.CAMPAIGN_IMAGE_URL, null);
                string campaign_Action_Url = SettingsStore.GetValueOrDefault <string>(AppCommonConst.CAMPAIGN_ACTION_URL, null);

                var backJson = await WebDataHelper.Instance.GetFromUrlWithAuthReturnString(url, null, 20);
                if (backJson != null)
                {
                    var result = JsonConvertHelper.Instance.DeserializeObject <DailyRootModel>(backJson);
                    if (result != null)
                    {
                        if (result.dailyList.Count != 0)
                        {
                            //如果是第一次加载数据或者刷新,则记录当前的刷新时间
                            if (collection.Count == 0 || isRefresh)
                            {
                                SettingsStore.AddOrUpdateValue <string>(AppCommonConst.LAST_UPDATE_TIME, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                            }

                            if (isRefresh)
                            {
                                collection.Clear();
                                flipViewCollection.Clear();

                                List <Videolist> myCollection         = new List <Videolist>();
                                List <Videolist> myFlipViewCollection = new List <Videolist>();

                                if (!AppEnvironment.IsPhone)
                                {
                                    result.dailyList[0].videoList.ForEach(B =>
                                    {
                                        myFlipViewCollection.Add(B);
                                    });
                                }
                                else
                                {
                                    result.dailyList.ForEach(A =>
                                    {
                                        if (myCollection.Count != 0)
                                        {
                                            Videolist vl = new Videolist();
                                            vl.today     = A.today;
                                            myCollection.Add(vl);
                                        }
                                        else
                                        {
                                            if (is_Campaign_Available && campaign_Image_Url != null && campaign_Action_Url != null)
                                            {
                                                Videolist vlCam = new Videolist();
                                                //vlCam.is_Campaign_Available = is_Campaign_Available;
                                                vlCam.coverForDetail = campaign_Image_Url;
                                                vlCam.webUrl.raw     = campaign_Action_Url;
                                                myCollection.Add(vlCam);
                                            }
                                        }

                                        A.videoList.ForEach(B =>
                                        {
                                            myCollection.Add(B);
                                            myFlipViewCollection.Add(B);
                                        });
                                    });
                                }

                                #region 处理 收藏 和 下载
                                if (!SimpleIoc.Default.IsRegistered <CollectionViewModel>())
                                {
                                    SimpleIoc.Default.Register <CollectionViewModel>(false);
                                }
                                var cvm = SimpleIoc.Default.GetInstance <CollectionViewModel>();

                                if (cvm != null)
                                {
                                    myFlipViewCollection.ForEach(A =>
                                    {
                                        var model = from m in cvm.FavoriteCollection
                                                    where A.id == m.id
                                                    select A;
                                        if (model.Count() != 0)
                                        {
                                            A.isFavorite = true;
                                        }
                                    });
                                }

                                if (!SimpleIoc.Default.IsRegistered <DownloadViewModel>())
                                {
                                    SimpleIoc.Default.Register <DownloadViewModel>(false);
                                }
                                var dlvm = SimpleIoc.Default.GetInstance <DownloadViewModel>();

                                if (dlvm != null)
                                {
                                    myFlipViewCollection.ForEach(A =>
                                    {
                                        //先去检查下载队列里面有没有
                                        var downloadingModels = from m in dlvm.DownloadingList
                                                                where m.DownloadId == A.id
                                                                select m;
                                        //这里说明有正在下载的,那么应该把当前的Model添加到下载队列里面的DownloadModelList
                                        if (downloadingModels.Count() != 0)
                                        {
                                            var downloadModel = downloadingModels.FirstOrDefault() as DownloadingModel;
                                            if (downloadModel != null)
                                            {
                                                downloadModel.DownloadModelList.Add(A);
                                            }
                                        }
                                        else
                                        {
                                            //然后检查已下载集合里面有没有
                                            var hasDownloadModels = from m in dlvm.DownloadCollection
                                                                    where A.id == m.id
                                                                    select A;
                                            if (hasDownloadModels.Count() != 0)
                                            {
                                                A.isAleadyDownload = true;
                                            }
                                        }
                                    });
                                }

                                #endregion

                                DailyCollection         = new ObservableCollection <Videolist>(myCollection);
                                DailyFlipViewCollection = new ObservableCollection <Videolist>(myFlipViewCollection);

                                myCollection         = null;
                                myFlipViewCollection = null;
                            }
                            else
                            {
                                if (!AppEnvironment.IsPhone)
                                {
                                    result.dailyList[0].videoList.ForEach(B =>
                                    {
                                        flipViewCollection.Add(B);
                                    });
                                }
                                else
                                {
                                    result.dailyList.ForEach(A =>
                                    {
                                        //这个地方是当collection.Count == 0 的时候不添加日期头的处理
                                        if (collection.Count != 0)
                                        {
                                            Videolist vl = new Videolist();
                                            vl.today     = A.today;
                                            collection.Add(vl);
                                        }
                                        else
                                        {
                                            if (is_Campaign_Available && campaign_Image_Url != null && campaign_Action_Url != null)
                                            {
                                                Videolist vlCam = new Videolist();
                                                //vlCam.is_Campaign_Available = is_Campaign_Available;
                                                vlCam.coverForDetail = campaign_Image_Url;
                                                vlCam.webUrl.raw     = campaign_Action_Url;
                                                collection.Add(vlCam);
                                            }
                                        }

                                        A.videoList.ForEach(B =>
                                        {
                                            collection.Add(B);
                                            flipViewCollection.Add(B);
                                        });
                                    });
                                }

                                #region 处理收藏和下载
                                if (!SimpleIoc.Default.IsRegistered <CollectionViewModel>())
                                {
                                    SimpleIoc.Default.Register <CollectionViewModel>(false);
                                }
                                var cvm = SimpleIoc.Default.GetInstance <CollectionViewModel>();

                                if (cvm != null)
                                {
                                    flipViewCollection.ForEach(A =>
                                    {
                                        var model = from m in cvm.FavoriteCollection
                                                    where A.id == m.id
                                                    select A;
                                        if (model.Count() != 0)
                                        {
                                            A.isFavorite = true;
                                        }
                                    });
                                }

                                if (!SimpleIoc.Default.IsRegistered <DownloadViewModel>())
                                {
                                    SimpleIoc.Default.Register <DownloadViewModel>(false);
                                }
                                var dlvm = SimpleIoc.Default.GetInstance <DownloadViewModel>();

                                if (dlvm != null)
                                {
                                    flipViewCollection.ForEach(A =>
                                    {
                                        //先去检查下载队列里面有没有
                                        var downloadingModels = from m in dlvm.DownloadingList
                                                                where m.DownloadId == A.id
                                                                select m;
                                        //这里说明有正在下载的,那么应该把当前的Model添加到下载队列里面的DownloadModelList
                                        if (downloadingModels.Count() != 0)
                                        {
                                            var downloadModel = downloadingModels.FirstOrDefault() as DownloadingModel;
                                            if (downloadModel != null)
                                            {
                                                downloadModel.DownloadModelList.Add(A);
                                            }
                                        }
                                        else
                                        {
                                            //然后检查已下载集合里面有没有
                                            var hasDownloadModels = from m in dlvm.DownloadCollection
                                                                    where A.id == m.id
                                                                    select A;
                                            if (hasDownloadModels.Count() != 0)
                                            {
                                                A.isAleadyDownload = true;
                                            }
                                        }
                                    });
                                }
                                #endregion

                                #region 首屏和磁贴
                                Task.Run(async() =>
                                {
                                    #region 存储每日精选的最新一天的图片。因为加入了动态磁贴,所以无论是手机还是pc都要去下载pc端今日的图片
                                    //if (!AppEnvironment.IsPhone)
                                    //{
                                    if (AppEnvironment.IsNeedToUpdateSplashImage)
                                    {
                                        var folder = await ApplicationData.Current.LocalFolder.CreateFolderAsync(CacheConfig.Instance.PCSplashScreenImageCacheRelativePath, CreationCollisionOption.OpenIfExists);
                                        foreach (var file in await folder.GetFilesAsync())
                                        {
                                            await file.DeleteAsync(StorageDeleteOption.PermanentDelete);
                                        }

                                        List <Task> taskList = new List <Task>();

                                        flipViewCollection.Take(8).ForEach(async A =>
                                        {
                                            try
                                            {
                                                var name = EyeSight.Encrypt.MD5Core.Instance.ComputeMD5(A.coverForDetail);

                                                Task task = Task.Run(async() =>
                                                {
                                                    await WebDownFileHelper.Instance.SaveAsyncWithHttp(A.coverForDetail, name, folder);
                                                });

                                                taskList.Add(task);
                                            }
                                            catch { }
                                        });

                                        Task.WhenAll(taskList).ContinueWith(o =>
                                        {
                                            Debug.WriteLine("我刚加载完首屏");

                                            #region 处理磁贴
                                            DicStore.AddOrUpdateValue <object>(AppCommonConst.CURRENT_TILE_COLLECTION, flipViewCollection.Take(5).ToList());
                                            if (SettingsStore.GetValueOrDefault <bool>(AppCommonConst.IS_TILE_ACTIVE, true) == true)
                                            {
                                                TileHelper.Instance.UpdateTiles(flipViewCollection.Take(5).ToList());
                                            }
                                            else
                                            {
                                                TileHelper.Instance.CloseTiles();
                                            }
                                            #endregion

                                            Debug.WriteLine("我加载完磁贴了");
                                        });
                                    }

                                    //}
                                    #endregion
                                });

                                #region 处理磁贴
                                DicStore.AddOrUpdateValue <object>(AppCommonConst.CURRENT_TILE_COLLECTION, flipViewCollection.Take(5).ToList());
                                if (SettingsStore.GetValueOrDefault <bool>(AppCommonConst.IS_TILE_ACTIVE, true) == true)
                                {
                                    TileHelper.Instance.UpdateTiles(flipViewCollection.Take(5).ToList());
                                }
                                else
                                {
                                    TileHelper.Instance.CloseTiles();
                                }
                                #endregion

                                #endregion
                            }

                            Debug.WriteLine("我的数据加载完了");

                            DicStore.AddOrUpdateValue <bool>(AppCommonConst.IS_APP_FIRST_LAUNCH, false);

                            //只存第一页的数据
                            if (cacheFileName != null)
                            {
                                //将第一页数据缓存到本地
                                FileHelper.Instance.SaveTextToFile(CacheConfig.Instance.ListFileCacheRelativePath, cacheFileName, backJson);
                            }
                        }
                        else
                        {
                            //判断是不是分页索引第一页,如果是第一页并且获取到的条目个数为0个,则此时要求再次获取。此时提示“没有获取到数据,请重试”
                            if (collection.Count == 0 && !isRefresh)
                            {
                                //这里使用反射
                                RetryBox.Instance.ShowRetry(AppNetworkMessageConst.COLLECTION_ITEM_IS_ZERO, typeof(EyeSight.ViewModel.Daily.DailyViewModel), "GetDaily", new object[] { collection, flipViewCollection, url, cacheFileName, isRefresh });
                            }
                            //如果不是第一页,就不用去管
                            else
                            {
                            }
                        }
                    }
                    else
                    {
                        //判断是不是分页索引第一页,如果是第一页的话则会弹出提示,重新加载。因为第一页没有加载成功,本条目下就没数据,此时就要弹出一个东西让其重新加载数据。如果不是第一页就不用去管了
                        if (collection.Count == 0)
                        {
                            //加载本地数据
                            var localJson = await FileHelper.Instance.ReadTextFromFile(CacheConfig.Instance.ListFileCacheRelativePath, cacheFileName);
                            if (localJson != null)
                            {
                                var localResult = JsonConvertHelper.Instance.DeserializeObject <DailyRootModel>(localJson);
                                if (localResult != null)
                                {
                                    //因为如果第一页获取到的数据为0条时不会写到本地的,所以,从本地获取到的数据条目数一定不为0
                                    if (localResult.dailyList.Count != 0)
                                    {
                                        //不是刷新说明是第一次加载。如果是刷新的话,此处无动作。因为如果数据加载成功的话前面会正确处理,如果数据加载失败了刷新还到这一步的话添加也无用。
                                        if (!isRefresh)
                                        {
                                            if (!AppEnvironment.IsPhone)
                                            {
                                                localResult.dailyList[0].videoList.ForEach(B =>
                                                {
                                                    flipViewCollection.Add(B);
                                                });
                                            }
                                            else
                                            {
                                                localResult.dailyList.ForEach(A =>
                                                {
                                                    if (collection.Count != 0)
                                                    {
                                                        Videolist vl = new Videolist();
                                                        vl.today     = A.today;
                                                        collection.Add(vl);
                                                    }
                                                    else
                                                    {
                                                        if (is_Campaign_Available && campaign_Image_Url != null && campaign_Action_Url != null)
                                                        {
                                                            Videolist vlCam = new Videolist();
                                                            //vlCam.is_Campaign_Available = is_Campaign_Available;
                                                            vlCam.coverForDetail = campaign_Image_Url;
                                                            vlCam.webUrl.raw     = campaign_Action_Url;
                                                            collection.Add(vlCam);
                                                        }
                                                    }

                                                    A.videoList.ForEach(B =>
                                                    {
                                                        collection.Add(B);
                                                        flipViewCollection.Add(B);
                                                    });
                                                });
                                            }

                                            #region 处理收藏和下载
                                            if (!SimpleIoc.Default.IsRegistered <CollectionViewModel>())
                                            {
                                                SimpleIoc.Default.Register <CollectionViewModel>(false);
                                            }
                                            var cvm = SimpleIoc.Default.GetInstance <CollectionViewModel>();

                                            if (cvm != null)
                                            {
                                                flipViewCollection.ForEach(A =>
                                                {
                                                    var model = from m in cvm.FavoriteCollection
                                                                where A.id == m.id
                                                                select A;
                                                    if (model.Count() != 0)
                                                    {
                                                        A.isFavorite = true;
                                                    }
                                                });
                                            }

                                            if (!SimpleIoc.Default.IsRegistered <DownloadViewModel>())
                                            {
                                                SimpleIoc.Default.Register <DownloadViewModel>(false);
                                            }
                                            var dlvm = SimpleIoc.Default.GetInstance <DownloadViewModel>();

                                            if (dlvm != null)
                                            {
                                                flipViewCollection.ForEach(A =>
                                                {
                                                    //先去检查下载队列里面有没有
                                                    var downloadingModels = from m in dlvm.DownloadingList
                                                                            where m.DownloadId == A.id
                                                                            select m;
                                                    //这里说明有正在下载的,那么应该把当前的Model添加到下载队列里面的DownloadModelList
                                                    if (downloadingModels.Count() != 0)
                                                    {
                                                        var downloadModel = downloadingModels.FirstOrDefault() as DownloadingModel;
                                                        if (downloadModel != null)
                                                        {
                                                            downloadModel.DownloadModelList.Add(A);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        //然后检查已下载集合里面有没有
                                                        var hasDownloadModels = from m in dlvm.DownloadCollection
                                                                                where A.id == m.id
                                                                                select A;
                                                        if (hasDownloadModels.Count() != 0)
                                                        {
                                                            A.isAleadyDownload = true;
                                                        }
                                                    }
                                                });
                                            }
                                            #endregion

                                            #region 处理磁贴
                                            DicStore.AddOrUpdateValue <object>(AppCommonConst.CURRENT_TILE_COLLECTION, flipViewCollection.Take(5).ToList());
                                            if (SettingsStore.GetValueOrDefault <bool>(AppCommonConst.IS_TILE_ACTIVE, true) == true)
                                            {
                                                TileHelper.Instance.UpdateTiles(flipViewCollection.Take(5).ToList());
                                            }
                                            else
                                            {
                                                TileHelper.Instance.CloseTiles();
                                            }
                                            #endregion
                                        }

                                        DicStore.AddOrUpdateValue <bool>(AppCommonConst.IS_APP_FIRST_LAUNCH, false);
                                    }
                                }
                                //虽然错误的数据是不会写到本地的,但如果反序列化失败一样会出错
                                else
                                {
                                    if (!isRefresh)
                                    {
                                        //如果此时还有网络,说明加载过程出错,提示信息为“加载数据出错,请重试。”
                                        if (AppEnvironment.IsInternetAccess)
                                        {
                                            RetryBox.Instance.ShowRetry(AppNetworkMessageConst.NETWOTK_IS_ERROR, typeof(EyeSight.ViewModel.Daily.DailyViewModel), "GetDaily", new object[] { collection, flipViewCollection, url, cacheFileName, isRefresh });
                                        }
                                        //如果没有网络,说明数据加载失败是因为没有网络造成的。提示信息为“没有网络,请确认网络连接。”
                                        else
                                        {
                                            RetryBox.Instance.ShowRetry(AppNetworkMessageConst.NETWORK_IS_OFFLINE_LOCAL_CACHE_IS_ERROR, typeof(EyeSight.ViewModel.Daily.DailyViewModel), "GetDaily", new object[] { collection, flipViewCollection, url, cacheFileName, isRefresh });
                                        }
                                    }
                                }
                            }
                            else
                            {
                                if (!isRefresh)
                                {
                                    //如果此时还有网络,说明加载过程出错,提示信息为“加载数据出错,请重试。”
                                    if (AppEnvironment.IsInternetAccess)
                                    {
                                        RetryBox.Instance.ShowRetry(AppNetworkMessageConst.NETWOTK_IS_ERROR, typeof(EyeSight.ViewModel.Daily.DailyViewModel), "GetDaily", new object[] { collection, flipViewCollection, url, cacheFileName, isRefresh });
                                    }
                                    //如果没有网络,说明数据加载失败是因为没有网络造成的。提示信息为“没有网络,请确认网络连接。”
                                    else
                                    {
                                        RetryBox.Instance.ShowRetry(AppNetworkMessageConst.NETWORK_IS_OFFLINE_LOCAL_CACHE_IS_NULL, typeof(EyeSight.ViewModel.Daily.DailyViewModel), "GetDaily", new object[] { collection, flipViewCollection, url, cacheFileName, isRefresh });
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    //判断是不是分页索引第一页,如果是第一页的话则会弹出提示,重新加载。因为第一页没有加载成功,本条目下就没数据,此时就要弹出一个东西让其重新加载数据。如果不是第一页就不用去管了
                    if (collection.Count == 0)
                    {
                        //如果此时还有网络,说明加载过程出错,提示信息为“加载数据出错,请重试。”
                        if (AppEnvironment.IsInternetAccess && !isRefresh)
                        {
                            RetryBox.Instance.ShowRetry(AppNetworkMessageConst.NETWOTK_IS_ERROR, typeof(EyeSight.ViewModel.Daily.DailyViewModel), "GetDaily", new object[] { collection, flipViewCollection, url, cacheFileName, isRefresh });
                        }
                        //如果没有网络,说明数据加载失败是因为没有网络造成的。提示信息为“没有网络,请确认网络连接。”
                        else
                        {
                            //加载本地数据
                            var localJson = await FileHelper.Instance.ReadTextFromFile(CacheConfig.Instance.ListFileCacheRelativePath, cacheFileName);
                            if (localJson != null)
                            {
                                var localResult = JsonConvertHelper.Instance.DeserializeObject <DailyRootModel>(localJson);
                                if (localResult != null)
                                {
                                    //因为如果第一页获取到的数据为0条时不会写到本地的,所以,从本地获取到的数据条目数一定不为0
                                    if (localResult.dailyList.Count != 0)
                                    {
                                        //不是刷新说明是第一次加载。如果是刷新的话,此处无动作。因为如果数据加载成功的话前面会正确处理,如果数据加载失败了刷新还到这一步的话添加也无用。
                                        if (!isRefresh)
                                        {
                                            if (!AppEnvironment.IsPhone)
                                            {
                                                localResult.dailyList[0].videoList.ForEach(B =>
                                                {
                                                    flipViewCollection.Add(B);
                                                });
                                            }
                                            else
                                            {
                                                localResult.dailyList.ForEach(A =>
                                                {
                                                    if (collection.Count != 0)
                                                    {
                                                        Videolist vl = new Videolist();
                                                        vl.today     = A.today;
                                                        collection.Add(vl);
                                                    }
                                                    else
                                                    {
                                                        if (is_Campaign_Available && campaign_Image_Url != null && campaign_Action_Url != null)
                                                        {
                                                            Videolist vlCam = new Videolist();
                                                            //vlCam.is_Campaign_Available = is_Campaign_Available;
                                                            vlCam.coverForDetail = campaign_Image_Url;
                                                            vlCam.webUrl.raw     = campaign_Action_Url;
                                                            collection.Add(vlCam);
                                                        }
                                                    }

                                                    A.videoList.ForEach(B =>
                                                    {
                                                        collection.Add(B);
                                                        flipViewCollection.Add(B);
                                                    });
                                                });
                                            }

                                            #region 处理收藏和下载
                                            if (!SimpleIoc.Default.IsRegistered <CollectionViewModel>())
                                            {
                                                SimpleIoc.Default.Register <CollectionViewModel>(false);
                                            }
                                            var cvm = SimpleIoc.Default.GetInstance <CollectionViewModel>();

                                            if (cvm != null)
                                            {
                                                flipViewCollection.ForEach(A =>
                                                {
                                                    var model = from m in cvm.FavoriteCollection
                                                                where A.id == m.id
                                                                select A;
                                                    if (model.Count() != 0)
                                                    {
                                                        A.isFavorite = true;
                                                    }
                                                });
                                            }

                                            if (!SimpleIoc.Default.IsRegistered <DownloadViewModel>())
                                            {
                                                SimpleIoc.Default.Register <DownloadViewModel>(false);
                                            }
                                            var dlvm = SimpleIoc.Default.GetInstance <DownloadViewModel>();

                                            if (dlvm != null)
                                            {
                                                flipViewCollection.ForEach(A =>
                                                {
                                                    //先去检查下载队列里面有没有
                                                    var downloadingModels = from m in dlvm.DownloadingList
                                                                            where m.DownloadId == A.id
                                                                            select m;
                                                    //这里说明有正在下载的,那么应该把当前的Model添加到下载队列里面的DownloadModelList
                                                    if (downloadingModels.Count() != 0)
                                                    {
                                                        var downloadModel = downloadingModels.FirstOrDefault() as DownloadingModel;
                                                        if (downloadModel != null)
                                                        {
                                                            downloadModel.DownloadModelList.Add(A);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        //然后检查已下载集合里面有没有
                                                        var hasDownloadModels = from m in dlvm.DownloadCollection
                                                                                where A.id == m.id
                                                                                select A;
                                                        if (hasDownloadModels.Count() != 0)
                                                        {
                                                            A.isAleadyDownload = true;
                                                        }
                                                    }
                                                });
                                            }
                                            #endregion

                                            #region 处理磁贴
                                            DicStore.AddOrUpdateValue <object>(AppCommonConst.CURRENT_TILE_COLLECTION, flipViewCollection.Take(5).ToList());
                                            if (SettingsStore.GetValueOrDefault <bool>(AppCommonConst.IS_TILE_ACTIVE, true) == true)
                                            {
                                                TileHelper.Instance.UpdateTiles(flipViewCollection.Take(5).ToList());
                                            }
                                            else
                                            {
                                                TileHelper.Instance.CloseTiles();
                                            }
                                            #endregion
                                        }

                                        DicStore.AddOrUpdateValue <bool>(AppCommonConst.IS_APP_FIRST_LAUNCH, false);
                                    }
                                    else
                                    {
                                        if (!isRefresh)
                                        {
                                            RetryBox.Instance.ShowRetry(AppNetworkMessageConst.NETWORK_IS_OFFLINE_LOCAL_CACHE_IS_NULL, typeof(EyeSight.ViewModel.Daily.DailyViewModel), "GetDaily", new object[] { collection, flipViewCollection, url, cacheFileName, isRefresh });
                                        }
                                    }
                                }
                                //虽然错误的数据是不会写到本地的,但如果反序列化失败一样会出错,又没有网络
                                else
                                {
                                    if (!isRefresh)
                                    {
                                        RetryBox.Instance.ShowRetry(AppNetworkMessageConst.NETWORK_IS_OFFLINE_LOCAL_CACHE_IS_ERROR, typeof(EyeSight.ViewModel.Daily.DailyViewModel), "GetDaily", new object[] { collection, flipViewCollection, url, cacheFileName, isRefresh });
                                    }
                                }
                            }
                            else
                            {
                                if (!isRefresh)
                                {
                                    RetryBox.Instance.ShowRetry(AppNetworkMessageConst.NETWORK_IS_OFFLINE_LOCAL_CACHE_IS_NULL, typeof(EyeSight.ViewModel.Daily.DailyViewModel), "GetDaily", new object[] { collection, flipViewCollection, url, cacheFileName, isRefresh });
                                }
                            }
                        }
                    }
                    //如果不是第一页就不用管了
                    else
                    {
                    }
                }

                IsBusy = false;
            });
        }