public async void Init()
        {
            await Task.WhenAll(viewModel.LoadNewestBuyOrRentList(), viewModel.GetCompany());

            if (UserLogged.RoleId == 0)
            {
                await viewModel.LoadContactNeeds();

                StackTitlNhuCauKhachHang.IsVisible = true;
                StackListNhuCauKhachHang.IsVisible = true;
            }

            if (viewModel.Company.CreatedById == Guid.Parse(UserLogged.Id))
            {
                StackButtonGroup.IsVisible = true;
            }

            MessagingCenter.Subscribe <ViewModels.MoiGioiViewModels.AddContactNeedContentViewModel>(this, "ReloadNhuCauList", async(sender) =>
            {
                await this.viewModel.LoadContactNeeds();
            });

            MessagingCenter.Subscribe <PostPage, Guid>(this, "OnDeleteSuccess", async(sender, PostId) =>
            {
                var deletedPost = this.viewModel.NewestBuyOrRentList.SingleOrDefault(x => x.Id == PostId);
                if (deletedPost != null)
                {
                    this.viewModel.NewestBuyOrRentList.Remove(deletedPost);
                }
            });
            MessagingCenter.Subscribe <PostPage>(this, "OnSavePost", async(sender) =>
            {
                await viewModel.LoadNewestBuyOrRentList();
            });

            MessagingCenter.Subscribe <ContactListPage, Guid>(this, "DeleteContact", async(sender, id) =>
            {
                await this.viewModel.LoadContactNeeds();
            });

            loadingPopup.IsVisible = false;
        }
Exemple #2
0
        public async void Init()
        {
            await Task.WhenAll(viewModel.LoadNewestBuyOrRentList(), viewModel.LoadNewestNeedtoBuyOrRentList(), viewModel.LoadProjectList(), viewModel.LoadNewFurnitureProducts(), viewModel.LoadLiquidationList());

            MessagingCenter.Subscribe <AddLiquidationPage>(this, "OnSaveItem", async(sender) => await viewModel.LoadLiquidationList());
            MessagingCenter.Subscribe <LiquidationDetailPage, Guid>(this, "OnDeleted", async(sender, liquidationId) =>
            {
                if (viewModel.Liquidations.Any(x => x.Id == liquidationId))
                {
                    await viewModel.LoadLiquidationList();
                }
            });
            loadingPopup.IsVisible = false;
        }