/// <summary> /// Sets the Position to the specified value. /// If the timer is running, it will be paused after this method call. /// </summary> /// <param name="ts">The ts.</param> public void Seek(TimeSpan ts) { lock (SyncLock) { Stopwatch.Reset(); OffsetTicks = Helper.RoundTicks(ts.Ticks < 0 ? 0 : ts.Ticks); IsPlaying = false; } }
private long ComputePositionTicks(decimal speedRatio) { var offsetTicks = Convert.ToDecimal(Stopwatch.Elapsed.Ticks) * speedRatio + Convert.ToDecimal(OffsetTicks); return(Helper.RoundTicks(Convert.ToInt64(offsetTicks))); }