void insertPeople(int numberOfPeople) { hud = new MBProgressHUD(); hud.Show(true); NameGenerator.GetPeopleAsync(numberOfPeople).ContinueWith(t=>{ if(t.Exception == null){ Database.Main.InsertPeople(t.Result).ContinueWith(t2 =>{ Database.Main.UpdateInstant<Person>(); this.BeginInvokeOnMainThread(delegate{ if(t2.Exception != null){ Console.WriteLine(t2.Exception); (new UIAlertView("Error", "There was an error inserting people.",null,"Ok")).Show(); } hud.Hide(true); }); }); } else { Console.WriteLine(t.Exception); this.BeginInvokeOnMainThread(delegate{ (new UIAlertView("Error", "There was an error generating names.",null,"Ok")).Show(); hud.Hide(true); }); } }); }
void Picked(UIImage image) { if(image == null) { completed(); return; } Console.WriteLine(image.Orientation); savingMessage = new MBProgressHUD(); savingMessage.TitleText = "Saving"; savingMessage.Show(true); selectedImage = image; Thread thread = new Thread(save); thread.Start(); }