views:

43

answers:

0

I need help! I'm facing a problem that is got to do with Slider + Tree View + Video. Using Blend and WPF, language C#.

Header

 (a) sub header X << Play Video (a) only on click
 (b) sub header Y << Play Video (b) only on click

Video (a) [Duration 0:00 to 0:09] and Video (b) [Duration 0:10 to 0:20]

I have combined the Video (a) and Video (b) into one video, so that when user click either (a) sub header X or (b) sub header Y, it will play on that particular Video and the slider also can detect where's the Video.

So now, I want to like stop the video when user click on (a) sub header X, after playing finish the Video (a), it will prompt the user to click on the (b) sub header Y to continue watching the video.

If I don't want prompt, I can also just write some texts on the Textbox to show user that the Video (a) has ended, and now they are watching the Video (b) part.

My coding are shown below:

private void headerX_Selected(object sender, RoutedEventArgs e)
{

  Video.Source = new Uri(@".\cooking.wmv", UriKind.Relative);

  Video.Play();

  info.Text = "Boil 500ml of water.";

}

private void headerY_Selected(object sender, RoutedEventArgs e)
{

  Video.Position = TimeSpan.FromSeconds(VideoTime.Value = 10);

  Video.Play();

  info.Text = "Add noodles when the water has boiled.";

}
  • Video = the MediaElement
  • VideoTime = the name of the slider
  • cooking.wmv = the Video
  • info.Text = Textbox

Any help would be appreciated.