[MonoTouch] NetworkActivityIndicatorVisible with MonoTouch.Dialog

Dean Cleaver dean.cleaver at xceptionsoftware.com
Fri Mar 2 19:36:36 UTC 2012


2 ideas.... I've seen problems when executing code on the UI thread right after a call to a UI element (also check that you are calling this on the main/UI thread).

#1
UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
StyledStringElement btnLogin = new StyledStringElement("Login", delegate { DoLogin(); });

public void DoLogin()
{
  try {
    ... do work
  }
  finally {
    UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
  }
}

#2

StyledStringElement btnLogin = new StyledStringElement("Login", delegate { DoLogin(); });

public void DoLogin()
{
  UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
  NSRunLoop.Current.RunUntil(DateTime.Now.AddMilliseconds(1));
  try {
    ... do work
  }
  finally {
    UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
  }
}

Dino

-----Original Message-----
From: monotouch-bounces at lists.ximian.com [mailto:monotouch-bounces at lists.ximian.com] On Behalf Of danmiser
Sent: Friday, March 02, 2012 11:20 AM
To: monotouch at lists.ximian.com
Subject: [MonoTouch] NetworkActivityIndicatorVisible with MonoTouch.Dialog

Has anyone got the NetworkActivityIndicatorVisible to work on the device while using MonoTouch.Dialog?

I create a button like this:

StyledStringElement btnLogin = new StyledStringElement("Login", delegate { DoLogin(); });

When I click the button it does take me to this method:
public void DoLogin()
{
  UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
  try {
    ... do work
  }
  finally {
    UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
  }
}

The spinning indicator doesn't show up. I've tried while debugging and tethered via USB, and also by just running the app with a wifi connection.

I'm using MT 5.2.

Anyone seeing the same thing? Anything look obviously wrong?

Thanks

--
View this message in context: http://monotouch.2284126.n4.nabble.com/NetworkActivityIndicatorVisible-with-MonoTouch-Dialog-tp4439142p4439142.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
MonoTouch at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch


More information about the MonoTouch mailing list