public async void Init()
        {
            await viewModel.LoadData();

            lv.ItemTapped         += Lv_ItemTapped;
            loadingPopup.IsVisible = false;
        }
        private async void Init()
        {
            Lv.ItemTapped += Item_Tapped;
            await viewModel.LoadData();

            loadingPopup.IsVisible = false;
        }
예제 #3
0
        private async void PickPost_Clicked(object sender, EventArgs e)
        {
            ModalPicker.Title      = Language.chon_bat_dong_san;
            loadingPopup.IsVisible = true;
            if (FilterPostPage == null)
            {
                FilterPostPage = new ContentView();
                SearchPageResultViewModel filterViewModel = new SearchPageResultViewModel();
                filterViewModel.FilterModel.CreatedById = Guid.Parse(UserLogged.Id);
                FilterPostPage.BindingContext           = filterViewModel;
                BsdListView bsdListView = new BsdListView()
                {
                    ItemTemplate = new DataTemplate(typeof(Cells.PostViewCell))
                };
                bsdListView.ItemTapped += async(object listview, ItemTappedEventArgs listviewEventArgs) =>
                {
                    var item = listviewEventArgs.Item as SundihomeApi.Entities.Post;
                    var post = new SundihomeApi.Entities.Mongodb.Post()
                    {
                        Title     = item.Title,
                        Avatar    = item.Avatar,
                        PostId    = item.Id.ToString(),
                        PriceText = item.PriceFormatText,
                        Address   = item.Address
                    };
                    viewModel.SendPostMessage(post);
                    await ModalPicker.Hide();
                };

                await filterViewModel.LoadData();

                FilterPostPage.Content = bsdListView;
            }

            ContentViewLookUp.Content = FilterPostPage;
            await ModalPicker.Show();

            loadingPopup.IsVisible = false;
        }
예제 #4
0
        private async void Init()
        {
            lv.ItemTapped += Lv_ItemTapped;
            await viewModel.LoadData();

            MessagingCenter.Subscribe <PostDetailPage, Guid>(this, "OnDeleteSuccess", async(sender, PostId) =>
            {
                loadingPopup.IsVisible = true;
                if (this.viewModel.Data.Any(x => x.Id == PostId))
                {
                    var deletedPost = this.viewModel.Data.Single(x => x.Id == PostId);
                    this.viewModel.Data.Remove(deletedPost);
                }
                loadingPopup.IsVisible = false;
            });

            MessagingCenter.Subscribe <PostPage>(this, "OnSavePost", async(sender) =>
            {
                this.viewModel.RefreshCommand.Execute(null);
            });

            loadingPopup.IsVisible = false;
        }
        private async void PickerPost_Clicked(object sender, EventArgs e)
        {
            loadingPopup.IsVisible = true;
            if (searchPageResultViewModel == null) // chua bat popup lan nao.
            {
                this.ListView0.ItemTapped += ListView0_ItemTapped;

                searchPageResultViewModel                         = new SearchPageResultViewModel();
                searchPageResultViewModel.FilterModel             = new FilterModel();
                searchPageResultViewModel.FilterModel.CreatedById = Guid.Parse(UserLogged.Id);

                this.ListView0.BindingContext = searchPageResultViewModel;
                await searchPageResultViewModel.LoadData();
            }
            else
            {
                searchPageResultViewModel.FilterModel.Keyword = null;
                ModalPopupSearchBar.Text = null;
                await searchPageResultViewModel.LoadOnRefreshCommandAsync();
            }
            loadingPopup.IsVisible = false;
            await ModalPickPost.Show();
        }