Rev | Line | |
---|
[3227] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.ComponentModel;
|
---|
| 4 | using System.Drawing;
|
---|
| 5 | using System.Data;
|
---|
| 6 | using System.Linq;
|
---|
| 7 | using System.Text;
|
---|
| 8 | using System.Windows.Forms;
|
---|
| 9 | using System.Threading;
|
---|
| 10 |
|
---|
| 11 | namespace HeuristicLab.MainForm.WindowsForms {
|
---|
| 12 | public partial class AsynchronousContentView : ContentView {
|
---|
| 13 | public AsynchronousContentView() {
|
---|
| 14 | InitializeComponent();
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | public AsynchronousContentView(object content)
|
---|
| 18 | : this() {
|
---|
| 19 | this.Content = content;
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | /// <summary>
|
---|
| 23 | /// Asynchron call of GUI updating.
|
---|
| 24 | /// </summary>
|
---|
| 25 | /// <param name="method">The delegate to invoke.</param>
|
---|
| 26 | protected new void Invoke(Delegate method) {
|
---|
| 27 | IAsyncResult res = base.BeginInvoke(method);
|
---|
| 28 | ThreadPool.RegisterWaitForSingleObject(res.AsyncWaitHandle,
|
---|
| 29 | new WaitOrTimerCallback((x, b) => { EndInvoke(res); }),
|
---|
| 30 | null, -1, true);
|
---|
| 31 | }
|
---|
| 32 | /// <summary>
|
---|
| 33 | /// Asynchron call of GUI updating.
|
---|
| 34 | /// </summary>
|
---|
| 35 | /// <param name="method">The delegate to invoke.</param>
|
---|
| 36 | /// <param name="args">The invoke arguments.</param>
|
---|
| 37 | protected new void Invoke(Delegate method, params object[] args) {
|
---|
| 38 | IAsyncResult res = base.BeginInvoke(method, args);
|
---|
| 39 | ThreadPool.RegisterWaitForSingleObject(res.AsyncWaitHandle,
|
---|
| 40 | new WaitOrTimerCallback((x, b) => { EndInvoke(res); }),
|
---|
| 41 | null, -1, true);
|
---|
| 42 | }
|
---|
| 43 | }
|
---|
| 44 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.