This repository has been archived by the owner on Apr 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
AddressBookController.xib.cs
75 lines (67 loc) · 1.94 KB
/
AddressBookController.xib.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.AddressBookUI;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace MonoCatalog
{
public partial class AddressBookController : UIViewController
{
ABPeoplePickerNavigationController p;
public AddressBookController () : base ("AddressBookController", null)
{
}
protected override void Dispose (bool disposing)
{
if (p != null) {
p.Dispose ();
p = null;
}
base.Dispose (disposing);
}
ABPeoplePickerNavigationController GetPicker ()
{
if (p != null)
return p;
p = new ABPeoplePickerNavigationController ();
p.SelectPerson += (o, e) => {
Console.Error.WriteLine ("# select Person: {0}", e.Person);
toString.Text = e.Person.ToString ();
firstName.Text = e.Person.FirstName;
lastName.Text = e.Person.LastName;
property.Text = "";
identifier.Text = "";
e.Continue = selectProperty.On;
if (!e.Continue)
DismissModalViewControllerAnimated (true);
};
p.PerformAction += (o, e) => {
Console.Error.WriteLine ("# perform action; person={0}", e.Person);
toString.Text = e.Person.ToString ();
firstName.Text = e.Person.FirstName;
lastName.Text = e.Person.LastName;
property.Text = e.Property.ToString ();
identifier.Text = e.Identifier.HasValue ? e.Identifier.ToString () : "";
e.Continue = performAction.On;
if (!e.Continue)
DismissModalViewControllerAnimated (true);
};
p.Cancelled += (o, e) => {
Console.Error.WriteLine ("# select Person cancelled.");
toString.Text = "Cancelled";
firstName.Text = "";
lastName.Text = "";
property.Text = "";
identifier.Text = "";
DismissModalViewControllerAnimated (true);
};
return p;
}
partial void showPicker (MonoTouch.UIKit.UIButton sender)
{
Console.Error.WriteLine ("# Select Contacts pushed!");
PresentModalViewController (GetPicker (), true);
}
}
}