コード例 #1
0
        private void meNowPlaying_MediaEnded(object sender, RoutedEventArgs e)
        {
            if (SelectedMediaItemPartIndex < (SelectedMediaItem.Parts.Count - 1))
            {
                SelectedMediaItemPartIndex++;
            }
            else
            {
                MediaItem selectedMediaItem = SelectedMediaItem;
                OnMediaItemEnding(selectedMediaItem);

                try
                {
                    SelectedMediaItem.Played();
                    SelectedMediaItem.Save();
                    OnMediaItemSaved(SelectedMediaItem);
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show("Could not update play history for media item: " + ex.Message, "", MessageBoxButton.OK, MessageBoxImage.Error);
                }

                SkipNext();
                OnMediaItemEnded(selectedMediaItem);
            }
        }
コード例 #2
0
        private void meNowPlaying_MediaOpened(object sender, RoutedEventArgs e)
        {
            if (meNowPlaying.NaturalDuration.HasTimeSpan)
            {
                if (SelectedMediaItemPart.Duration != meNowPlaying.NaturalDuration.TimeSpan)
                {
                    SelectedMediaItem.SetPartDuration(SelectedMediaItemPartIndex, meNowPlaying.NaturalDuration.TimeSpan);
                    SelectedMediaItem.Save();

                    OnMediaItemSaved(SelectedMediaItem);
                }

                OnOpeningMediaItemPart(SelectedMediaItemPart);
            }
        }