Added XNA 4.0 for Windows Phone 7 project; updated Nuclex.Support to compile targeting Windows Phone 7

git-svn-id: file:///srv/devel/repo-conversion/nusu@203 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2010-09-17 15:29:22 +00:00
parent 1aad371ece
commit 374152cd63
15 changed files with 442 additions and 39 deletions

View file

@ -94,7 +94,7 @@ namespace Nuclex.Support.Scheduling {
int milliseconds = (int)(ticks / TicksPerMillisecond);
#if XNA_3
bool signalled = waitHandle.WaitOne(Math.Min(1000, milliseconds), false);
#elif XBOX360
#elif XBOX360 || WINDOWS_PHONE
bool signalled = waitHandle.WaitOne(Math.Min(1000, milliseconds));
#else
bool signalled = waitHandle.WaitOne(Math.Min(1000, milliseconds), false);

View file

@ -130,7 +130,7 @@ namespace Nuclex.Support.Scheduling {
this.timerThread.Name = "Nuclex.Support.Scheduling.Scheduler";
#if XNA_3
this.timerThread.Priority = ThreadPriority.Highest;
#elif !XBOX360
#elif !XBOX360 && !WINDOWS_PHONE
this.timerThread.Priority = ThreadPriority.Highest;
#endif
this.timerThread.IsBackground = true;
@ -147,7 +147,7 @@ namespace Nuclex.Support.Scheduling {
// a lot of time given that it doesn't do any real work), forcefully abort
// the thread. This may risk some leaks, but it's the only thing we can do.
bool success = this.timerThread.Join(2500);
#if !XBOX360
#if !XBOX360 && !WINDOWS_PHONE
Trace.Assert(success, "Scheduler timer thread did not exit in time");
#endif
// Unsubscribe from the time source to avoid surprise events during or

View file

@ -22,7 +22,7 @@ using System;
using System.Collections.Generic;
using System.Threading;
#if !XBOX360
#if !NO_SYSTEMEVENTS
using Microsoft.Win32;
#endif
@ -38,9 +38,9 @@ namespace Nuclex.Support.Scheduling {
/// <summary>Initializes a new Windows time source</summary>
public WindowsTimeSource() {
#if XBOX360
#if NO_SYSTEMEVENTS
throw new InvalidOperationException(
"Windows time source is not available on the XBox 360"
"Windows time source is not available without the SystemEvents class"
);
#else
this.onDateTimeAdjustedDelegate = new EventHandler(OnDateTimeAdjusted);
@ -50,8 +50,8 @@ namespace Nuclex.Support.Scheduling {
/// <summary>Immediately releases all resources owned by the instance</summary>
public void Dispose() {
#if !XBOX360
if(this.onDateTimeAdjustedDelegate != null) {
#if !NO_SYSTEMEVENTS
if (this.onDateTimeAdjustedDelegate != null) {
SystemEvents.TimeChanged -= this.onDateTimeAdjustedDelegate;
this.onDateTimeAdjustedDelegate = null;
}
@ -67,7 +67,7 @@ namespace Nuclex.Support.Scheduling {
public override bool WaitOne(AutoResetEvent waitHandle, long ticks) {
#if XNA_3
return waitHandle.WaitOne((int)(ticks / TicksPerMillisecond), false);
#elif XBOX360
#elif XBOX360 || WINDOWS_PHONE
return waitHandle.WaitOne((int)(ticks / TicksPerMillisecond));
#else
return waitHandle.WaitOne((int)(ticks / TicksPerMillisecond), false);
@ -81,7 +81,7 @@ namespace Nuclex.Support.Scheduling {
get { return Environment.OSVersion.Platform == PlatformID.Win32NT; }
}
#if !XBOX360
#if !NO_SYSTEMEVENTS
/// <summary>Delegate for the timeChanged() callback method</summary>
private EventHandler onDateTimeAdjustedDelegate;