From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 17 十二月 2020 09:07:13 +0800 Subject: [PATCH] 新云端Ver1.3 --- ZigbeeApp/Shared/Phone/UserCenter/SharedContent/AddNewSharedListRoomForm.cs | 207 ++++++++------------------------------------------- 1 files changed, 34 insertions(+), 173 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/AddNewSharedListRoomForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/AddNewSharedListRoomForm.cs index 1a76109..98b9962 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/AddNewSharedListRoomForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/AddNewSharedListRoomForm.cs @@ -22,13 +22,9 @@ /// </summary> private BottomClickButton btnShard = null; /// <summary> - /// 鎴愬憳淇℃伅 + /// 鎴愬憳ID /// </summary> - private MemberInfoRes memberResult = null; - /// <summary> - /// 鎴愬憳鐨勫垎浜暟鎹� - /// </summary> - private MemberShardInfoData memberShardInfo = null; + private string ChildAccountId = string.Empty; /// <summary> /// 閫夋嫨鐨勬埧闂� /// </summary> @@ -45,12 +41,10 @@ /// <summary> /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) /// </summary> - /// <param name="i_memberResult">鎴愬憳淇℃伅</param> - /// <param name="i_memberShardInfo">鎴愬憳鐨勫叡浜俊鎭�</param> - public void ShowForm(MemberInfoRes i_memberResult, MemberShardInfoData i_memberShardInfo) + /// <param name="i_ChildAccountId">鎴愬憳ID</param> + public void ShowForm(string i_ChildAccountId) { - this.memberResult = i_memberResult; - this.memberShardInfo = i_memberShardInfo; + this.ChildAccountId = i_ChildAccountId; //璁剧疆澶撮儴淇℃伅 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddShared)); @@ -76,7 +70,7 @@ bodyFrameLayout.AddChidren(frameBack); //鎴块棿鍒楄〃 var btnTitle = new NormalViewControl(800, 60, true); - btnTitle.X = ControlCommonResourse.XXLeft; + btnTitle.X = HdlControlResourse.XXLeft; btnTitle.Y = Application.GetRealHeight(52); btnTitle.TextID = R.MyInternationalizationString.RoomList; btnTitle.TextColor = UserCenterColor.Current.TextColor2; @@ -117,7 +111,7 @@ private void InitTopRightMenuControl() { //鑾峰彇妤煎眰 - var dicFloor = Common.Room.CurrentRoom.GetFloorSortList(); + var dicFloor = HdlRoomLogic.Current.GetFloorSortList(); if (dicFloor.Count == 0) { return; @@ -144,10 +138,10 @@ btnIconContr.ButtonClickEvent += (sender, e) => { //妤煎眰鑿滃崟 - var contr = new TopRightMenuControl(dicFloor.Count, 449, Language.StringByID(R.MyInternationalizationString.SelectFloor)); + var contr = new TopRightFloorMenuControl(dicFloor.Count, 2, this.nowSelectFloorId, Language.StringByID(R.MyInternationalizationString.SelectFloor)); foreach (var floorId in dicFloor.Keys) { - contr.AddRowMenu(dicFloor[floorId], "Floor/Floor.png", "Floor/FloorSelected.png", () => + contr.AddRowMenu(floorId, () => { //璁板綍璧烽�夋嫨鐨処D this.nowSelectFloorId = floorId; @@ -170,7 +164,7 @@ private void InitAreaListRow(string floorId) { dicSelectRoom.Clear(); - var listRoom = Common.Room.CurrentRoom.GetFloorSortRoom(floorId, false); + var listRoom = HdlRoomLogic.Current.GetFloorSortRoom(floorId, false); HdlThreadLogic.Current.RunMain(() => { var listDataRoom = new List<Common.Room>(); @@ -199,26 +193,12 @@ frameTemp.Height = bodyFrameLayout.Height - btnShard.Y; listView.AddChidren(frameTemp); } - if (listView.ChildrenCount == 0) + if (listDataRoom.Count == 0) { //濡傛灉娌℃湁鑳藉鍏变韩鐨勬埧闂� 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); - //鏃犲彲鍏变韩鐨勬埧闂� - 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.TextID = R.MyInternationalizationString.uNotShardDeviceInAllRoomMsg; - bodyFrameLayout.AddChidren(btnMsg1); + this.ShowNotDataImage(bodyFrameLayout, Language.StringByID(R.MyInternationalizationString.uNotCanShardRoomMsg), "Item/NotShardPic.png", 383, 279); } }); } @@ -247,9 +227,8 @@ row.ButtonClickEvent += (sender, e) => { var form = new AddNewSharedContentForm(); - form.AddForm(room, memberShardInfo); + form.AddForm(room, this.ChildAccountId); }; - //閫夋嫨 var btnSelect = row.AddMostRightEmptyIcon(69, 69); @@ -289,129 +268,28 @@ /// <param name="room">鎸囧畾瑕佸垎浜殑鎴块棿</param> public void DoSharedContentByRoom(List<Common.Room> listRoom) { - //鑾峰彇闇�瑕佷笂浼犵殑璁惧(鎸夋埧闂碙ist椤哄簭鍒嗙粍) - var dicDevice = new Dictionary<int, List<CommonDevice>>(); - //鑾峰彇闇�瑕佷笂浼犵殑鍦烘櫙,杩欎釜涓滆タ涓嶈鑾峰彇瀹冪殑缁戝畾鐩爣(鎸夋埧闂碙ist椤哄簭鍒嗙粍) - var dicScene = new Dictionary<int, List<Common.SceneUI>>(); - //鑾峰彇闇�瑕佷笂浼犵殑鎴块棿鏁版嵁 - int fileCount = this.GetUpLoadRoomData(listRoom, dicDevice, dicScene); - - var listCheckFile = new HashSet<string>(); - HdlThreadLogic.Current.RunThread(async () => + HdlThreadLogic.Current.RunThread(() => { //鎵撳紑杩涘害鏉� this.ShowProgressBar(); - - for (int index = 0; index < listRoom.Count; index++) - { - //鎵ц涓婁紶 - var result = await HdlShardLogic.Current.DoUploadSharedContent(memberShardInfo, listRoom[index], dicDevice[index], dicScene[index], fileCount, listCheckFile); - if (result == false) - { - break; - } - } + //涓婁紶鍒嗕韩 + var result = HdlShardLogic.Current.UploadSharedRoom(this.ChildAccountId, listRoom); //鍏抽棴杩涘害鏉� this.CloseProgressBar(); - //涓嶇鎴愬姛杩樻槸澶辫触,閮藉埛鏂扮晫闈� - Application.RunOnMainThread(() => + if (result == true) { - if (this.Parent != null) + //涓嶅埛鏂扮晫闈� + HdlThreadLogic.Current.RunMain(() => { - //閲嶆柊鍒锋柊鐣岄潰 - this.InitMiddleFrame(); - } - }); - }); - } - - /// <summary> - /// 鑾峰彇闇�瑕佷笂浼犵殑鎴块棿鏁版嵁 - /// </summary> - /// <param name="listRoom">闇�瑕佷笂浼犵殑鎴块棿鍒楄〃</param> - /// <param name="dicDevice">鑾峰彇闇�瑕佷笂浼犵殑璁惧(鎸夋埧闂碙ist椤哄簭鍒嗙粍)</param> - /// <param name="dicScene">鑾峰彇闇�瑕佷笂浼犵殑鍦烘櫙,杩欎釜涓滆タ涓嶈鑾峰彇瀹冪殑缁戝畾鐩爣(鎸夋埧闂碙ist椤哄簭鍒嗙粍)</param> - /// <returns></returns> - private int GetUpLoadRoomData(List<Common.Room> listRoom, Dictionary<int, List<CommonDevice>> dicDevice, Dictionary<int, List<Common.SceneUI>> dicScene) - { - var listAllFile = new HashSet<string>(); - for (int i = 0; i < listRoom.Count; i++) - { - //鎸夋埧闂碙ist椤哄簭鍒嗙粍鐨勮澶囧垪琛� - var listDevice = new List<CommonDevice>(); - dicDevice[i] = listDevice; - //鎸夋埧闂碙ist椤哄簭鍒嗙粍鐨勫満鏅垪琛� - var listScene = new List<Common.SceneUI>(); - dicScene[i] = listScene; - - //鑾峰彇鎴块棿鍏ㄩ儴璁惧 - foreach (var deviceUi in listRoom[i].DeviceUIList) - { - var device = deviceUi.CommonDevice; - if (device == null || memberShardInfo.dicAllShardKeys.ContainsKey(device.FilePath) == true) - { - //寮傚父 - continue; - } - string deviceFile = device.FilePath; - if (memberShardInfo.dicAllShardKeys.ContainsKey(deviceFile) == false) - { - //鎴栬�呭凡缁忓垎浜簡鐨勶紝涓嶅啀鏄剧ず - listDevice.Add(device); - if (listAllFile.Contains(deviceFile) == false) + if (this.Parent != null) { - listAllFile.Add(deviceFile); + //閲嶆柊鍒锋柊鐣岄潰 + this.InitMiddleFrame(); } - } + }); } - - //鑾峰彇鍦烘櫙閲岄潰宓屽鐨勫瓙璁惧鍜屽瓙鍦烘櫙(璁$畻鎬绘暟鐢�) - var listCheck = new HashSet<string>(); - var listChirdDevice = new List<CommonDevice>(); - var listChirdScene = new List<Common.SceneUI>(); - //鑾峰彇鎴块棿鍏ㄩ儴鍦烘櫙 - foreach (var sceneUi in listRoom[i].SceneUIList) - { - if (sceneUi == null || memberShardInfo.dicAllShardKeys.ContainsKey(sceneUi.FileName) == true) - { - //寮傚父锛屾垨鑰呭凡缁忓垎浜簡鐨勶紝涓嶅啀鏄剧ず - continue; - } - listScene.Add(sceneUi); - //浠庣紦瀛樿幏鍙栧満鏅殑鎵ц鐩爣(杩欎釜鍑芥暟鏄绠楁�绘暟鐢�) - HdlShardLogic.Current.GetSceneDeviceList(sceneUi, listCheck, listChirdScene, listChirdDevice); - if (listAllFile.Contains(sceneUi.FileName) == false) - { - listAllFile.Add(sceneUi.FileName); - } - } - foreach (var device in listChirdDevice) - { - //宓屽瀛愯澶囩殑鏂囦欢鍚嶅瓧(璁$畻鎬绘暟鐢�) - string deviceFile = device.FilePath; - if (listAllFile.Contains(deviceFile) == false) - { - listAllFile.Add(deviceFile); - } - } - foreach (var secene in listChirdScene) - { - //宓屽瀛愬満鏅殑鏂囦欢鍚嶅瓧(璁$畻鎬绘暟鐢�) - if (listAllFile.Contains(secene.FileName) == false) - { - listAllFile.Add(secene.FileName); - } - } - //鎴块棿鏂囦欢 - listAllFile.Add(listRoom[i].FileName); - } - //濡傛灉鏈夋ゼ灞傜殑璇� - if (Common.Config.Instance.Home.FloorDics.Count > 0) - { - return listAllFile.Count + 1; - } - return listAllFile.Count; + }); } #endregion @@ -439,7 +317,7 @@ /// <returns></returns> private bool CheckCanShowRow(Common.Room room) { - if (room.DeviceUIList.Count == 0 && room.SceneUIList.Count == 0) + if (room.ListDevice.Count == 0 && room.ListSceneId.Count == 0) { return false; } @@ -447,55 +325,38 @@ { return false; } - if (memberShardInfo.dicShardRoom.ContainsKey(room.FileName) == false) + if (HdlShardLogic.Current.GetShardRoomFromMemory(room.Id) == null) { //娌℃湁杩欎釜鎴块棿 return true; } - foreach (var deviceUi in room.DeviceUIList) + foreach (var deviceKeys in room.ListDevice) { - if (deviceUi.CommonDevice == null) + if (HdlDeviceCommonLogic.Current.GetDevice(deviceKeys) == null) { + //鏈湴娌℃湁杩欎釜璁惧 continue; } - if (memberShardInfo.dicAllShardKeys.ContainsKey(deviceUi.CommonDevice.FilePath) == false) + if (HdlShardLogic.Current.GetShardDeviceFromMemory(deviceKeys) == null) { //瀛樺湪鏈垎浜殑璁惧鐨勮瘽锛屾鎴块棿鍙互鏄剧ず return true; } } - foreach (var sceneUi in room.SceneUIList) + foreach (var sceneId in room.ListSceneId) { - if (sceneUi == null) + if (HdlSceneLogic.Current.GetSceneUIBySceneId(sceneId) == null) { + //鏈湴娌℃湁杩欎釜鍦烘櫙 continue; } - if (memberShardInfo.dicAllShardKeys.ContainsKey(sceneUi.FileName) == false) + if (HdlShardLogic.Current.GetShardSceneFromMemory(sceneId) == null) { //瀛樺湪鏈垎浜殑鍦烘櫙鐨勮瘽锛屾鎴块棿鍙互鏄剧ず return true; } } return false; - } - - #endregion - - #region 鈻� 缁撴瀯浣揰____________________________ - - /// <summary> - /// 鎺ユ敹鍒嗕韩鏁版嵁 - /// </summary> - private class MemberShardInfoResult - { - /// <summary> - /// 鏂囦欢鍚嶅瓧 - /// </summary> - public string ShareName = string.Empty; - /// <summary> - /// 涓婚敭 - /// </summary> - public string DistributedMark = string.Empty; } #endregion -- Gitblit v1.8.0