I've looked around google cause i need to mutithread as my program lags whenever it attempts to load a gif and load a usercontrol at the same time. Rather, the gif hangs and the the page suddenly shows my usercontrol without any transition. Ok How the program is supposed to behave,
Show gif-->Load Usercontrol-->Hide Gif-->run animation(a Simple slide in effect)
But because of the lag when rendering the ui elements of the usercontrol, the program behaves like this
Show Gif -->Gif Hangs(or freezes) -->show Usercontrol immediately
So I found this thing called BackgroundWorker . Sounds great . Well ... not entirely. i tried it out and applied it to my codes like so
BackgroundWorker worker = new BackgroundWorker();
CrowdWatch_Portrait.CrowdWatch crowder;
//The page is a frame fyi
thePage.LoadCompleted += new LoadCompletedEventHandler(thePage_LoadCompleted);
worker.DoWork += delegate(object s, DoWorkEventArgs args)
{
crowder = new CrowdWatch_Portrait.CrowdWatch();
thePage.Content = crowder;
};
worker.RunWorkerAsync();
Sounds good. Ran it. Failed. It gave me this error
The calling thread must be STA, because many UI components require this.
So after researching online again , I couldn't find any scenario in which this class was used to load a usercontrol. So I turn to the community for help....help?