Esempio n. 1
0
        public async void Init()
        {
            await LoadDetailCompany();

            this.Title = Company.Name;
            this.MainCompanyContentView.Content = new CompanyInfoContentView(this.Company);
            SetVisibleEditCompanyDetail();

            ControlSegment.ItemsSource = new List <string>()
            {
                Language.cong_ty, Language.san_pham, Language.hinh_anh
            };
            ControlSegment.SetActive(0);

            MessagingCenter.Subscribe <AddCompanyPage>(this, "OnSaveCompany", async(sender) =>
            {
                // chi co thong tin va hinh anh thay doi. cho nen set null lai.
                MainCompanyContentView.Content = null;
                MainImagesContentView.Content  = null;
                await LoadDetailCompany(); // load lai thong tin cong ty

                // goi ham nay de quay ve tab thong tin cong ty
                //Company_Clicked(BtnCompany, EventArgs.Empty);
            });

            loadingPopup.IsVisible = false;
        }
Esempio n. 2
0
 public AddPostItemPage()
 {
     InitializeComponent();
     this.BindingContext        = viewModel = new AddPostItemPageViewModel();
     ControlSegment.ItemsSource = new List <string> {
         Language.can_thanh_ly, Language.can_mua
     };
     ControlSegment.SetActive(0);
     Init();
 }
 public B2BAddPage()
 {
     InitializeComponent();
     this.BindingContext        = viewModel = new B2BAddPageViewModel();
     ControlSegment.ItemsSource = new List <string> {
         Language.hop_tac, Language.cung_cap
     };
     ControlSegment.SetActive(0);
     ImageList = new List <string>();
     Init();
 }
Esempio n. 4
0
 public AddPostItemPage()
 {
     InitializeComponent();
     this.BindingContext          = viewModel = new AddPostItemPageViewModel();
     pickerUnitPrice.SelectedItem = this.viewModel.PriceOptions.First(); //set mac dinh vnd.
     ControlSegment.ItemsSource   = new List <string> {
         Language.can_ban, Language.cho_thue, Language.can_mua, Language.can_thue
     };
     ControlSegment.SetActive(0);
     ImageList = new List <string>();
     InitAdd();
 }
Esempio n. 5
0
        public async void InitFromPOst(SundihomeApi.Entities.Post post)
        {
            Init();
            CheckLastPost = true;
            ControlSegment.ItemsSource = new List <string> {
                Language.can_ban, Language.cho_thue, Language.can_mua, Language.can_thue
            };
            ControlSegment.SetActive(post.PostType);
            editor.Text = post.Description;

            EntryTitle.Text = post.Title;

            // loai bat dong san
            LookUpType.SelectedItem = loaiBatDongSans.Single(x => x.Id == post.LoaiBatDongSanId);

            // gia
            if (!post.IsNegotiate) // khong phai la thoa thuan
            {
                EntryPrice.Text = post.PriceFrom;

                var priceOption = this.viewModel.PriceOptions.SingleOrDefault(x => x.Id == post.PriceFromUnit);
                if (priceOption != null)
                {
                    pickerUnitPrice.SelectedItem = priceOption;
                }
                else
                {
                    pickerUnitPrice.SelectedItem = this.viewModel.PriceOptions.First();
                }
            }
            else
            {
                pickerUnitPrice.SelectedItem = this.viewModel.PriceOptions.First();
            }

            // dien tich.
            EntryArea.Text = post.AreaFormatText?.Replace("m2", "") ?? "";

            // phong ngu
            if (post.NumOfBedroom.HasValue)
            {
                SoPhongNgu_Tapped(StacklayoutSophongngu.Children[this.NumberList.ToList().IndexOf((int)post.NumOfBedroom)], EventArgs.Empty);
            }

            // phong ta
            if (post.NumOfBathroom.HasValue)
            {
                SoPhongNgu_Tapped(StacklayoutSoPhongtam.Children[this.NumberList.ToList().IndexOf((int)post.NumOfBathroom)], EventArgs.Empty);
            }

            if (!string.IsNullOrEmpty(post.Images))
            {
                ImageList = post.ImageList.ToList();

                foreach (var image in post.ImageList)
                {
                    viewModel.Media.Add(new MediaFile()
                    {
                        PreviewPath = ImageHelper.GetImageUrl("post", image),
                    });
                }
            }
            else
            {
                ImageList = new List <string>();
            }

            EntryPrice.Text = post.PriceFrom;

            await viewModel.GetProvinceAsync();

            viewModel.Province = viewModel.ProvinceList.Single(x => x.Id == post.ProvinceId);
            await viewModel.GetDistrictAsync();

            viewModel.District = viewModel.DistrictList.Single(x => x.Id == post.DistrictId);

            await viewModel.GetWardAsync();

            viewModel.Ward   = viewModel.WardList.Single(x => x.Id == post.WardId);
            viewModel.Street = post.Street;

            loadingPopup.IsVisible = false;
        }