public Page()
{
InitializeComponent();
System.Windows.Threading.DispatcherTimer myDispatcherTimer = new System.Windows.Threading.DispatcherTimer();
myDispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 100); // 100 Milliseconds
myDispatcherTimer.Tick += new EventHandler(Each_Tick);
myDispatcherTimer.Start();
}
// Fires every 100 miliseconds while the DispatcherTimer is active.
public void Each_Tick(object o, EventArgs sender)
{
MediaProgress.Value = media.Position.TotalSeconds;
}
private void Play_Click(object sender, RoutedEventArgs e)
{
media.Play();
MediaProgress.Maximum = media.NaturalDuration.TimeSpan.TotalSeconds;
//media.Position;
}
private void pause_Click(object sender, RoutedEventArgs e)
{
media.Pause();
}
No comments:
Post a Comment