I'm writing a Toast that needs to be thread-safe as it's being used to report the status of asynchronous socket input. I've tried to make it thread-safe but the toasts are still locking up.
public static void Show( string message ) {
Toast toast = new Toast( message );
toast.ShowAction();
}
private delegate void InvokeCallback();
public void ShowAction() {
if ( InvokeRequired ) {
Invoke( new InvokeCallback( ShowAction ) );
}
else {
Show();
}
}
I want to be able to display them easily like a message box, i.e. Toast.Show("Status changed");
. Any help would be greatly appreciated.