| | |
| | | }
|
| | |
|
| | | listView = new VerticalListControl(29);
|
| | | listView.Y = Application.GetRealHeight(-6);
|
| | | listView.Height = bodyFrameLayout.Height + Application.GetRealHeight(6);
|
| | | listView.BackgroundColor = UserCenterColor.Current.White;
|
| | | bodyFrameLayout.AddChidren(listView);
|
| | |
| | | continue;
|
| | | }
|
| | | var info = dicData[listResidenceSort[i]];
|
| | | if (info.IsOthreShare == false)
|
| | | {
|
| | | //收集该账号所拥有的自己的住宅的数据
|
| | | this.dicResidenceData[info.Id] = info;
|
| | | }
|
| | |
|
| | | //收集该账号住宅的数据
|
| | | this.dicResidenceData[info.Id] = info;
|
| | | this.AddRowLayout(info, i != listResidenceSort.Count - 1);
|
| | | }
|
| | | //调整列表控件的高度
|
| | |
| | | {
|
| | | this.ShowProgressBar();
|
| | |
|
| | | //检测本地有没有这个住宅
|
| | | this.CheckIsExsitResidence(info);
|
| | |
|
| | | Config.Instance.HomeId = info.Id;
|
| | | Global.CreateHomeDirectory(info.Id);
|
| | | //重新初始化住宅对象
|
| | | Config.Instance.Home = House.GetHouseByHouseId(info.Id);
|
| | | Config.Instance.Save();
|
| | |
| | | return;
|
| | | }
|
| | | //更改
|
| | | var btnChanged = new NormalViewControl(Application.GetRealWidth(184), rowLayout.Height, false);
|
| | | btnChanged.BackgroundColor = 0xff4a4a4a;
|
| | | btnChanged.TextSize = 12;
|
| | | btnChanged.TextColor = UserCenterColor.Current.White;
|
| | | btnChanged.TextAlignment = TextAlignment.Center;
|
| | | var btnChanged = rowLayout.AddEditorControl();
|
| | | btnChanged.TextID = R.MyInternationalizationString.uChanged1;
|
| | | rowLayout.AddRightView(btnChanged);
|
| | | btnChanged.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //显示编辑名称界面
|
| | |
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 检测本地有没有这个住宅
|
| | | /// </summary>
|
| | | /// <param name="info"></param>
|
| | | private void CheckIsExsitResidence(Common.ResponseEntity.ResidenceObj info)
|
| | | {
|
| | | var path = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Config.Instance.Guid, info.Id);
|
| | | bool isExsit = System.IO.Directory.Exists(path);
|
| | | if (isExsit == true) { return; }
|
| | | //创建文件夹
|
| | | Global.CreateHomeDirectory(info.Id);
|
| | | //创建新的住宅
|
| | | var house = new House();
|
| | | house.Id = info.Id;
|
| | | house.Name = info.Name;
|
| | | house.IsOthreShare = info.IsOthreShare;
|
| | | house.AccountType = info.AccountType;
|
| | | house.MainUserDistributedMark = info.MainUserDistributedMark;
|
| | | house.Longitude = info.Longitude;
|
| | | house.Latitude = info.Latitude;
|
| | | house.Save(false);
|
| | |
|
| | | string fileName = house.FileName;
|
| | | if (Config.Instance.HomeFilePathList.Contains(fileName) == false)
|
| | | {
|
| | | //添加列表
|
| | | Config.Instance.HomeFilePathList.Add(fileName);
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 检测能否删除住宅
|
| | | /// </summary>
|
| | | /// <param name="info"></param>
|
| | | /// <returns></returns>
|
| | | private bool CheckIsCanDeleteResidence(Common.ResponseEntity.ResidenceObj info)
|
| | | {
|
| | | if (this.dicResidenceData.Count == 1)
|
| | | if (info.IsOthreShare == false)
|
| | | {
|
| | | //如果此账号下只剩下唯一一个自己的住宅,当删除这个住宅时,提示不能删除
|
| | | //因为最少要有一个住宅
|
| | | if (this.dicResidenceData.ContainsKey(info.Id) == true)
|
| | | int myCount = 0;
|
| | | foreach (var data in this.dicResidenceData.Values)
|
| | | {
|
| | | if (data.IsOthreShare == false)
|
| | | {
|
| | | myCount++;
|
| | | }
|
| | | }
|
| | | //如果此账号下只剩下唯一一个自己的住宅,则不能再删除
|
| | | if (myCount == 1)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | | if (info.IsOthreShare == true)
|
| | | {
|
| | | //分享过来的住宅不能删除
|
| | | return false;
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
| | | //住宅名字重复检测
|
| | | foreach (string strId in this.dicResidenceData.Keys)
|
| | | {
|
| | | if (this.dicResidenceData[strId].IsOthreShare == true)
|
| | | {
|
| | | //分享的住宅不考虑
|
| | | continue;
|
| | | }
|
| | | if (residenceId != strId && residenceName == this.dicResidenceData[strId].Name)
|
| | | {
|
| | | //住宅名字已经存在
|