private void AppBarButtonPlay_Click(object sender, RoutedEventArgs e)
 {
     if (AudioPlay.IsMyBackgroundTaskRunning)
     {
         if (MediaPlayerState.Playing == BackgroundMediaPlayer.Current.CurrentState)
         {
             //正在播放,播放暂停
             BackgroundMediaPlayer.Current.Pause();
             //控件状态 显示播放
             SetPlayButtonState(false);
         }
         else if (MediaPlayerState.Paused == BackgroundMediaPlayer.Current.CurrentState)
         {
             BackgroundMediaPlayer.Current.Play();
             //控件状态 显示暂停
             SetPlayButtonState(true);
         }
         else if (MediaPlayerState.Closed == BackgroundMediaPlayer.Current.CurrentState)
         {
             var message = new ValueSet();
             message.Add("playsinglefile", "ms-appx:///Assets/VideoSample/Media/红豆.mp3");
             BackgroundMediaPlayer.SendMessageToBackground(message);
             //控件状态 显示暂停
             SetPlayButtonState(true);
         }
     }
     else
     {
         MyToast.ShowToast("提示", "暂无音乐播放,请先选一首歌曲");
     }
 }
        private void Image_Tapped(object sender, TappedRoutedEventArgs e)
        {
            Image im      = sender as Image;
            bool  isBegin = false;

            if (im.Name == "ImageStart")
            {
                this.ImageStart.Visibility  = Visibility.Collapsed;
                this.ImagePauset.Visibility = Visibility.Visible;
                isBegin = true;
            }
            else
            {
                this.ImageStart.Visibility  = Visibility.Visible;
                this.ImagePauset.Visibility = Visibility.Collapsed;
            }

            if (!isBegin)
            {
                _download.PauseAll();
            }
            else
            {
                if (_download == null)
                {
                    string url = CommonString.URL;

                    _download = new BackgroundDownload();

                    _download.GetPercent += (current, total) =>
                    {
                        PBarDownload.Value = current;

                        TextBlockPercent.Text = current + "%";
                        if (current >= 100)
                        {
                            TextBlockState.Text = "下载完成";
                            _download           = null;

                            MyToast.ShowToast(" ", Global.Current.Globalization.Video_DownloadMessage);
                        }
                    };

                    _download.ErrorException += (o, s) =>
                    {
                        TextBlockState.Text = "下载错误 " + s;
                    };

                    TextBlockState.Text   = "下载进度";
                    TextBlockPercent.Text = 0 + "%";
                    PBarDownload.Value    = 0;
                    _download.StartDownload(url);
                }
                else
                {
                    TextBlockState.Text = Global.Current.Globalization.Video_Downloading;
                    _download.ResumeAll();
                }
            }
        }