, , , BackgroundWorker, . , , - , - SplashScreen . BackgroundWorker .
using System.ComponentModel.Component;
private BackgroundWorker newThread = new BackgroundWorker();
public void appForm_Load(object sender, EventArgs e) {
SplashForm sf = new SplashForm();
sf.Parent = this;
newThread.DoWork += new EventHandler(newThread_DoWork);
newThread.RunWorkerAsync();
sf.ShowDialog();
}
public void newThread_DoWork(object sender, DoWorkEventArgs e) {
}
. , , , . ProgressBar, SplashForm BackgroundWorker.ProgressChanged(). Dispose() SplashForm BackgroundWorker. BackgroundWorker.RunWorkerCompleted().
, SplashForm appForm_Load(), BackgroundWorker.RunWorkerCompleted() , .
This, in my opinion, is humbly, the most efficient and easiest way to do multithreading. BackgroundWorker is very convenient for programmers, without worrying about blocking, delegation, calls and callbacks.
The .NET Framework 4 should have many tools to facilitate multithreading: Threadsafe collections, parallel LINQs, etc.
source
share