From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期二, 30 八月 2022 09:37:38 +0800
Subject: [PATCH] 合并了IOS的代码

---
 ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedListRoomForm.cs |   96 +++++++++++++++++-------------------------------
 1 files changed, 34 insertions(+), 62 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedListRoomForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedListRoomForm.cs
index d34fc96..7feed80 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedListRoomForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedListRoomForm.cs
@@ -67,21 +67,18 @@
             //娓呯┖bodyFrame
             this.ClearBodyFrame();
 
-            HdlThreadLogic.Current.RunThread(async () =>
+            HdlThreadLogic.Current.RunThread(() =>
             {
                 //鑾峰彇鎴愬憳鐨勫叡浜垪琛�
-                var result = await HdlShardLogic.Current.GetMemberShardContentListAndSetToLocation(memberShardInfo);
+                var result = HdlShardLogic.Current.GetMemberShardContentListAndSetToLocation(memberShardInfo);
                 if (result == false)
                 {
                     //鏄剧ず閲嶆柊鍔犺浇鐨勭晫闈�
                     this.ShowReLoadView();
                     return;
                 }
-                //浠庢湰鍦拌幏鍙栨垚鍛樼殑鍒嗕韩鍒楄〃
-                HdlShardLogic.Current.GetMemberShardContentListFromLocal(memberShardInfo);
                 //鍒濆鍖栧尯鍩熷垪琛�
                 this.InitAreaListRow();
-
             });
         }
 
@@ -98,8 +95,11 @@
             {
                 HdlThreadLogic.Current.RunMain(() =>
                 {
-                    //鏄剧ず娌℃湁鍒嗕韩鏁版嵁妯″紡
-                    this.ShowNotShardMode();
+                    bodyFrameLayout.RemoveAll();
+                    //杩樻病鏈夊叡浜尯鍩熺粰鎴愬憳{0}鍙偣鍑诲彸涓婅鈥�+鈥濇坊鍔�
+                    string msg = Language.StringByID(R.MyInternationalizationString.uNotShardComtentMsg);
+                    string[] Arry = msg.Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries);
+                    this.ShowNotDataImage(bodyFrameLayout, Arry, "Item/NotShardPic.png", 383, 279);
                 });
             }
             else
@@ -124,7 +124,7 @@
                     bodyFrameLayout.AddChidren(listView);
 
                     //鎺掑簭妤煎眰
-                    var dicSort = Common.Room.CurrentRoom.GetFloorSortList();
+                    var dicSort = HdlRoomLogic.Current.GetFloorSortList();
                     foreach (var floorId in dicSort.Keys)
                     {
                         if (dicGroup.ContainsKey(floorId) == true)
@@ -139,6 +139,8 @@
                     {
                         this.AddRoomListRow(floorId, dicGroup[floorId]);
                     }
+                    //璋冩暣妗屽竷楂樺害
+                    listView.AdjustTableHeight();
                 });
             }
         }
@@ -152,7 +154,7 @@
             var frameBack = new FrameListControl(29);
             frameBack.BackgroundColor = UserCenterColor.Current.White;
             frameBack.Height = 10;
-            this.listView.AddChidrenFrame(frameBack);
+            this.listView.AddChidren(frameBack);
 
             //妤煎眰
             if (string.IsNullOrEmpty(floorId) == false)
@@ -178,7 +180,7 @@
                 }
             }
             //鎴块棿鎺掑簭
-            var listSortRoom = Common.Room.CurrentRoom.GetFloorSortRoom(floorId, false);
+            var listSortRoom = HdlRoomLogic.Current.GetFloorSortRoom(floorId, false);
             var listSort = new HashSet<string>();
             foreach (var room in listSortRoom)
             {
@@ -223,6 +225,8 @@
                 }
                 frameRow.frameTable.ButtonClickEvent += (sender, e) =>
                 {
+                    var form = new LookSharedContentForm();
+                    form.AddForm(room, memberShardInfo);
                 };
 
                 //鍒犻櫎
