示例#1
0
        private async void OnBindingContextChanged(object sender, EventArgs e)
        {
            familyTabPageViewModel = (FamilyTabPageViewModel)Parent.BindingContext;
            if (!string.IsNullOrEmpty(familyTabPageViewModel.user.familyId))
            {
                familyTabPageViewModel.family = await familyRepository.GetOneAsync(familyTabPageViewModel.user.familyId);
            }

            if (familyTabPageViewModel.family != null)
            {
                if (familyTabPageViewModel.family.toDoList != null && familyTabPageViewModel.family.toDoList.Count > 0 && ((List <UsersForDomesticas>)familyTabPageViewModel.usersForDomesticas).Count != familyTabPageViewModel.family.toDoList.Count)
                {
                    lblNoDomestica.IsVisible = false;
                    lstDomesticas.IsVisible  = true;
                    familyTabPageViewModel.usersForDomesticas = new List <UsersForDomesticas>();
                    foreach (Domesticas d in familyTabPageViewModel.family.toDoList)
                    {
                        familyTabPageViewModel.addUsersForDomesticas(new UsersForDomesticas(d, ((List <User>)familyTabPageViewModel.members).Find(use => use.uid.Equals(d.user))));
                    }
                }
                else if (familyTabPageViewModel.family.toDoList.Count == 0)
                {
                    lblNoDomestica.IsVisible = true;
                    lstDomesticas.IsVisible  = false;
                }
                await Device.InvokeOnMainThreadAsync(async() => { lstDomesticas.ItemsSource = familyTabPageViewModel.usersForDomesticas; });

                firstTime = false;
            }
        }
示例#2
0
        private async void OnAppearing(object sender, EventArgs e)
        {
            familyTabPageViewModel = new FamilyTabPageViewModel();

            if (string.IsNullOrEmpty(user.photoURL))
            {
                user.photoURL = "placeholder_profile.png";
            }
            else
            {
                if (!File.Exists(user.photoURL))
                {
                    await LoadImmage();
                }
            }

            familyTabPageViewModel.user = user;

            if (!string.IsNullOrEmpty(familyTabPageViewModel.user.familyId))
            {
                familyTabPageViewModel.family = await familyRepository.GetOneAsync(familyTabPageViewModel.user.familyId);
            }

            List <User> members = new List <User>();

            foreach (string id in familyTabPageViewModel.family.membersID)
            {
                members.Add(await userRepository.GetOneAsync(id));
            }
            familyTabPageViewModel.members = members;

            BindingContext = familyTabPageViewModel;
        }
示例#3
0
        private async void OnAppearing(object sender, EventArgs e)
        {
            toDisplay.Clear();
            familyTabPageViewModel = (FamilyTabPageViewModel)BindingContext;
            if (!string.IsNullOrEmpty(familyTabPageViewModel.user.familyId))
            {
                familyTabPageViewModel.family = familyTabPageViewModel.family = await familyRepository.GetOneAsync(familyTabPageViewModel.user.familyId);
            }


            if (!string.IsNullOrEmpty(familyTabPageViewModel.user.familyId))
            {
                GoInEditMode();
                toDisplay = familyTabPageViewModel.members;
            }
            else
            {
                GoInAddMode();
            }

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

            await Device.InvokeOnMainThreadAsync(async() => { familyNameEntry.Text = familyTabPageViewModel.family.familyName; });
        }