Ejemplo n.º 1
0
        public static Timer DelayCall <T>(TimeSpan delay, TimeSpan interval, int count, TimerStateCallback <T> callback, T state)
        {
            Timer t = new DelayStateCallTimer <T>(delay, interval, count, callback, state);

            t.Start();

            return(t);
        }
Ejemplo n.º 2
0
        public static Timer DelayCall(TimeSpan delay, TimeSpan interval, int count, TimerStateCallback callback, object state)
        {
            Timer t = new DelayStateCallTimer(delay, interval, count, callback, state);

            t.Start();

            return(t);
        }
Ejemplo n.º 3
0
        public static Timer DelayCall <T1, T2, T3, T4>(TimeSpan delay, TimeSpan interval, int count, TimerStateCallback <T1, T2, T3, T4> callback, T1 state1, T2 state2, T3 state3, T4 state4)
        {
            Timer t = new DelayStateCallTimer <T1, T2, T3, T4>(delay, interval, count, callback, state1, state2, state3, state4)
            {
                Priority = ComputePriority(count == 1 ? delay : interval)
            };

            t.Start();

            return(t);
        }
Ejemplo n.º 4
0
        public static Timer DelayCall <T>(TimeSpan delay, TimeSpan interval, int count, TimerStateCallback <T> callback, T state)
        {
            Timer t = new DelayStateCallTimer <T>(delay, interval, count, callback, state)
            {
                Priority = ComputePriority(count == 1 ? delay : interval)
            };

            t.Start();

            return(t);
        }
Ejemplo n.º 5
0
        public static Timer DelayCall <T1, T2>(
            TimeSpan delay, TimeSpan interval, int count, TimerStateCallback <T1, T2> callback,
            T1 t1, T2 t2
            )
        {
            Timer t = new DelayStateCallTimer <T1, T2>(delay, interval, count, callback, t1, t2);

            t.Priority = ComputePriority(count == 1 ? delay : interval);

            t.Start();

            return(t);
        }
Ejemplo n.º 6
0
        public void CallbackTest1()
        {
            TimerPriority          processPriority    = new TimerPriority();                                                                                           // TODO: 初始化为适当的值
            TimeSpan               delayTimeSpan      = new TimeSpan();                                                                                                // TODO: 初始化为适当的值
            TimeSpan               intervalTimeSpan   = new TimeSpan();                                                                                                // TODO: 初始化为适当的值
            long                   iCount             = 0;                                                                                                             // TODO: 初始化为适当的值
            TimeSliceStateCallback timerStateCallback = null;                                                                                                          // TODO: 初始化为适当的值
            object                 oState             = null;                                                                                                          // TODO: 初始化为适当的值
            DelayStateCallTimer    target             = new DelayStateCallTimer(processPriority, delayTimeSpan, intervalTimeSpan, iCount, timerStateCallback, oState); // TODO: 初始化为适当的值
            TimeSliceStateCallback actual;

            actual = target.Callback;
            Assert.Inconclusive("验证此测试方法的正确性。");
        }
Ejemplo n.º 7
0
        /// <summary>
        ///Callback 的测试
        ///</summary>
        public void CallbackTestHelper <T>()
        {
            TimerPriority processPriority  = new TimerPriority();                                                                                                  // TODO: 初始化为适当的值
            TimeSpan      delayTimeSpan    = new TimeSpan();                                                                                                       // TODO: 初始化为适当的值
            TimeSpan      intervalTimeSpan = new TimeSpan();                                                                                                       // TODO: 初始化为适当的值
            long          iCount           = 0;                                                                                                                    // TODO: 初始化为适当的值
            TimeSliceStateCallback <T> timerStateCallback = null;                                                                                                  // TODO: 初始化为适当的值
            T tState = default(T);                                                                                                                                 // TODO: 初始化为适当的值
            DelayStateCallTimer <T>    target = new DelayStateCallTimer <T>(processPriority, delayTimeSpan, intervalTimeSpan, iCount, timerStateCallback, tState); // TODO: 初始化为适当的值
            TimeSliceStateCallback <T> actual;

            actual = target.Callback;
            Assert.Inconclusive("验证此测试方法的正确性。");
        }
Ejemplo n.º 8
0
 public static Server.Timer DelayCall(TimeSpan delay, TimeSpan interval, int count, TimerStateCallback callback, object state)
 {
     Server.Timer timer1 = new DelayStateCallTimer(delay, interval, count, callback, state);
     if (count == 1)
     {
         timer1.Priority = Server.Timer.ComputePriority(delay);
     }
     else
     {
         timer1.Priority = Server.Timer.ComputePriority(interval);
     }
     timer1.Start();
     return(timer1);
 }
Ejemplo n.º 9
0
        public void ToStringTest1()
        {
            TimerPriority          processPriority    = new TimerPriority();                                                                                           // TODO: 初始化为适当的值
            TimeSpan               delayTimeSpan      = new TimeSpan();                                                                                                // TODO: 初始化为适当的值
            TimeSpan               intervalTimeSpan   = new TimeSpan();                                                                                                // TODO: 初始化为适当的值
            long                   iCount             = 0;                                                                                                             // TODO: 初始化为适当的值
            TimeSliceStateCallback timerStateCallback = null;                                                                                                          // TODO: 初始化为适当的值
            object                 oState             = null;                                                                                                          // TODO: 初始化为适当的值
            DelayStateCallTimer    target             = new DelayStateCallTimer(processPriority, delayTimeSpan, intervalTimeSpan, iCount, timerStateCallback, oState); // TODO: 初始化为适当的值
            string                 expected           = string.Empty;                                                                                                  // TODO: 初始化为适当的值
            string                 actual;

            actual = target.ToString();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }
Ejemplo n.º 10
0
        public static Timer DelayCall <T>(TimeSpan delay, TimeSpan interval, int count, TimerStateCallback <T> callback, T state)
        {
            Timer t = new DelayStateCallTimer <T>(delay, interval, count, callback, state);

            if (count == 1)
            {
                t.Priority = ComputePriority(delay);
            }
            else
            {
                t.Priority = ComputePriority(interval);
            }

            t.Start();

            return(t);
        }
Ejemplo n.º 11
0
		public static Timer DelayCall( TimeSpan delay, TimeSpan interval, int count, TimerStateCallback callback, object state )
		{
			Timer t = new DelayStateCallTimer( delay, interval, count, callback, state );

			if ( count == 1 )
				t.Priority = ComputePriority( delay );
			else
				t.Priority = ComputePriority( interval );

			t.Start();

			return t;
		}