From 3272ca5b51e19f7f8a827b0f68400570a547fe60 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期二, 28 四月 2020 15:02:44 +0800 Subject: [PATCH] 2020-04-28-1 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs | 94 ++++++++++++++++++++++++++++++++-------------- 1 files changed, 65 insertions(+), 29 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs index 55c143d..9a6ce1c 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs @@ -24,6 +24,10 @@ /// </summary> private bool m_isOnline = false; /// <summary> + /// 浼犳劅鍣ㄦ帹閫佷腑 + /// </summary> + private bool sensorPushing = false; + /// <summary> /// 鍦ㄧ嚎鐘舵�� /// </summary> public bool isOnline @@ -42,13 +46,13 @@ /// </summary> public IconViewControl btnIcon = null; /// <summary> - /// 璁惧绫诲瀷鎺т欢 - /// </summary> - private NormalViewControl btnDeviceObject = null; - /// <summary> /// 璁惧澶囨敞鎺т欢 /// </summary> private NormalViewControl btnDeviceName = null; + /// <summary> + /// 璁惧鎴块棿鎺т欢 + /// </summary> + private NormalViewControl btnDeviceRoom = null; #endregion @@ -70,36 +74,29 @@ public void InitControl() { var listDevice = Common.LocalDevice.Current.GetDevicesByMac(this.deviceMac); + if (listDevice.Count == 0) + { + //閽堝鍗曠函鍙湁涓�涓�200绔偣鐨勮澶� + listDevice.Add(Common.LocalDevice.Current.GetOTADevice(this.deviceMac)); + } //鍥炬爣 btnIcon = frameTable.AddLeftIcon(81); - Common.LocalDevice.Current.SetDeviceBeloneIconToControl(btnIcon, listDevice); - - //璁惧绫诲瀷 - string objText = Common.LocalDevice.Current.GetDeviceObjectText(listDevice); - btnDeviceObject = frameTable.AddLeftCaption(objText, 800, 60, true); - btnDeviceObject.TextSize = 15; - //杩欎釜鍧愭爣鏈夌偣鐗规畩 - btnDeviceObject.Y = Application.GetRealHeight(12) + this.chidrenYaxis; - btnDeviceObject.Text = Common.LocalDevice.Current.GetDeviceObjectText(listDevice); - frameTable.AddChidren(btnDeviceObject, ChidrenBindMode.BindEventOnly); + Common.LocalDevice.Current.SetDeviceObjectIconToControl(btnIcon, listDevice); //璁惧 string deviceName = Common.LocalDevice.Current.GetDeviceMacName(listDevice[0]); - btnDeviceName = frameTable.AddLeftCaption(deviceName, 800, 49, true); - //杩欎釜鍧愭爣鏈夌偣鐗规畩 - btnDeviceName.Y = Application.GetRealHeight(72) + this.chidrenYaxis; - btnDeviceName.TextSize = 12; - btnDeviceName.TextColor = UserCenterColor.Current.TextGrayColor1; - btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceMacName(listDevice[0]); + btnDeviceName = frameTable.AddTopView(deviceName, 800); frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEventOnly); + + //鎴块棿 + string roomName = Common.LocalDevice.Current.GeteRealDeviceRoomName(listDevice[0]); + btnDeviceRoom = frameTable.AddBottomView(roomName, 800); //搴曠嚎 frameTable.AddBottomLine(); //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥 this.isOnline = listDevice[0].IsOnline == 1; - - listDevice = null; } #endregion @@ -114,11 +111,11 @@ { if (isOnline == false) { - btnDeviceObject.TextColor = UserCenterColor.Current.TextGrayColor1; + btnDeviceName.TextColor = UserCenterColor.Current.TextGrayColor1; } else { - btnDeviceObject.TextColor = UserCenterColor.Current.TextColor1; + btnDeviceName.TextColor = UserCenterColor.Current.TextColor1; } } @@ -135,17 +132,56 @@ hadRefresh = true; var listDevice = Common.LocalDevice.Current.GetDevicesByMac(this.deviceMac); + if (listDevice.Count == 0) + { + //閽堝鍗曠函鍙湁涓�涓�200绔偣鐨勮澶� + listDevice.Add(Common.LocalDevice.Current.GetOTADevice(this.deviceMac)); + } //鍥炬爣 - Common.LocalDevice.Current.SetDeviceBeloneIconToControl(btnIcon, listDevice); - //璁惧绫诲瀷 - btnDeviceObject.Text = Common.LocalDevice.Current.GetDeviceObjectText(listDevice); + Common.LocalDevice.Current.SetDeviceObjectIconToControl(btnIcon, listDevice); //璁惧 btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceMacName(listDevice[0]); + //璁惧鎴块棿 + btnDeviceRoom.Text = Common.LocalDevice.Current.GeteRealDeviceRoomName(listDevice[0]); //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥 this.isOnline = listDevice[0].IsOnline == 1; - - listDevice = null; } + + + /// <summary> + /// 鏄剧ず浼犳劅鍣ㄤ笂鎶ョ殑鐗规晥 + /// </summary> + public void StartSensorPushAppeal() + { + if (this.sensorPushing == true) + { + //浼犳劅鍣ㄦ鍦ㄧ壒鏁堜腑 + return; + } + this.sensorPushing = true; + //璁惧 + uint oldTextColor1 = btnDeviceName.TextColor; + btnDeviceName.TextColor = UserCenterColor.Current.TextOrangeColor; + //璁惧鎴块棿 + uint oldTextColor2 = btnDeviceRoom.TextColor; + btnDeviceRoom.TextColor = UserCenterColor.Current.TextOrangeColor; + HdlThreadLogic.Current.RunThread(() => + { + System.Threading.Thread.Sleep(5000); + HdlThreadLogic.Current.RunMain(() => + { + if (btnDeviceName.Parent != null) + { + //璁惧 + btnDeviceName.TextColor = oldTextColor1; + //璁惧鎴块棿 + btnDeviceRoom.TextColor = oldTextColor2; + } + this.sensorPushing = false; + }, ShowErrorMode.NO); + }); + } + #endregion } } -- Gitblit v1.8.0