@@ -259,32 +263,39 @@
         {
             //鑾峰彇鍏ㄩ儴璁惧
             var listDevice = new List<CommonDevice>();
-            foreach (var deviceUi in room.DeviceUIList)
+            foreach (var deviceKeys in room.ListDevice)
             {
-                var device = deviceUi.CommonDevice;
-                if (device == null)
+                string deviceFile = HdlShardLogic.Current.GetShardDeviceFileName(deviceKeys);
+                if (deviceFile == string.Empty)
                 {
-                    string deviceFile = deviceUi.FileName.Replace("DeviceUI_", string.Empty);
-                    var byteData = HdlShardLogic.Current.GetShardFileContent(deviceFile);
-                    if (byteData == null)
-                    {
-                        continue;
-                    }
-                    device = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice>(System.Text.Encoding.UTF8.GetString(byteData));
+                    continue;
                 }
+                var byteData = HdlShardLogic.Current.GetShardFileContent(deviceFile);
+                if (byteData == null)
+                {
+                    continue;
+                }
+                var device = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice>(System.Text.Encoding.UTF8.GetString(byteData));
+                device.Type = (DeviceType)device.DeviceID;
                 listDevice.Add(device);
             }
             //鑾峰彇鍏ㄩ儴鍦烘櫙
             var listScene = new List<Common.SceneUI>();
-            foreach (var sceneUi in room.SceneUIList)
+            foreach (var sceneId in room.ListSceneId)
             {
+                var byteData = HdlShardLogic.Current.GetShardFileContent($"Scene_{sceneId}.json");
+                if (byteData == null)
+                {
+                    continue;
+                }
+                var sceneUi = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.SceneUI>(System.Text.Encoding.UTF8.GetString(byteData));
                 listScene.Add(sceneUi);
             }
 
-            HdlThreadLogic.Current.RunThread(async () =>
+            HdlThreadLogic.Current.RunThread(() =>
             {
                 //鎵ц鍒犻櫎
-                var result = await HdlShardLogic.Current.DoDeleteSharedContent(memberShardInfo, room, listDevice, listScene);
+                var result = HdlShardLogic.Current.DoDeleteSharedContent(memberShardInfo, room, listDevice, listScene);
                 if (result == true)
                 {
                     HdlThreadLogic.Current.RunMain(() =>
@@ -308,45 +319,6 @@
             //閲嶆柊鍒锋柊鐣岄潰
             this.InitMiddleFrame();
             return 1;
-        }
-
-        #endregion
-
-        #region 鈻� 涓�鑸柟娉昣__________________________
-
-        /// <summary>
-        /// 鏄剧ず娌℃湁鍒嗕韩鏁版嵁妯″紡
-        /// </summary>
-        private void ShowNotShardMode()
-        {
-            bodyFrameLayout.RemoveAll();
-            //鍥剧墖
-            var btnPic = new PicViewControl(383, 279);
-            btnPic.Gravity = Gravity.CenterHorizontal;
-            btnPic.Y = Application.GetRealHeight(498);
-            btnPic.UnSelectedImagePath = "Item/NotShardPic.png";
-            bodyFrameLayout.AddChidren(btnPic);
-
-            //杩樻病鏈夊叡浜尯鍩熺粰鎴愬憳{0}鍙偣鍑诲彸涓婅鈥�+鈥濇坊鍔�
-            string msg = Language.StringByID(R.MyInternationalizationString.uNotShardComtentMsg);
-            string[] Arry = msg.Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries);
-            var btnMsg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false);
-            btnMsg1.Y = Application.GetRealHeight(962);
-            btnMsg1.TextAlignment = TextAlignment.Center;
-            btnMsg1.TextSize = 12;
-            btnMsg1.TextColor = UserCenterColor.Current.TextGrayColor1;
-            btnMsg1.Text = Arry[0];
-            bodyFrameLayout.AddChidren(btnMsg1);
-            if (Arry.Length > 1)
-            {
-                var btnMsg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false);
-                btnMsg2.Y = btnMsg1.Bottom;
-                btnMsg2.TextAlignment = TextAlignment.Center;
-                btnMsg2.TextSize = 12;
-                btnMsg2.TextColor = UserCenterColor.Current.TextGrayColor1;
-                btnMsg2.Text = Arry[1];
-                bodyFrameLayout.AddChidren(btnMsg2);
-            }
         }
 
         #endregion

--
Gitblit v1.8.0