2010-06-03 Jb Evain <jbevain@novell.com>
[mcs.git] / class / WindowsBase / samples / dis.cs
blobd2825a9fd9e73f9cd5d1503772a94f65a0cdbd65
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using System.Windows.Threading;
6 class Class1 {
7 delegate void Action ();
9 static void Main ()
11 Dispatcher d = Dispatcher.CurrentDispatcher;
12 Action a = delegate {
13 object x = d;
14 d.Invoke (DispatcherPriority.Normal, new Action (mine));
15 Console.WriteLine ("Task");
18 d.BeginInvoke (DispatcherPriority.Normal, (Action) delegate {
19 Console.WriteLine ("First");
20 });
21 d.BeginInvoke (DispatcherPriority.Normal, (Action) delegate {
22 Console.WriteLine ("Second");
23 d.InvokeShutdown ();
24 });
25 d.BeginInvoke (DispatcherPriority.Send, (Action) delegate {
26 Console.WriteLine ("High Priority");
27 d.BeginInvoke (DispatcherPriority.Send, (Action) delegate {
28 Console.WriteLine ("INSERTED");
29 });
30 });
31 d.BeginInvoke (DispatcherPriority.SystemIdle, (Action) delegate {
32 Console.WriteLine ("Idle");
33 });
35 Dispatcher.Run ();
38 static void mine ()
40 Console.WriteLine ("Mine");