public override void ViewDidLoad() { base.ViewDidLoad(); SaveButton.TouchUpInside += (sender, e) => { current.Name = NameText.Text; current.Notes = NotesText.Text; current.Done = DoneSwitch.On; current.For = ForText.Text; // includes CoreSpotlight indexing! Delegate.SaveTodo(current); UIAccessibility.PostNotification(UIAccessibilityPostNotification.Announcement, new NSString(@"Item was saved")); NavigationController.PopViewController(true); }; CancelButton.TouchUpInside += (sender, e) => { if (Delegate != null) { Delegate.DeleteTodo(current); // also CoreSpotlight UIAccessibility.PostNotification(UIAccessibilityPostNotification.Announcement, new NSString(@"Item was deleted")); } else // HACK: TODO: { Console.WriteLine("Delegate not set - HACK"); } NavigationController.PopViewController(true); }; #region iOS 9 Contacts contacts = new ContactHelper(current); UITapGestureRecognizer forTextTap = new UITapGestureRecognizer(() => { PresentViewController(contacts.GetPicker(), true, null); }); ForText.AddGestureRecognizer(forTextTap); ForText.UserInteractionEnabled = true; #endregion NameText.TextAlignment = UITextAlignment.Natural; NotesText.TextAlignment = UITextAlignment.Natural; UserActivity = UserActivityHelper.CreateNSUserActivity(current ?? new TodoItem()); }
public ContactPickerDelegate(ContactHelper helper) { this.helper = helper; }