Ejemplo n.º 1
0
 private void OnPlayPauseClick(object sender, RoutedEventArgs e)
 {
     if (output.HasMedia)
     {
         if (output.IsPlaying)
         {
             output.Pause();
             PlayPauseImg.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/play.png"));
         }
         else if (output.Paused)
         {
             output.Resume();
             PlayPauseImg.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/pause.png"));
         }
     }
 }
Ejemplo n.º 2
0
        private void OnPlayPauseClick(object sender, RoutedEventArgs e)
        {
            if (output.HasMedia)
            {
                if (!output.FileName.Equals(_oldPlayedSound))
                {
                    output.Stop();
                    output.Load(_oldPlayedSound);
                    output.Play();

                    string name = Path.GetFileName(_oldPlayedSound);
                    InputFileVm.inputFileViewModel.Set(name, output);
                    DiscordIntegration.Update(string.Empty, string.Format(Properties.Resources.Listening, name));
                    PlayPauseImg.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/pause.png"));
                }
                else if (output.IsPlaying)
                {
                    output.Pause();
                    PlayPauseImg.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/play.png"));
                }
                else if (output.Paused)
                {
                    output.Resume();
                    PlayPauseImg.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/pause.png"));
                }
                else if (output.IsStopped)
                {
                    output.Play();
                    PlayPauseImg.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/pause.png"));
                }
            }
            else
            {
                if (Sound_LstBox.SelectedIndex > -1 && Sound_LstBox.SelectedItem is ListBoxViewModel2 selected)
                {
                    output.Stop();
                    output.Load(selected.FullPath);
                    output.Play();

                    InputFileVm.inputFileViewModel.Set(selected.Content, output);
                    DiscordIntegration.Update(string.Empty, string.Format(Properties.Resources.Listening, selected.Content));
                    PlayPauseImg.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/pause.png"));
                }
            }
        }
Ejemplo n.º 3
0
 private void PausePlayback(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     output.Pause();
 }