tags:

views:

27

answers:

1

How do I stop a video at a specific time using Blend/WPF in C#?

Example:

When I clicked on a "TreeViewItem" called "MONDAY", the video will start to play. But up to 10sec of that video, I want it to stop. As after 10sec, that video will be showing video of another "TreeViewItem" called "TUESDAY". So what is the coding for it?

My coding is shown below:

        if (MONDAY.IsSelected == true)
        {
            Video.Source = new Uri(@".\weekday.wmv", UriKind.Relative);
            Video.Play();
            descriptionText.Text = "Monday Blues";

           ****When video play until 10sec, it will auto stop it****
        }

        else if (TUESDAY.IsSelected == true)
        {
            TimeSpan t = TimeSpan.FromSeconds(VideoTime.Value = 10);
            Video.Position = t;
            descriptionText.Text = "Tuesday is here";
        }

Can someone help me? Thanks.

A: 

Run a timer for 10 seconds, when timer elapsed call Stop

Andrey