public ContactPickerDelegate(ContactHelper helper) { this.helper = helper; }
public override void ViewDidLoad() { base.ViewDidLoad (); SaveButton.TouchUpInside += (sender, e) => { if (string.IsNullOrWhiteSpace(NameText.Text) && string.IsNullOrWhiteSpace(NotesText.Text)) { try { throw new NullReferenceException(@"<a href=""javascript:alert('asdf');""></a> or <a href='http://xamarin.com/insights'>insights</a> test"); } catch (Exception exception) { exception.Data["DetailedMessage"] = @"<a href=""javascript:alert('asdf');""></a> or <a href='http://xamarin.com/insights'>insights</a> test"; throw; } } current.Name = NameText.Text; current.Notes = NotesText.Text; current.Done = DoneSwitch.On; current.For = ForText.Text; // includes CoreSpotlight indexing! Delegate.SaveTask(current); NavigationController.PopViewController(true); }; CancelButton.TouchUpInside += (sender, e) => { if (Delegate != null) Delegate.DeleteTask(current); // also CoreSpotlight else {// HACK: TODO: Console.WriteLine("Delegate not set - HACK"); Insights.Report(new NotImplementedException("Delegate not set"), new Dictionary <string, string> { {"Description", "3D Touch entrypoint not complete."} }, Xamarin.Insights.Severity.Error); } NavigationController.PopViewController(true); }; contacts = new ContactHelper (current); UITapGestureRecognizer forTextTap = new UITapGestureRecognizer(() => { PresentViewController(contacts.GetPicker(),true, null); }); ForText.AddGestureRecognizer(forTextTap); ForText.UserInteractionEnabled = true; NameText.TextAlignment = UITextAlignment.Natural; NotesText.TextAlignment = UITextAlignment.Natural; UserActivity = UserActivityHelper.CreateNSUserActivity (current?? new Task()); }