You really need to give more details about your problem. I could be completely wrong, but I will take a picture in the dark. From what I present, what happens is, and you want, you want the splash screen to display, do some processing on another thread, then the splash screen leaves when it is done.
To do this, you will need to move the GetFromServer() call to BackgroundWorker . Then move
this.Hide(); _serverData = new ArrayList(); _thisData.Add(_allServerNarrators); _thisData.Add(_serverNarrators);
for the BackgroundWorker_RunWorkerCompleted event handler.
To use BackgroundWorker :
1) Initialize BackgroundWorker
BackgroundWorker myWorker = new BackgroundWorker();
2) Add event handlers
myWorker.DoWork += new DoWorkEventHandler(myWorker_DoWork); //put the work you want done in this one myWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(myWorker_RunWorkerCompleted); //this gets fired when the work is finished
3) Add code to event handlers.
4) Start myWorker.RunWorkerAsync() to get started.
As a separate note, you don't seem to be doing anything with the ArrayList that you pass to the splash screen constructor. Is this intended?
lc. Dec 25 '08 at 15:50 2008-12-25 15:50
source share