Пример #1
0
        private async void Model_AddedNew(object sender, AddedNewEventArgs <Friend> e)
        {
            // TODO : Invoke a platform specific contact picker here.
            ContactInfo contact = await DependencyService.Get <IContactPicker>().GetSelectedContactInfo();

            if (contact == null)
            {
                //Do nothing, user must have cancelled.
            }
            else
            {
                // contact
                // TODO : Add a friend view model of some sort for use in display.

                e.NewObject.ContactId = contact.Id;
                OnPropertyChanged("Model");
            }
        }
Пример #2
0
        private async void Model_AddedNew(object sender, AddedNewEventArgs <Friend> e)
        {
            if (!_adding)
            {
                _adding = true;
                PrepareToShowModal();
                ContactInfo contact = await DependencyService.Get <IContactPicker>().GetSelectedContactInfo();

                if (contact == null)
                {
                    Model.Remove(e.NewObject);
                }
                else
                {
                    e.NewObject.ContactId = contact.Id;
                    List.Add(new FriendInfo(contact));
                }
                _adding = false;
            }
        }