Beispiel #1
0
        private void FlatButtonPlayPause_Click(object sender, MouseEventArgs e)
        {
            if (Playing)
            {
                Playing = false;
                FB_PlayPause.Image_Source = new BitmapImage(new Uri("pack://application:,,,/Resources/Icons/Media/Play.png"));
                ME_MediaPlayer.Pause();
            }
            else
            {
                Playing = true;
                FB_PlayPause.Image_Source = new BitmapImage(new Uri("pack://application:,,,/Resources/Icons/Media/Pause.png"));

                if (ME_MediaPlayer.NaturalDuration.HasTimeSpan && ME_MediaPlayer.Position.TotalSeconds == ME_MediaPlayer.NaturalDuration.TimeSpan.TotalSeconds)
                {
                    ME_MediaPlayer.Position = TimeSpan.Zero;
                }

                ME_MediaPlayer.Play();
            }
        }
Beispiel #2
0
        private void ME_MediaPlayer_Loaded(object sender, RoutedEventArgs e)
        {
            //Very strange situation... Volume 100 is like Volume 50
            if (Volume > 99)
            {
                ME_MediaPlayer.Volume = 0.99;
                SL_Volume.Value       = 99;
            }
            else
            {
                ME_MediaPlayer.Volume = (double)Volume / 100;
                SL_Volume.Value       = Volume;
            }

            dispatcherTimer          = new DispatcherTimer();
            dispatcherTimer.Tick    += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = TimeSpan.FromMilliseconds(500);
            dispatcherTimer.Start();

            if (Autoplay)
            {
                ME_MediaPlayer.Play();
            }
        }
Beispiel #3
0
 private void FlatButtonPlayFromStart_Click(object sender, MouseEventArgs e)
 {
     ME_MediaPlayer.Position = TimeSpan.Zero;
     ME_MediaPlayer.Play();
 }