annotate Implab.Fx/ControlBoundPromise.cs @ 239:eedf4d834e67 v2

fix
author cin
date Wed, 13 Dec 2017 19:54:45 +0300
parents 97fbbf816844
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
72
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
1 using System.Windows.Forms;
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
2 using System;
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
3
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
4
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
5 namespace Implab.Fx {
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
6 public class ControlBoundPromise<T> : Promise<T> {
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
7 readonly Control m_target;
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
8
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
9 public ControlBoundPromise(Control target) {
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
10 Safe.ArgumentNotNull(target, "target");
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
11
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
12 m_target = target;
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
13 }
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
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
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
18 else
156
97fbbf816844 Promises: SignalXXX methods merged into SignalHandler method.
cin
parents: 145
diff changeset
19 base.SignalHandler(handler, signal);
72
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
20 }
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
21 }
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
22 }
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
23