コード例 #1
0
ファイル: PlayerInfo.xaml.cs プロジェクト: Jesn/MangGuoTv
 protected override void OnNavigatedFrom(NavigationEventArgs e)
 {
     base.OnNavigatedFrom(e);
     CallbackManager.currentPage = null;
     currentPosition.Stop();
     //当用户按win键 或者长按返回键时  不清空 datacontext  否则从墓碑模式返回时会丢失当前数据
     if (e.Content != null)
     {
         //如果不是返回下载页
         if (!(e.Content is DownVideo))
         {
             leaveSilderValue = pbVideo.Value;
             App.PlayerModel.ClearData();
             this.DataContext = null;
         }
     }
     else
     {
         needSetSliderValue = true;
         GC.Collect();
         GC.WaitForPendingFinalizers();
     }
     myMediaElement.Tap -= myMediaElement_Tap;
     App.HideLoading();
     WpStorage.SetIsoSetting(needSetSliderValueIso, needSetSliderValue);
     WpStorage.SetIsoSetting(leaveSilderValueIso, leaveSilderValue);
 }
コード例 #2
0
ファイル: PlayerInfo.xaml.cs プロジェクト: Jesn/MangGuoTv
 //视频状态改变时的处理事件
 void myMediaElement_CurrentStateChanged(object sender, RoutedEventArgs e)
 {
     if (myMediaElement.CurrentState == MediaElementState.Playing)
     {//播放视频时各菜单的状态
         if (WpStorage.GetIsoSetting(needSetSliderValueIso) != null)
         {
             needSetSliderValue = (bool)WpStorage.GetIsoSetting(needSetSliderValueIso);
             if (needSetSliderValue)
             {
                 needSetSliderValue = false;
                 WpStorage.SetIsoSetting(needSetSliderValueIso, needSetSliderValue);
                 if (WpStorage.GetIsoSetting(leaveSilderValueIso) != null)
                 {
                     leaveSilderValue = (double)WpStorage.GetIsoSetting(leaveSilderValueIso);
                     pbVideo.Tag      = "isFoucesed";
                     pbVideo.Value    = leaveSilderValue;
                 }
             }
         }
         //更换清晰度
         if (App.PlayerModel.IsChangeDefinition)
         {
             pbVideo.Tag   = "isFoucesed";
             pbVideo.Value = leaveSilderValue;
             //myMediaElement.Position = new TimeSpan(0, 0, 0, (int)leaveSilderValue);
         }
         currentPosition.Start();
         App.HideLoading();
         App.PlayerModel.LoadVisibility = Visibility.Collapsed;
         PlayImg.Source = new BitmapImage(new Uri(pauseImg, UriKind.RelativeOrAbsolute));
     }
     else if (myMediaElement.CurrentState == MediaElementState.Paused)
     { //暂停视频时各菜单的状态
         currentPosition.Stop();
         PlayImg.Source = new BitmapImage(new Uri(playImg, UriKind.RelativeOrAbsolute));
     }
     else
     {//停止视频时各菜单的状态
         currentPosition.Stop();
         PlayImg.Source = new BitmapImage(new Uri(playImg, UriKind.RelativeOrAbsolute));
         //NextPlayerGrid_Tap(null,null);
     }
 }