Put your work off on its own thread.
MCActivityView.Start();
ThreadPool.QueueUserWorkItem(delegate {
// Do heavy operation here
InvokeOnMainThread(delegate {
MCActivityView.Stop();
});
});
On Mon, Dec 10, 2012 at 9:10 AM, Guido Van Hoecke <[email protected]> wrote:
> Good Evening to All,
>
> I have this little static utility class:
>
> using System;
> using MonoTouch.Foundation;
> using MonoTouch.UIKit;
>
> namespace ZzLib
> {
> public class MCActivityView : UIAlertView
> {
> private static System.Drawing.RectangleF _frame =
> new System.Drawing.Rectangle(128,64,48,48);
>
> private MCActivityView(string title)
> : base()
> {
> Frame = _frame;
> Title = "Please wait";
> Show ();
> }
>
> private static UIAlertView _av;
>
> public static void Start() {
> _av = new MCActivityView();
> }
>
> public static void Stop() {
> if (_av != null) {
> _av.DismissWithClickedButtonIndex(0, true);
> _av = null;
> }
> }
>
> }
> }
>
> Before a lengthy operation I call
>
> MCActivityView.Start();
>
> and after the operation I call
>
> MCActivityView.Stop();
>
>
> Works fine. But rather than immediately displaying the alert, the screen
> gets shaded during some time and then only the alertView is shown.
>
> Most of the time, the tasks are not excessively long, so the're almost
> finished by the time the alertview appears.
>
> Is it possible to have the alertView appearing immediately (I don't
> really care whether the screen gets shades, but I do want the alertview
> to appear immediately.)
>
> Thanks in advance,
>
>
> Guido
>
> --
> Real computer scientists don't program in assembler. They don't write
> in anything less portable than a number two pencil.
>
> http://vanhoecke.org ... and go2 places!
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch
>
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch