Hi Asha,
Here is a briefly explained way of doing it:
private void OnSpaceStatusChecked ( object sender, EventArgsEndpointStatus e )
{
Thread newThread = new Thread(DoYourBackgroundWork);
newThread.IsBackground = true;
newThread.Start(param);
}
private void DoYourBackgroundWork(object obj)
{
this.Invoke(new MethodInvoker(UpdateTheUIs));
}
private void UpdateTheUIs()
{
}
UPDATE:
Comment from OP:
Not possible because mine is web application..
Well there is another solution by using Delegates.
Declare a delegate
after before the class declaration:
public delegate void UpdateUI(object params);
UpdateUI update;
private void OnSpaceStatusChecked ( object sender, EventArgsEndpointStatus e )
{
update = UpdateTheUIs;
Thread newThread = new Thread(DoYourBackgroundWork);
newThread.IsBackground = true;
newThread.Start(param);
}
private void DoYourBackgroundWork(object obj)
{
this.Dispatcher.Invoke(update , obj);
}
private void UpdateTheUIs(object param)
{
}
UPDATE 2:
Oops, I forgot that its silverlight. :doh:
Just replace
this.Invoke
with
this.Dispatcher.Invoke
I have updated the answer accordingly.
Hope its clear now.