Ejemplo n.º 1
0
        /// <summary>
        /// 返回参数到上一级页面
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        public async Task BackPage(EstateItemInfo e)
        {
            var page = Application.Current.MainPage.Navigation.NavigationStack.FirstOrDefault(p => p is AddHousePage2);

            if (page.BindingContext is AddHouseViewModel vm)
            {
                vm.Estate     = e;
                vm.HouseTitle = e.DistrictName + " " + e.EstateName + " ";
                vm.GetBuildings();
            }

            await Application.Current.MainPage.Navigation.PopAsync();
        }
Ejemplo n.º 2
0
        public AddHouseViewModel()
        {
            Title     = "新增房源";
            btnText   = "确认新增";
            ImageList = new ObservableCollection <string>();
            TradeList = new List <string> {
                "出售", "出租"
            };
            DirectionList = new List <string> {
                "南北", "东西", "南", "北", "东", "西", "东南", "西南", "东北", "西北"
            };
            DecorationList = new List <string> {
                "毛坯", "简装", "中装", "精装", "豪装", "其它"
            };
            PropertyTypeList = new List <string> {
                "多层", "高层", "小高层", "多层复式", "高层复式", "多层跃式", "高层跃式", "独立别墅", "联体别墅", "双拼别墅", "叠加别墅", "围院别墅", "裙楼", "四合院"
            };
            PropertySourceList = new List <string> {
                "上店", "驻守", "贴单", "网络", "朋友", "同行", "安居客", "58", "房天下", "68好房", "平台推荐"
            };
            PropertyUseTypeList = new List <string> {
                "住宅", "商住", "商铺", "网点", "写字楼", "厂房", "写厂", "铺厂", "仓库", "地皮", "工厂", "车位", "公寓", "其他"
            };
            PropertyRightList = new List <string> {
                "单独所有", "共有", "单位产权"
            };
            CredentialsList = new List <string> {
                "不动产证", "房权证", "购房合同", "委托公证", "法院拍卖", "判决书", "离婚协议", "继承"
            };
            StatusList = new List <string> {
                "自住", "空房", "出租", "经商", "查封"
            };
            LookWaysList = new List <string> {
                "预约", "有钥匙", "借钥匙", "直接看"
            };
            CommissionPayList = new List <string> {
                "满佣", "折扣", "拒付", "商议"
            };
            PaymentList = new List <string> {
                "一次性", "按揭", "垫资解押", "月付", "季度付", "半年付", "年付商议"
            };
            FurnitureList = new List <string> {
                "少量", "全配", "无", "可协商"
            };
            OwnershipList = new List <string> {
                "商品房", "房改房", "经济适用房", "集体房", "军产房", "其它房"
            };

            BuiltYearList = new List <string>();
            for (int i = 1970; i <= 2030; i++)
            {
                BuiltYearList.Add(i.ToString());
            }

            Para   = new AddHousePara();
            Estate = new EstateItemInfo();

            //BedroomList = new List<string>();
            //DiningroomList = new List<string>();
            //BathroomList = new List<string>();
            //BalconyList = new List<string>();
            //for (int i = 0; i < 10; i++)
            //{
            //    BedroomList.Add()
            //}

            AddImageCommand = new Command(async() =>
            {
                await GetReadPermissionAsync();

                List <string> list = await DependencyService.Get <IImagePickerService>().PickImageAsync();

                list?.ForEach(item => ImageList.Add(item));
                //if (list != null)
                //{
                //foreach (var item in streams)
                //{
                //stack.Children.Add(new Image() { Source = ImageSource.FromStream(() => item) });
                //stack.Children.Add(new Image() { Source = item });

                //}
                //image.Source = ImageSource.FromStream(() => stream);
                //byte[] bytes = new byte[stream.Length];
                //stream.Read(bytes, 0, bytes.Length);
                //stream.Seek(0, SeekOrigin.Begin);
                //
                //string base64 = Convert.ToBase64String(bytes);
                //Console.WriteLine(base64);
                //}
            }, () => { return(true); });

            DoubleTappedCommand = new Command <string>(async(index) =>
            {
                bool result = await Application.Current.MainPage.DisplayAlert("删除", "要删除这张照片吗?", "确定", "取消");
                if (result)
                {
                    ImageList.Remove(index);
                }
            }, (index) => { return(true); });

            AddCommand = new Command(() =>
            {
                if (CheckInput())
                {
                    AddNewHouse();
                }
            }, () => { return(true); });

            ClearCommand = new Command(() =>
            {
            }, () => { return(true); });

            ToEstateSelectCommand = new Command(async() =>
            {
                EstateSelectPage estateSelectPage = new EstateSelectPage();
                await Application.Current.MainPage.Navigation.PushAsync(estateSelectPage);
            }, () => { return(true); });

            GetUnitsCommand = new Command <int>((index) =>
            {
                GetUnits(RawBuildingList[index].BuildingID);
            }, (index) => { return(true); });
        }