From f3e65daca7978b21b5888f49b1bf35e1a6e5d4fd Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 13 七月 2020 12:33:31 +0800 Subject: [PATCH] 新版本 --- ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs | 120 +++++++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 94 insertions(+), 26 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs b/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs index 737c569..38c1f5b 100755 --- a/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs +++ b/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs @@ -100,16 +100,21 @@ Common.LocalDevice.Current.SetDeviceIconToControl(btnDeviceIcon, i_device); frameIconBackGroud.AddChidren(btnDeviceIcon); //閲嶆柊缁戝畾浜嬩欢 - this.frameTable.ChangedChidrenBindMode(frameIconBackGroud, ChidrenBindMode.BindEventOnly); + this.frameTable.ChangedChidrenBindMode(frameIconBackGroud, ChidrenBindMode.BindEvent); //璁惧鍚嶅瓧 this.btnDeviceName = new NormalViewControl(600, 60, true); + if (this.device.Type == DeviceType.WindowCoveringDevice) + { + //绐楀笜鍥犱负鍙宠竟鏈変笁涓寜閽�,鎵�浠ラ渶瑕佹墍鏈夊悕瀛楃殑瀹藉害 + this.btnDeviceName.Width = Application.GetRealWidth(360); + } btnDeviceName.X = Application.GetRealWidth(181); //褰撴寚瀹氬疄闄呭潗鏍囨椂,杩欓噷闇�瑕佺殑鍋忕Щ閲忎负2鍊� btnDeviceName.Y = Application.GetRealHeight(16) + this.chidrenYaxis * 2; btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device); btnDeviceName.SelectedTextColor = Common.ZigbeeColor.Current.GXCTextSelectedColor; - this.frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEventOnly); + this.frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEvent); if (this.hadStatuFunction == false) { @@ -127,7 +132,7 @@ btnStatu.Y = Application.GetRealHeight(70) + this.chidrenYaxis * 2; btnStatu.TextSize = 10; btnStatu.TextColor = UserCenterColor.Current.TextGrayColor1; - this.frameTable.AddChidren(btnStatu, ChidrenBindMode.BindEventOnly); + this.frameTable.AddChidren(btnStatu, ChidrenBindMode.BindEvent); } //搴曠嚎 @@ -258,31 +263,13 @@ { this.btnStatu.Text = HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device); } - - if (this.btnDeviceName.IsSelected == isOpen) - { - //鐘舵�佷竴鏍�,鍒欎笉闇�瑕佸鐞� - return; - } - //璁惧鍚嶇О鎺т欢 - this.btnDeviceName.IsSelected = isOpen; - this.btnDeviceName.IsBold = isOpen; - //璁惧鐨勮儗鏅渾鍦堝浘 - if (isOpen == true) - { - this.frameIconBackGroud.BackgroundColor = Common.ZigbeeColor.Current.GXCSelectedBackgroundColor; - } - else - { - this.frameIconBackGroud.BackgroundColor = Common.ZigbeeColor.Current.GXCGrayBackgroundColor; - } - //璁惧鍥炬爣鎺т欢 - this.btnDeviceIcon.IsSelected = isOpen; //寮�鍏虫帶浠� - if (this.btnSwitch != null) + if (this.btnSwitch != null && this.btnSwitch.IsSelected != isOpen) { this.btnSwitch.IsSelected = isOpen; } + //鍒囨崲鍗$墖鐘舵�佺壒鏁� + this.SwitchRowStatuAppeal(isOpen); } /// <summary> @@ -394,7 +381,7 @@ this.ResponeResult = 0; HdlThreadLogic.Current.RunThread(() => { - int waitime = 30; + int waitime = 40; while (waitime > 0) { System.Threading.Thread.Sleep(100); @@ -404,8 +391,15 @@ break; } waitime--; + //2绉掔殑鏃跺��,杩樻槸鎺ュ彈涓嶅埌鐨勮瘽,寮哄埗鍐嶆鍒锋柊璁惧鐘舵�� + if (waitime == 20) + { + //浠庢柊鍙戦�佽幏鍙栬澶囩殑鐘舵��(寮哄埗) + this.device.HadReadDeviceStatu = false; + this.SendStatuComand(); + } } - if (waitime <= 0) + if (waitime <= 0 && this.Parent != null) { //娌℃湁鑾峰彇寰楀埌缁撴灉 HdlThreadLogic.Current.RunMain(() => @@ -452,6 +446,80 @@ #endregion + #region 鈻� 琛岄棯鐑佺壒鏁坃________________________ + + /// <summary> + /// 鏄惁澶勪簬鐗规晥涓� + /// </summary> + private bool isAppeal = false; + /// <summary> + /// 寮�鍚闂儊鐗规晥 + /// </summary> + public void StartRowLightAppeal() + { + //璁惧鐘舵�佸繀椤诲埛鏂� + this.btnStatu.Text = HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device); + + if (this.isAppeal == true) { return; } + this.isAppeal = true; + + HdlThreadLogic.Current.RunThread(() => + { + //闂儊5绉�,闂撮殧400姣 + int count = 5000 / 400; + bool isOpen = false; + while (this.Parent != null && count >= 0) + { + //闂儊鐗规晥 + HdlThreadLogic.Current.RunMain(() => + { + isOpen = !isOpen; + this.SwitchRowStatuAppeal(isOpen); + }); + System.Threading.Thread.Sleep(400); + count--; + } + if (this.Parent != null && isOpen == false) + { + HdlThreadLogic.Current.RunMain(() => + { + //缁撴潫鏃�,榛樿涓烘墦寮�鐗规晥 + this.SwitchRowStatuAppeal(true); + }, ShowErrorMode.NO); + } + this.isAppeal = false; + + }, ShowErrorMode.NO); + } + + /// <summary> + /// 鍒囨崲鍗$墖鐘舵�佺壒鏁� + /// </summary> + private void SwitchRowStatuAppeal(bool isOpen) + { + if (this.btnDeviceName.IsSelected == isOpen) + { + //鐘舵�佷竴鏍�,鍒欎笉闇�瑕佸鐞� + return; + } + //璁惧鍚嶇О鎺т欢 + this.btnDeviceName.IsSelected = isOpen; + this.btnDeviceName.IsBold = isOpen; + //璁惧鐨勮儗鏅渾鍦堝浘 + if (isOpen == true) + { + this.frameIconBackGroud.BackgroundColor = Common.ZigbeeColor.Current.GXCSelectedBackgroundColor; + } + else + { + this.frameIconBackGroud.BackgroundColor = Common.ZigbeeColor.Current.GXCGrayBackgroundColor; + } + //璁惧鍥炬爣鎺т欢 + this.btnDeviceIcon.IsSelected = isOpen; + } + + #endregion + #region 鈻� 鎺т欢鎽ф瘉___________________________ /// <summary> -- Gitblit v1.8.0