| | |
| | | }
|
| | |
|
| | | listView = new VerticalListControl(29);
|
| | | listView.Y = Application.GetRealHeight(-6);
|
| | | listView.Height = bodyFrameLayout.Height + Application.GetRealHeight(6);
|
| | | listView.BackgroundColor = UserCenterColor.Current.White;
|
| | | bodyFrameLayout.AddChidren(listView);
|
| | |
| | | listResidenceSort.Add(pageData.PageData[i].Id);
|
| | | }
|
| | | }
|
| | | for (int i = 0; i < listResidenceSort.Count; i++)
|
| | | {
|
| | | //移除掉不存在了的顺序
|
| | | if (dicData.ContainsKey(listResidenceSort[i]) == false)
|
| | | {
|
| | | listResidenceSort.RemoveAt(i);
|
| | | i--;
|
| | | }
|
| | | }
|
| | | //保存顺序
|
| | | string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.ResidenceSortFile);
|
| | | UserCenterLogic.SaveFileContent(fullName, listResidenceSort);
|
| | |
|
| | | Application.RunOnMainThread(() =>
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (this.Parent == null)
|
| | | {
|
| | |
| | | this.dicResidenceData = new Dictionary<string, Common.ResponseEntity.ResidenceObj>();
|
| | | for (int i = 0; i < listResidenceSort.Count; i++)
|
| | | {
|
| | | var info = dicData[listResidenceSort[i]];
|
| | | if (info.IsOthreShare == false)
|
| | | if (dicData.ContainsKey(listResidenceSort[i]) == false)
|
| | | {
|
| | | //收集该账号所拥有的自己的住宅的数据
|
| | | this.dicResidenceData[info.Id] = info;
|
| | | continue;
|
| | | }
|
| | | var info = dicData[listResidenceSort[i]];
|
| | |
|
| | | //收集该账号住宅的数据
|
| | | this.dicResidenceData[info.Id] = info;
|
| | | this.AddRowLayout(info, i != listResidenceSort.Count - 1);
|
| | | }
|
| | | //调整列表控件的高度
|
| | |
| | | {
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | ProgressBar.Show();
|
| | | this.ShowProgressBar();
|
| | |
|
| | | //检测本地有没有这个住宅
|
| | | this.CheckIsExsitResidence(info);
|
| | |
|
| | | Config.Instance.HomeId = info.Id;
|
| | | Global.CreateHomeDirectory(info.Id);
|
| | | //重新初始化住宅对象
|
| | | Config.Instance.Home = House.GetHouseByHouseId(info.Id);
|
| | | Config.Instance.Save();
|
| | | //刷新个人中心的内存及线程
|
| | | await UserCenterLogic.InitUserCenterMenmoryAndThread();
|
| | | await UserCenterLogic.InitUserCenterMenmoryAndThread(false);
|
| | |
|
| | | Room.InitAllRoom();
|
| | | HdlRoomLogic.Current.InitAllRoom();
|
| | |
|
| | | Application.RunOnMainThread(() =>
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //重新刷新列表
|
| | | this.listView.RemoveAll();
|
| | |
| | | }
|
| | | };
|
| | |
|
| | | if (info.IsOthreShare == true && info.AccountType != 1)
|
| | | if (info.IsOthreShare == true)
|
| | | {
|
| | | //分享的,又不拥有管理员权限的,不能更改
|
| | | //分享的,不能更改
|
| | | 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) =>
|
| | | {
|
| | | //显示编辑名称界面
|
| | |
| | | private void ShowEditorNameForm(Common.ResponseEntity.ResidenceObj info, NormalViewControl btnHome)
|
| | | {
|
| | | //生成一个弹窗画面
|
| | | var dialogForm = new DialogInputFrameControl(this, DialogFrameMode.OnlyInput);
|
| | | var dialogForm = new DialogInputControl();
|
| | | //编辑住宅
|
| | | dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uChangedName));
|
| | | //请输入住宅名称
|
| | |
| | | private void ShowAddNameForm()
|
| | | {
|
| | | //生成一个弹窗画面
|
| | | var dialogForm = new DialogInputFrameControl(this, DialogFrameMode.OnlyInput);
|
| | | var dialogForm = new DialogInputControl();
|
| | | //创建住宅
|
| | | dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uCreatResidence));
|
| | | //请输入住宅名称
|
| | |
| | | #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)
|
| | | {
|
| | | //住宅名字已经存在
|
| | |
| | | {
|
| | | if (Config.Instance.HomeFilePathList.Contains($"House_{keys}.json") == false)
|
| | | {
|
| | | //保存顺序
|
| | | listResidenceSort.Remove(keys);
|
| | | HdlRoomLogic.Current.SaveFloorSort(listResidenceSort);
|
| | |
|
| | | this.listView.RemoveAll();
|
| | | //数据已经变更
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | |
| | | public PageSettingInfo PageSetting = new PageSettingInfo()
|
| | | {
|
| | | Page = 1,
|
| | | PageSize = 500
|
| | | PageSize = 5000
|
| | | };
|
| | | }
|
| | |
|
| | |
| | | /// ZigbeeHomeGuid
|
| | | /// </summary>
|
| | | public string Id = string.Empty;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 编辑住宅的启动参数
|
| | | /// </summary>
|
| | | public class EditorResidencePra : IfacePraCommon
|
| | | {
|
| | | /// <summary>
|
| | | /// RequestVersion
|
| | | /// </summary>
|
| | | public string RequestVersion = Common.CommonPage.RequestVersion;
|
| | | /// <summary>
|
| | | /// LoginAccessToken
|
| | | /// </summary>
|
| | | public string LoginAccessToken = Common.Config.Instance.Token;
|
| | | /// <summary>
|
| | | /// ZigbeeHomeId
|
| | | /// </summary>
|
| | | public string HomeId = "";
|
| | | /// <summary>
|
| | | /// Name
|
| | | /// </summary>
|
| | | public string Name = string.Empty;
|
| | | }
|
| | |
|
| | | #endregion
|