Pergunta

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)
        {



        }
Foi útil?

Solução

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;
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top