示例#1
0
        private async void ListView0_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            if (viewModel.CommentPosts.Count == 5)
            {
                await DisplayAlert("", Language.vui_long_chon_toi_da_5_san_pham, Language.dong);

                return;
            }
            var item = e.Item as Liquidation;
            var post = new LiquidationCommentPost()
            {
                PostId    = item.Id.ToString(),
                Title     = item.Name,
                Avatar    = item.Avatar,
                PriceText = string.Format("{0:0,0 đ}", item.Price),
                Address   = item.Address
            };

            if (!viewModel.CommentPosts.Any(x => x.PostId == post.PostId))
            {
                viewModel.CommentPosts.Add(post);
                viewModel.FireOnChangeClearCommentButton();

                //xoa khoi list view
                searchPageResultViewModel.Data.Remove(item);
            }
            else
            {
                ToastMessageHelper.ShortMessage(Language.san_pham_nay_da_them_vao_binh_luan_roi);
            }
        }
示例#2
0
        private async void PickerLiquidationPost_Clicked(object sender, EventArgs e)
        {
            ModalPicker.Title      = Language.chon_tu_san_pham_thanh_ly;
            loadingPopup.IsVisible = true;
            if (FilterLiquidationPage == null)
            {
                FilterLiquidationPage = new ContentView();

                LiquidationFilterViewModel filterViewModel = new LiquidationFilterViewModel();
                filterViewModel.FilterModel.CreatedById = Guid.Parse(UserLogged.Id);
                filterViewModel.FilterModel.Status      = 0;
                FilterLiquidationPage.BindingContext    = filterViewModel;
                BsdListView bsdListView = new BsdListView()
                {
                    ItemTemplate = new DataTemplate(typeof(Views.Cells.LiquidationCells.LiquidationViewCell))
                };
                bsdListView.ItemTapped += async(object listview, ItemTappedEventArgs listviewEventArgs) =>
                {
                    var item = listviewEventArgs.Item as Liquidation;
                    var post = new LiquidationCommentPost
                    {
                        Title     = item.Name,
                        Avatar    = item.Avatar,
                        PostId    = item.Id.ToString(),
                        PriceText = item.Price > 0 ? string.Format("{0:0,0 đ}", item.Price) : "",
                        Address   = item.Address
                    };
                    viewModel.SendLiquidationtMessage(post);
                    await ModalPicker.Hide();
                };

                await filterViewModel.LoadData();

                FilterLiquidationPage.Content = bsdListView;
            }

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

            loadingPopup.IsVisible = false;
        }