From dc0309e64f02227d8e1468b7326c07955f804612 Mon Sep 17 00:00:00 2001 From: chenqiyang <1406175257@qq.com> Date: 星期三, 22 六月 2022 11:22:18 +0800 Subject: [PATCH] 修改引用路径 --- ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs | 235 +++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 188 insertions(+), 47 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs b/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs index 4dc0ec2..8874393 100755 --- a/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs +++ b/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs @@ -46,6 +46,10 @@ /// </summary> private MostRightIconControl btnSwitch = null; /// <summary> + /// 鐢垫睜鎺т欢 + /// </summary> + private IconViewControl btnBattery = null; + /// <summary> /// 鏄惁鑾峰彇缃戝叧鍙嶉鐨勭粨鏋� 0:娌℃湁鑾峰彇寰楀埌 1:宸茬粡鑾峰彇寰楀埌 /// </summary> private int ResponeResult = 0; @@ -53,6 +57,10 @@ /// 鍒ゆ柇鏄惁鏈夊紑鍏冲姛鑳� /// </summary> private bool isHadOpenSwitch = true; + /// <summary> + /// 褰撳墠閫夋嫨鐨勬埧闂� + /// </summary> + public Common.Room nowSelectRoom = null; #endregion @@ -61,8 +69,7 @@ /// <summary> /// 鏈垎閰嶇晫闈㈢殑璁惧閫夋嫨鎺т欢 /// </summary> - /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(鐪熷疄鍊�,鏈変簺鐣岄潰闇�瑕佽繖绉嶇壒娈婃搷浣�)</param> - public DeviceRowCommon(int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) + public DeviceRowCommon() { this.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft); this.Width = Application.GetRealWidth(1022); @@ -72,16 +79,18 @@ /// 鍒濆鍖栨帶浠� /// </summary> /// <param name="i_device">璁惧瀵硅薄</param> - public virtual void InitControl(CommonDevice i_device) + /// <param name="i_nowSelectRoom">褰撳墠閫夋嫨鐨勬埧闂�(鏈夌偣鐢ㄥ)</param> + public virtual void InitControl(CommonDevice i_device, Common.Room i_nowSelectRoom) { this.device = i_device; + this.nowSelectRoom = i_nowSelectRoom; //璁惧鍥炬爣鑳屾櫙鎺т欢 this.frameIconBackGroud = new FrameLayout(); - frameIconBackGroud.Height = Application.GetMinRealAverage(112); - frameIconBackGroud.Width = Application.GetMinRealAverage(112); + frameIconBackGroud.Height = this.GetPictrueRealSize(112); + frameIconBackGroud.Width = this.GetPictrueRealSize(112); frameIconBackGroud.Gravity = Gravity.CenterVertical; frameIconBackGroud.X = Application.GetRealWidth(46); - frameIconBackGroud.Radius = (uint)Application.GetMinRealAverage(112 / 2); + frameIconBackGroud.Radius = (uint)this.GetPictrueRealSize(112 / 2); frameIconBackGroud.BackgroundColor = Common.ZigbeeColor.Current.GXCGrayBackgroundColor; this.frameTable.AddChidren(frameIconBackGroud, ChidrenBindMode.NotBind); if (chidrenYaxis != 0) @@ -95,15 +104,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.device.Type == DeviceType.Airer) + { + //绐楀笜鍥犱负鍙宠竟鏈変笁涓寜閽�,鎵�浠ラ渶瑕佺缉灏忓悕瀛楃殑瀹藉害 + this.btnDeviceName.Width = Application.GetRealWidth(360); + } btnDeviceName.X = Application.GetRealWidth(181); - btnDeviceName.Y = Application.GetRealHeight(16) + this.chidrenYaxis; + //褰撴寚瀹氬疄闄呭潗鏍囨椂,杩欓噷闇�瑕佺殑鍋忕Щ閲忎负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) { @@ -117,10 +132,11 @@ //鐘舵�� this.btnStatu = new NormalViewControl(600, 50, true); btnStatu.X = Application.GetRealWidth(181); - btnStatu.Y = Application.GetRealHeight(70) + this.chidrenYaxis; + //褰撴寚瀹氬疄闄呭潗鏍囨椂,杩欓噷闇�瑕佺殑鍋忕Щ閲忎负2鍊� + 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); } //搴曠嚎 @@ -135,20 +151,36 @@ btnSwitch.UnSelectedImagePath = "Item/Switch.png"; btnSwitch.SelectedImagePath = "Item/SwitchSelected.png"; + //鐢垫睜鎺т欢 + if (this.device.Type == DeviceType.IASZone) + { + this.btnBattery = new IconViewControl(69); + btnBattery.X = this.Width - Application.GetRealWidth(69 + 29); + btnBattery.UnSelectedImagePath = "Item/Battery.png"; + btnBattery.Gravity = Gravity.CenterVertical; + this.frameTable.AddChidren(btnBattery, ChidrenBindMode.BindEvent); + if (chidrenYaxis != 0) + { + btnBattery.Y += chidrenYaxis; + } + if (this.device.IsBatteryDown == false) + { + btnBattery.Visible = false; + } + } + //鍒嗕韩鐨勬埧闂�,鍒欎笉鑳界紪杈戝拰鍒犻櫎 - if (HdlRoomLogic.Current.CurrentRoom.IsSharedRoom == false) + if (this.nowSelectRoom.IsSharedRoom == false) { //缂栬緫 var btnEditor = this.AddEditorControl(); btnEditor.ButtonClickEvent += (sender, e) => { - //鍏抽棴宸︽粦鑿滃崟 - this.HideMenu(); var detailInfo = new MainPage.DeviceDetailInfoForm(); - detailInfo.AddForm(i_device, HdlRoomLogic.Current.CurrentRoom); - detailInfo.FormCloseEvent += (curDevice, curRoom) => + detailInfo.AddForm(i_device, this.nowSelectRoom); + detailInfo.FormCloseEvent += () => { - if (HdlRoomLogic.Current.CurrentRoom.IsLove == true) + if (this.nowSelectRoom.IsLove == true) { //褰撳墠鏄枩鐖辨埧闂存椂 if (HdlRoomLogic.Current.IsCollectInRoom(this.device) == false) @@ -160,7 +192,8 @@ return; } } - else if (HdlRoomLogic.Current.CurrentRoom.Id != curRoom.Id) + var curRoom = HdlRoomLogic.Current.GetRoomByDevice(this.device); + if (curRoom == null || this.nowSelectRoom.Id != curRoom.Id) { //鍥炶皟鎺т欢琚Щ闄ょ殑浜嬩欢 this.RowNeedRemoveEvent?.Invoke(); @@ -183,7 +216,7 @@ { //绉婚櫎鏀惰棌(涓嶇浠�涔堟儏鍐�,鏀惰棌閮借绉婚櫎) HdlRoomLogic.Current.DeleteLoveDevice(i_device); - if (HdlRoomLogic.Current.CurrentRoom.IsLove == false) + if (this.nowSelectRoom.IsLove == false) { //浠庢埧闂翠腑绉婚櫎 HdlRoomLogic.Current.DeleteDevice(i_device); @@ -191,6 +224,8 @@ //鍥炶皟鎺т欢琚Щ闄ょ殑浜嬩欢 this.RowNeedRemoveEvent?.Invoke(); this.RemoveFromParent(); + //涓婁紶绌洪棿鍖哄煙淇℃伅 + HdlRoomLogic.Current.SetRoomInfoToGateway(); }; }; } @@ -238,6 +273,13 @@ //绛夊緟缃戝叧鍥炲鍚庝細閲嶆柊鍒锋柊,涓嶇劧涓�鐩存槸鍏抽棴鐘舵�� isOpen = false; } + //濡傛灉鏄紶鎰熷櫒绫�,鍒欓粯璁ゆ槸鍏崇殑鏁堟灉 + if (this.device.Type == DeviceType.PMSensor || this.device.Type == DeviceType.IASZone + || this.device.Type == DeviceType.TemperatureSensor) + { + isOpen = false; + } + this.SetRowOpenStatu(isOpen); } @@ -252,31 +294,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> @@ -331,7 +355,7 @@ //濡傛灉杩欎釜鍑芥暟琚噸鍐欑殑璇�,鍒欎唬琛ㄨ繖涓澶囨湁寮�鍏冲姛鑳� this.isHadOpenSwitch = false; //榛樿鐢ㄥ湪绾跨姸鎬佹潵鍒ゆ柇 - return i_device.IsOnline == 1; + return Common.LocalDevice.Current.CheckDeviceIsOnline(i_device); } @@ -343,10 +367,9 @@ /// 娣卞害鍗$墖淇℃伅鐨勮繑鍥炰簨浠�(搴曞眰涓撶敤) /// </summary> /// <param name="device">璁惧</param> - /// <param name="room">鎴块棿</param> - public void CardDetailInfoBackEvent(CommonDevice device, Common.Room room) + public void CardDetailInfoBackEvent(CommonDevice device) { - if (HdlRoomLogic.Current.CurrentRoom.IsLove == true) + if (this.nowSelectRoom.IsLove == true) { //宸茬粡鍙栨秷鐨勬敹钘� if (HdlRoomLogic.Current.IsCollectInRoom(device) == false) @@ -362,7 +385,7 @@ { //濡傛灉杩欎釜璁惧鏀瑰彉浜嗘埧闂寸殑璇�,鍥炶皟鍗$墖琚垹闄ょ殑鍑芥暟 var nowRoom = HdlRoomLogic.Current.GetRoomByDevice(device); - if (nowRoom == null || nowRoom.Id != HdlRoomLogic.Current.CurrentRoom.Id) + if (nowRoom == null || nowRoom.Id != this.nowSelectRoom.Id) { //鍥炶皟鎺т欢琚Щ闄ょ殑浜嬩欢 this.RowNeedRemoveEvent?.Invoke(); @@ -389,7 +412,7 @@ this.ResponeResult = 0; HdlThreadLogic.Current.RunThread(() => { - int waitime = 30; + int waitime = 40; while (waitime > 0) { System.Threading.Thread.Sleep(100); @@ -399,8 +422,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(() => @@ -420,6 +450,43 @@ public void SetHadGetResponeResultStatu() { this.ResponeResult = 1; + } + + /// <summary> + /// 鎺ユ敹缃戝叧鍥炲鐨勭姸鎬�(true:宸茬粡鎺ユ敹鍒扮綉鍏崇殑鍥炲 false:杩樻病鏈夋帴鏀跺埌缃戝叧鍥炲) + /// </summary> + /// <returns></returns> + public bool ReceiveResponeResultStatu() + { + return this.ResponeResult == 1; + } + + #endregion + + #region 鈻� 鏄剧ず浣庣數閲廮________________________ + + /// <summary> + /// 鍒锋柊鐢垫睜鐢甸噺鐘舵�� + /// </summary> + public void RefreshBatteryStatu() + { + if (this.btnBattery == null) { return; } + if (this.device.IsBatteryDown == true) + { + //鐢甸噺浣�,鏄剧ず鍥炬爣 + if (this.btnBattery.Visible == false) + { + this.btnBattery.Visible = true; + } + } + else + { + //鐢甸噺瓒冲,闅愯棌鍥炬爣 + if (this.btnBattery.Visible == true) + { + this.btnBattery.Visible = false; + } + } } #endregion @@ -447,6 +514,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> + public 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