It's UI, therefore do it in the main thread :)
public ButtonClickEvent()
> {
> ServiceClass.DoAsyncTask(delegate(RestResponse arg1,
> RestRequestAsyncHandle arg2) {
var o = new NSObject();
o.InvokeOnMainThread(delegate {
> var message = new UIAlertView(Constants.AppTitle,
> arg1.ResponseStatus.ToString(), null, "OK");
> message.Show();
});
> });
> }
> }
On Wed, Apr 18, 2012 at 14:09, bustergonad <[email protected]> wrote:
> Hi,
>
> I'm sure someone else must have hit this issue. Say you have a background
> task (or aysnc web service call) that is invoked from within an
> UIViewController - you start the process and let the user carry on using the
> app eg. if the app has a tab bar, the user can then select another
> UIViewController.
>
> Now, what if on that initial invoke of the background task you setup has a
> delegate handler on the response to handle any progress/error messages. If
> you need to display that message via an UIAlertView, how do you always
> display it on top (in front of) the current active controller.
>
> eg.
>
> FirstViewController extract:
>
> public ButtonClickEvent()
> {
> ServiceClass.DoAsyncTask(delegate(RestResponse arg1,
> RestRequestAsyncHandle arg2) {
> var message = new UIAlertView(Constants.AppTitle,
> arg1.ResponseStatus.ToString(), null, "OK");
> message.Show();
> });
> }
> }
>
> If the user has moved away from FirstViewController, the "message.Show();"
> fires, but is not displayed (I think because it's now hidden in the
> background, as the current view dims slightly). Do I need to bring the
> original FirstViewController to front before calling "message.Show();" or
> something?!
>
> Any tips, much appreciated!
>
> --
> View this message in context:
> http://monotouch.2284126.n4.nabble.com/Displaying-UIViewAlert-to-the-user-from-background-tasks-tp4567660p4567660.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch
--
Nic Wise
t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/
Earnest: Self-employed? Track your business expenses and income.
http://earnestapp.com
Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch