From 54d13b13d33f455122a92aef1bc6f700d31535b1 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 01 六月 2023 10:23:29 +0800
Subject: [PATCH] 去掉调试代码
---
HDL_ON/UI/UI2/FuntionControlView/DoorLock/DoorLockPage.cs | 300 +++++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 239 insertions(+), 61 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/DoorLock/DoorLockPage.cs b/HDL_ON/UI/UI2/FuntionControlView/DoorLock/DoorLockPage.cs
index 6b7887f..a3d0b18 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/DoorLock/DoorLockPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/DoorLock/DoorLockPage.cs
@@ -6,6 +6,7 @@
using HDL_ON.UI.CSS;
using HDL_ON.Entity;
using HDL_ON.DriverLayer;
+using HDL_ON.DAL.Server;
namespace HDL_ON.UI
{
@@ -73,6 +74,8 @@
/// </summary>
private Dictionary<string, string> dicText = new Dictionary<string, string>();
+
+
#endregion
#region 鈻� 鍒濆鍖朹____________________________
@@ -117,6 +120,47 @@
this.RefreshFormStatu();
//璇诲彇璁惧鐘舵��
Control.Ins.SendReadCommand(device);
+
+ // 鑾峰彇涓存椂瀵嗙爜
+ GetTempPwd();
+ }
+
+ /// <summary>
+ /// 鑾峰彇涓存椂瀵嗙爜
+ /// </summary>
+ private void GetTempPwd()
+ {
+ new System.Threading.Thread(() =>
+ {
+ try
+ {
+ var pack = Common.ApiUtlis.Ins.HttpRequest.GetDoorTempPassword(device.deviceId);
+ if (pack != null)
+ {
+ Application.RunOnMainThread(() =>
+ {
+ if (pack.Code == StateCode.SUCCESS)
+ {
+ var tempPasswrodObj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<DoorTempPassword>>(pack.Data.ToString());
+ if (tempPasswrodObj.Count > 0)
+ {
+ doorLockData.TempPassword = tempPasswrodObj[0].pwd;
+ doorLockData.StartTimeTick = tempPasswrodObj[0].beginTime;
+ doorLockData.EndTimeTick = tempPasswrodObj[0].endTime;
+ doorLockData.PwdId = tempPasswrodObj[0].pwdId;
+ this.InitTempPasswordControl();
+ }
+ }
+ });
+ }
+ }
+ catch (Exception ex)
+ {
+ MainPage.Log($"鑾峰彇涓存椂瀵嗙爜寮傚父:{ex.Message}");
+ }
+ })
+ { IsBackground = true }.Start();
+
}
/// <summary>
@@ -185,37 +229,43 @@
frameTempPsw.Visible = false;
FrameWhiteCentet1.AddChidren(frameTempPsw);
- ////澹伴煶
- //this.btnVoice = new IconViewControl(24);
- //btnVoice.UnSelectedImagePath = "FunctionIcon/DoorLock/Voice.png";
- //btnVoice.X = Application.GetRealWidth(23);
- //btnVoice.Y = Application.GetRealHeight(410);
- //FrameWhiteCentet1.AddChidren(btnVoice);
+
+ //澹伴煶
+ this.btnVoice = new IconViewControl(24);
+ btnVoice.UnSelectedImagePath = "FunctionIcon/DoorLock/Voice.png";
+ btnVoice.X = Application.GetRealWidth(23);
+ btnVoice.Y = Application.GetRealHeight(410);
+ FrameWhiteCentet1.AddChidren(btnVoice);
- ////澹伴煶鐨勬粦鍔ㄦ潯
- //this.seekBarVoiceControl = new SeekBarImageControl(215);
- //seekBarVoiceControl.Gravity = Gravity.CenterHorizontal;
- //FrameWhiteCentet1.AddChidren(seekBarVoiceControl);
- //seekBarVoiceControl.Y = btnVoice.Y - (seekBarVoiceControl.Height - btnVoice.Height) / 2;
- ////缁戝畾PageLayout鎺т欢
- //seekBarVoiceControl.BindPageLayout();
+ //澹伴煶鐨勬粦鍔ㄦ潯
+ this.seekBarVoiceControl = new SeekBarImageControl(215);
+ seekBarVoiceControl.Gravity = Gravity.CenterHorizontal;
+ FrameWhiteCentet1.AddChidren(seekBarVoiceControl);
+ seekBarVoiceControl.Y = btnVoice.Y - (seekBarVoiceControl.Height - btnVoice.Height) / 2;
+ //缁戝畾PageLayout鎺т欢
+ seekBarVoiceControl.BindPageLayout();
- ////澹伴煶鐧惧垎姣�
- //this.btnVoicePersent = new NormalViewControl(Application.GetRealWidth(50), btnVoice.Height, false);
- //btnVoicePersent.X = seekBarVoiceControl.Right + Application.GetRealWidth(8) - seekBarVoiceControl.SeekBarPadding;
- //btnVoicePersent.Y = btnVoice.Y;
- //btnVoicePersent.TextColor = CSS_Color.PromptingColor1;
- //btnVoicePersent.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
- //btnVoicePersent.Text = "100%";
- //FrameWhiteCentet1.AddChidren(btnVoicePersent);
+ //澹伴煶鐧惧垎姣�
+ this.btnVoicePersent = new NormalViewControl(Application.GetRealWidth(50), btnVoice.Height, false);
+ btnVoicePersent.X = seekBarVoiceControl.Right + Application.GetRealWidth(8) - seekBarVoiceControl.SeekBarPadding;
+ btnVoicePersent.Y = btnVoice.Y;
+ btnVoicePersent.TextColor = CSS_Color.PromptingColor1;
+ btnVoicePersent.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
+ btnVoicePersent.Text = "100%";
+ FrameWhiteCentet1.AddChidren(btnVoicePersent);
- //seekBarVoiceControl.ProgressChangedEvent += (div, value) =>
- //{
- // btnVoicePersent.Text = value + "%";
- // if (div == 1)
- // {
- // }
- //};
+ seekBarVoiceControl.ProgressChangedEvent += (div, value) =>
+ {
+ btnVoicePersent.Text = value + "%";
+ //if (div == 1)
+ //{
+ //}
+ };
+ seekBarVoiceControl.OnStopTrackingTouchEvent = (sender, e) => {
+ var dic = new Dictionary<string, string>();
+ dic.Add("door_volume", e.ToString());
+ Control.Ins.SendWriteCommand(this.device, dic);
+ };
//鍒濆鍖栧紑閿佽彍鍗�(涓�閿紑閿�,涓存椂瀵嗙爜寮�閿�)
this.InitUnLockMenuControl();
@@ -229,7 +279,7 @@
private void InitUnLockMenuControl()
{
//濡傛灉鏄垚鍛�,鍒欏彧鏈変竴閿紑閿�
- if (true)// DB_ResidenceData.Instance.CurrentRegion.isOtherShare == true)
+ if ( DB_ResidenceData.Instance.CurrentRegion.isOtherShare == true)
{
//涓�閿紑閿�
var btnOneKey = new NormalViewControl(100, 25, true);
@@ -556,32 +606,34 @@
this.frameTempPsw.AddChidren(btnDelete);
btnDelete.ButtonClickEvent += (sender, e) =>
{
- //娓呴櫎褰撳墠涓存椂瀵嗙爜锛�
- HdlMessageLogic.Current.ShowMassage(ShowMsgType.Confirm, Language.StringByID(StringId.ClearTempPsswordMsg), () =>
+ if (Convert.ToInt64(this.doorLockData.EndTimeTick) < DateTime.Now.Ticks)
{
- //娓呯┖涓存椂瀵嗙爜
- this.doorLockData.TempPassword = string.Empty;
- this.doorLockData.StatrtTime = string.Empty;
- this.doorLockData.EndTime = string.Empty;
- //閲嶆柊鍒濆鍖栦复鏃跺瘑鐮佹帶浠�
- this.InitTempPasswordControl();
- });
+ DelTempPwd();
+ }
+ else
+ {
+ //娓呴櫎褰撳墠涓存椂瀵嗙爜锛�
+ HdlMessageLogic.Current.ShowMassage(ShowMsgType.Confirm, Language.StringByID(StringId.ClearTempPsswordMsg), () =>
+ {
+ DelTempPwd();
+ });
+ }
};
- //澶嶅埗涓存椂瀵嗙爜鍥炬爣
- var btnCopy = new IconViewControl(28);
- btnCopy.UnSelectedImagePath = "FunctionIcon/DoorLock/Shard.png";
- btnCopy.X = this.frameTempPsw.Width - btnCopy.IconSize - btnDelete.X;
- btnCopy.Y = btnDelete.Y;
- this.frameTempPsw.AddChidren(btnCopy);
- btnCopy.ButtonClickEvent += (sender, e) =>
- {
- //涓存椂瀵嗙爜宸茬粡澶嶅埗
- HdlCommonLogic.Current.SetTextToShearPlate(this.doorLockData.TempPassword, Language.StringByID(StringId.TempPsswordHasBeenCopy));
- };
+ ////澶嶅埗涓存椂瀵嗙爜鍥炬爣
+ //var btnCopy = new IconViewControl(28);
+ //btnCopy.UnSelectedImagePath = "FunctionIcon/DoorLock/Shard.png";
+ //btnCopy.X = this.frameTempPsw.Width - btnCopy.IconSize - btnDelete.X;
+ //btnCopy.Y = btnDelete.Y;
+ //this.frameTempPsw.AddChidren(btnCopy);
+ //btnCopy.ButtonClickEvent += (sender, e) =>
+ //{
+ // //涓存椂瀵嗙爜宸茬粡澶嶅埗
+ // HdlCommonLogic.Current.SetTextToShearPlate(this.doorLockData.TempPassword, Language.StringByID(StringId.TempPsswordHasBeenCopy));
+ //};
//鐢熸晥鏃堕棿
- var frameEffective = this.CreatEffectiveTimeControl(this.frameTempPsw, Language.StringByID(StringId.EffectiveTime), this.doorLockData.StatrtTime);
+ var frameEffective = this.CreatEffectiveTimeControl(this.frameTempPsw, Language.StringByID(StringId.EffectiveTime), this.doorLockData.StartTime);
frameEffective.X = Application.GetRealWidth(24);
frameEffective.Y = Application.GetRealHeight(180);
@@ -600,6 +652,61 @@
btnLine.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
this.frameTempPsw.AddChidren(btnLine);
}
+ }
+ /// <summary>
+ /// 鍒犻櫎涓存椂瀵嗙爜
+ /// </summary>
+ private void DelTempPwd()
+ {
+ var waitPage = new Loading();
+ this.AddChidren(waitPage);
+ waitPage.Start("");
+ new System.Threading.Thread(() =>
+ {
+ try
+ {
+ var pack = Common.ApiUtlis.Ins.HttpRequest.DelDoorTempPassword(device.deviceId, doorLockData.PwdId);
+ if (pack != null)
+ {
+ Application.RunOnMainThread(() =>
+ {
+ if (pack.Code == StateCode.SUCCESS)
+ {
+ //娓呯┖涓存椂瀵嗙爜
+ this.doorLockData.TempPassword = string.Empty;
+ this.doorLockData.StartTimeTick = string.Empty;
+ this.doorLockData.EndTimeTick = string.Empty;
+ this.doorLockData.PwdId = string.Empty;
+ //閲嶆柊鍒濆鍖栦复鏃跺瘑鐮佹帶浠�
+ this.InitTempPasswordControl();
+ }
+ else
+ {
+ IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
+ }
+ });
+ }
+ }
+ catch (Exception ex)
+ {
+ MainPage.Log($"鍒犻櫎闂ㄩ攣涓存椂瀵嗙爜寮傚父: {ex.Message}");
+ }
+ finally
+ {
+ Application.RunOnMainThread(() =>
+ {
+ try
+ {
+ waitPage.Hide();
+ waitPage.RemoveFromParent();
+ waitPage = null;
+ }
+ catch { }
+ });
+ }
+ })
+ { IsBackground = true }.Start();
+
}
/// <summary>
@@ -657,12 +764,13 @@
//鐢熸晥鏃堕棿
var effectiveTime = Language.StringByID(StringId.EffectiveTime);
- contr.AddRowMenu(effectiveTime, startTime.ToString("yyyy.MM.dd HH:mm"), (btnView, btnValue) =>
+ contr.AddRowMenu(effectiveTime + ": " + startTime.ToString("yyyy.MM.dd HH:mm"),"", (btnView, btnValue) =>
{
//鍏虫帀鐣岄潰,鐒跺悗閲嶆柊璋冭捣鏉�
contr.Close();
var form = new DoorLockSelectTimePage();
+ form.TimeCheck = true;
form.AddForm(startTime);
form.SelectFinshEvent += (selectTime) =>
{
@@ -673,12 +781,13 @@
//澶辨晥鏃堕棿
var failTime = Language.StringByID(StringId.FailureTime);
- contr.AddRowMenu(failTime, endTime.ToString("yyyy.MM.dd HH:mm"), (btnView, btnValue) =>
+ contr.AddRowMenu(failTime+": "+ endTime.ToString("yyyy.MM.dd HH:mm"),"", (btnView, btnValue) =>
{
//鍏虫帀鐣岄潰,鐒跺悗閲嶆柊璋冭捣鏉�
contr.Close();
var form = new DoorLockSelectTimePage();
+ form.TimeCheck = true;
form.AddForm(endTime);
form.SelectFinshEvent += (selectTime) =>
{
@@ -698,12 +807,32 @@
//鍏虫帀鐣岄潰
contr.Close();
- //鐢熸垚涓存椂瀵嗙爜
- this.doorLockData.TempPassword = "987654";
- this.doorLockData.StatrtTime = startTime.ToString("yyyy.MM.dd HH:mm");
- this.doorLockData.EndTime = endTime.ToString("yyyy.MM.dd HH:mm");
- //閲嶆柊鍒濆鍖栦复鏃跺瘑鐮佹帶浠�
- this.InitTempPasswordControl();
+ new System.Threading.Thread(() =>
+ {
+ var pack = Common.ApiUtlis.Ins.HttpRequest.CreateDoorTempPassword(device.deviceId,
+ Utlis.DateTimeToUnix(startTime).ToString(), Utlis.DateTimeToUnix(endTime).ToString());
+ if (pack != null)
+ {
+ if (pack.Code == StateCode.SUCCESS)
+ {
+ // 鑾峰彇涓存椂瀵嗙爜
+ GetTempPwd();
+ }
+ else
+ {
+ Application.RunOnMainThread(() => {
+ IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
+ });
+ }
+ }
+ })
+ { IsBackground = true }.Start();
+ ////鐢熸垚涓存椂瀵嗙爜
+ //this.doorLockData.TempPassword = "987654";
+ //this.doorLockData.StatrtTime = startTime.ToString("yyyy.MM.dd HH:mm");
+ //this.doorLockData.EndTime = endTime.ToString("yyyy.MM.dd HH:mm");
+ ////閲嶆柊鍒濆鍖栦复鏃跺瘑鐮佹帶浠�
+ //this.InitTempPasswordControl();
}
};
@@ -1001,7 +1130,7 @@
}
}
//闊抽噺
- else if (data.key == "volume")
+ else if (data.key == "door_volume")
{
var value = data.state;
if (value != string.Empty)
@@ -1065,13 +1194,62 @@
/// <summary>
/// 涓存椂瀵嗙爜鐢熸晥鏃堕棿(2020.03.17 13:27)
/// </summary>
- public string StatrtTime = string.Empty;
+ public string StartTime {
+ get
+ {
+ try
+ {
+ if(string.IsNullOrEmpty(StartTimeTick))
+ {
+ return string.Empty;
+ }
+ return Utlis.UnixToDateTime(Convert.ToInt64(StartTimeTick)).ToString("yyyy.MM.dd HH:mm");
+ }catch(Exception ex)
+ {
+ MainPage.Log($"涓存椂瀵嗙爜鐢熸晥鏃堕棿杞崲寮傚父: {ex.Message}");
+ return string.Empty;
+ }
+ }
+ }
+ public string StartTimeTick = string.Empty;
/// <summary>
/// 涓存椂瀵嗙爜澶辨晥鏃堕棿(2020.03.17 13:27)
/// </summary>
- public string EndTime = string.Empty;
+ public string EndTime {
+ get
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(EndTimeTick))
+ {
+ return string.Empty;
+ }
+ return Utlis.UnixToDateTime(Convert.ToInt64(EndTimeTick)).ToString("yyyy.MM.dd HH:mm");
+ }
+ catch (Exception ex)
+ {
+ MainPage.Log($"涓存椂瀵嗙爜鐢熸晥鏃堕棿杞崲寮傚父: {ex.Message}");
+ return string.Empty;
+ }
+ }
+ }
+ public string EndTimeTick = string.Empty;
+ /// <summary>
+ /// 涓存椂瀵嗙爜id
+ /// </summary>
+ public string PwdId = string.Empty;
}
+ /// <summary>
+ /// 闂ㄩ攣涓存椂瀵嗙爜
+ /// </summary>
+ private class DoorTempPassword
+ {
+ public string pwdId = string.Empty;
+ public string pwd = string.Empty;
+ public string beginTime = string.Empty;
+ public string endTime = string.Empty;
+ }
#endregion
}
}
--
Gitblit v1.8.0