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

            DataListView.ItemTapped += DataListView_ItemTapped;

            loadingPopup.IsVisible = false;
        }
Esempio n. 2
0
        public async void Init()
        {
            lvSanPham.ItemTapped += lvSanPham_ItemTapped;
            await viewModel.LoadData();

            if (UserLogged.RoleId == 0 && Guid.Parse(UserLogged.CompanyId) == _companyId)
            {
                _isOwner = true;
                StackButton.IsVisible = true;
            }
            loadingPopup.IsVisible = false;
        }
        public async void Init()
        {
            LvData.ItemTapped += LvData_ItemTapped;
            MessagingCenter.Subscribe <ViewModels.Furniture.ProductDetailPageViewModel, Guid>(this, "DeleteProduct", async(sender, PostId) =>
            {
                var deletedProduct = this.viewModel.Data.SingleOrDefault(x => x.Id == PostId);
                if (deletedProduct != null)
                {
                    this.viewModel.Data.Remove(deletedProduct);
                }
            });
            MessagingCenter.Subscribe <AddProductPage, FurnitureProduct>(this, "UpdateProduct", async(sender, product) =>
            {
                this.viewModel.RefreshCommand.Execute(null);
            });
            await viewModel.LoadData();

            loadingPopup.IsVisible = false;
        }
        public async void Init()
        {
            LvData.ItemTapped += LvData_ItemTapped;
            MessagingCenter.Subscribe <PostPage, Guid>(this, "OnDeleteSuccess", async(sender, PostId) =>
            {
                var deletedPost = this.viewModel.Data.SingleOrDefault(x => x.Id == PostId);
                if (deletedPost != null)
                {
                    this.viewModel.Data.Remove(deletedPost);
                }
            });
            MessagingCenter.Subscribe <PostPage>(this, "OnSavePost", async(sender) =>
            {
                this.viewModel.RefreshCommand.Execute(null);
            });
            await viewModel.LoadData();

            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 ListViewPageViewModel2 <SundihomeApi.Entities.Post>();
                searchPageResultViewModel.PreLoadData = new Command(() =>
                {
                    searchPageResultViewModel.ApiUrl = ApiRouter.COMPANY_GETPOSTLIST + $"?CompanyId={UserLogged.CompanyId}&page={searchPageResultViewModel.Page}&Keyword={viewModel.PostKeyword}&Status=2";
                });

                this.ListView0.BindingContext = searchPageResultViewModel;
                await searchPageResultViewModel.LoadData();
            }
            else
            {
                viewModel.PostKeyword    = null;
                ModalPopupSearchBar.Text = null;
                await searchPageResultViewModel.LoadOnRefreshCommandAsync();
            }
            loadingPopup.IsVisible = false;
            await ModalPickerPost.Show();
        }
Esempio n. 6
0
        public async void Init()
        {
            LvData.ItemTapped += LvData_ItemTapped;
            MessagingCenter.Subscribe <AddProjectPage, Guid>(this, "OnDeleteSuccess", async(sender, PostId) =>
            {
                var deleteProject = this.viewModel.Data.SingleOrDefault(x => x.Id == PostId);
                if (deleteProject != null)
                {
                    this.viewModel.Data.Remove(deleteProject);
                }
            });
            MessagingCenter.Subscribe <AddProjectPage>(this, "OnSaveProject", async(sender) =>
            {
                this.viewModel.RefreshCommand.Execute(null);
            });
            await viewModel.LoadData();

            if (UserLogged.RoleId == 0 && Guid.Parse(UserLogged.CompanyId) == this._companyId)
            {
                _isOwner = true;
                StackButton.IsVisible = true;
            }
            loadingPopup.IsVisible = false;
        }
        public async void Init()
        {
            segment.ItemsSource = new List <string> {
                Language.nhu_cau, Language.moi, Language.dau_tu, Language.da_mua
            };
            segment.SetActive(0);
            LvData.ItemTapped += LvData_ItemTapped;
            MessagingCenter.Subscribe <ContactDetailContent>(this, "ReloadData", async(sender) =>
            {
                loadingPopup.IsVisible = true;
                await viewModel.LoadOnRefreshCommandAsync();
                loadingPopup.IsVisible = false;
            });
            MessagingCenter.Subscribe <ContactDetailContent, Guid>(this, "DeleteContact", async(sender, ContactId) =>
            {
                loadingPopup.IsVisible = true;
                if (viewModel.Data.Any(x => x.Id == ContactId))
                {
                    await viewModel.LoadOnRefreshCommandAsync();
                }
                await viewModelContactNeed.LoadOnRefreshCommandAsync();
                loadingPopup.IsVisible = false;
            });
            MessagingCenter.Subscribe <AddContactNeedContent>(this, "AddContactNeed", async(sender) =>
            {
                loadingPopup.IsVisible = true;
                await viewModelContactNeed.LoadOnRefreshCommandAsync();
                loadingPopup.IsVisible = false;
            });
            MessagingCenter.Subscribe <AddContactNeedContent, Guid>(this, "UpdateContactNeed", async(sender, ContactNeedId) =>
            {
                loadingPopup.IsVisible = true;
                if (viewModelContactNeed.Data.Any(x => x.Id == ContactNeedId))
                {
                    await viewModelContactNeed.LoadOnRefreshCommandAsync();
                }
                loadingPopup.IsVisible = false;
            });
            MessagingCenter.Subscribe <AddContactNeedContent, ContactNeed>(this, "DeleteContactNeed", async(sender, ContactNeed) =>
            {
                loadingPopup.IsVisible = true;
                if (viewModelContactNeed.Data.Any(x => x.Id == ContactNeed.Id))
                {
                    viewModelContactNeed.Data.Remove(ContactNeed);
                }
                loadingPopup.IsVisible = false;
            });
            MessagingCenter.Subscribe <AddContactNeedContentViewModel, ContactNeed>(this, "DeleteContactNeed", async(sender, ContactNeed) =>
            {
                loadingPopup.IsVisible = true;
                if (viewModelContactNeed.Data.Any(x => x.Id == ContactNeed.Id))
                {
                    viewModelContactNeed.Data.Remove(ContactNeed);
                }
                loadingPopup.IsVisible = false;
            });

            viewModel.GroupList = Models.ContactGroupModel.GetList();
            ModalAddContact.CustomCloseButton(OnBtnCancelAddContact_Click);

            contactNeedFilterModel = new ContactNeedFilterModel();
            if (viewModel.CompanyId.HasValue)
            {
                contactNeedFilterModel.CompanyId = viewModel.CompanyId.Value;
            }
            if (viewModel.CreatedById.HasValue)
            {
                contactNeedFilterModel.CreatedById = viewModel.CreatedById.Value;
            }
            if (viewModel.Keyword != null)
            {
                contactNeedFilterModel.Keyword = viewModel.Keyword;
            }
            string json = Newtonsoft.Json.JsonConvert.SerializeObject(contactNeedFilterModel);

            viewModelContactNeed = new ListViewPageViewModel2 <ContactNeed>()
            {
                PreLoadData = new Command(() =>
                {
                    string url;
                    contactNeedFilterModel.Keyword = viewModel.Keyword;
                    url = ApiRouter.COMPANY_GET_FILTER_CONTACTNEEDS + $"?json={json}" + $"&page={viewModelContactNeed.Page}";


                    viewModelContactNeed.ApiUrl = url;
                })
            };
            LvDataContactNeed.BindingContext = viewModelContactNeed;
            LvDataContactNeed.ItemTapped    += LvDataContactNeed_ItemTapped;
            await viewModelContactNeed.LoadData();

            loadingPopup.IsVisible = false;
        }