Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
2007-01-25 Miguel de Icaza <miguel@novell.com>
* DispatcherTimer.cs: Add new class.
* Dispatcher.cs (ExitAllframes): Implement.
(everywhere): Add support for hooks.
* DispatcherHooks: Implement
* DispatcherOperation.cs: Store result.
* Dispatcher.cs:
Check frame.Continue for early termination.
PokableQueue: new class used so we can move DispatcherOperation
tasks from one thread to another.
2007-01-24 Miguel de Icaza <miguel@novell.com>
* Dispatcher.cs: Implement reprioritization.
We now take locks instead of using a separate async queue, as
things like DispatcherOperation.Priority (reprioritization) can be
called from a separate thread without crashing.
2007-01-23 Miguel de Icaza <miguel@novell.com>
* Dispatcher.cs: Start with the Async methods.
2007-01-20 Miguel de Icaza <miguel@novell.com>
* Dispatcher.cs: Move all tasks, not only the first one from the
async queue into the proper priority queues.
Eliminate the `Task' class, it is mostly redundant, instead move
all the data into DispatcherOperation.
* DispatcherOperation.cs, DispatcherOperationStatus.cs: Add new
files.
* Dispatcher.cs: Make our class `Task' internal, so we can pass
that to DispatcherOperation.
* Dispatcher.cs: Queue will now queue
locally (if same thread) or post to the dispatcher queue if
invoked from a different thread.
2007-01-13 Miguel de Icaza <miguel@novell.com>
* Dispatcher.cs: Initially I thought this
was a stroke of genius. Looking at the actual results, it does
not seem as brilliant as I had hoped.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,43 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
using System;
namespace System.Windows.Threading {
public class DispatcherEventArgs : EventArgs
{
Dispatcher dispatcher;
internal DispatcherEventArgs (Dispatcher dispatcher)
{
this.dispatcher = dispatcher;
}
public Dispatcher Dispatcher {
get { return dispatcher; }
}
}
}

View File

@@ -0,0 +1,74 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Miguel de Icaza (miguel@novell.com)
using System;
using System.Collections;
using System.Collections.Generic;
using System.Security;
using System.Threading;
namespace System.Windows.Threading {
public class DispatcherFrame : DispatcherObject {
DispatcherFrame parent_frame;
internal bool exit_on_request;
bool cont;
internal Dispatcher dispatcher;
public DispatcherFrame ()
{
exit_on_request = true;
cont = true;
}
public DispatcherFrame (bool exitWhenRequested)
{
exit_on_request = exitWhenRequested;
cont = true;
}
public bool Continue {
get {
return cont;
}
[SecurityCritical]
set {
cont = value;
}
}
internal DispatcherFrame ParentFrame {
get {
return parent_frame;
}
set {
parent_frame = value;
}
}
}
}

View File

@@ -0,0 +1,49 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Miguel de Icaza (miguel@novell.com)
//
using System;
namespace System.Windows.Threading {
public sealed class DispatcherHookEventArgs : EventArgs {
DispatcherOperation operation;
public DispatcherHookEventArgs (DispatcherOperation operation)
{
this.operation = operation;
}
public Dispatcher Dispatcher {
get {
return operation.Dispatcher;
}
}
public DispatcherOperation Operation {
get {
return operation;
}
}
}
}

View File

@@ -0,0 +1,32 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Miguel de Icaza (miguel@novell.com)
//
using System;
namespace System.Windows.Threading {
public delegate void DispatcherHookEventHandler (object sender, DispatcherHookEventArgs e);
}

View File

@@ -0,0 +1,82 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Miguel de Icaza (miguel@novell.com)
//
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Threading;
namespace System.Windows.Threading {
public sealed class DispatcherHooks {
Dispatcher owner;
internal DispatcherHooks (Dispatcher owner)
{
this.owner = owner;
}
public event EventHandler DispatcherInactive;
public event DispatcherHookEventHandler OperationAborted;
public event DispatcherHookEventHandler OperationCompleted;
public event DispatcherHookEventHandler OperationPosted;
public event DispatcherHookEventHandler OperationPriorityChanged;
internal void EmitOperationPosted (DispatcherOperation op)
{
DispatcherHookEventHandler posted = OperationPosted;
if (posted != null)
posted (owner, new DispatcherHookEventArgs (op));
}
internal void EmitOperationCompleted (DispatcherOperation op)
{
DispatcherHookEventHandler completed = OperationCompleted;
if (completed != null)
completed (owner, new DispatcherHookEventArgs (op));
}
internal void EmitOperationAborted (DispatcherOperation op)
{
DispatcherHookEventHandler aborted = OperationAborted;
if (aborted != null)
aborted (owner, new DispatcherHookEventArgs (op));
}
internal void EmitOperationPriorityChanged (DispatcherOperation op)
{
DispatcherHookEventHandler prio = OperationPriorityChanged;
if (prio != null)
prio (owner, new DispatcherHookEventArgs (op));
}
internal void EmitInactive ()
{
EventHandler inactive = DispatcherInactive;
if (inactive != null)
inactive (owner, EventArgs.Empty);
}
}
}

