public void Dispose()
 {
     if (currentDispatcherTimer != null)
     {
         currentDispatcherTimer.DisposeTimer();
     }
 }
 public void Start()
 {
     currentDispatcherTimer          = new System.Windows.Threading.DispatcherTimer();
     currentDispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, millsecond);
     //注:此处 Tick 为 dTimer 对象的事件( 超过计时器间隔时发生)
     currentDispatcherTimer.Tick += (sender, e) =>
     {
         if (currentExecuteCnt >= executeCnt)
         {
             System.Windows.Threading.DispatcherTimer ds = sender as System.Windows.Threading.DispatcherTimer;
             if (ds != null)
             {
                 ds.DisposeTimer();
                 currentExecuteCnt = 0;
                 if (EndAction != null)
                 {
                     EndAction();
                 }
             }
         }
         else
         {
             executeAction(currentDispatcherTimer);
             currentExecuteCnt++;
         }
     };
     currentDispatcherTimer.StartTimer();
 }
 public void Dispose()
 {
     if (dTimer != null)
     {
         dTimer.DisposeTimer();
     }
 }
 /// <summary>
 /// 不建议使用,建议使用AyTimeSetTimeout
 /// </summary>
 /// <param name="millsecond"></param>
 /// <param name="action"></param>
 /// <returns></returns>
 public static System.Windows.Threading.DispatcherTimer setTimeout(int millsecond, Action action)
 {
     System.Windows.Threading.DispatcherTimer dTimer = new System.Windows.Threading.DispatcherTimer();
     //注:此处 Tick 为 dTimer 对象的事件( 超过计时器间隔时发生)
     dTimer.Tick += (sender, e) =>
     {
         action();
         System.Windows.Threading.DispatcherTimer ds = sender as System.Windows.Threading.DispatcherTimer;
         if (ds != null)
         {
             ds.DisposeTimer();
         }
     };
     dTimer.Interval = new TimeSpan(0, 0, 0, 0, millsecond);
     dTimer.StartTimer();
     return(dTimer);
 }