Mercurial > pub > ImplabNet
annotate Implab.Fx/ControlBoundPromise.cs @ 203:4d9830a9bbb8 v2
Added 'Fail' method to RunnableComponent which allows component to move from
Running to Failed state.
Added PollingComponent a timer based runnable component
More tests
Added FailPromise a thin class to wrap exceptions
Fixed error handling in SuccessPromise classes.
author | cin |
---|---|
date | Tue, 18 Oct 2016 17:49:54 +0300 |
parents | 97fbbf816844 |
children |
rev | line source |
---|---|
72 | 1 using System.Windows.Forms; |
2 using System; | |
3 | |
4 | |
5 namespace Implab.Fx { | |
6 public class ControlBoundPromise<T> : Promise<T> { | |
7 readonly Control m_target; | |
8 | |
9 public ControlBoundPromise(Control target) { | |
10 Safe.ArgumentNotNull(target, "target"); | |
11 | |
12 m_target = target; | |
13 } | |
14 | |
156
97fbbf816844
Promises: SignalXXX methods merged into SignalHandler method.
cin
parents:
145
diff
changeset
|
15 protected override void SignalHandler(HandlerDescriptor handler, int signal) { |
119
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
106
diff
changeset
|
16 if (m_target.InvokeRequired) |
156
97fbbf816844
Promises: SignalXXX methods merged into SignalHandler method.
cin
parents:
145
diff
changeset
|
17 m_target.BeginInvoke(new Action<Promise<T>.HandlerDescriptor, int>(base.SignalHandler), handler, signal); |
72 | 18 else |
156
97fbbf816844
Promises: SignalXXX methods merged into SignalHandler method.
cin
parents:
145
diff
changeset
|
19 base.SignalHandler(handler, signal); |
72 | 20 } |
21 } | |
22 } | |
23 |