From 9a4b76398009cf76c508d61f7e48fb6f5cb7ac2d Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期二, 21 七月 2020 09:46:53 +0800 Subject: [PATCH] 请合并最新多功能面板代码 --- ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs | 170 +++++++++++++++++++++----------------------------------- 1 files changed, 65 insertions(+), 105 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs index 20a5eea..2aadc19 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs @@ -19,7 +19,7 @@ /// <summary> /// 妗屽竷鎺т欢 /// </summary> - private FrameLayout frameTable = null; + private NormalFrameLayout frameTable = null; #endregion @@ -49,7 +49,7 @@ this.ClearBodyFrame(); //鍒濆鍖栨甯冩帶浠� - this.frameTable = new FrameLayout(); + this.frameTable = new NormalFrameLayout(); frameTable.Y = Application.GetRealHeight(187); frameTable.Height = bodyFrameLayout.Height - Application.GetRealHeight(187); bodyFrameLayout.AddChidren(frameTable); @@ -68,7 +68,7 @@ bodyFrameLayout.AddChidren(tabControl); tabControl.SelectTabEvent += (tabIndex) => { - if (tabIndex == 1) + if (tabIndex == 0) { //鏄剧ず鍦烘櫙鍒楄〃 this.ShowSceneList(); @@ -79,7 +79,11 @@ this.ShowFunctionList(); } }; - 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 @@ -95,42 +99,27 @@ this.frameTable.RemoveAll(); HdlThreadLogic.Current.RunMainInThread(() => { - if (lookRoom.SceneUIList.Count == 0) + if (lookRoom.ListSceneId.Count == 0) { //杩樻病鏈夋坊鍔犲満鏅摝 this.ShowNotDataImage(frameTable, Language.StringByID(R.MyInternationalizationString.uDoNotHadAddScenceMsg)); return; } - var listView = new VerticalFrameControl(29); + var listView = new VerticalFrameControl(3); listView.Height = frameTable.Height; frameTable.AddChidren(listView); - foreach (var data in lookRoom.SceneUIList) + foreach (var dataId in lookRoom.ListSceneId) { - var frameContr = new FrameLayout(); - frameContr.Height = Application.GetRealHeight(470); - frameContr.Gravity = Gravity.CenterHorizontal; - 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 = (uint)Application.GetRealHeight(17); - frameContr.AddChidren(btnPic); - - var btnName = new NormalViewControl(251, 282, true); - btnName.X = ControlCommonResourse.XXLeft; - btnName.Y = Application.GetRealHeight(58); - btnName.BackgroundColor = 0xff333333; - btnName.RadiusEx = 17; - btnName.Text = data.Name; - btnName.TextSize = 15; - btnName.TextColor = UserCenterColor.Current.White; - btnName.TextAlignment = TextAlignment.Center; - frameContr.AddChidren(btnName); + var data = HdlSceneLogic.Current.GetSceneUIBySceneId(dataId); + if (data == null) + { + continue; + } + //鍦烘櫙鎺т欢 + var frameContr = new ScenePictrueControl(); + listView.AddChidren(frameContr); + frameContr.InitControl(data); } }); } @@ -190,8 +179,12 @@ } } listView.AdjustRealHeight(Application.GetRealHeight(23)); - //寮�鍚澶囧湪绾跨洃娴� - this.StartCheckDeviceOnline(listView, listGwId, dicData); + //濡傛灉涓嶆槸铏氭嫙浣忓畢 + if (Common.Config.Instance.Home.IsVirtually == false) + { + //寮�鍚澶囧湪绾跨洃娴� + this.StartCheckDeviceOnline(listView, listGwId, dicData); + } }); } @@ -243,58 +236,20 @@ private Dictionary<int, DeviceRowInfo> GetAllGroupDevice() { //鍏ㄩ儴鐨勮澶� - var listDevice = lookRoom.GetRoomListDevice(); + var listDevice = HdlRoomLogic.Current.GetRoomListDevice(lookRoom); var dic = new Dictionary<int, DeviceRowInfo>(); 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); + //鎸夋墍灞濱D鍒嗙粍 + if (dic.ContainsKey(typeInfo.BeloneTextId) == false) { - //杩欎釜寮哄埗涓轰紶鎰熷櫒 - typeInfo.BeloneTextId = R.MyInternationalizationString.uDeviceBelongId1200; - typeInfo.ConcreteType = Common.DeviceConcreteType.Sensor; - } - if (device.Type == DeviceType.OnOffOutput) - { - string iconPath = string.Empty; - //缁х數鍣ㄧ殑鏃跺��,闇�瑕佺壒娈婂鐞� - if (device.DfunctionType == DeviceFunctionType.A寮�鍏�) - { - typeInfo.BeloneTextId = R.MyInternationalizationString.uSwitch; - iconPath = "Device/Switch.png"; - } - else if (device.DfunctionType == DeviceFunctionType.A鎻掑骇) - { - typeInfo.BeloneTextId = R.MyInternationalizationString.uSocket1; - iconPath = "Device/Socket1.png"; - } - else if (device.DfunctionType == DeviceFunctionType.A鐏厜) - { - typeInfo.BeloneTextId = R.MyInternationalizationString.uLight; - iconPath = "Device/Light.png"; - } - else - { - //缁х數鍣� - typeInfo.BeloneTextId = R.MyInternationalizationString.uDeviceBelongId2300; - iconPath = "Device/Relay.png"; - } - if (dic.ContainsKey(typeInfo.BeloneTextId) == false) - { - dic[typeInfo.BeloneTextId] = new DeviceRowInfo(); - dic[typeInfo.BeloneTextId].IconPath = iconPath; - } - } - else - { - if (dic.ContainsKey(typeInfo.BeloneTextId) == false) - { - dic[typeInfo.BeloneTextId] = new DeviceRowInfo(); - string path1 = string.Empty; - string path2 = string.Empty; - Common.LocalDevice.Current.GetDeviceBeloneIcon(typeInfo.ConcreteType, ref path1, ref path2); - dic[typeInfo.BeloneTextId].IconPath = path1; - } + dic[typeInfo.BeloneTextId] = new DeviceRowInfo(); + string path1 = string.Empty; + string path2 = string.Empty; + //鑾峰彇鍥剧墖 + Common.LocalDevice.Current.GetDeviceFunctionTypeMenuIcon(typeInfo.ConcreteType, ref path1, ref path2); + dic[typeInfo.BeloneTextId].IconPath = path1; } dic[typeInfo.BeloneTextId].listDeviceKeys.Add(Common.LocalDevice.Current.GetDeviceMainKeys(device)); } @@ -324,31 +279,36 @@ } //杩欓噷涓昏鍙槸鑾峰彇鍦ㄧ嚎鐘舵�� var zbway = HdlGatewayLogic.Current.GetLocalGateway(listGwId[i]); - var result = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, (device) => - { - string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device); - if (listView.Parent == null || dicData.ContainsKey(mainkeys) == false || listCheck.Contains(mainkeys) == true) - { - return; - } - listCheck.Add(mainkeys); + int statu = 0; + var list = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO); + if (statu != -1) + { + HdlThreadLogic.Current.RunMain(() => + { + for (int j = 0; j < list.Count; j++) + { + string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(list[j]); + if (listView.Parent == null || dicData.ContainsKey(mainkeys) == false || listCheck.Contains(mainkeys) == true) + { + return; + } + listCheck.Add(mainkeys); - var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys); - if (localDevice != null && localDevice.IsOnline != device.IsOnline) - { - //鍦ㄧ嚎鐘舵�佷竴鏍风殑璇濓紝涓嶉渶瑕佸埛鏂� - localDevice.IsOnline = device.IsOnline; - localDevice.ReSave(); - } - if (device.IsOnline == 1) - { - HdlThreadLogic.Current.RunMain(() => - { - dicData[mainkeys].OnlineCount += 1; - dicData[mainkeys].btnOnline.Text = dicData[mainkeys].OnlineCount + "/" + dicData[mainkeys].listDeviceKeys.Count; - }); - } - }, ShowErrorMode.NO); + var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys); + if (localDevice != null && localDevice.IsOnline != list[j].IsOnline) + { + //鍦ㄧ嚎鐘舵�佷竴鏍风殑璇濓紝涓嶉渶瑕佸埛鏂� + localDevice.IsOnline = list[j].IsOnline; + localDevice.ReSave(); + } + if (Common.LocalDevice.Current.CheckDeviceIsOnline(list[j]) == true) + { + dicData[mainkeys].OnlineCount += 1; + dicData[mainkeys].btnOnline.Text = dicData[mainkeys].OnlineCount + "/" + dicData[mainkeys].listDeviceKeys.Count; + } + } + }); + } } }); } -- Gitblit v1.8.0