void _timer_Tick(object state) { this.Dispatcher.BeginInvoke(delegate() { var endSecond = (int)slider1.Value + (int)slider2.Value; var sc = new SecondsToFormattedTimeConverter(); int n = (int)MyMediaElement.Position.TotalSeconds; tbCurrentPosition.Text = (n / 60).ToString().PadLeft(2, '0') + ":" + (n % 60).ToString().PadLeft(2, '0'); if (MyMediaElement.Position.TotalSeconds >= endSecond) { MyMediaElement.Stop(); } }); }
void _timer_Tick(object state) { this.Dispatcher.BeginInvoke(delegate() { var endSecond = (int)slider1.Value + (int)slider2.Value; var sc = new SecondsToFormattedTimeConverter(); int n = (int)MyMediaElement.Position.TotalSeconds; tbCurrentPosition.Text = (n / 60).ToString().PadLeft(2, '0') + ":" + (n % 60).ToString().PadLeft(2, '0'); if (MyMediaElement.Position.TotalSeconds >= endSecond) MyMediaElement.Stop(); }); }