From 993ecf49ae04ccea89f6bc4a32cfc0c45def1215 Mon Sep 17 00:00:00 2001
From: 温居城 <wenjucheng@wenjuchengdeMacBook-Pro.local>
Date: 星期三, 27 十月 2021 14:23:30 +0800
Subject: [PATCH] 2021-10-27-01
---
ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs | 112 +++++++++++++++++++++++++++++++++++--------------------
1 files changed, 71 insertions(+), 41 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs
index de7b257..9b337e2 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs
@@ -102,7 +102,7 @@
//瀵艰建闀垮害涓�0鏃�
if (curtainData.CurtainLength <= 0)
{
- //鐢垫満鏁版嵁寮傚父,璇烽噸缃數鏈�
+ //鐢垫満鏁版嵁寮傚父,纭宸茬粡瀹夎瀵艰建鍚�,璇烽噸缃數鏈�
this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uCurtainDataIsErrorPleaseResetCurtain));
try
{
@@ -134,7 +134,7 @@
//Log鍑哄姏
string msg = "褰撳墠婵�娲荤殑鐣岄潰[" + UserCenterResourse.NowActionFormID + "]";
HdlLogLogic.Current.WriteLog(ex, msg);
- //鐢垫満鏁版嵁寮傚父,璇烽噸缃數鏈�
+ //鐢垫満鏁版嵁寮傚父,纭宸茬粡瀹夎瀵艰建鍚�,璇烽噸缃數鏈�
this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uCurtainDataIsErrorPleaseResetCurtain));
try
{
@@ -176,11 +176,11 @@
listText.Add(Language.StringByID(R.MyInternationalizationString.uReverseDirection));//鍙嶅悜
var form = new BottomItemSelectForm();
- form.AddForm(Language.StringByID(R.MyInternationalizationString.uDirectionSelect), listText, nowSelectNo);
- form.FinishSelectEvent += async (index) =>
+ form.AddForm(Language.StringByID(R.MyInternationalizationString.uDirectionSelect), listText, null, nowSelectNo);
+ form.FinishSelectEvent += (index) =>
{
//鍙樻洿鏂瑰悜
- var result = await HdlDeviceCurtainLogic.Current.SetCurtainDirection(curtainDevice, index == 0 ? false : true);
+ var result = HdlDeviceCurtainLogic.Current.SetCurtainDirection(curtainDevice, index == 0 ? false : true);
if (result == false)
{
return;
@@ -190,6 +190,11 @@
curtainData.Direction = index == 0 ? false : true;
};
};
+ //濡傛灉褰撳墠鏄睍绀烘ā鏉�,鍒欎笉鑳界紪杈�
+ if (Common.Config.Instance.Home.IsShowTemplate == true)
+ {
+ rowDirection.CanClick = false;
+ }
}
#endregion
@@ -336,7 +341,8 @@
frameBack.AddChidren(btnSave);
btnSave.ButtonClickEvent += (sender, e) =>
{
- if (this.receiveOpenlimit == true)
+ //2020.05.17:杩藉姞铏氭嫙浣忓畢鍙互鐩存帴鐐瑰嚮
+ if (this.receiveOpenlimit == true || Common.Config.Instance.Home.IsVirtually == true)
{
//纭寮�闄愪綅鐐�
this.SaveOpenLimit();
@@ -356,27 +362,37 @@
//鏁版嵁鍙樻洿,鐧惧垎姣�
curtainData.OpenLimitPersent = value;
};
+ //濡傛灉褰撳墠鏄睍绀烘ā鏉�,鍒欎笉鑳界紪杈�
+ if (Common.Config.Instance.Home.IsShowTemplate == true)
+ {
+ openSeekBar.Enable = false;
+ btnMinus.CanClick = false;
+ btnPlus.CanClick = false;
+ btnSave.CanClick = false;
+ }
+
+ //铏氭嫙浣忓畢涓嶉渶瑕佺洃鍚�
+ if (Common.Config.Instance.Home.IsVirtually == true)
+ {
+ return;
+ }
HdlThreadLogic.Current.RunThread(async () =>
{
- //澶勭悊涓�
- bool checking = false;
while (openSeekBar.Parent != null)
{
int nowValue = curtainData.OpenLimitPersent;
- if (oldProValue == nowValue || checking == true)
+ if (oldProValue == nowValue)
{
//鍊间笉绛夋墠澶勭悊
await Task.Delay(500);
continue;
}
oldProValue = nowValue;
- checking = true;
//灏嗙獥甯樿皟鏁村埌鎸囧畾鐧惧垎姣�
this.sendDiv = 1;
curtainDevice.WcdGoToTiltValue(nowValue);
- checking = false;
}
});
}
@@ -388,15 +404,14 @@
{
//纭褰撳墠浣嶇疆涓哄紑闄愪綅?
string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainOpenLimitMsg);
- this.ShowMassage(ShowMsgType.Confirm, msg, async () =>
+ this.ShowMassage(ShowMsgType.Confirm, msg, () =>
{
decimal openValue = ((decimal)curtainData.OpenLimitPersent / 100) * curtainData.CurtainLength;
decimal closeValue = ((decimal)curtainData.CloseLimitPersent / 100) * curtainData.CurtainLength;
if (openValue < 0) { openValue = 0; }
if (closeValue < 0) { closeValue = curtainData.CurtainLength; }
//鎵ц纭鍙婅鐩栦笂闄愪綅鐐�
- var result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.UpLimit,
- (int)openValue, (int)closeValue);
+ var result = HdlDeviceCurtainLogic.Current.SetAutoOpenCurtainLimitPoint(curtainDevice, (int)openValue, (int)closeValue, curtainData.CurtainLength);
if (result == true)
{
this.receiveOpenlimit = false;
@@ -508,7 +523,8 @@
frameBack.AddChidren(btnSave);
btnSave.ButtonClickEvent += (sender, e) =>
{
- if (this.receiveCloseLimit == true)
+ //2020.05.17:杩藉姞铏氭嫙浣忓畢鍙互鐩存帴鐐瑰嚮
+ if (this.receiveCloseLimit == true || Common.Config.Instance.Home.IsVirtually == true)
{
//淇濆瓨鍚堥檺浣嶇偣
this.SaveCloseLimit();
@@ -528,27 +544,36 @@
//鏁版嵁鍙樻洿,鐧惧垎姣�
curtainData.CloseLimitPersent = value;
};
+ //濡傛灉褰撳墠鏄睍绀烘ā鏉�,鍒欎笉鑳界紪杈�
+ if (Common.Config.Instance.Home.IsShowTemplate == true)
+ {
+ closeSeekBar.Enable = false;
+ btnMinus.CanClick = false;
+ btnPlus.CanClick = false;
+ btnSave.CanClick = false;
+ }
+ //铏氭嫙浣忓畢涓嶉渶瑕佺洃鍚�
+ if (Common.Config.Instance.Home.IsVirtually == true)
+ {
+ return;
+ }
HdlThreadLogic.Current.RunThread(async () =>
{
- //澶勭悊涓�
- bool checking = false;
while (closeSeekBar.Parent != null)
{
int nowValue = curtainData.CloseLimitPersent;
- if (oldProValue == nowValue || checking == true)
+ if (oldProValue == nowValue)
{
//鍊间笉绛夋墠澶勭悊
await Task.Delay(500);
continue;
}
- checking = true;
oldProValue = nowValue;
//灏嗙獥甯樿皟鏁村埌鎸囧畾鐧惧垎姣�
this.sendDiv = 2;
curtainDevice.WcdGoToTiltValue(nowValue);
- checking = false;
}
});
}
@@ -560,15 +585,14 @@
{
//纭褰撳墠浣嶇疆涓哄悎闄愪綅?
string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainCloseLimitMsg);
- this.ShowMassage(ShowMsgType.Confirm, msg, async () =>
+ this.ShowMassage(ShowMsgType.Confirm, msg, () =>
{
decimal openValue = ((decimal)curtainData.OpenLimitPersent / 100) * curtainData.CurtainLength;
decimal closeValue = ((decimal)curtainData.CloseLimitPersent / 100) * curtainData.CurtainLength;
if (openValue < 0) { openValue = 0; }
if (closeValue < 0) { closeValue = curtainData.CurtainLength; }
//鎵ц纭鍙婅鐩栦笂闄愪綅鐐�
- var result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.DownLimit,
- (int)openValue, (int)closeValue);
+ var result = HdlDeviceCurtainLogic.Current.SetAutoOpenCurtainLimitPoint(curtainDevice, (int)openValue, (int)closeValue, curtainData.CurtainLength);
if (result == true)
{
@@ -594,6 +618,11 @@
rowReset.AddBottomLine();
rowReset.ButtonClickEvent += (sender, e) =>
{
+ //濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
+ if (Common.Config.Instance.Home.IsVirtually == true)
+ {
+ return;
+ }
//閲嶇疆鐢垫満灏嗗垵濮嬪寲{0}鏂瑰悜涓庨檺浣嶈缃紝纭缁х画锛�
string msg = Language.StringByID(R.MyInternationalizationString.uResetElectricalMachineryMsg);
msg = msg.Replace("{0}", "\r\n");
@@ -651,13 +680,24 @@
/// <returns></returns>
private bool InitCurtainDefultData()
{
- //寮�鍚繘搴︽潯
- this.ShowProgressBar();
-
this.curtainData = new CurtainData();
this.receiveOpenlimit = false;
this.receiveCloseLimit = false;
this.sendDiv = 0;
+
+ //濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
+ if (Common.Config.Instance.Home.IsVirtually == true)
+ {
+ var data = TemplateData.TemplateDeviceDataLogic.Current.GetCurtainLimitPoint(curtainDevice);
+ curtainData.Direction = data.Direction;
+ curtainData.CurtainLength = data.curtainLength;
+ curtainData.OpenLimitValue = data.upLimit;
+ curtainData.CloseLimitValue = data.downLimit;
+ return true;
+ }
+
+ //寮�鍚繘搴︽潯
+ this.ShowProgressBar();
int receiptDataCount = 0;
string mainkeys = LocalDevice.Current.GetDeviceMainKeys(curtainDevice);
@@ -729,21 +769,6 @@
//绉婚櫎鐩戝惉
HdlGatewayReceiveLogic.Current.RemoveEvent("CurtainDeviceAttribute");
- //澶囦唤绐楀笜鏁版嵁
- if (this.backupCurtainData == true && curtainData.CurtainLength > 0)
- {
- this.backupCurtainData = false;
- HdlThreadLogic.Current.RunThread(async () =>
- {
- //鏂瑰悜澶囦唤
- await HdlDeviceCurtainLogic.Current.BackupCurtainDirection(curtainDevice, curtainData.Direction);
- //闄愪綅澶囦唤
- int uplimit = (int)(curtainData.OpenLimitValue / (curtainData.CurtainLength * 1.0) * 100);
- int downlimit = (int)(curtainData.CloseLimitValue / (curtainData.CurtainLength * 1.0) * 100);
- await HdlDeviceCurtainLogic.Current.BackupCurtainLimitPoint(curtainDevice, uplimit, downlimit);
- });
- }
-
return true;
}
@@ -756,6 +781,11 @@
/// </summary>
private void ReceiveLimitData()
{
+ //濡傛灉褰撳墠鏄睍绀烘ā鏉�,鍒欓渶瑕佸鐞�
+ if (Common.Config.Instance.Home.IsShowTemplate == true)
+ {
+ return;
+ }
if (HdlGatewayReceiveLogic.Current.IsEsixt("ReceiveLimitData") == true)
{
HdlGatewayReceiveLogic.Current.RemoveEvent("ReceiveLimitData");
--
Gitblit v1.8.0