public Task <EntryAlertResult> Show(string title, string message, string accepte, string cancel, bool isTextwindow = false) { var tcs = new TaskCompletionSource <EntryAlertResult>(); UIApplication.SharedApplication.InvokeOnMainThread(() => { var alert = new UIAlertView(title, message, null, cancel, new[] { accepte }); if (isTextwindow) { alert.AlertViewStyle = UIAlertViewStyle.SecureTextInput; } else { alert.AlertViewStyle = UIAlertViewStyle.PlainTextInput; } alert.Clicked += (sender, e) => tcs.SetResult(new EntryAlertResult { PressedButtonTitle = alert.ButtonTitle(e.ButtonIndex), Text = alert.GetTextField(0).Text }); alert.Show(); }); return(tcs.Task); }
public void ButtonTitle() { string text = Guid.NewGuid().ToString("N"); var alertView = new UIAlertView(); alertView.AddButton(text); Assert.AreEqual(text, alertView.ButtonTitle(0)); }