Example #1
0
        private async void AddClick(object sender, EventArgs e)
        {
            var item = new UsersForDomesticas();

            MessagingCenter.Subscribe <UsersForDomesticas>(this, "domesticasDataAdd", async(value) =>
            {
                if (value != null)
                {
                    value.domesticas.domesticaID = utilities.Utilities.RandomString(20);
                    value.domesticas.familyID    = familyTabPageViewModel.family.fid;
                    familyTabPageViewModel.family.addDomesticas(value.domesticas);
                    familyTabPageViewModel.addUsersForDomesticas(value);
                    await familyRepository.AddAsync(familyTabPageViewModel.family);
                    await DisplayAlert("Compito famigliare", "Compito famigliare aggiunto correttamente", "OK");
                    lblNoDomestica.IsVisible = false;
                    lstDomesticas.IsVisible  = true;
                    await Device.InvokeOnMainThreadAsync(async() => { lstDomesticas.ItemsSource = familyTabPageViewModel.usersForDomesticas; });
                    MessagingCenter.Unsubscribe <UsersForDomesticas>(this, "domesticasDataAdd");
                }
            });
            if (((ImageButton)sender).ClassId.Equals("btnAdd"))
            {
                await PopupNavigation.Instance.PushAsync(new DomesticasPopup(familyTabPageViewModel, false, null), true);
            }
            else
            {
                await DisplayAlert("Compito famigliare", "Il compito famigliare selezionato รจ associato ad un altro utente. Operazione non completabile", "OK");
            }
        }
Example #2
0
        public async void LeaveClick(object sender, EventArgs e)
        {
            familyTabPageViewModel.family.removeMember(familyTabPageViewModel.user.uid);
            familyTabPageViewModel.user.familyId = null;
            await familyRepository.AddAsync(familyTabPageViewModel.family);

            await userRepository.AddAsync(familyTabPageViewModel.user);

            GoInAddMode();
            await Device.InvokeOnMainThreadAsync(async() => { lstUsers.ItemsSource = familyTabPageViewModel.members; });

            await Device.InvokeOnMainThreadAsync(async() => { familyNameEntry.Text = ""; });

            await DisplayAlert("La tua famiglia", "Sei uscito correttamente dalla famiglia", "OK");

            Parent.BindingContext = familyTabPageViewModel;
        }