public bool Remove(ABPersonProperty item)
        {
            var dp = g();

            if (dp == null)
            {
                return(false);
            }
            var  id     = ABPersonPropertyId.ToId(item);
            var  values = new List <NSNumber> (dp);
            bool found  = false;

            for (int i = values.Count - 1; i >= 0; --i)
            {
                if (values [i].Int32Value == id)
                {
                    values.RemoveAt(i);
                    found = true;
                }
            }
            if (found)
            {
                s(values.ToArray());
            }
            return(true);
        }
Ejemplo n.º 2
0
        static InitConstants()
        {
            // ensure we can init. This is needed before iOS6 (as per doc).
            IntPtr p = ABAddressBook.ABAddressBookCreate();

            ABGroupProperty.Init();
            ABLabel.Init();
            ABPersonAddressKey.Init();
            ABPersonDateLabel.Init();
            ABPersonInstantMessageKey.Init();
            ABPersonInstantMessageService.Init();
            ABPersonKindId.Init();
            ABPersonPhoneLabel.Init();
            ABPersonPropertyId.Init();
            ABPersonRelatedNamesLabel.Init();
            ABPersonUrlLabel.Init();
            ABSourcePropertyId.Init();

            // From iOS 6.0+ this might return NULL, e.g. if the application is not authorized to access the
            // address book, and we would crash if we tried to release a null pointer
            if (p != IntPtr.Zero)
            {
                CFObject.CFRelease(p);
            }
        }
        public IEnumerator <ABPersonProperty> GetEnumerator()
        {
            var values = g();

            for (int i = 0; i < values.Length; ++i)
            {
                yield return(ABPersonPropertyId.ToPersonProperty(values [i].Int32Value));
            }
        }
Ejemplo n.º 4
0
        public override void DidSelectPerson(ABPeoplePickerNavigationController peoplePicker, ABPerson selectedPerson, int propertyId, int identifier)
        {
            ABPersonProperty property = ABPersonPropertyId.ToPersonProperty(propertyId);
            int?id = identifier == ABRecord.InvalidPropertyId ? null : (int?)identifier;

            var e = new ABPeoplePickerPerformAction2EventArgs(selectedPerson, property, id);

            peoplePicker.OnPerformAction2(e);
        }
		public override bool ShouldPerformDefaultActionForPerson (ABPersonViewController personViewController, ABPerson person, int propertyId, int identifier)
		{
			ABPersonProperty property = ABPersonPropertyId.ToPersonProperty (propertyId);
			int? id = identifier == ABRecord.InvalidPropertyId ? null : (int?) identifier;
			
			var e = new ABPersonViewPerformDefaultActionEventArgs (person, property, id);
			personViewController.OnPerformDefaultAction (e);
			return e.ShouldPerformDefaultAction;
		}
Ejemplo n.º 6
0
        public override bool ShouldContinue(ABPeoplePickerNavigationController peoplePicker, IntPtr selectedPerson, int propertyId, int identifier)
        {
            ABPerson         person   = selectedPerson == IntPtr.Zero ? null : new ABPerson(selectedPerson, peoplePicker.AddressBook);
            ABPersonProperty property = ABPersonPropertyId.ToPersonProperty(propertyId);
            int?id = identifier == ABRecord.InvalidPropertyId ? null : (int?)identifier;

            var e = new ABPeoplePickerPerformActionEventArgs(person, property, id);

            peoplePicker.OnPerformAction(e);
            return(e.Continue);
        }
        public override bool ShouldPerformDefaultActionForPerson(ABUnknownPersonViewController personViewController, IntPtr personId, int propertyId, int identifier)
        {
            ABPerson person = personId == IntPtr.Zero ? null : new ABPerson(personId, personViewController.AddressBook);
#endif
            ABPersonProperty property = ABPersonPropertyId.ToPersonProperty(propertyId);
            int?id = identifier == ABRecord.InvalidPropertyId ? null : (int?)identifier;

            var e = new ABPersonViewPerformDefaultActionEventArgs(person, property, id);
            personViewController.OnPerformDefaultAction(e);
            return(e.ShouldPerformDefaultAction);
        }
        public void Add(ABPersonProperty item)
        {
            List <NSNumber> values;
            var             dp = g();

            if (dp != null)
            {
                values = new List <NSNumber> (dp);
            }
            else
            {
                values = new List <NSNumber> ();
            }
            values.Add(new NSNumber(ABPersonPropertyId.ToId(item)));
            s(values.ToArray());
        }
        public bool Contains(ABPersonProperty item)
        {
            int id     = ABPersonPropertyId.ToId(item);
            var values = g();

            if (values == null)
            {
                return(false);
            }

            for (int i = 0; i < values.Length; ++i)
            {
                if (values [i].Int32Value == id)
                {
                    return(true);
                }
            }
            return(false);
        }
		public void SetHighlightedProperty (ABPersonProperty property)
		{
			SetHighlightedItemForProperty (
					ABPersonPropertyId.ToId (property),
					ABRecord.InvalidPropertyId);
		}
		public void SetHighlightedItemForProperty (ABPersonProperty property, int? identifier)
		{
			SetHighlightedItemForProperty (
					ABPersonPropertyId.ToId (property),
					identifier ?? ABRecord.InvalidPropertyId);
		}