From 587c36e27131f2d028fcabc13b296a8de7470034 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期三, 08 一月 2020 08:59:19 +0800
Subject: [PATCH] 2019.1.8
---
ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs | 470 ++++++++++++++++++++++++++++++++++++----------------------
1 files changed, 289 insertions(+), 181 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs
index d1ff0f7..4f509d2 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs
@@ -23,13 +23,17 @@
/// </summary>
private CurtainData curtainData = null;
/// <summary>
- /// 鍏佽鎺ユ敹涓婇檺浣�(0:涓嶅厑璁� 1:鍏佽)
+ /// 鎺ユ敹寮�闄愪綅 false:娌℃湁鎺ユ敹鍒� true:宸茬粡鎺ユ敹鍒�
/// </summary>
- private string receiveUplimit = "0";
+ private bool receiveOpenlimit = false;
/// <summary>
- /// 鍏佽鎺ユ敹涓嬮檺浣�(0:涓嶅厑璁� 1:鍏佽)
+ /// 鎺ユ敹鍚堥檺浣� false:娌℃湁鎺ユ敹鍒� true:宸茬粡鎺ユ敹鍒�
/// </summary>
- private string receiveDownLimit = "0";
+ private bool receiveCloseLimit = false;
+ /// <summary>
+ /// 鍙戦�佸尯鍒� 1:寮�闄愪綅 2:鍚堥檺浣�
+ /// </summary>
+ private int sendDiv = 0;
/// <summary>
/// 鏄惁澶囦唤绐楀笜鏁版嵁
/// </summary>
@@ -41,11 +45,11 @@
/// <summary>
/// 寮�闄愪綅鐨勮繘搴︽潯
/// </summary>
- private HorizontalSeekBar openSeekBar = null;
+ private SeekBarControl openSeekBar = null;
/// <summary>
/// 鍚堥檺浣嶇殑杩涘害鏉�
/// </summary>
- private HorizontalSeekBar closeSeekBar = null;
+ private SeekBarControl closeSeekBar = null;
#endregion
@@ -95,23 +99,29 @@
listView.Height = bodyFrameLayout.Height;
bodyFrameLayout.AddChidren(listView);
- //娣诲姞鏂瑰悜琛�
- this.AddDirectionRow();
- //娣诲姞闄愪綅琛�
- this.AddLimitRow();
- //娣诲姞閲嶇疆鐢垫満琛�
- this.AddElectricalMachineryRow();
- //淇濆瓨
- var btnSave = new BottomClickButton();
- btnSave.TextID = R.MyInternationalizationString.uSave;
- bodyFrameLayout.AddChidren(btnSave);
- btnSave.ButtonClickEvent += (sender, e) =>
+ try
{
- //杩欎釜淇濆瓨娌″暐鎰忎箟
- this.CloseForm();
- };
- //闄愪綅鏁版嵁鎺ユ敹
- this.ReceiveLimitData();
+ //娣诲姞鏂瑰悜琛�
+ this.AddDirectionRow();
+ //娣诲姞闄愪綅琛�
+ this.AddLimitRow();
+ //娣诲姞閲嶇疆鐢垫満琛�
+ this.AddElectricalMachineryRow();
+
+ //闄愪綅鏁版嵁鎺ユ敹
+ this.ReceiveLimitData();
+ }
+ catch (Exception ex)
+ {
+ //Log鍑哄姏
+ string msg = "褰撳墠婵�娲荤殑鐣岄潰[" + UserCenterResourse.NowActionFormID + "]";
+ HdlLogLogic.Current.WriteLog(ex, msg);
+ //鍑虹幇鏈煡閿欒
+ this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError));
+ this.listView.RemoveAll();
+ //璁惧寮傚父琛ユ晳 -> 娣诲姞閲嶇疆鐢垫満琛�
+ this.AddElectricalMachineryRow();
+ }
});
}
@@ -143,7 +153,7 @@
listText.Add(Language.StringByID(R.MyInternationalizationString.uForwardDirection));//姝e悜
listText.Add(Language.StringByID(R.MyInternationalizationString.uReverseDirection));//鍙嶅悜
- var form = new BottomDialogSelectForm();
+ var form = new BottomItemSelectForm();
form.AddForm(Language.StringByID(R.MyInternationalizationString.uDirectionSelect), listText, nowSelectNo);
form.FinishSelectEvent += async (index) =>
{
@@ -170,7 +180,7 @@
private void AddLimitRow()
{
var frameBack = new FrameLayout();
- frameBack.Height = Application.GetRealHeight(679);
+ frameBack.Height = Application.GetRealHeight(956);
var rowLimit = new FrameRowControl(listView.rowSpace / 2);
rowLimit.UseClickStatu = false;
@@ -181,14 +191,14 @@
var btnRinght = rowLimit.AddMostRightEmptyIcon(58, 58);
rowLimit.ChangedChidrenBindMode(btnRinght, ChidrenBindMode.NotBind);
btnRinght.UseClickStatu = false;
- btnRinght.UnSelectedImagePath = "Item/Next.png";
+ btnRinght.UnSelectedImagePath = "Item/RightNext.png";
btnRinght.SelectedImagePath = "Item/Down.png";
btnRinght.IsSelected = true;
btnRinght.ButtonClickEvent += (sender, e) =>
{
btnRinght.IsSelected = !btnRinght.IsSelected;
//灞曞紑鎶樺彔
- frameBack.Height = frameBack.Height > 10 ? 0 : Application.GetRealHeight(679);
+ frameBack.Height = frameBack.Height > 10 ? 0 : Application.GetRealHeight(956);
};
//搴曠嚎
rowLimit.AddBottomLine();
@@ -200,6 +210,10 @@
this.AddCloseLimitProgress(frameBack);
}
+ #endregion
+
+ #region 鈻� 寮�闄愪綅琛宊__________________________
+
/// <summary>
/// 娣诲姞寮�闄愪綅杩涘害鏉�
/// </summary>
@@ -209,7 +223,7 @@
//寮�闄愪綅
var btnProgressView = new NormalViewControl(200, 50, true);
btnProgressView.X = ControlCommonResourse.XXLeft;
- btnProgressView.Y = Application.GetRealHeight(60);
+ btnProgressView.Y = Application.GetRealHeight(78);
btnProgressView.TextSize = 12;
btnProgressView.TextColor = UserCenterColor.Current.TextGrayColor1;
btnProgressView.TextID = R.MyInternationalizationString.uOpenLimit;
@@ -224,15 +238,9 @@
btnProgress1.Text = progressValue + "%";
frameBack.AddChidren(btnProgress1);
//杩涘害鏉�
- this.openSeekBar = new HorizontalSeekBar();
+ this.openSeekBar = new SeekBarControl(965);
openSeekBar.Y = btnProgressView.Bottom + Application.GetRealHeight(46);
- openSeekBar.Gravity = Gravity.CenterHorizontal;
- openSeekBar.Width = Application.GetRealWidth(962);
- openSeekBar.Height = Application.GetRealHeight(84);
- openSeekBar.Max = 100;
- openSeekBar.BackgroundColor = 0xfff5f5f5;
- openSeekBar.ThumbColor = Common.ZigbeeColor.Current.GXCButtonBlueColor;
- openSeekBar.ProgressColor = 0xff288bfd;
+ openSeekBar.ProgressBarColor = 0xff288bfd;
openSeekBar.Progress = progressValue;
frameBack.AddChidren(openSeekBar);
@@ -254,78 +262,134 @@
//绾�
var btnLine = new NormalViewControl(frameBack.Width - ControlCommonResourse.XXLeft * 2, ControlCommonResourse.BottomLineHeight, false);
btnLine.X = ControlCommonResourse.XXLeft;
- btnLine.Y = btnTemp2.Bottom + Application.GetRealHeight(69);
+ btnLine.Y = btnTemp2.Bottom + Application.GetRealHeight(156);
btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
frameBack.AddChidren(btnLine);
- int oldValue = progressValue;
- int waitTime = 4;//500姣涓哄崟浣�
- bool startWait = false;
- bool checking = false;
- openSeekBar.ProgressChanged += (sender, value) =>
+ //鍑忓彿
+ var btnMinus = new IconViewControl(104);
+ btnMinus.UseClickStatu = true;
+ btnMinus.X = Application.GetRealWidth(847);
+ btnMinus.Y = Application.GetRealHeight(46);
+ btnMinus.UnSelectedImagePath = "Item/MinusSign2.png";
+ btnMinus.SelectedImagePath = "Item/MinusSign2Selected.png";
+ frameBack.AddChidren(btnMinus);
+ btnMinus.ButtonClickEvent += (sender, e) =>
{
- //鍊肩户缁敼鍙�,鍒欑瓑寰呮椂闂磋繕鍘�
- waitTime = 4;
+ if (openSeekBar.Progress <= 0)
+ {
+ return;
+ }
+ openSeekBar.Progress -= 5;
+ openSeekBar.ProgressChangedEvent(1, openSeekBar.Progress);
+ };
+
+ //鍔犲彿
+ var btnPlus = new IconViewControl(104);
+ btnPlus.UseClickStatu = true;
+ btnPlus.X = btnMinus.Right;
+ btnPlus.Y = btnMinus.Y;
+ btnPlus.UnSelectedImagePath = "Item/PlusSign2.png";
+ btnPlus.SelectedImagePath = "Item/PlusSign2Selected.png";
+ frameBack.AddChidren(btnPlus);
+ btnPlus.ButtonClickEvent += (sender, e) =>
+ {
+ if (openSeekBar.Progress >= 100)
+ {
+ return;
+ }
+ openSeekBar.Progress += 5;
+ openSeekBar.ProgressChangedEvent(1, openSeekBar.Progress);
+ };
+
+ //淇濆瓨
+ var btnSave = new NormalViewControl(150, 60, true);
+ btnSave.X = Application.GetRealWidth(906);
+ btnSave.Y = btnTemp1.Bottom + Application.GetRealHeight(68);
+ btnSave.TextAlignment = TextAlignment.Center;
+ btnSave.TextID = R.MyInternationalizationString.uSave;
+ btnSave.TextColor = UserCenterColor.Current.TextOrangeColor;
+ frameBack.AddChidren(btnSave);
+ btnSave.ButtonClickEvent += (sender, e) =>
+ {
+ if (this.receiveOpenlimit == true)
+ {
+ //纭寮�闄愪綅鐐�
+ this.SaveOpenLimit();
+ }
+ };
+
+ int oldProValue = curtainData.OpenLimitPersent;
+ openSeekBar.ProgressChangedEvent += (div, value) =>
+ {
//寮�闄愪綅涓嶈兘澶т簬鍚堥檺浣�
if (value > closeSeekBar.Progress)
{
openSeekBar.Progress = closeSeekBar.Progress;
return;
}
- if (checking == false)
- {
- startWait = true;
- }
-
btnProgress1.Text = value + "%";
//鏁版嵁鍙樻洿,鐧惧垎姣�
curtainData.OpenLimitPersent = value;
};
+
HdlThreadLogic.Current.RunThread(async () =>
{
+ //澶勭悊涓�
+ bool checking = false;
while (openSeekBar.Parent != null)
{
- if (startWait == false)
+ int nowValue = curtainData.OpenLimitPersent;
+ if (oldProValue == nowValue || checking == true)
{
- await Task.Delay(200);
+ //鍊间笉绛夋墠澶勭悊
+ await Task.Delay(500);
continue;
}
- //寮�鍚�兼敼鍙樼瓑寰�
- await Task.Delay(500);
- waitTime--;
- if (waitTime <= 0)
+ oldProValue = nowValue;
+ checking = true;
+ if (curtainData.DeleteOpenLimit == true)
{
- //濡傛灉2绉掑唴鍊间笉鍐嶆敼鍙�,鍒欒繘琛屽垽鏂�
- startWait = false;
- checking = true;
-
- var value = curtainData.OpenLimitPersent;
- if (oldValue == value)
+ //閲嶇疆寮�闄愪綅鐐�
+ var result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.UpLimit);
+ if (result == false)
{
- //鐩稿悓鏁板��
checking = false;
continue;
}
- oldValue = value;
- if (curtainData.DeleteOpenLimit == true)
- {
- //閲嶇疆寮�闄愪綅鐐�
- var result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.UpLimit);
- if (result == false)
- {
- checking = false;
- continue;
- }
- curtainData.DeleteOpenLimit = false;
- }
- receiveUplimit = "1";
- //灏嗙獥甯樿皟鏁村埌鎸囧畾鐧惧垎姣�
- curtainDevice.WcdGoToTiltValue(value);
- checking = false;
+ curtainData.DeleteOpenLimit = false;
}
+ //灏嗙獥甯樿皟鏁村埌鎸囧畾鐧惧垎姣�
+ this.sendDiv = 1;
+ curtainDevice.WcdGoToTiltValue(nowValue);
+ checking = false;
}
});
}
+
+ /// <summary>
+ /// 纭寮�闄愪綅鐐�
+ /// </summary>
+ private void SaveOpenLimit()
+ {
+ //纭褰撳墠浣嶇疆涓哄紑闄愪綅?
+ string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainOpenLimitMsg);
+ this.ShowMassage(ShowMsgType.Confirm, msg, async () =>
+ {
+ //鎵ц纭鍙婅鐩栦笂闄愪綅鐐�
+ var result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.UpLimit,
+ curtainData.OpenLimitPersent, curtainData.CloseLimitPersent);
+ if (result == true)
+ {
+ curtainData.DeleteOpenLimit = true;
+ this.receiveOpenlimit = false;
+ }
+ });
+ }
+
+ #endregion
+
+ #region 鈻� 鍚堥檺浣嶈___________________________
/// <summary>
/// 娣诲姞鍚堥檺浣嶈繘搴︽潯
@@ -336,7 +400,7 @@
//鍚堥檺浣�
var btnProgressView = new NormalViewControl(200, 50, true);
btnProgressView.X = ControlCommonResourse.XXLeft;
- btnProgressView.Y = Application.GetRealHeight(397);
+ btnProgressView.Y = Application.GetRealHeight(536);
btnProgressView.TextSize = 12;
btnProgressView.TextColor = UserCenterColor.Current.TextGrayColor1;
btnProgressView.TextID = R.MyInternationalizationString.uCloseLimit;
@@ -351,15 +415,9 @@
btnProgress1.Text = progressValue + "%";
frameBack.AddChidren(btnProgress1);
//杩涘害鏉�
- this.closeSeekBar = new HorizontalSeekBar();
+ this.closeSeekBar = new SeekBarControl(965);
closeSeekBar.Y = btnProgressView.Bottom + Application.GetRealHeight(46);
- closeSeekBar.Gravity = Gravity.CenterHorizontal;
- closeSeekBar.Width = Application.GetRealWidth(962);
- closeSeekBar.Height = Application.GetRealHeight(84);
- closeSeekBar.Max = 100;
- closeSeekBar.BackgroundColor = 0xfff5f5f5;
- closeSeekBar.ThumbColor = Common.ZigbeeColor.Current.GXCButtonBlueColor;
- closeSeekBar.ProgressColor = 0xff288bfd;
+ closeSeekBar.ProgressBarColor = 0xff288bfd;
closeSeekBar.Progress = progressValue;
frameBack.AddChidren(closeSeekBar);
@@ -381,75 +439,126 @@
//绾�
var btnLine = new NormalViewControl(frameBack.Width - ControlCommonResourse.XXLeft * 2, ControlCommonResourse.BottomLineHeight, false);
btnLine.X = ControlCommonResourse.XXLeft;
- btnLine.Y = btnTemp2.Bottom + Application.GetRealHeight(69);
+ btnLine.Y = btnTemp2.Bottom + Application.GetRealHeight(156);
btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
frameBack.AddChidren(btnLine);
- int oldValue = progressValue;
- int waitTime = 4;//500姣涓哄崟浣�
- bool startWait = false;
- bool checking = false;
- closeSeekBar.ProgressChanged += (sender, value) =>
+ //鍑忓彿
+ var btnMinus = new IconViewControl(104);
+ btnMinus.UseClickStatu = true;
+ btnMinus.X = Application.GetRealWidth(847);
+ btnMinus.Y = Application.GetRealHeight(504);
+ btnMinus.UnSelectedImagePath = "Item/MinusSign2.png";
+ btnMinus.SelectedImagePath = "Item/MinusSign2Selected.png";
+ frameBack.AddChidren(btnMinus);
+ btnMinus.ButtonClickEvent += (sender, e) =>
{
- //鍊肩户缁敼鍙�,鍒欑瓑寰呮椂闂磋繕鍘�
- waitTime = 4;
- //鍚堥檺浣嶄笉鑳藉皬浜庡悎闄愪綅
- if (value < openSeekBar.Progress)
+ if (closeSeekBar.Progress <= 0)
{
+ return;
+ }
+ closeSeekBar.Progress -= 5;
+ closeSeekBar.ProgressChangedEvent(1, closeSeekBar.Progress);
+ };
+
+ //鍔犲彿
+ var btnPlus = new IconViewControl(104);
+ btnPlus.UseClickStatu = true;
+ btnPlus.X = btnMinus.Right;
+ btnPlus.Y = btnMinus.Y;
+ btnPlus.UnSelectedImagePath = "Item/PlusSign2.png";
+ btnPlus.SelectedImagePath = "Item/PlusSign2Selected.png";
+ frameBack.AddChidren(btnPlus);
+ btnPlus.ButtonClickEvent += (sender, e) =>
+ {
+ if (closeSeekBar.Progress >=100)
+ {
+ return;
+ }
+ closeSeekBar.Progress += 5;
+ closeSeekBar.ProgressChangedEvent(1, closeSeekBar.Progress);
+ };
+
+ //淇濆瓨
+ var btnSave = new NormalViewControl(150, 60, true);
+ btnSave.X = Application.GetRealWidth(906);
+ btnSave.Y = btnTemp1.Bottom + Application.GetRealHeight(68);
+ btnSave.TextAlignment = TextAlignment.Center;
+ btnSave.TextID = R.MyInternationalizationString.uSave;
+ btnSave.TextColor = UserCenterColor.Current.TextOrangeColor;
+ frameBack.AddChidren(btnSave);
+ btnSave.ButtonClickEvent += (sender, e) =>
+ {
+ if (this.receiveCloseLimit == true)
+ {
+ //淇濆瓨鍚堥檺浣嶇偣
+ this.SaveCloseLimit();
+ }
+ };
+
+ int oldProValue = curtainData.CloseLimitPersent;
+ closeSeekBar.ProgressChangedEvent += (div, value) =>
+ {
+ if (value < curtainData.OpenLimitPersent)
+ {
+ //鍚堥檺浣嶄笉鑳藉皬浜庡悎闄愪綅
closeSeekBar.Progress = openSeekBar.Progress;
return;
}
- if (checking == false)
- {
- startWait = true;
- }
-
btnProgress1.Text = value + "%";
//鏁版嵁鍙樻洿,鐧惧垎姣�
curtainData.CloseLimitPersent = value;
};
+
HdlThreadLogic.Current.RunThread(async () =>
{
+ //澶勭悊涓�
+ bool checking = false;
while (closeSeekBar.Parent != null)
{
- if (startWait == false)
+ int nowValue = curtainData.CloseLimitPersent;
+ if (oldProValue == nowValue || checking == true)
{
- await Task.Delay(200);
+ //鍊间笉绛夋墠澶勭悊
+ await Task.Delay(500);
continue;
}
- //寮�鍚�兼敼鍙樼瓑寰�
- await Task.Delay(500);
- waitTime--;
- if (waitTime <= 0)
+ checking = true;
+ oldProValue = nowValue;
+ if (curtainData.DeleteCloseLimit == true)
{
- //濡傛灉2绉掑唴鍊间笉鍐嶆敼鍙�,鍒欒繘琛屽垽鏂�
- startWait = false;
- checking = true;
-
- var value = curtainData.CloseLimitPersent;
- if (oldValue == value)
+ //閲嶇疆鍚堥檺浣嶇偣
+ var result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.DownLimit);
+ if (result == false)
{
- //鐩稿悓鏁板��
- checking = false;
continue;
}
- oldValue = value;
- if (curtainData.DeleteCloseLimit == true)
- {
- //閲嶇疆鍚堥檺浣嶇偣
- var result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.DownLimit);
- if (result == false)
- {
- checking = false;
- continue;
- }
- curtainData.DeleteCloseLimit = false;
- }
- receiveDownLimit = "1";
- //灏嗙獥甯樿皟鏁村埌鎸囧畾鐧惧垎姣�
- curtainDevice.WcdGoToTiltValue(value);
- checking = false;
+ curtainData.DeleteCloseLimit = false;
}
+ //灏嗙獥甯樿皟鏁村埌鎸囧畾鐧惧垎姣�
+ this.sendDiv = 2;
+ curtainDevice.WcdGoToTiltValue(nowValue);
+ checking = false;
+ }
+ });
+ }
+
+ /// <summary>
+ /// 淇濆瓨鍚堥檺浣嶇偣
+ /// </summary>
+ private void SaveCloseLimit()
+ {
+ //纭褰撳墠浣嶇疆涓哄悎闄愪綅?
+ string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainCloseLimitMsg);
+ this.ShowMassage(ShowMsgType.Confirm, msg, async () =>
+ {
+ //鎵ц纭鍙婅鐩栧悎闄愪綅鐐�
+ var result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.DownLimit,
+ curtainData.OpenLimitPersent, curtainData.CloseLimitPersent);
+ if (result == true)
+ {
+ curtainData.DeleteCloseLimit = true;
+ this.receiveCloseLimit = false;
}
});
}
@@ -476,14 +585,39 @@
msg = msg.Replace("{0}", "\r\n");
this.ShowMassage(ShowMsgType.Confirm, msg, () =>
{
+ //寮�鍚繘搴︽潯
+ ProgressFormBar.Current.Start();
+ //姝e湪閲嶇疆鐢垫満
+ ProgressFormBar.Current.SetMsg(Language.StringByID(R.MyInternationalizationString.uElectricalMachineryResetting));
+ //閲嶇疆绐楀笜
HdlThreadLogic.Current.RunThread(async () =>
{
- //閲嶇疆绐楀笜
var result = await HdlDeviceCurtainLogic.Current.RestoreCurtain(curtainDevice);
if (result == false)
{
+ //鍏抽棴杩涘害鏉�
+ ProgressFormBar.Current.Close();
return;
}
+
+ //姣�10鐨勯暱搴﹀ぇ姒傛槸2绉�,澶氶鐣�1娆″嚭鏉�
+ int waitCount = ((curtainData.CurtainLength / 10) + 1) * 3;
+ if (waitCount < 12)
+ {
+ waitCount = 12;
+ }
+
+ int timeCount = 0;
+ while (timeCount <= waitCount)
+ {
+ //杩涘害鏉″��
+ ProgressFormBar.Current.SetValue(timeCount, waitCount);
+ timeCount++;
+ System.Threading.Thread.Sleep(1000);
+ }
+ //鍏抽棴杩涘害鏉�
+ ProgressFormBar.Current.Close();
+
//鑾峰彇鏁版嵁鍚�,澶囦唤绐楀笜鏁版嵁
this.backupCurtainData = true;
//閲嶆柊鍒濆鍖栫晫闈�
@@ -507,12 +641,13 @@
this.ShowProgressBar();
this.curtainData = new CurtainData();
- this.receiveUplimit = "0";
- this.receiveDownLimit = "0";
+ this.receiveOpenlimit = false;
+ this.receiveCloseLimit = false;
+ this.sendDiv = 0;
bool receiptData = false;
string mainkeys = LocalDevice.Current.GetDeviceMainKeys(curtainDevice);
- HdlDeviceAttributeLogic.Current.AddAttributeEvent("CurtainDeviceAttribute", "DeviceStatusReport", (device) =>
+ HdlGatewayReceiveLogic.Current.AddAttributeEvent("CurtainDeviceAttribute", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (device) =>
{
string checkKey = LocalDevice.Current.GetDeviceMainKeys(device);
if (mainkeys != checkKey || device.DeviceStatusReport.CluterID != 258)
@@ -576,7 +711,7 @@
return false;
}
//绉婚櫎鐩戝惉
- HdlDeviceAttributeLogic.Current.RemoveEvent("CurtainDeviceAttribute");
+ HdlGatewayReceiveLogic.Current.RemoveEvent("CurtainDeviceAttribute");
//澶囦唤绐楀笜鏁版嵁
if (this.backupCurtainData == true)
@@ -605,59 +740,32 @@
/// </summary>
private void ReceiveLimitData()
{
- if (HdlDeviceAttributeLogic.Current.IsEsixt("ReceiveLimitData") == true)
+ if (HdlGatewayReceiveLogic.Current.IsEsixt("ReceiveLimitData") == true)
{
- HdlDeviceAttributeLogic.Current.RemoveEvent("ReceiveLimitData");
+ HdlGatewayReceiveLogic.Current.RemoveEvent("ReceiveLimitData");
}
string mainkeys = LocalDevice.Current.GetDeviceMainKeys(curtainDevice);
- HdlDeviceAttributeLogic.Current.AddAttributeEvent("ReceiveLimitData", "DeviceStatusReport", (device) =>
+ HdlGatewayReceiveLogic.Current.AddAttributeEvent("ReceiveLimitData", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (device) =>
{
string checkKey = LocalDevice.Current.GetDeviceMainKeys(device);
if (mainkeys != checkKey || device.DeviceStatusReport.CluterID != 258)
{
return;
}
- lock (receiveUplimit)
+ foreach (var attriBute in device.DeviceStatusReport.AttriBute)
{
- if (receiveUplimit == "0" && receiveDownLimit == "0")
+ //绐楀笜鐧惧垎姣旀帹閫�
+ if (attriBute.AttributeId == 8)
{
- return;
- }
- foreach (var attriBute in device.DeviceStatusReport.AttriBute)
- {
- //绐楀笜鐧惧垎姣旀帹閫�
- if (attriBute.AttributeId == 8)
+ //寮�闄愪綅
+ if (sendDiv == 1)
{
- //涓婇檺浣�
- if (receiveUplimit == "1")
- {
- receiveUplimit = "0";
- openSeekBar.Progress = curtainData.OpenLimitPersent;
- //纭褰撳墠浣嶇疆{0}涓哄紑闄愪綅?
- string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainOpenLimitMsg);
- msg = msg.Replace("{0}", curtainData.OpenLimitPersent + "%");
- this.ShowMassage(ShowMsgType.Confirm, msg, async () =>
- {
- //鎵ц纭鍙婅鐩栦笂闄愪綅鐐�
- await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.UpLimit,
- curtainData.OpenLimitPersent, curtainData.CloseLimitPersent);
- });
- }
- //鍚堥檺浣�
- else if (receiveDownLimit == "1")
- {
- receiveDownLimit = "0";
- closeSeekBar.Progress = curtainData.CloseLimitPersent;
- //纭褰撳墠浣嶇疆{0}涓哄悎闄愪綅?
- string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainCloseLimitMsg);
- msg = msg.Replace("{0}", curtainData.CloseLimitPersent + "%");
- this.ShowMassage(ShowMsgType.Confirm, msg, async () =>
- {
- //鎵ц纭鍙婅鐩栧悎闄愪綅鐐�
- await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.DownLimit,
- curtainData.OpenLimitPersent, curtainData.CloseLimitPersent);
- });
- }
+ receiveOpenlimit = true;
+ }
+ //鍚堥檺浣�
+ else if (sendDiv == 2)
+ {
+ receiveCloseLimit = true;
}
}
}
@@ -671,14 +779,14 @@
/// <summary>
/// 鐣岄潰鍏抽棴
/// </summary>
- public override void CloseForm()
+ public override void CloseFormBefore()
{
- HdlDeviceAttributeLogic.Current.RemoveEvent("CurtainDeviceAttribute");
- HdlDeviceAttributeLogic.Current.RemoveEvent("ReceiveLimitData");
+ HdlGatewayReceiveLogic.Current.RemoveEvent("CurtainDeviceAttribute");
+ HdlGatewayReceiveLogic.Current.RemoveEvent("ReceiveLimitData");
UserView.HomePage.Instance.ScrollEnabled = true;
- base.CloseForm();
+ base.CloseFormBefore();
}
#endregion
--
Gitblit v1.8.0