| | |
| | | /// 住宅数据(无网时使用)
|
| | | /// </summary>
|
| | | private List<House> listLocalHouse = null;
|
| | | /// <summary>
|
| | | /// 住宅顺序
|
| | | /// </summary>
|
| | | private List<string> listResidenceSort = new List<string>();
|
| | |
|
| | | #endregion
|
| | |
|
| | |
| | | {
|
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | //读取住宅顺序
|
| | | var strData = UserCenterLogic.LoadFileContent(UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.ResidenceSortFile));
|
| | | if (strData != null)
|
| | | {
|
| | | listResidenceSort = Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>>(strData);
|
| | | }
|
| | |
|
| | | listView = new VerticalListControl(29);
|
| | | listView.Height = bodyFrameLayout.Height + Application.GetRealHeight(6);
|
| | |
| | |
|
| | | //暂时存储数据
|
| | | var dicData = new Dictionary<string, Common.ResponseEntity.ResidenceObj>();
|
| | | var listResidenceSort = new List<string>();
|
| | | for (int i = 0; i < pageData.PageData.Count; i++)
|
| | | {
|
| | | dicData[pageData.PageData[i].Id] = pageData.PageData[i];
|
| | | if (listResidenceSort.Contains(pageData.PageData[i].Id) == false)
|
| | | {
|
| | | //新添加的住宅
|
| | | listResidenceSort.Add(pageData.PageData[i].Id);
|
| | | }
|
| | | 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);
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | |
| | | btnHome = rowLayout.frameTable.AddLeftCaption(info.Name, 800, 60, true);
|
| | | btnHome.TextSize = 15;
|
| | | btnHome.Y = Application.GetRealHeight(12) + rowLayout.chidrenYaxis;
|
| | | rowLayout.frameTable.AddChidren(btnHome, ChidrenBindMode.BindEventOnly);
|
| | | rowLayout.frameTable.AddChidren(btnHome, ChidrenBindMode.BindEvent);
|
| | |
|
| | | //当前住宅
|
| | | var btnNowView = rowLayout.frameTable.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uNowResidence), 800, 49, true);
|
| | | btnNowView.Y = Application.GetRealHeight(72) + rowLayout.chidrenYaxis;
|
| | | btnNowView.TextSize = 12;
|
| | | btnNowView.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | rowLayout.frameTable.AddChidren(btnNowView, ChidrenBindMode.BindEventOnly);
|
| | | rowLayout.frameTable.AddChidren(btnNowView, ChidrenBindMode.BindEvent);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | //检测本地有没有这个住宅
|
| | | this.CheckIsExsitResidence(info);
|
| | |
|
| | | Config.Instance.HomeId = info.Id;
|
| | | //重新初始化住宅对象
|
| | | Config.Instance.Home = House.GetHouseByHouseId(info.Id);
|
| | | Config.Instance.Save();
|
| | | //刷新个人中心的内存及线程
|
| | | await UserCenterLogic.InitUserCenterMenmoryAndThread(false);
|
| | | await HdlResidenceLogic.Current.SwitchResidence(info.Id);
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | |
| | | btnHome = rowLayout.frameTable.AddLeftCaption(i_home.Name, 800, 60, true);
|
| | | btnHome.TextSize = 15;
|
| | | btnHome.Y = Application.GetRealHeight(12) + rowLayout.chidrenYaxis;
|
| | | rowLayout.frameTable.AddChidren(btnHome, ChidrenBindMode.BindEventOnly);
|
| | | rowLayout.frameTable.AddChidren(btnHome, ChidrenBindMode.BindEvent);
|
| | |
|
| | | //当前住宅
|
| | | var btnNowView = rowLayout.frameTable.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uNowResidence), 800, 49, true);
|
| | | btnNowView.Y = Application.GetRealHeight(72) + rowLayout.chidrenYaxis;
|
| | | btnNowView.TextSize = 12;
|
| | | btnNowView.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | rowLayout.frameTable.AddChidren(btnNowView, ChidrenBindMode.BindEventOnly);
|
| | | rowLayout.frameTable.AddChidren(btnNowView, ChidrenBindMode.BindEvent);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | {
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | this.ShowProgressBar();
|
| | |
|
| | | Config.Instance.HomeId = i_home.Id;
|
| | | //重新初始化住宅对象
|
| | | Config.Instance.Home = House.GetHouseByHouseId(i_home.Id);
|
| | | Config.Instance.Save();
|
| | | //刷新个人中心的内存及线程
|
| | | await UserCenterLogic.InitUserCenterMenmoryAndThread(false);
|
| | | await HdlResidenceLogic.Current.SwitchResidence(i_home.Id);
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | |
| | | return;
|
| | | }
|
| | | //刷新内存的住宅名
|
| | | House.EditorHouseByHouseId(i_house.Id, textValue);
|
| | | HdlResidenceLogic.Current.EditorHouseByHouseId(i_house.Id, textValue);
|
| | | //更改显示的名字
|
| | | btnHome.Text = textValue;
|
| | | }
|
| | |
| | | if (flage == true)
|
| | | {
|
| | | //刷新内存的住宅名
|
| | | House.EditorHouseByHouseId(info.Id, ResidenceName);
|
| | | HdlResidenceLogic.Current.EditorHouseByHouseId(info.Id, ResidenceName);
|
| | | //更改显示的名字
|
| | | btnHome.Text = ResidenceName;
|
| | | info.Name = ResidenceName;
|
| | |
| | |
|
| | | var newInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<NewResidenceInfo>>(resultData);
|
| | |
|
| | | House.AddHouse(newInfo[0].Id, ResidenceName, 0);
|
| | | HdlResidenceLogic.Current.AddHouseToMemmory(newInfo[0].Id, ResidenceName);
|
| | | //重新刷新列表
|
| | | this.listView.RemoveAll();
|
| | | this.SetResidenceInfo(2);
|
| | |
| | | {
|
| | | if (Config.Instance.HomeFilePathList.Contains($"House_{keys}.json") == false)
|
| | | {
|
| | | //保存顺序
|
| | | listResidenceSort.Remove(keys);
|
| | | HdlRoomLogic.Current.SaveFloorSort(listResidenceSort);
|
| | |
|
| | | this.listView.RemoveAll();
|
| | | //数据已经变更 重新设置住宅信息
|
| | | this.SetResidenceInfo(2);
|