#region CPL License
/*
Nuclex Framework
Copyright (C) 2002-2009 Nuclex Development Labs
This library is free software; you can redistribute it and/or
modify it under the terms of the IBM Common Public License as
published by the IBM Corporation; either version 1.0 of the
License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
IBM Common Public License for more details.
You should have received a copy of the IBM Common Public
License along with this library
*/
#endregion
using System;
using System.Collections.Generic;
using System.Threading;
namespace Nuclex.Support.Scheduling {
#if SCHEDULER_USE_CUSTOM_CALLBACK
/// Signature for a timed callback from the scheduler service
public delegate void SchedulerCallback();
#endif // SCHEDULER_USE_CUSTOM_CALLBACK
/// Service that allows the scheduled invocation of tasks
public interface ISchedulerService {
/// Time source being used by the scheduler
ITimeSource TimeSource { get; }
/// Schedules a notification at the specified absolute time
///
/// Absolute time at which the notification will occur
///
///
/// Callback that will be invoked when the notification is due
///
/// A handle that can be used to cancel the notification
///
/// The notification is scheduled for the indicated absolute time. If the system
/// enters/leaves daylight saving time or the date/time is changed (for example
/// when the system synchronizes with an NTP server), this will affect
/// the notification. So if you need to be notified after a fixed time, use
/// the NotifyIn() method instead.
///
object NotifyAt(DateTime notificationTime, WaitCallback callback);
///
/// Schedules a recurring notification after the specified amount of milliseconds
///
///
/// Milliseconds after which the first notification will occur
///
///
/// Interval in milliseconds at which the notification will be repeated
///
///
/// Callback that will be invoked when the notification is due
///
/// A handle that can be used to cancel the notification
object NotifyEach(
int delayMilliseconds, int intervalMilliseconds, WaitCallback callback
);
///
/// Schedules a recurring notification after the specified time span
///
/// Delay after which the first notification will occur
/// Interval at which the notification will be repeated
///
/// Callback that will be invoked when the notification is due
///
/// A handle that can be used to cancel the notification
object NotifyEach(TimeSpan delay, TimeSpan interval, WaitCallback callback);
///
/// Schedules a notification after the specified amount of milliseconds
///
///
/// Number of milliseconds after which the notification will occur
///
///
/// Callback that will be invoked when the notification is due
///
/// A handle that can be used to cancel the notification
object NotifyIn(int delayMilliseconds, WaitCallback callback);
/// Schedules a notification after the specified time span
/// Delay after which the notification will occur
///
/// Callback that will be invoked when the notification is due
///
/// A handle that can be used to cancel the notification
object NotifyIn(TimeSpan delay, WaitCallback callback);
/// Cancels a scheduled notification
///
/// Handle of the notification that will be cancelled
///
void Cancel(object notificationHandle);
}
} // namespace Nuclex.Support.Scheduling