I've been working on this simple use of the Progress Dialog. I have everything working, and then it hit me that I am not using RunOnUIThread. My code is below. I put in RunOnUIThread in several places and it still works as I would think it would. Is there something magical about the Progress Dialog not needing the RunOnUIThread to be sprinkled in?
ProgressDialog progressDialog; protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it Button button = FindViewById<Button>(Resource.Id.MyButton); button.Click += delegate { progressDialog = new ProgressDialog(this); progressDialog.SetProgressStyle(ProgressDialogStyle.Horizontal); progressDialog.SetMessage("Loading..."); progressDialog.SetCancelable(true); progressDialog.Show(); System.Threading.ThreadPool.QueueUserWorkItem( new System.Threading.WaitCallback(ProgressProcess)); }; } private void ProgressProcess(object state) { while (progressDialog.Progress < 100) { RunOnUiThread(delegate{ progressDialog.IncrementProgressBy(1); }); System.Threading.Thread.Sleep(50); } RunOnUiThread(delegate { progressDialog.Dismiss(); }); }
_______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid