Provides a one-shot timer integrated to the Dispatcher queue.
 private void RequestCachePruning()
 {
     lock (this)
     {
         if (_cachePruningTimer != null || _cachePruningTimestamp.Add(CachePruningInterval) >= DateTime.UtcNow)
         {
             return;
         }
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             if (_cachePruningTimer != null)
             {
                 return;
             }
             _cachePruningTimer = OneShotDispatcherTimer.CreateAndStart(CachePruningTimerDuration, OnCachePruningTimerFired);
         });
     }
 }
 /// <summary>
 /// Creates a new <see cref="OneShotDispatcherTimer"/> and starts it.
 /// </summary>
 /// <param name="duration">The duration of the timer.</param>
 /// <param name="callback">The delegate that will be called when the timer fires.</param>
 /// <returns>The newly created timer.</returns>
 public static OneShotDispatcherTimer CreateAndStart(TimeSpan duration, EventHandler callback)
 {
     OneShotDispatcherTimer timer = new OneShotDispatcherTimer();
     timer.Duration = duration;
     timer.Fired += callback;
     timer.Start();
     return timer;
 }
 private void OnCachePruningTimerFired(object sender, EventArgs e)
 {
     if (sender != _cachePruningTimer)
     {
         return;
     }
     _cachePruningTimer = null;
     _cachePruningTimestamp = DateTime.UtcNow;
     ThreadPool.QueueUserWorkItem((state) => { PruneCache(); });
 }