Merge pull request #2735 from xmcclure/early-lookup-addr
[mono.git] / mcs / class / WindowsBase / samples / dis.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using System.Windows.Threading;
5
6 class Class1 {
7     delegate void Action ();
8
9     static void Main ()
10     {
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");
16         };
17
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         });
34
35         Dispatcher.Run ();
36     }
37
38     static void mine ()
39     {
40         Console.WriteLine ("Mine");
41     }
42 }