开发者

How do I stop a video at a specific time using Blend/WPF

开发者 https://www.devze.com 2023-01-20 04:04 出处:网络
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 i

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";

 开发者_如何学Python          ****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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号