View File

@@ -0,0 +1,59 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Miguel de Icaza (miguel@novell.com)
//
using System;
using System.ComponentModel;
using System.Threading;
namespace System.Windows.Threading {
public abstract class DispatcherObject {
Thread base_thread;
protected DispatcherObject ()
{
base_thread = Thread.CurrentThread;
}
[EditorBrowsable (EditorBrowsableState.Never)]
public bool CheckAccess ()
{
return Thread.CurrentThread == base_thread;
}
[EditorBrowsable (EditorBrowsableState.Never)]
public void VerifyAccess ()
{
throw new InvalidOperationException ("The calling thread is not the same as the creation thread");
}
[EditorBrowsable (EditorBrowsableState.Never)]
public Dispatcher Dispatcher {
get {
return Dispatcher.FromThread (base_thread);
}
}
}
}

View File

@@ -0,0 +1,149 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Miguel de Icaza (miguel@novell.com)
//
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Security;
using System.Threading;
namespace System.Windows.Threading {
public sealed class DispatcherOperation {
DispatcherOperationStatus status;
DispatcherPriority priority;
Dispatcher dispatcher;
object result;
Delegate delegate_method;
object [] delegate_args;
internal DispatcherOperation (Dispatcher dis, DispatcherPriority prio)
{
dispatcher = dis;
priority = prio;
if (Dispatcher.HasShutdownFinished)
status = DispatcherOperationStatus.Aborted;
else
status = DispatcherOperationStatus.Pending;
}
internal DispatcherOperation (Dispatcher dis, DispatcherPriority prio, Delegate d)
: this (dis, prio)
{
delegate_method = d;
}
internal DispatcherOperation (Dispatcher dis, DispatcherPriority prio, Delegate d, object arg)
: this (dis, prio)
{
delegate_method = d;
delegate_args = new object [1];
delegate_args [0] = arg;
}
internal DispatcherOperation (Dispatcher dis, DispatcherPriority prio, Delegate d, object arg, object [] args)
: this (dis, prio)
{
delegate_method = d;
delegate_args = new object [args.Length + 1];
delegate_args [0] = arg;
Array.Copy (args, 0, delegate_args, 1, args.Length);
}
internal void Invoke ()
{
status = DispatcherOperationStatus.Executing;
result = delegate_method.DynamicInvoke (delegate_args);
status = DispatcherOperationStatus.Completed;
if (Completed != null)
Completed (this, EventArgs.Empty);
}
public bool Abort ()
{
status = DispatcherOperationStatus.Aborted;
throw new NotImplementedException ();
}
public DispatcherOperationStatus Status {
get {
return status;
}
internal set {
status = value;
}
}
public Dispatcher Dispatcher {
get {
return dispatcher;
}
}
public DispatcherPriority Priority {
get {
return priority;
}
set {
if (priority != value){
DispatcherPriority old = priority;
priority = value;
dispatcher.Reprioritize (this, old);
}
}
}
public object Result {
get {
return result;
}
}
public DispatcherOperationStatus Wait ()
{
if (status == DispatcherOperationStatus.Executing)
throw new InvalidOperationException ("Already executing");
throw new NotImplementedException ();
}
[SecurityCritical]
public DispatcherOperationStatus Wait (TimeSpan timeout)
{
if (status == DispatcherOperationStatus.Executing)
throw new InvalidOperationException ("Already executing");
throw new NotImplementedException ();
}
public event EventHandler Aborted;
public event EventHandler Completed;
}
}

View File

@@ -0,0 +1,30 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
namespace System.Windows.Threading {
public delegate object DispatcherOperationCallback (object arg);
}

View File

@@ -0,0 +1,35 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Miguel de Icaza (miguel@novell.com)
//
namespace System.Windows.Threading {
public enum DispatcherOperationStatus {
Pending = 0,
Aborted = 1,
Completed = 2,
Executing = 3
}
}

View File

@@ -0,0 +1,47 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Miguel de Icaza (miguel@novell.com)
//
using System;
using System.Threading;
namespace System.Windows.Threading {
public enum DispatcherPriority {
Invalid = -1,
Inactive = 0,
SystemIdle = 1,
ApplicationIdle = 2,
ContextIdle = 3,
Background = 4,
Input = 5,
Loaded = 6,
Render = 7,
DataBind = 8,
Normal = 9,
Send = 10,
}
}

View File

@@ -0,0 +1,62 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
using System;
namespace System.Windows.Threading {
public struct DispatcherProcessingDisabled : IDisposable
{
internal DispatcherProcessingDisabled (int foo)
{
}
public void Dispose ()
{
throw new NotImplementedException ();
}
public override bool Equals (object obj)
{
throw new NotImplementedException ();
}
public override int GetHashCode ()
{
throw new NotImplementedException ();
}
public static bool operator != (DispatcherProcessingDisabled left, DispatcherProcessingDisabled right)
{
throw new NotImplementedException ();
}
public static bool operator == (DispatcherProcessingDisabled left, DispatcherProcessingDisabled right)
{
throw new NotImplementedException ();
}
}
}

