Forum Post: Re: How To Deal With The Background Tread In .net And Raise The Event In The...

  • Thread starter Thread starter Mike Fechner
  • Start date Start date
Status
Not open for further replies.
M

Mike Fechner

Guest
You're willing to build your own C# assembly? Because it requires .NET code. A .NET Control is able to raise an event from a background thread in the UI thread. Code looks like this, in a class inheriting from Control. This code will raise the event from the foreground thread when already running there and switch to the foreground thread if required - in the ABL you put that Control on a Form (might be a very small Control): protected void OnDataAvailable (EventArgs e) { if (this.InvokeRequired) this.BeginInvoke(new Action (OnDataAvailable), new[] { e }); else this.DataAvailable(this, e); }

Continue reading...
 
Status
Not open for further replies.
Back
Top