Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/AsynchronousContentView.cs @ 3239

Last change on this file since 3239 was 3229, checked in by mkommend, 14 years ago

corrected type in XML doc of AsynchronousContentView (ticket #953)

File size: 1.4 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Drawing;
5using System.Data;
6using System.Linq;
7using System.Text;
8using System.Windows.Forms;
9using System.Threading;
10
11namespace 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    /// Asynchronous 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    /// Asynchronous 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.