View File

@@ -0,0 +1,66 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
using System;
using System.Security;
using System.Threading;
namespace System.Windows.Threading {
public sealed class DispatcherSynchronizationContext : SynchronizationContext
{
public DispatcherSynchronizationContext ()
{
throw new NotImplementedException ();
}
public DispatcherSynchronizationContext (Dispatcher dispatcher)
{
throw new NotImplementedException ();
}
public override SynchronizationContext CreateCopy ()
{
throw new NotImplementedException ();
}
public override void Post (SendOrPostCallback d, object state)
{
throw new NotImplementedException ();
}
public override void Send (SendOrPostCallback d, object state)
{
throw new NotImplementedException ();
}
[SecurityCritical]
public override int Wait (IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout)
{
throw new NotImplementedException ();
}
}
}

View File

@@ -0,0 +1,142 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Miguel de Icaza (miguel@novell.com)
//
using System;
using System.Collections;
using System.Threading;
namespace System.Windows.Threading {
public class DispatcherTimer {
DispatcherPriority priority;
Dispatcher target_dispatcher;
long interval;
EventHandler callback;
Timer timer;
object tag;
public DispatcherTimer ()
: this (DispatcherPriority.Background, Dispatcher.CurrentDispatcher)
{
}
public DispatcherTimer (DispatcherPriority priority)
: this (priority, Dispatcher.CurrentDispatcher)
{
}
public DispatcherTimer (DispatcherPriority priority, Dispatcher dispatcher)
: this (TimeSpan.Zero, priority, null, dispatcher)
{
}
public DispatcherTimer (TimeSpan interval, DispatcherPriority priority,
EventHandler callback, Dispatcher dispatcher)
{
this.priority = priority;
this.target_dispatcher = dispatcher;
this.interval = interval.Ticks;
this.callback = callback;
}
public void Start ()
{
if (timer == null){
long repeat_interval = interval;
if (repeat_interval == 0)
repeat_interval = 1;
timer = new Timer (new TimerCallback (timer_tick),
null, new TimeSpan (interval),
new TimeSpan (repeat_interval));
}
}
void timer_tick (object state)
{
target_dispatcher.BeginInvoke (priority, (ThreadStart) delegate {
EventHandler h = Tick;
if (h != null)
h (this, EventArgs.Empty);
if (callback != null)
callback (this, EventArgs.Empty);
});
}
public void Stop ()
{
if (timer == null)
return;
timer.Dispose ();
timer = null;
}
public Dispatcher Dispatcher {
get {
return target_dispatcher;
}
}
public TimeSpan Interval {
get {
return new TimeSpan (interval);
}
set {
if (interval == value.Ticks)
return;
interval = value.Ticks;
if (timer != null)
timer.Change (new TimeSpan (interval),
new TimeSpan (interval));
}
}
public bool IsEnabled {
get {
return timer != null;
}
set {
if (value && timer == null)
Start ();
if (value == false && timer != null)
Stop ();
}
}
public object Tag {
get {
return tag;
}
set {
tag = value;
}
}
public event EventHandler Tick;
}
}

View File

@@ -0,0 +1,51 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
using System;
namespace System.Windows.Threading {
public sealed class DispatcherUnhandledExceptionEventArgs : DispatcherEventArgs
{
Exception exception;
bool handled;
internal DispatcherUnhandledExceptionEventArgs (Dispatcher dispatcher,
Exception exception)
: base (dispatcher)
{
this.exception = exception;
}
public Exception Exception {
get { return exception; }
}
public bool Handled {
get { return handled; }
set { handled = value; }
}
}
}

View File

@@ -0,0 +1,30 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
namespace System.Windows.Threading {
public delegate void DispatcherUnhandledExceptionEventHandler (object sender,
DispatcherUnhandledExceptionEventArgs e);
}

View File

@@ -0,0 +1,52 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
using System;
namespace System.Windows.Threading {
public sealed class DispatcherUnhandledExceptionFilterEventArgs : DispatcherEventArgs
{
Exception exception;
bool requestCatch;
internal DispatcherUnhandledExceptionFilterEventArgs (Dispatcher dispatcher,
Exception exception)
: base (dispatcher)
{
this.exception = exception;
}
public Exception Exception {
get { return exception; }
}
public bool RequestCatch {
get { return requestCatch; }
set { requestCatch = value; }
}
}
}

View File

@@ -0,0 +1,33 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
using System;
namespace System.Windows.Threading {
public delegate void DispatcherUnhandledExceptionFilterEventHandler (object sender,
DispatcherUnhandledExceptionFilterEventArgs e);
}