HDL Home App 第二版本 旧平台金堂用 正在使用
hxb
2022-08-30 25429f085093d89d543a0b90e30d0d62d1b7dac9
ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs
@@ -42,7 +42,7 @@
            base.SetTitleText(Common.Config.Instance.Home.Name);
            //主人或者管理员才会出现这个菜单
            if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2)
            if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
            {
                //查看模板时,不允许编辑
                if (Common.Config.Instance.Home.IsShowTemplate == false)
@@ -91,7 +91,7 @@
            btnNowView.TextColor = UserCenterColor.Current.TextGrayColor1;
            rowHome.frameTable.AddChidren(btnNowView, ChidrenBindMode.BindEvent);
            //主人或者管理员才会出现这个菜单
            if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2)
            if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
            {
                //右箭头
                rowHome.frameTable.AddRightArrow();
@@ -103,7 +103,7 @@
            btnLocation.Text = Common.Config.Instance.Home.ResidenceAddressName;
            //主人或者管理员才会出现这个菜单
            if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2)
            if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
            {
                rowHome.frameTable.UseClickStatu = true;
                //查看模板时,不允许编辑
@@ -320,7 +320,7 @@
                form.AddForm(keys);
            };
            if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2)
            if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
            {
                //查看模板时,不允许编辑
                if (Common.Config.Instance.Home.IsShowTemplate == true)
@@ -659,12 +659,36 @@
            //开启进度条
            this.ShowProgressBar();
            var result = HdlResidenceLogic.Current.DeleteCloundHouse(Common.Config.Instance.Home.Id);
            if (result == false)
            if (Common.Config.Instance.Home.IsOthreShare == false)
            {
                //关闭进度条
                this.CloseProgressBar();
                return;
                //删除主人自己的住宅
                var Pra = new DeleteResidencePra();
                Pra.HomeId = Common.Config.Instance.Home.Id;
                Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
                bool result = UserCenterLogic.GetResultStatuByRequestHttps("App/DelHome", true, Pra);
                if (result == false)
                {
                    //关闭进度条
                    this.CloseProgressBar();
                    return;
                }
            }
            else
            {
                //删除分享的住宅
                var Pra2 = new
                {
                    HomeId = Common.Config.Instance.Home.Id,
                    PrimaryUserId = Common.Config.Instance.Home.MainUserDistributedMark
                };
                bool result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/SubAccountDelShareHome", false, Pra2);
                if (result == false)
                {
                    //关闭进度条
                    this.CloseProgressBar();
                    return;
                }
            }
            //因为删除的是当前的住宅,所以需要先切换到别的住宅
@@ -673,9 +697,19 @@
            int index = 0;
            for (; index < Common.Config.Instance.HomeFilePathList.Count; index++)
            {
                //当前住宅所处的位置(住宅数肯定大于1,不然不会出现删除按钮)
                if (Common.Config.Instance.HomeFilePathList[index] != deleteFile)
                if (Common.Config.Instance.HomeFilePathList[index] == deleteFile)
                {
                    //当前住宅所处的位置(住宅数肯定大于1,不然不会出现删除按钮)
                    if (index == 0)
                    {
                        //取下一位
                        index++;
                    }
                    else
                    {
                        //取前一位
                        index--;
                    }
                    break;
                }
            }
@@ -688,7 +722,7 @@
            Common.Config.Instance.Save();
            //刷新个人中心的内存及线程
            bool result2 = HdlUserCenterLogic.Current.InitUserCenterMenmoryAndThread(false);
            bool result2 = UserCenterLogic.InitUserCenterMenmoryAndThread(false);
            if (result2 == false)
            {
                //开启了调试功能
@@ -778,17 +812,54 @@
        /// <param name="addresName">位置名称</param>
        private void SaveResidenceAdrress(NormalViewControl btnLocation, double latitude, double longitude, string addresName)
        {
            //开启进度条
            this.ShowProgressBar();
            //保存经纬度
            var result = HdlResidenceLogic.Current.EditorResidenceLongitudeAndLatitude(latitude, longitude, addresName);
            this.CloseProgressBar();
            if (result == false)
            //如果不是虚拟住宅,才更新云端
            if (Common.Config.Instance.Home.IsVirtually == false)
            {
                return;
                //开启进度条
                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)
                {
                    //关闭进度条
                    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;