コード例 #1
0
 /// <summary>
 /// 销毁由PlanPeriod占用的非托管资源,还可以另外再释放托管资源
 /// </summary>
 public void Dispose()
 {
     try
     {
         lock (Mutex)
         {
             if (m_RaiseTimer != null)
             {
                 m_RaiseTimer.Dispose();
                 m_RaiseTimer = null;
             }
             m_Begun = false;
             m_BegunSet.Clear();
             m_EndedSet.Clear();
         }
         Dispose(true);
     }
     finally
     {
         lock (typeof(PlanPeriod))
         {
             PlanPeriod.PlanPeriods.Remove(this);
         }
     }
 }
コード例 #2
0
 public void Reset()
 {
     lock (Mutex)
     {
         if (m_RaiseTimer != null)
         {
             m_RaiseTimer.Dispose();
             m_RaiseTimer = null;
             m_RaiseTimer = new WrappedTimer(PlanTimerCallBack, null, GetNextRaisePeriod(), TimeSpan.FromDays(1));
         }
     }
 }
コード例 #3
0
 public void Reset()
 {
     lock (Mutex)
     {
         if (m_RaiseTimer != null)
         {
             m_RaiseTimer.Dispose();
             m_RaiseTimer = null;
             m_RaiseTimer = new WrappedTimer(PlanTimerCallBack, null, GetNextRaisePeriod(false), RepeatInterval);
         }
     }
 }
コード例 #4
0
 /// <summary>
 /// 创建PlanTime对象
 /// </summary>
 /// <param name="id"></param>
 /// <param name="year">年</param>
 /// <param name="month">月</param>
 /// <param name="day">日</param>
 /// <param name="hour">时</param>
 /// <param name="minute">分</param>
 /// <param name="second">秒</param>
 /// <param name="dayOfWeek">星期几</param>
 /// <param name="repeatTimes">重复提示次数,取值范围:[1,5],默认为1次</param>
 /// <param name="repeatInterval">重复提示的间隔时间,取值范围: (5秒至30分钟),默认为30秒.</param>
 /// <param name="enabled">是否启用计划,注意:如果在提示期间Enabled的值被修改,将不再继续RepeatTimes的后续提示,而是转而等待下次计划的触发。</param>
 internal Plan(String id, Nullable <Int32> year, Nullable <Int32> month, Nullable <Int32> day, Int32 hour, Int32 minute, Int32 second, Nullable <DayOfWeek> dayOfWeek, Int32 repeatTimes, TimeSpan repeatInterval, Boolean enabled)
 {
     this.Tag            = null;
     this.Id             = id;
     this.m_Time         = new PlanTime(year, month, day, hour, minute, second, dayOfWeek);
     this.RepeatTimes    = repeatTimes;
     this.RepeatInterval = repeatInterval;
     m_RaiseTimer        = null;
     this.Enabled        = enabled;
     lock (typeof(Plan))
     {
         Plan.Plans.Add(this);
     }
 }
コード例 #5
0
 /// <summary>
 /// 销毁计划对象
 /// </summary>
 public void Dispose()
 {
     try
     {
         lock (Mutex)
         {
             if (m_RaiseTimer != null)
             {
                 m_RaiseTimer.Dispose();
                 m_RaiseTimer = null;
             }
             m_RemindedSet.Clear();
         }
         Dispose(true);
     }
     finally
     {
         lock (typeof(Plan))
         {
             Plan.Plans.Remove(this);
         }
     }
 }