May not help, but you can just do this:
public void HideProgressIndicator()
{
if (this.progressHUD != null)
{
if (!NSThread.Current.IsMainThread)
this.InvokeOnMainThread(()=>{
this.progressHUD.Hide(true);
});
else
this.progressHUD.Hide(true);
}
}
Dino
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of technohead
Sent: Tuesday, October 09, 2012 15:54
To: [email protected]
Subject: [MonoTouch] InvokeOnMainThread hanging
Hi guys,
I am seeing a problem where calling InvokeOnMainThread is hanging in certain
parts of the code. I thought maybe the problem might be because the code is
already running on the main thread, but based on the following code, it wasn't.
The code is hanging on the InvokeOnMainThread and execution never hits the
this.progressHUD.Hide(true) line. Any ideas why this might be the case?
thanks,
Dennis
public void HideProgressIndicator()
{
if (this.progressHUD != null)
{
if (!IsMainThread())
this.InvokeOnMainThread(()=>{
this.progressHUD.Hide(true);
});
else
this.progressHUD.Hide(true);
}
}
protected static bool IsMainThread() {
return Messaging.bool_objc_msgSend(GetClassHandle("NSThread"),
new Selector("isMainThread").Handle);
}
protected static IntPtr GetClassHandle (string clsName)
{
return (new Class(clsName)).Handle;
}
--
View this message in context:
http://monotouch.2284126.n4.nabble.com/InvokeOnMainThread-hanging-tp4657446.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch