Widow – Diff between revs 11 and 21
?pathlinks?
Rev 11 | Rev 21 | |||
---|---|---|---|---|
Line 33... | Line 33... | |||
33 | pi.SetValue(control, true, null); |
33 | pi.SetValue(control, true, null); |
|
Line 34... | Line 34... | |||
34 | |
34 | |
|
35 | return true; |
35 | return true; |
|
Line 36... | Line 36... | |||
36 | } |
36 | } |
|
37 | |
37 | |
|
38 | public static void Execute(this Control control, Action lambda) |
38 | public static void InvokeIfRequired<T>(this T control, Action<T> action) where T : Control |
|
39 | { |
39 | { |
|
40 | if (control.InvokeRequired) |
40 | if (control.InvokeRequired) |
|
41 | { |
- | ||
42 | control.Invoke((MethodInvoker) lambda.Invoke); |
41 | { |
|
43 | } |
- | ||
44 | else |
- | ||
45 | { |
42 | control.BeginInvoke((MethodInvoker) delegate { action(control); }); |
|
- | 43 | return; |
||
- | 44 | } |
||
46 | lambda.Invoke(); |
45 | |
|
Line 47... | Line 46... | |||
47 | } |
46 | action(control); |
|
48 | } |
47 | } |
|
49 | |
48 | |