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/LookSharedContentForm.cs | 154 +++++++++++++++----------------------------------- 1 files changed, 47 insertions(+), 107 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs index b42621a..0d010e3 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs @@ -17,17 +17,17 @@ /// </summary> private Common.Room lookRoom = null; /// <summary> - /// 鎴愬憳鐨勫垎浜暟鎹� + /// 鎴愬憳ID /// </summary> - private MemberShardInfoData memberShardInfo = null; + private string ChildAccountId = string.Empty; /// <summary> /// 璁惧妗屽竷鎺т欢 /// </summary> - private FrameLayout frameDeviceTable = null; + private NormalFrameLayout frameDeviceTable = null; /// <summary> /// 璁惧妗屽竷鎺т欢 /// </summary> - private FrameLayout frameSceneTable = null; + private NormalFrameLayout frameSceneTable = null; /// <summary> /// 鍒犻櫎鎸夐挳 /// </summary> @@ -41,9 +41,9 @@ /// </summary> private Dictionary<string, CommonDevice> dicSelectDevice = new Dictionary<string, CommonDevice>(); /// <summary> - /// 褰撳墠閫夋嫨鐨勫垎鏀� 1锛氬満鏅� 2锛氬姛鑳� + /// 褰撳墠閫夋嫨鐨勫垎鏀� 0锛氬満鏅� 1锛氬姛鑳� /// </summary> - private int nowSwitchIndex = 1; + private int nowSwitchIndex = 0; /// <summary> /// 褰撳墠閫夋嫨鐨勮澶囩储寮� /// </summary> @@ -58,10 +58,10 @@ /// </summary> /// <param name="i_room">鏌ョ湅鐨勬埧闂村璞�</param> /// <param name="i_memberShardInfo">鎴愬憳鐨勫垎浜暟鎹�</param> - public void ShowForm(Common.Room i_room, MemberShardInfoData i_memberShardInfo) + public void ShowForm(Common.Room i_room, string i_ChildAccountId) { this.lookRoom = i_room; - this.memberShardInfo = i_memberShardInfo; + this.ChildAccountId = i_ChildAccountId; //璁剧疆澶撮儴淇℃伅 base.SetTitleText(i_room.Name); @@ -81,12 +81,12 @@ this.dicSelectScene = new Dictionary<int, Common.SceneUI>(); //鍒濆鍖栨甯冩帶浠� - this.frameSceneTable = new FrameLayout(); + this.frameSceneTable = new NormalFrameLayout(); frameSceneTable.Y = Application.GetRealHeight(132); frameSceneTable.Height = bodyFrameLayout.Height - Application.GetRealHeight(132); bodyFrameLayout.AddChidren(frameSceneTable); - this.frameDeviceTable = new FrameLayout(); + this.frameDeviceTable = new NormalFrameLayout(); frameDeviceTable.Y = frameSceneTable.Y; frameDeviceTable.Height = frameSceneTable.Height; bodyFrameLayout.AddChidren(frameDeviceTable); @@ -126,7 +126,7 @@ tabControl.SelectTabEvent += (tabIndex) => { this.nowSwitchIndex = tabIndex; - if (tabIndex == 1) + if (tabIndex == 0) { //鏄剧ず鍦烘櫙鍒楄〃 this.frameSceneTable.Visible = true; @@ -139,7 +139,11 @@ this.frameDeviceTable.Visible = true; } }; - tabControl.InitControl(); + //寮�濮嬪垵濮嬪寲鍦烘櫙鍔熻兘鍒囨崲鎺т欢 + var listTitle = new List<string>(); + listTitle.Add(Language.StringByID(R.MyInternationalizationString.uScence)); + listTitle.Add(Language.StringByID(R.MyInternationalizationString.uFunction)); + tabControl.InitControl(listTitle); } #endregion @@ -155,11 +159,12 @@ this.frameSceneTable.RemoveAll(); var listScene = new List<Common.SceneUI>(); - for (int i = 0; i < lookRoom.SceneUIList.Count; i++) + foreach (var sceneId in lookRoom.ListSceneId) { - if (HdlShardLogic.Current.IsFileExists(lookRoom.SceneUIList[i].FileName) == true) + var scene = HdlShardLogic.Current.GetShardSceneFromMemory(sceneId); + if (scene != null) { - listScene.Add(lookRoom.SceneUIList[i]); + listScene.Add(scene); } } if (listScene.Count == 0) @@ -171,45 +176,24 @@ HdlThreadLogic.Current.RunMainInThread(() => { - var listView = new VerticalFrameControl(29); + var listView = new VerticalFrameControl(3); listView.Y = Application.GetRealHeight(53); listView.Height = bodyFrameLayout.Height - Application.GetRealHeight(187); frameSceneTable.AddChidren(listView); foreach (var data in listScene) { - //鍦烘櫙鍥剧墖 - var frameContr = new FrameLayoutControl(); - frameContr.UseClickStatu = false; - frameContr.Height = Application.GetRealHeight(470); - listView.AddChidrenFrame(frameContr); - - //鍦烘櫙鍥剧墖 - var btnPic = new ImageView(); - btnPic.X = Application.GetRealWidth(179); - btnPic.Width = Application.GetRealWidth(844); - btnPic.Height = Application.GetRealHeight(420); - btnPic.ImagePath = data.IconPath; - btnPic.Radius = 17; - frameContr.AddChidren(btnPic); - - var btnName = new NormalViewControl(251, 282, true); - btnName.X = ControlCommonResourse.XXLeft; - btnName.Gravity = Gravity.CenterVertical; - btnName.BackgroundColor = 0xff333333; - btnName.Radius = 17; - btnName.Text = data.Name; - btnName.TextSize = 15; - btnName.TextColor = UserCenterColor.Current.White; - btnName.TextAlignment = TextAlignment.Center; - frameContr.AddChidren(btnName); + //鍦烘櫙鎺т欢 + var frameContr = new ScenePictrueControl(); + listView.AddChidren(frameContr); + frameContr.InitControl(data); var btnSelect = new IconViewControl(58); btnSelect.UnSelectedImagePath = "Item/ItemUnSelected.png"; btnSelect.SelectedImagePath = "Item/ItemSelected.png"; btnSelect.X = Application.GetRealWidth(887); btnSelect.Y = Application.GetRealHeight(35); - frameContr.AddChidren(btnSelect, ChidrenBindMode.BindEventOnly); + frameContr.AddChidren(btnSelect, ChidrenBindMode.BindEvent); if (dicSelectScene.ContainsKey(data.Id) == true) { btnSelect.IsSelected = true; @@ -264,13 +248,13 @@ } else { - var frameBack = new FrameLayoutControl(false); - frameBack.X = ControlCommonResourse.XXLeft; + var frameBack = new FrameLayout(); + frameBack.X = HdlControlResourse.XXLeft; frameBack.Y = Application.GetRealHeight(178); frameBack.BackgroundColor = UserCenterColor.Current.White; frameBack.Width = bodyFrameLayout.Width; frameBack.Height = Application.GetRealHeight(1650); - frameBack.RadiusEx = 20; + frameBack.Radius = (uint)Application.GetRealHeight(58); frameDeviceTable.AddChidren(frameBack); var listView = new VerticalListControl(23); @@ -292,7 +276,7 @@ /// </summary> /// <param name="dicData"></param> /// <param name="listView"></param> - private void InitDeviceObjectRow(Dictionary<int, List<CommonDevice>> dicData, VerticalListControl listView) + private void InitDeviceObjectRow(Dictionary<string, List<CommonDevice>> dicData, VerticalListControl listView) { var scrolContr = new RoomDeviceGroupMenuControl(dicData); this.frameDeviceTable.AddChidren(scrolContr); @@ -325,15 +309,15 @@ foreach (var device in listDevice) { var frameRow = new FrameRowControl(listView.rowSpace / 2); - frameRow.LeftOffset = Application.GetRealWidth(46) - ControlCommonResourse.XXLeft; - frameRow.RightOffset = -ControlCommonResourse.XXLeft; + frameRow.LeftOffset = Application.GetRealWidth(46) - HdlControlResourse.XXLeft; + frameRow.RightOffset = -HdlControlResourse.XXLeft; listView.AddChidren(frameRow); //鍥炬爣 var btnIcon = frameRow.AddLeftIcon(81); - Common.LocalDevice.Current.SetDeviceIconToControl(btnIcon, device); + HdlDeviceCommonLogic.Current.SetDeviceIconToControl(btnIcon, device); //鍚嶇О var btnView = frameRow.AddLeftCaption(string.Empty, 600); - btnView.Text = Common.LocalDevice.Current.GetDeviceEpointName(device); + btnView.Text = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device); btnView.TextSize = 15; //搴曠嚎 frameRow.AddBottomLine(); @@ -342,7 +326,7 @@ btnSelect.UnSelectedImagePath = "Item/ItemUnSelected.png"; btnSelect.SelectedImagePath = "Item/ItemSelected.png"; - string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device); + string mainKeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device); if (dicSelectDevice.ContainsKey(mainKeys) == true) { btnSelect.IsSelected = true; @@ -381,53 +365,19 @@ /// 鑾峰彇鍒嗙粍鍚庣殑璁惧 /// </summary> /// <returns></returns> - private Dictionary<int, List<CommonDevice>> GetAllGroupDevice() + private Dictionary<string, List<CommonDevice>> GetAllGroupDevice() { //鍏ㄩ儴鐨勮澶� var listDevice = this.GetShardListDevice(); - var dic = new Dictionary<int, List<CommonDevice>>(); + var dic = new Dictionary<string, List<CommonDevice>>(); foreach (var device in listDevice) { - var typeInfo = Common.LocalDevice.Current.GetNotHdlMyDeviceEnumInfo(new List<ZigBee.Device.CommonDevice>() { device }); - if (device.Type == DeviceType.IASZone) + var typeInfo = HdlDeviceCommonLogic.Current.GetDeviceBelongEnumInfo(device); + if (dic.ContainsKey(typeInfo.BeloneText) == false) { - //杩欎釜寮哄埗涓轰紶鎰熷櫒 - typeInfo.BeloneTextId = R.MyInternationalizationString.uDeviceBelongId1200; - typeInfo.ConcreteType = Common.DeviceConcreteType.Sensor; + dic[typeInfo.BeloneText] = new List<CommonDevice>(); } - if (device.Type == DeviceType.OnOffOutput) - { - //缁х數鍣ㄧ殑鏃跺��,闇�瑕佺壒娈婂鐞� - if (device.DfunctionType == DeviceFunctionType.A寮�鍏�) - { - typeInfo.BeloneTextId = R.MyInternationalizationString.uSwitch; - } - else if (device.DfunctionType == DeviceFunctionType.A鎻掑骇) - { - typeInfo.BeloneTextId = R.MyInternationalizationString.uSocket1; - } - else if (device.DfunctionType == DeviceFunctionType.A鐏厜) - { - typeInfo.BeloneTextId = R.MyInternationalizationString.uLight; - } - else - { - //缁х數鍣� - typeInfo.BeloneTextId = R.MyInternationalizationString.uDeviceBelongId2300; - } - if (dic.ContainsKey(typeInfo.BeloneTextId) == false) - { - dic[typeInfo.BeloneTextId] = new List<CommonDevice>(); - } - } - else - { - if (dic.ContainsKey(typeInfo.BeloneTextId) == false) - { - dic[typeInfo.BeloneTextId] = new List<CommonDevice>(); - } - } - dic[typeInfo.BeloneTextId].Add(device); + dic[typeInfo.BeloneText].Add(device); } return dic; } @@ -457,10 +407,10 @@ //纭鍒犻櫎閫夋嫨鐨勫叡浜満鏅拰鍔熻兘锛� this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uDeleteShardContentMsg), () => { - HdlThreadLogic.Current.RunThread(async () => + HdlThreadLogic.Current.RunThread(() => { //涓婁紶鏂囦欢 - var result = await HdlShardLogic.Current.DoDeleteSharedContent(memberShardInfo, this.lookRoom, listDevice, listScene); + var result = HdlShardLogic.Current.DeleteSharedContent(this.ChildAccountId, this.lookRoom, listDevice, listScene); if (result == true) { HdlThreadLogic.Current.RunMain(() => @@ -485,22 +435,12 @@ { //鑾峰彇杩欎釜鎴块棿閲岄潰鐨勫垎浜澶� var listDevice = new List<CommonDevice>(); - foreach (var deviceFile in this.lookRoom.DeviceUIFilePathList) + foreach (var deviceKey in this.lookRoom.ListDevice) { - if (memberShardInfo.dicAllShardKeys.ContainsKey(deviceFile) == true) + var device = HdlShardLogic.Current.GetShardDeviceFromMemory(deviceKey); + if (device != null) { - var strArry = deviceFile.Split('_'); - if (strArry.Length < 3) - { - continue; - } - //浠庡垎浜枃浠朵腑搴忓垪鍖栧洖鏉� - var deviceData = HdlShardLogic.Current.GetShardFileContent(deviceFile); - var device = ZigBee.Device.CommonDevice.CommonDeviceByByteString(strArry[1], System.Text.Encoding.UTF8.GetString(deviceData)); - if (device != null) - { - listDevice.Add(device); - } + listDevice.Add(device); } } return listDevice; -- Gitblit v1.8.0