From 9904031f5291daaf56985146bb671f25e18ebbdf Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 02 四月 2020 19:51:31 +0800
Subject: [PATCH] 最新代码

---
 ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs |  106 +++++++++++++++++++++++------------------------------
 1 files changed, 46 insertions(+), 60 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs
index 30cd414..15f46ff 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs
@@ -92,7 +92,7 @@
             }
             //缁忕含搴�
             var btnLocation = rowHome.frameTable.AddMostRightView(string.Empty, 500);
-            btnLocation.Text = this.GetLatitudeAndLongitudeText(Common.Config.Instance.Home.Longitude, Common.Config.Instance.Home.Latitude);
+            btnLocation.Text = Common.Config.Instance.Home.ResidenceAddressName;
 
             //涓讳汉鎴栬�呯鐞嗗憳鎵嶄細鍑虹幇杩欎釜鑿滃崟
             if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
@@ -109,9 +109,12 @@
                         HdlThreadLogic.Current.RunThread(() =>
                         {
                             //淇濆瓨浣忓畢鍦板潃
-                            this.SaveResidenceAdrress(btnLocation, mLatitude, mLongitude);
+                            this.SaveResidenceAdrress(btnLocation, mLatitude, mLongitude, name);
                         });
-                    }, Language.StringByID(R.MyInternationalizationString.uSelectAdrress), true, latitude, longitude, 100);
+                    }, 
+                    Language.StringByID(R.MyInternationalizationString.uSelectAdrress),
+                    Language.StringByID(R.MyInternationalizationString.uSave),
+                    true, latitude, longitude, 100);
                 };
             }
 
@@ -363,6 +366,8 @@
                                 Common.Config.Instance.Home.CurrentFloorId = floorId;
                                 break;
                             }
+                            //鍒犻櫎褰撳墠妤煎眰鐨勮瘽,闇�瑕佸幓鍒锋柊涓婚〉宸﹁竟鐨勬埧闂村垪琛�
+                            HdlRoomLogic.Current.RefreshRoomListView();
                         }
                         var listDeleteId = new List<string>();
                         var listAllRoom = HdlRoomLogic.Current.GetAllListRooms();
@@ -434,6 +439,9 @@
             //鎸変笅纭鎸夐挳
             dialogForm.ComfirmClickEvent += ((textValue) =>
             {
+                //杩樺師宸﹀彸鑿滃崟
+                frameRow?.HideMenu();
+
                 if (this.CheckFloorName(keys, textValue) == false)
                 {
                     //妤煎眰鍚嶇О妫�娴�
@@ -441,8 +449,6 @@
                 }
                 //鐢婚潰鍏抽棴
                 dialogForm.CloseDialog();
-                //杩樺師宸﹀彸鑿滃崟
-                frameRow?.HideMenu();
                 if (floorName != textValue)
                 {
                     //缂栬緫鎴栬�呭垱寤烘ゼ灞傚悕绉�
@@ -455,6 +461,8 @@
                     if (Common.Config.Instance.Home.CurrentFloorId == string.Empty)
                     {
                         Common.Config.Instance.Home.CurrentFloorId = keys;
+                        //鍒涘缓绗竴涓柊鐨勬ゼ灞傜殑璇�,闇�瑕佸幓鍒锋柊涓婚〉宸﹁竟鐨勬埧闂村垪琛�
+                        HdlRoomLogic.Current.RefreshRoomListView();
                     }
                     if (btnFloor != null)
                     {
@@ -620,16 +628,36 @@
             //寮�鍚繘搴︽潯
             this.ShowProgressBar();
 
-            var Pra = new DeleteResidencePra();
-            Pra.HomeId = Common.Config.Instance.Home.Id;
-            Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
-
-            bool result = await UserCenterLogic.GetResultStatuByRequestHttps("App/DelHome", true, Pra);
-            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 = await 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 = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/SubAccountDelShareHome", false, Pra2);
+                if (result == false)
+                {
+                    //鍏抽棴杩涘害鏉�
+                    this.CloseProgressBar();
+                    return;
+                }
             }
 
             //鍥犱负鍒犻櫎鐨勬槸褰撳墠鐨勪綇瀹�,鎵�浠ラ渶瑕佸厛鍒囨崲鍒板埆鐨勪綇瀹�
@@ -685,7 +713,8 @@
         /// <param name="btnLocation">鏄剧ず鎺т欢</param>
         /// <param name="latitude">绾害</param>
         /// <param name="longitude">缁忓害</param>
-        private async void SaveResidenceAdrress(NormalViewControl btnLocation, double latitude, double longitude)
+        /// <param name="addresName">浣嶇疆鍚嶇О</param>
+        private async void SaveResidenceAdrress(NormalViewControl btnLocation, double latitude, double longitude, string addresName)
         {
             //寮�鍚繘搴︽潯
             this.ShowProgressBar();
@@ -729,10 +758,11 @@
             //淇濆瓨缂撳瓨
             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 = this.GetLatitudeAndLongitudeText(longitude, latitude);
+                btnLocation.Text = addresName;
             });
         }
 
@@ -787,50 +817,6 @@
                 }
             }
             return true;
-        }
-
-        /// <summary>
-        /// 鑾峰彇缁忕含搴︾殑缈昏瘧鍚嶅瓧
-        /// </summary>
-        /// <param name="Longitude">缁忓害</param>
-        /// <param name="Latitude">绾害</param>
-        /// <returns></returns>
-        private string GetLatitudeAndLongitudeText(double Longitude, double Latitude)
-        {
-            string value1 = string.Empty;
-            string value2 = string.Empty;
-            if (Longitude == 0)
-            {
-                //榛樿涓滅粡
-                value1 = "0掳00'E";
-            }
-            else if (Longitude > 0)
-            {
-                //涓滅粡
-                value1 = Math.Round(Longitude, 2).ToString().Replace(".", "掳") + "'E";
-            }
-            else if (Longitude < 0)
-            {
-                //瑗跨粡
-                value1 = Math.Round(-Longitude, 2).ToString().Replace(".", "掳") + "'W";
-            }
-
-            if (Latitude == 0)
-            {
-                //榛樿鍖楃含
-                value2 = "0掳00'N";
-            }
-            else if (Latitude > 0)
-            {
-                //鍖楃含
-                value2 = Math.Round(Latitude, 2).ToString().Replace(".", "掳") + "'N";
-            }
-            else if (Latitude < 0)
-            {
-                //鍗楃含
-                value2 = Math.Round(-Latitude, 2).ToString().Replace(".", "掳") + "'S";
-            }
-            return value1 + " " + value2;
         }
 
         #endregion

--
Gitblit v1.8.0