| | |
| | | base.SetTitleText(Common.Config.Instance.Home.Name);
|
| | |
|
| | | //主人或者管理员才会出现这个菜单
|
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
|
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2)
|
| | | {
|
| | | //查看模板时,不允许编辑
|
| | | if (Common.Config.Instance.Home.IsShowTemplate == false)
|
| | |
| | | btnNowView.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | rowHome.frameTable.AddChidren(btnNowView, ChidrenBindMode.BindEvent);
|
| | | //主人或者管理员才会出现这个菜单
|
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
|
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2)
|
| | | {
|
| | | //右箭头
|
| | | rowHome.frameTable.AddRightArrow();
|
| | |
| | | btnLocation.Text = Common.Config.Instance.Home.ResidenceAddressName;
|
| | |
|
| | | //主人或者管理员才会出现这个菜单
|
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
|
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2)
|
| | | {
|
| | | rowHome.frameTable.UseClickStatu = true;
|
| | | //查看模板时,不允许编辑
|
| | |
| | | form.AddForm(keys);
|
| | | };
|
| | |
|
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
|
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2)
|
| | | {
|
| | | //查看模板时,不允许编辑
|
| | | if (Common.Config.Instance.Home.IsShowTemplate == true)
|
| | |
| | | //开启进度条
|
| | | this.ShowProgressBar();
|
| | |
|
| | | if (Common.Config.Instance.Home.IsOthreShare == false)
|
| | | if (Common.Config.Instance.Home.IsOtherShare == false)
|
| | | {
|
| | | //删除主人自己的住宅
|
| | | var Pra = new DeleteResidencePra();
|
| | | Pra.HomeId = Common.Config.Instance.Home.Id;
|
| | | Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
|
| | |
|
| | | bool result = UserCenterLogic.GetResultStatuByRequestHttps("App/DelHome", true, Pra);
|
| | | var result = HdlResidenceLogic.Current.DeleteCloundHouse(Common.Config.Instance.Home.Id);
|
| | | if (result == false)
|
| | | {
|
| | | //关闭进度条
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | //删除分享的住宅
|
| | | var Pra2 = new
|
| | | {
|
| | | HomeId = Common.Config.Instance.Home.Id,
|
| | | PrimaryUserId = Common.Config.Instance.Home.MainUserDistributedMark
|
| | | };
|
| | | bool result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/SubAccountDelShareHome", false, Pra2);
|
| | | //删除分享的住宅,使用主人的Token,把自己删了
|
| | | var result = HdlMemberLogic.Current.DeleteMember(Common.Config.Instance.Guid);
|
| | | if (result == false)
|
| | | {
|
| | | //关闭进度条
|
| | |
| | | }
|
| | |
|
| | | //因为删除的是当前的住宅,所以需要先切换到别的住宅
|
| | | string deleteId = Common.Config.Instance.Home.Id;
|
| | | string deleteFile = Common.Config.Instance.Home.FileName;
|
| | | int index = 0;
|
| | | for (; index < Common.Config.Instance.HomeFilePathList.Count; index++)
|
| | | var listLocalHouse = HdlResidenceLogic.Current.GetAllLocalResidenceListByDirectory();
|
| | | //取一个住宅id
|
| | | string houseId = string.Empty;
|
| | | foreach (var myHouse in listLocalHouse)
|
| | | {
|
| | | if (Common.Config.Instance.HomeFilePathList[index] == deleteFile)
|
| | | houseId = myHouse.Id;
|
| | | if (houseId != Common.Config.Instance.Home.Id)
|
| | | {
|
| | | //当前住宅所处的位置(住宅数肯定大于1,不然不会出现删除按钮)
|
| | | if (index == 0)
|
| | | {
|
| | | //取下一位
|
| | | index++;
|
| | | }
|
| | | else
|
| | | {
|
| | | //取前一位
|
| | | index--;
|
| | | }
|
| | | //随便取一个和当前住宅不相等的ID
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | var myHouse = HdlResidenceLogic.Current.GetHouseByFilePath(Common.Config.Instance.HomeFilePathList[index]);
|
| | | //当前住宅ID
|
| | | string nowHouseId = Common.Config.Instance.Home.Id;
|
| | | //切换住宅
|
| | | Common.Config.Instance.HomeId = myHouse.Id;
|
| | | Common.Config.Instance.Home = myHouse;
|
| | | Common.Global.CreateHomeDirectory(myHouse.Id);
|
| | | Common.Config.Instance.Save();
|
| | |
|
| | | //刷新个人中心的内存及线程
|
| | | bool result2 = UserCenterLogic.InitUserCenterMenmoryAndThread(false);
|
| | | bool result2 = HdlResidenceLogic.Current.SwitchResidence(houseId);
|
| | | //删掉这个文件夹
|
| | | HdlResidenceLogic.Current.DeleteHouseMemmory(nowHouseId);
|
| | | if (result2 == false)
|
| | | {
|
| | | //开启了调试功能
|
| | | return;
|
| | | }
|
| | |
|
| | | //删除住宅
|
| | | HdlResidenceLogic.Current.DeleteHouseMemmory(deleteId);
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | |
| | | //开启进度条
|
| | | this.ShowProgressBar();
|
| | |
|
| | | var Pra = new EditorResidencePra();
|
| | | Pra.HomeId = Common.Config.Instance.Home.Id;
|
| | | Pra.Name = Common.Config.Instance.Home.Name;
|
| | | Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
|
| | | Pra.Latitude = latitude;
|
| | | Pra.Longitude = longitude;
|
| | |
|
| | | //编辑住宅
|
| | | bool flage = UserCenterLogic.GetResultStatuByRequestHttps("App/EditHome", true, Pra);
|
| | | if (flage == false)
|
| | | var result = HdlResidenceLogic.Current.EditorResidenceLongitudeAndLatitude(latitude, longitude, addresName);
|
| | | if (result == false)
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | | return;
|
| | | }
|
| | | //设置全部网关的住宅地址
|
| | | var listGateway = HdlGatewayLogic.Current.GetAllLocalGateway();
|
| | | foreach (var gateway in listGateway)
|
| | | {
|
| | | ZigBee.Device.ZbGateway realWay = null;
|
| | | if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, gateway) == false)
|
| | | {
|
| | | //错误:网关对象丢失
|
| | | continue;
|
| | | }
|
| | | var result = HdlGatewayLogic.Current.SetGatewaySite(gateway, longitude, latitude, ShowErrorMode.YES);
|
| | | if (result == false)
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | | return;
|
| | | }
|
| | | }
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | | }
|
| | |
|
| | | //保存缓存
|
| | | Common.Config.Instance.Home.Longitude = longitude;
|
| | | Common.Config.Instance.Home.Latitude = latitude;
|
| | | Common.Config.Instance.Home.ResidenceAddressName = addresName;
|
| | | Common.Config.Instance.Home.Save();
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | btnLocation.Text = addresName;
|