Frage

I am using silverlight 4 with smf and I want to create a play , pause toggle button. So if the media is playing and if the button is clicked it will pause the video. But if the media is paused, it will restart playing video. How can I do that

 private void btnPlay_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {



        }
War es hilfreich?

Lösung

I don't know anything about silverlight, but you could use a boolean.

private void btnPlay_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
     if(isPlaying)
     {
         music.pause();
         isPlaying = FALSE;
         return;
     }

     music.play();
     isPlaying = TRUE;
     return;
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top