main
1using System;
2using System.Threading;
3
4namespace jive
5{
6 public interface ISynchronizedCommand : Command<Action>, Command<Command> {}
7
8 public class SynchronizedCommand : ISynchronizedCommand
9 {
10 readonly SynchronizationContext context;
11
12 public SynchronizedCommand(SynchronizationContext context)
13 {
14 this.context = context;
15 }
16
17 public void run(Action item)
18 {
19 context.Post(x => item(), new object());
20 }
21
22 public void run(Command item)
23 {
24 run(item.run);
25 }
26 }
27}