From d978b68da978982b35dd7d7da27217925cf8d788 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期三, 29 四月 2020 09:34:28 +0800
Subject: [PATCH] 完整版的虚拟设备功能
---
ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs | 48 +++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs
index 7e06c98..cf2a242 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs
@@ -20,6 +20,10 @@
/// </summary>
private VerticalListControl listview = null;
/// <summary>
+ /// 璁惧澶囨敞鎺т欢
+ /// </summary>
+ private FrameCaptionInputControl btnNote = null;
+ /// <summary>
/// 淇濆瓨榛樿鍚嶅瓧(涓昏閽堝娌℃湁淇敼鍚嶅瓧鐨勬椂鍊欙紝蹇呴』瑕佺粰涓�涓粯璁ゅ悕瀛楃粰缃戝叧)
/// </summary>
private string saveDefultName = string.Empty;
@@ -49,6 +53,8 @@
//璁剧疆鍏ㄩ儴鍥炶矾鐨勯粯璁ゅ悕瀛�
this.SetAllEpointName();
+ // 璁剧疆缃戝叧鎵�鍦ㄧ殑鏃跺尯鐨勬椂闂寸粰闂ㄩ攣鏃堕棿
+ this.SetDoorTime();
}
/// <summary>
@@ -95,7 +101,7 @@
//璁惧澶囨敞
string caption = Language.StringByID(R.MyInternationalizationString.uDeviceNote);
string deviceName = Common.LocalDevice.Current.GetDeviceMacName(listNewDevice[0]);
- var btnNote = new FrameCaptionInputControl(caption, deviceName, listview.rowSpace / 2);
+ this.btnNote = new FrameCaptionInputControl(caption, deviceName, listview.rowSpace / 2);
listview.AddChidren(btnNote);
btnNote.InitControl();
//鍒掔嚎
@@ -121,22 +127,31 @@
//鍒掔嚎
btnType.AddBottomLine();
- //鎵�灞炲尯鍩�
+ //瀹夎浣嶇疆
var rowBeloneArea = new BelongAreaControl(listview.rowSpace / 2);
listview.AddChidren(rowBeloneArea);
- rowBeloneArea.InitControl(Language.StringByID(R.MyInternationalizationString.uBelongArea), this.listNewDevice);
+ rowBeloneArea.InitControl(Language.StringByID(R.MyInternationalizationString.uInstallationLocation), this.listNewDevice);
//搴曠嚎
rowBeloneArea.AddBottomLine();
var listCheck = new List<string>();
rowBeloneArea.SelectRoomEvent += (roomKeys) =>
{
+ //閫夋嫨鏈垎閰嶆椂,娓呯┖
+ if (roomKeys == string.Empty) { listCheck = new List<string>(); }
foreach (var device in this.listNewDevice)
{
if (device is OTADevice)
{
continue;
}
+ if (roomKeys == string.Empty)
+ {
+ //濡傛灉閫夋嫨鐨勬槸鏈垎閰嶏紝鍒欏畠鐨勫叏閮ㄥ洖璺棤鏉′欢鍏ㄩ儴娓呯┖鎴块棿
+ HdlRoomLogic.Current.ChangedRoom(device, roomKeys);
+ continue;
+ }
+
var room = HdlRoomLogic.Current.GetRoomByDevice(device);
string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
if (room == null)
@@ -164,6 +179,11 @@
btnHelp.Text = Language.StringByID(R.MyInternationalizationString.uMoreSettion);
btnHelp.ButtonClickEvent += (sender, e) =>
{
+ //鏇存敼杩囦竴娆′箣鍚庯紝鍒欑晫闈㈠叧闂悗涓嶅啀鏇存敼
+ this.saveDefultName = string.Empty;
+ //鏀瑰悕瀛�
+ btnNote.txtInput.FinishInputEvent();
+
var form = new DeviceMacInfoEditorForm();
form.AddForm(this.listNewDevice[0].DeviceAddr);
};
@@ -217,6 +237,10 @@
detailBackFrame.AddChidren(btnFinish);
btnFinish.MouseUpEventHandler += (sender, e) =>
{
+ //鏇存敼杩囦竴娆′箣鍚庯紝鍒欑晫闈㈠叧闂悗涓嶅啀鏇存敼
+ this.saveDefultName = string.Empty;
+ //鏀瑰悕瀛�
+ btnNote.txtInput.FinishInputEvent();
//鍏抽棴鑷韩
this.CloseForm();
};
@@ -262,6 +286,24 @@
}
}
+ /// <summary>
+ /// 璁剧疆缃戝叧鎵�鍦ㄧ殑鏃跺尯鐨勬椂闂寸粰闂ㄩ攣鏃堕棿
+ /// </summary>
+ private async void SetDoorTime()
+ {
+ //濡傛灉鏄棬閿�
+ if (this.listNewDevice[0].Type == DeviceType.DoorLock)
+ {
+ var doorLock = this.listNewDevice[0] as ZigBee.Device.DoorLock;
+ //1銆佸叆缃戝悗鍏堣幏鍙栭棬閿佸湪缃戝叧涓殑鏃跺尯鏃堕棿
+ var curDateTime = DoorLock.DoorLockCommonInfo.GetDoorLockZoneTime();
+ //2銆佸皢鏃堕棿璁剧疆鍒扮綉鍏充腑
+ var dateTime = new DateTime(curDateTime.Year, curDateTime.Month, curDateTime.Day, curDateTime.Hour, curDateTime.Minute, curDateTime.Second);
+ var setTimestamp = DoorLock.DoorLockCommonInfo.GetUnixTimeStamp(dateTime);
+ await doorLock.RectifyDoorLockTimeAsync(int.Parse(setTimestamp));
+ }
+ }
+
#endregion
#region 鈻� 鐢婚潰鍏抽棴___________________________
--
Gitblit v1.8.0