Пример #1
0
        internal TimerQueueTimer(
            TimerQueue queue,
            TimerCallback cb,
            object state,
            uint dueTime,
            uint period,
            TimerQueueTimerFlags flags)
        {
            MyQueue  = queue;
            Callback = cb;
            win32WaitOrTimerCallback = TimerCallback;
            UserState = state;
            bool rslt = TQTimerWin32.CreateTimerQueueTimer(
                out Handle,
                MyQueue.Handle,
                win32WaitOrTimerCallback,
                IntPtr.Zero,
                dueTime,
                period,
                flags);

            if (!rslt)
            {
                throw new Win32Exception(Marshal.GetLastWin32Error(), "Error creating timer.");
            }
        }
Пример #2
0
 public extern static bool CreateTimerQueueTimer(
     out IntPtr newTimer,
     IntPtr timerQueue,
     Win32WaitOrTimerCallback callback,
     IntPtr userState,
     uint dueTime,
     uint period,
     TimerQueueTimerFlags flags);
Пример #3
0
 public extern static bool CreateTimerQueueTimer(
     out IntPtr newTimer,
     IntPtr timerQueue,
     Win32WaitOrTimerCallback callback,
     IntPtr userState,
     uint dueTime,
     uint period,
     TimerQueueTimerFlags flags);
Пример #4
0
 public TimerQueueTimer CreateOneShot(
     TimerCallback callback,
     object state,
     uint dueTime,
     TimerQueueTimerFlags flags)
 {
     return(CreateTimer(callback, state, dueTime, 0, (flags | TimerQueueTimerFlags.ExecuteOnlyOnce)));
 }
Пример #5
0
 public TimerQueueTimer CreateTimer(
     TimerCallback callback,
     object state,
     uint dueTime,
     uint period,
     TimerQueueTimerFlags flags)
 {
     return(new TimerQueueTimer(this, callback, state, dueTime, period, flags));
 }
Пример #6
0
 public TimerQueueTimer CreateOneShot(
     TimerCallback callback,
     object state,
     uint dueTime,
     TimerQueueTimerFlags flags)
 {
     return CreateTimer(callback, state, dueTime, 0, (flags | TimerQueueTimerFlags.ExecuteOnlyOnce));
 }
Пример #7
0
 public TimerQueueTimer CreateTimer(
     TimerCallback callback,
     object state,
     uint dueTime,
     uint period,
     TimerQueueTimerFlags flags)
 {
     return new TimerQueueTimer(this, callback, state, dueTime, period, flags);
 }
Пример #8
0
 internal TimerQueueTimer(
     TimerQueue queue,
     TimerCallback cb,
     object state,
     uint dueTime,
     uint period,
     TimerQueueTimerFlags flags)
 {
     MyQueue = queue;
     Callback = cb;
     win32WaitOrTimerCallback = TimerCallback;
     UserState = state;
     bool rslt = TQTimerWin32.CreateTimerQueueTimer(
         out Handle,
         MyQueue.Handle,
         win32WaitOrTimerCallback,
         IntPtr.Zero,
         dueTime,
         period,
         flags);
     if (!rslt)
     {
         throw new Win32Exception(Marshal.GetLastWin32Error(), "Error creating timer.");
     }
 }