From 48ba446936b51fffafa7c3600c0dadc6ac0e8c20 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期五, 10 七月 2020 10:52:13 +0800 Subject: [PATCH] 2020-07-10-01 --- ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs | 101 +++++++++++++------------------------------------- 1 files changed, 27 insertions(+), 74 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs index b42621a..bb545c2 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs @@ -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> @@ -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,12 +159,15 @@ this.frameSceneTable.RemoveAll(); var listScene = new List<Common.SceneUI>(); - for (int i = 0; i < lookRoom.SceneUIList.Count; i++) + for (int i = 0; i < lookRoom.ListSceneId.Count; i++) { - if (HdlShardLogic.Current.IsFileExists(lookRoom.SceneUIList[i].FileName) == true) + var byteData = HdlShardLogic.Current.GetShardFileContent($"Scene_{lookRoom.ListSceneId[i]}.json"); + if (byteData == null) { - listScene.Add(lookRoom.SceneUIList[i]); + continue; } + var sceneUi = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.SceneUI>(System.Text.Encoding.UTF8.GetString(byteData)); + listScene.Add(sceneUi); } if (listScene.Count == 0) { @@ -171,45 +178,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 +250,13 @@ } else { - var frameBack = new FrameLayoutControl(false); + var frameBack = new FrameLayout(); frameBack.X = ControlCommonResourse.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); @@ -388,44 +374,10 @@ var dic = new Dictionary<int, 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 = Common.LocalDevice.Current.GetDeviceBelongEnumInfo(device); + if (dic.ContainsKey(typeInfo.BeloneTextId) == false) { - //杩欎釜寮哄埗涓轰紶鎰熷櫒 - typeInfo.BeloneTextId = R.MyInternationalizationString.uDeviceBelongId1200; - typeInfo.ConcreteType = Common.DeviceConcreteType.Sensor; - } - 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] = new List<CommonDevice>(); } dic[typeInfo.BeloneTextId].Add(device); } @@ -485,8 +437,9 @@ { //鑾峰彇杩欎釜鎴块棿閲岄潰鐨勫垎浜澶� var listDevice = new List<CommonDevice>(); - foreach (var deviceFile in this.lookRoom.DeviceUIFilePathList) + foreach (var deviceKeys in this.lookRoom.ListDevice) { + string deviceFile = HdlShardLogic.Current.GetShardDeviceFileName(deviceKeys); if (memberShardInfo.dicAllShardKeys.ContainsKey(deviceFile) == true) { var strArry = deviceFile.Split('_'); -- Gitblit v1.8.0