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/Device/DeviceListMainForm.cs | 216 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 180 insertions(+), 36 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs index fefadb2..1c30f0e 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs @@ -1,4 +1,5 @@ 锘縰sing Shared.Common; +using Shared.Phone.UserCenter.SmartSound; using System; using System.Collections.Generic; using System.Text; @@ -12,7 +13,10 @@ public class DeviceListMainForm : EditorCommonForm { #region 鈻� 鍙橀噺澹版槑___________________________ - + /// <summary> + /// 鏅鸿兘闊崇 + /// </summary> + private MySmartSoundControl smmartSoundView = null; /// <summary> /// 缃戝叧鎺т欢 /// </summary> @@ -86,6 +90,18 @@ //娓呯┖bodyFrame this.ClearBodyFrame(); + smmartSoundView = new MySmartSoundControl(); + bodyFrameLayout.AddChidren(smmartSoundView); + smmartSoundView.InitControl(); + //褰撳墠涓嶆槸铏氭嫙浣忓畢鐨勮瘽 + if (Config.Instance.Home.IsVirtually == false) + { + smmartSoundView.ButtonClickEvent += (sernder, e) => + { + var form = new SmartSoundListForm(); + form.AddForm(); + }; + } //鍒濆鍖栫綉鍏宠鎺т欢 GatewayResourse.NowSelectGatewayId = GatewayResourse.AppOldSelectGatewayId; var nowGateway = HdlGatewayLogic.Current.GetLocalGateway(GatewayResourse.AppOldSelectGatewayId); @@ -135,7 +151,7 @@ listView.BeginHeaderRefreshingAction += () => { //鍒锋柊璁惧鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂� - UserView.UserPage.Instance.RefreshForm = true; + UserView.UserPage.Instance.RefreshAllForm = true; HdlThreadLogic.Current.RunThread(() => { @@ -232,7 +248,7 @@ //鎻愮ず鏂扮増鏈� var btnNew = new InformationTipView(rowMenu.btnIcon); btnNew.Visible = false; - rowMenu.frameTable.AddChidren(btnNew, ChidrenBindMode.BindEventOnly); + rowMenu.frameTable.AddChidren(btnNew, ChidrenBindMode.BindEvent); rowMenu.AddTag("btnNew", btnNew); //妫�娴嬭澶囨槸鍚︽嫢鏈夊畾浣嶇殑鍔熻兘 @@ -317,17 +333,52 @@ var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac); if (isShow == true) { - //灞曞紑妯″紡鏃讹紝鎵╁ぇ渚濇嵁涓�:瀹冩湁鍑犱釜瀛愭帶浠� - heightValue = (listDevice.Count + 1) * (ControlCommonResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace); - //鏍囬鑷繁灏辨槸涓�涓瓙鎺т欢 - if (rowInfo.frameTable.ChildrenCount == 1) + //澶囨敞锛氶潰鏉夸腑鍙樉绀虹湡瀹炵殑璁惧锛屽叾浠栧睘浜庣粦瀹氱殑鍥炶矾涓嶆樉绀� + //鑾峰彇杩欎竴鍫嗚澶囨椂灞炰簬浠�涔堢被鍨嬬殑 + var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice); + if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction) { - //鑾峰彇杩欎竴鍫嗚澶囨椂灞炰簬浠�涔堢被鍨嬬殑 - var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice); - foreach (CommonDevice info in listDevice) + var listTemp = Common.LocalDevice.Current.GetMutilfunctionPanelByMac(listDevice); + //灞曞紑妯″紡鏃讹紝鎵╁ぇ渚濇嵁涓�:瀹冩湁鍑犱釜瀛愭帶浠� + heightValue = (listTemp.Count + 1) * (ControlCommonResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace); + //鏍囬鑷繁灏辨槸涓�涓瓙鎺т欢 + if (rowInfo.frameTable.ChildrenCount == 1) { - //鍔犺浇瀹冪殑鍒楄〃 - this.AddDeviceDetailRow(rowInfo.frameTable, info, deviceEnumInfo); + foreach (CommonDevice info in listTemp) + { + //鍔犺浇瀹冪殑鍒楄〃 + this.AddDeviceDetailRow(rowInfo.frameTable, info, deviceEnumInfo); + } + } + } + else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir + || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment) + { + var listTemp = Common.LocalDevice.Current.GetPanelMatchEpointByMac(listDevice); + //灞曞紑妯″紡鏃讹紝鎵╁ぇ渚濇嵁涓�:瀹冩湁鍑犱釜瀛愭帶浠� + heightValue = (listTemp.Count + 1) * (ControlCommonResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace); + //鏍囬鑷繁灏辨槸涓�涓瓙鎺т欢 + if (rowInfo.frameTable.ChildrenCount == 1) + { + foreach (CommonDevice info in listTemp) + { + //鍔犺浇瀹冪殑鍒楄〃 + this.AddDeviceDetailRow(rowInfo.frameTable, info, deviceEnumInfo); + } + } + } + else + { + //灞曞紑妯″紡鏃讹紝鎵╁ぇ渚濇嵁涓�:瀹冩湁鍑犱釜瀛愭帶浠� + heightValue = (listDevice.Count + 1) * (ControlCommonResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace); + //鏍囬鑷繁灏辨槸涓�涓瓙鎺т欢 + if (rowInfo.frameTable.ChildrenCount == 1) + { + foreach (CommonDevice info in listDevice) + { + //鍔犺浇瀹冪殑鍒楄〃 + this.AddDeviceDetailRow(rowInfo.frameTable, info, deviceEnumInfo); + } } } } @@ -463,6 +514,27 @@ var form = new DeviceFunctionSettionForm(); form.AddForm(device, true); } + } + //绠�绾︾幆澧冮潰鏉跨殑鎸夐敭閰嶇疆 + else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment) + { + + if (device.Type == DeviceType.FreshAir || device.Type == DeviceType.Thermostat) + { + var form = new DevicePanel.PanelSimpleEnvironmentButtonSettionForm(); + form.AddForm(device); + } + else + { + var form = new DeviceFunctionSettionForm(); + form.AddForm(device, true); + } + } + //绠�绾︾幆澧冮潰鏉跨殑鎸夐敭閰嶇疆 + else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction) + { + var form = new DeviceFunctionSettionForm(); + form.AddForm(device, true); } //鏂规偊闈㈡澘 else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueTwo @@ -625,7 +697,7 @@ if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, nowGateway) == true) { //閲嶆柊璁剧疆浣忓畢ID(杩欎釜搴旇鏄笉缁忚繃APP,鐩存帴鎶婄綉鍏虫仮澶嶄簡鍑哄巶璁剧疆) - if (HdlGatewayLogic.Current.HomeIdIsEmpty(realWay.getGatewayBaseInfo.HomeId) == true) + if (HdlGatewayLogic.Current.HomeIdIsEmpty(realWay.HomeId) == true) { //鏄剧ず杩涘害鏉� ProgressBar.Show(); @@ -701,13 +773,14 @@ /// </summary> /// <param name="gateWay">缃戝叧瀵硅薄</param> /// <param name="online">鍦ㄧ嚎鐘舵�佸彉鏇村悗鐨勭姸鎬�</param> - public override void GatewayOnlinePush(ZbGateway gateWay, bool online) + /// <param name="hadGwOnline">2020.05.25杩藉姞:姝や綇瀹呮槸鍚︽嫢鏈夌綉鍏冲湪绾�</param> + public override void GatewayOnlinePush(ZbGateway gateWay, bool online, bool hadGwOnline) { if (this.gatewayViewRow == null) { return; } - if (HdlGatewayLogic.Current.GetGatewayId(gateWay) == this.gatewayViewRow.zbGatewayId) + if (gateWay.GwId == this.gatewayViewRow.zbGatewayId) { Application.RunOnMainThread(() => { @@ -753,18 +826,31 @@ string gwId = GatewayResourse.NowSelectGatewayId; HdlThreadLogic.Current.RunThread(() => { - System.Threading.Thread.Sleep(2000); - //杩欓噷涓昏鍙槸鑾峰彇鍦ㄧ嚎鐘舵�� - var list = LocalDevice.Current.GetDeviceOnlineList(gwId); - HdlThreadLogic.Current.RunMain(() => + if (this.Parent == null) { return; } + //鑾峰彇璁惧鍒楄〃 + var listDevice = Common.LocalDevice.Current.GetDeviceByGatewayID(gwId); + var listCheck = new List<string>(); + foreach (var device in listDevice) { - for (int i = 0; i < list.Count; i++) + if (this.Parent == null) { return; } + if (listCheck.Contains(device.DeviceAddr) == false) { - //璁剧疆璁惧鍦ㄧ嚎鐘舵�� - this.ReceiveDeviceStatu(list[i]); + //鍙涓�涓洖璺嵆鍙� + listCheck.Add(device.DeviceAddr); + var deviceInfo = Common.LocalDevice.Current.ReadDeviceEpointDeviceInfo(device); + if (deviceInfo != null) + { + //鍙樻洿鍦ㄧ嚎鐘舵�� + device.IsOnline = deviceInfo.IsOnline; + HdlThreadLogic.Current.RunMain(() => + { + //璁剧疆璁惧鍦ㄧ嚎鐘舵�� + this.ReceiveDeviceStatu(device); + }, ShowErrorMode.NO); + } + System.Threading.Thread.Sleep(30); } - - }, ShowErrorMode.NO); + } }); } @@ -788,13 +874,8 @@ var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys); if (localDevice != null) { - //鍦ㄧ嚎鐘舵�佷竴鏍风殑璇濓紝涓嶉渶瑕佸埛鏂� - if (localDevice.IsOnline != device.IsOnline) - { - //淇濆瓨鐘舵�� - localDevice.IsOnline = device.IsOnline; - localDevice.ReSave(); - } + //淇濆瓨鐘舵�� + localDevice.IsOnline = device.IsOnline; } rowInfo.MenuRow.IsOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(device); @@ -863,9 +944,9 @@ /// <param name="list">ota璁惧</param> private void CheckDeviceNewVersion(List<OTADevice> list) { - HdlThreadLogic.Current.RunThread(async () => + HdlThreadLogic.Current.RunThread(() => { - await System.Threading.Tasks.Task.Delay(2000); + System.Threading.Thread.Sleep(2000); foreach (var ota in list) { if (this.Parent == null) @@ -873,7 +954,7 @@ return; } //娣诲姞鍗囩骇鍥轰欢淇℃伅(鎴愪笉鎴愬姛閮芥棤鎵�璋�) - var result = await HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.ZigbeeDevice, ota.HwVersion.ToString(), ota.ImgTypeId.ToString()); + var result = HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.ZigbeeDevice, ota.HwVersion.ToString(), ota.ImgTypeId.ToString()); //鑾峰彇璁惧鏈�鏂扮増鏈� var deviceFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.ZigbeeDevice, @@ -887,7 +968,7 @@ } //鎷ユ湁鏂扮増鏈� - Application.RunOnMainThread(() => + HdlThreadLogic.Current.RunMain(() => { if (this.dicRowInfo.ContainsKey(ota.DeviceAddr) == true) { @@ -983,6 +1064,20 @@ if (device == null || device.DeviceAddr == null) { continue; + } + + //鑾峰彇璁惧绫诲瀷鐨� + var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); + if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_SimpleEnvironment) + { + foreach (var outClu in device.OutClusterList) + { + //鍘绘帀绠�绾︾幆澧冮潰鏉跨被鐨勫悇绉嶆湇鍔$璁惧锛屽鍐呮満涓嶆樉绀� + if (outClu.OutCluster == 513) + { + continue; + } + } } if (dic.ContainsKey(device.DeviceAddr) == false) { @@ -1126,9 +1221,10 @@ this.UseClickStatu = false; if (i_zbGateway != null) { - this.zbGatewayId = HdlGatewayLogic.Current.GetGatewayId(i_zbGateway); + this.zbGatewayId = i_zbGateway.GwId; } this.BackgroundColor = UserCenterColor.Current.White; + this.Y = Application.GetRealHeight(174); this.Height = Application.GetRealHeight(173); } @@ -1243,7 +1339,55 @@ } } } + #endregion + #region 鈻� 鑷畾涔夋櫤鑳介煶绠辨帶浠禵________________ + + /// <summary> + /// 鑷畾涔夌綉鍏虫帶浠� + /// </summary> + private class MySmartSoundControl : FrameRowControl + { + + /// <summary> + /// 缃戝叧鍚嶅瓧鎺т欢 + /// </summary> + private NormalViewControl btnName = null; + + /// <summary> + /// 鑷畾闊崇鍏虫帶浠� + /// </summary> + public MySmartSoundControl() + { + this.UseClickStatu = false; + this.BackgroundColor = UserCenterColor.Current.White; + this.Height = Application.GetRealHeight(173); + + //this.InitControl(); + } + + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + public void InitControl() + { + //鍥炬爣 + var btnIcon = this.AddLeftIcon(81); + btnIcon.UnSelectedImagePath = "SmartSound/SoundIcon.png"; + + //鏄剧ず鏂囨湰 + btnName = this.AddLeftCaption(string.Empty, 700); + btnName.Height = Application.GetRealHeight(60); + btnName.TextSize = 15; + btnName.Y = Application.GetRealHeight(57); + btnName.Text = "灏忓害灏忓害"; + + this.AddRightArrow(); + this.AddMostRightView("", 300, false).Name = "smartSoundLayout"; + this.AddBottomLine(); + } + } #endregion } } -- Gitblit v1.8.0