public FriendListViewModel(FamilyRepository family, IContactPicker contactPicker)
        {
            _family        = family;
            _contactPicker = contactPicker;

            family.CurrentChild.Friends.ForEach(_ => Friends.Add(_));

            NewFriendCommand     = new Command(async() => await AddFriend());
            ChangeContactCommand = new Command <Friend>(async(_) => await ChangeContact(_));
            DeleteContactCommand = new Command <Friend>(DeleteContact);
        }
Exemplo n.º 2
0
        private void SwitchNameInputType()
        {
            if (lastContact != null)
            {
                nameEditText.Enabled = true;
                lastPicker           = null;
                lastContact          = null;
                UpdateButtons();
                return;
            }
            ShowChoiceDialog();

            UpdateButtons();
        }
Exemplo n.º 3
0
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            var picker = ContactPickers.All.SingleOrDefault(p => p.RequestCode == requestCode);

            if (picker == null)
            {
                base.OnActivityResult(requestCode, resultCode, data);
                lastPicker  = null;
                lastContact = null;
                return;
            }
            if (resultCode == Result.Canceled)
            {
                return;
            }
            lastContact = data
                          .GetByteArrayExtra(FriendPickerActivity.IntentExtraContactKey)
                          .FromBinary <Contact>();
            lastPicker           = picker;
            nameEditText.Text    = lastContact.Name;
            nameEditText.Enabled = false;
            UpdateButtons();
        }