سؤال

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



        }
هل كانت مفيدة؟

المحلول

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;
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top