diff --git a/Nuclex.Support (Xbox 360).csproj b/Nuclex.Support (Xbox 360).csproj
index 4e4bdd8..8bf4786 100644
--- a/Nuclex.Support (Xbox 360).csproj
+++ b/Nuclex.Support (Xbox 360).csproj
@@ -152,6 +152,9 @@
Scheduler.cs
+
+ Scheduler.cs
+
WindowsTimeSource.cs
diff --git a/Nuclex.Support.csproj b/Nuclex.Support.csproj
index 42dffe0..08cd1b5 100644
--- a/Nuclex.Support.csproj
+++ b/Nuclex.Support.csproj
@@ -138,6 +138,9 @@
Scheduler.cs
+
+ Scheduler.cs
+
WindowsTimeSource.cs
diff --git a/Source/EnumHelper.cs b/Source/EnumHelper.cs
index 4ff5019..c2f4d5d 100644
--- a/Source/EnumHelper.cs
+++ b/Source/EnumHelper.cs
@@ -115,7 +115,7 @@ namespace Nuclex.Support {
BindingFlags.Public | BindingFlags.Static
);
- // Create an array to hold the enumeration value and copy them over from
+ // Create an array to hold the enumeration values and copy them over from
// the fields we just retrieved
EnumType[] values = new EnumType[fieldInfos.Length];
for(int index = 0; index < fieldInfos.Length; ++index) {
diff --git a/Source/Scheduling/ISchedulerService.cs b/Source/Scheduling/ISchedulerService.cs
index 7df7e9f..a829862 100644
--- a/Source/Scheduling/ISchedulerService.cs
+++ b/Source/Scheduling/ISchedulerService.cs
@@ -24,9 +24,17 @@ 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
@@ -57,7 +65,9 @@ namespace Nuclex.Support.Scheduling {
/// 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);
+ object NotifyEach(
+ int delayMilliseconds, int intervalMilliseconds, WaitCallback callback
+ );
///
/// Schedules a recurring notification after the specified time span
diff --git a/Source/Scheduling/Scheduler.TimeSource.cs b/Source/Scheduling/Scheduler.TimeSource.cs
new file mode 100644
index 0000000..6960943
--- /dev/null
+++ b/Source/Scheduling/Scheduler.TimeSource.cs
@@ -0,0 +1,79 @@
+#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;
+using System.Diagnostics;
+
+using Nuclex.Support.Collections;
+
+namespace Nuclex.Support.Scheduling {
+
+ /// Schedules actions for execution at a future point in time
+ partial class Scheduler {
+
+ #region class TimeSourceSingleton
+
+ ///
+ /// Manages the singleton instance of the scheduler's default time source
+ ///
+ private class TimeSourceSingleton {
+
+ ///
+ /// Explicit static constructor to guarantee the singleton is initialized only
+ /// when a static member of this class is accessed.
+ ///
+ static TimeSourceSingleton() { } // Do not remove!
+
+ /// The singleton instance of the default time source
+ internal static readonly ITimeSource Instance = Scheduler.CreateDefaultTimeSource();
+
+ }
+
+ #endregion // class TimeSourceSingleton
+
+ /// Returns the default time source for the scheduler
+ public static ITimeSource DefaultTimeSource {
+ get { return TimeSourceSingleton.Instance; }
+ }
+
+ /// Creates a new default time source for the scheduler
+ ///
+ /// Whether the specialized windows time source should be used
+ ///
+ /// The newly created time source
+ internal static ITimeSource CreateTimeSource(bool useWindowsTimeSource) {
+ if(useWindowsTimeSource) {
+ return new WindowsTimeSource();
+ } else {
+ return new GenericTimeSource();
+ }
+ }
+
+ /// Creates a new default time source for the scheduler
+ /// The newly created time source
+ internal static ITimeSource CreateDefaultTimeSource() {
+ return CreateTimeSource(WindowsTimeSource.Available);
+ }
+
+ }
+
+} // namespace Nuclex.Support.Scheduling
diff --git a/Source/Scheduling/Scheduler.cs b/Source/Scheduling/Scheduler.cs
index 2d73f68..54415b6 100644
--- a/Source/Scheduling/Scheduler.cs
+++ b/Source/Scheduling/Scheduler.cs
@@ -28,31 +28,11 @@ using Nuclex.Support.Collections;
namespace Nuclex.Support.Scheduling {
/// Schedules actions for execution at a future point in time
- public class Scheduler : ISchedulerService, IDisposable {
+ public partial class Scheduler : ISchedulerService, IDisposable {
/// One tick is 100 ns, meaning 10000 ticks equal 1 ms
private const long TicksPerMillisecond = 10000;
- #region class TimeSourceSingleton
-
- ///
- /// Manages the singleton instance of the scheduler's default time source
- ///
- private class TimeSourceSingleton {
-
- ///
- /// Explicit static constructor to guarantee the singleton is initialized only
- /// when a static member of this class is accessed.
- ///
- static TimeSourceSingleton() { } // Do not remove!
-
- /// The singleton instance of the default time source
- internal static readonly ITimeSource Instance = Scheduler.CreateDefaultTimeSource();
-
- }
-
- #endregion // class TimeSourceSingleton
-
#region class Notification
/// Scheduled notification
@@ -187,6 +167,11 @@ namespace Nuclex.Support.Scheduling {
}
}
+ /// Time source being used by the scheduler
+ public ITimeSource TimeSource {
+ get { return this.timeSource; }
+ }
+
/// Schedules a notification at the specified absolute time
///
/// Absolute time at which the notification will occur
@@ -320,30 +305,6 @@ namespace Nuclex.Support.Scheduling {
}
}
- /// Returns the default time source for the scheduler
- public static ITimeSource DefaultTimeSource {
- get { return TimeSourceSingleton.Instance; }
- }
-
- /// Creates a new default time source for the scheduler
- ///
- /// Whether the specialized windows time source should be used
- ///
- /// The newly created time source
- internal static ITimeSource CreateTimeSource(bool useWindowsTimeSource) {
- if(useWindowsTimeSource) {
- return new WindowsTimeSource();
- } else {
- return new GenericTimeSource();
- }
- }
-
- /// Creates a new default time source for the scheduler
- /// The newly created time source
- internal static ITimeSource CreateDefaultTimeSource() {
- return CreateTimeSource(WindowsTimeSource.Available);
- }
-
/// Called when the system date/time have been adjusted
/// Time source which detected the adjustment
/// Not used