From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 28 二月 2020 15:25:13 +0800
Subject: [PATCH] 2020.2.28
---
ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitSettionForm.cs | 121 ++++++++++++++++++++++++++++++++++++---
1 files changed, 110 insertions(+), 11 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitSettionForm.cs
index 202f732..db7bcd9 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitSettionForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitSettionForm.cs
@@ -20,6 +20,14 @@
/// 褰撳墠閫夋嫨鐨勭綉鍏�
/// </summary>
private AC deviceAc = null;
+ /// <summary>
+ /// 鎽嗛妯″紡(鐢ㄤ簩杩涘埗鏉ョ帺鑷畾涔夋ā寮� 0:涓嶄娇鐢� 1:浣跨敤)
+ /// </summary>
+ private int swingMode = 0;
+ /// <summary>
+ /// 鍥哄畾棰勭暀鐨勬暟鎹�
+ /// </summary>
+ private string fixValue = null;
#endregion
@@ -39,8 +47,27 @@
//鍒濆鍖栧彸涓婅鑿滃崟
this.InitTopRightMenu();
- //鍒濆鍖栦腑閮ㄦ帶浠�
- this.InitMiddleFrame();
+ HdlThreadLogic.Current.RunThread(() =>
+ {
+ //寮�鍚繘搴︽潯
+ this.ShowProgressBar();
+ //璇诲彇绌鸿皟鎽嗛妯″紡
+ var result = this.ReadAirConditionerSwingModeSupport();
+ if (result == false)
+ {
+ //鍏抽棴杩涘害鏉�
+ this.CloseProgressBar(ShowReLoadMode.YES);
+ return;
+ }
+ //鍏抽棴杩涘害鏉�
+ this.CloseProgressBar();
+
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ //鍒濆鍖栦腑閮ㄦ帶浠�
+ this.InitMiddleFrame();
+ });
+ });
}
/// <summary>
@@ -110,10 +137,6 @@
rowBeloneArea.AddBottomLine();
rowBeloneArea.SelectRoomEvent += (roomKeys) =>
{
- //淇濆瓨杩欎釜璁惧灞炰簬鍝釜鍖哄煙
- deviceAc.DeviceRoomId = roomKeys;
- deviceAc.ReSave();
-
Common.Room.CurrentRoom.ChangedRoom(deviceAc, roomKeys);
};
@@ -133,12 +156,37 @@
var rowSwing = new FrameRowControl(listview.rowSpace / 2);
rowSwing.UseClickStatu = false;
listview.AddChidren(rowSwing);
- rowSwing.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uAirConditionerSwing), 600);
+ rowSwing.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uAirConditionerSwing), 400);
rowSwing.AddBottomLine();
- var btnSwicth = rowSwing.AddMostRightSwitchIcon();
- btnSwicth.ButtonClickEvent += (sender, e) =>
+ var btnSwingSwitch = rowSwing.AddMostRightSwitchIcon();
+ if (this.swingMode == 1)
{
- btnSwicth.IsSelected = !btnSwicth.IsSelected;
+ btnSwingSwitch.IsSelected = true;
+ }
+ btnSwingSwitch.ButtonClickEvent += (sender, e) =>
+ {
+ //涓嶈兘鍐嶇偣鍑�
+ btnSwingSwitch.CanClick = false;
+ string statu = btnSwingSwitch.IsSelected == true ? "0" : "1";
+ //灏嗕簩杩涘埗杞崲涓哄崄杩涘埗
+ int sendData = Convert.ToInt32(this.fixValue + statu, 2);
+ HdlThreadLogic.Current.RunThread(async () =>
+ {
+ var result = await HdlDeviceAirConditionerLogic.Current.SetUseAcSwingFunctionStatu(deviceAc, sendData);
+ if (result == true)
+ {
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ btnSwingSwitch.IsSelected = !btnSwingSwitch.IsSelected;
+ this.swingMode = this.swingMode == 1 ? 0 : 1;
+
+ deviceAc.UseSwingFunction = btnSwingSwitch.IsSelected;
+ deviceAc.ReSave();
+ });
+ }
+ //鑳藉缁х画鐐瑰嚮
+ btnSwingSwitch.CanClick = true;
+ });
};
//鍒濆鍖栨甯冨畬鎴�
@@ -196,7 +244,7 @@
/// </summary>
private void ShowTopRightMenu()
{
- var frame = new TopRightMenuControl(1);
+ var frame = new TopRightMenuControl(1, 1);
//瀹氫綅
var deviceMenu = Language.StringByID(R.MyInternationalizationString.uFixedPosition);
frame.AddRowMenu(deviceMenu, "Item/FixedPosition.png", "Item/FixedPositionSelected.png", () =>
@@ -207,5 +255,56 @@
}
#endregion
+
+ #region 鈻� 璇诲彇绌鸿皟鎽嗛妯″紡___________________
+
+ /// <summary>
+ /// 璇诲彇绌鸿皟鎽嗛妯″紡
+ /// </summary>
+ private bool ReadAirConditionerSwingModeSupport()
+ {
+ string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(deviceAc);
+ HdlGatewayReceiveLogic.Current.AddAttributeEvent("ReadAirConditionerModeSupport", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (report) =>
+ {
+ string checkKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report);
+ if (checkKeys != mainkeys || report.DeviceStatusReport.CluterID != 514)
+ {
+ return;
+ }
+ for (int i = 0; i < report.DeviceStatusReport.AttriBute.Count; i++)
+ {
+ var data = report.DeviceStatusReport.AttriBute[i];
+ if (data.AttributeId == 4097)
+ {
+ HdlGatewayReceiveLogic.Current.RemoveEvent("ReadAirConditionerModeSupport");
+ //杞崲涓轰簩杩涘埗
+ var value = Convert.ToString(data.AttriButeData, 2).PadLeft(16, '0');
+ //杩欎釜璁剧疆鏄斁鍦ㄥ悗闈㈢殑
+ this.fixValue = value.Substring(0, value.Length - 1);
+ this.swingMode = Convert.ToInt32(value.Substring(this.fixValue.Length));
+ }
+ }
+ });
+ //鑾峰彇鏄惁鍚敤绌鸿皟鎽嗛妯″紡鐨勭姸鎬�(鎵撳紑 鎴栬�� 鍏抽棴)
+ deviceAc.ReadUseSwingFunctionStatu();
+
+ int timeOut = 0;
+ while (this.fixValue == null && timeOut <= 30)
+ {
+ System.Threading.Thread.Sleep(100);
+ timeOut++;
+ }
+ if (this.fixValue == null)
+ {
+ //鑾峰彇绌鸿皟鎽嗛鐘舵�佸け璐�
+ string msg = Language.StringByID(R.MyInternationalizationString.uGetAirConditionerSwingFunctionFail);
+ msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, null, "鍥炲瓒呮椂");
+ this.ShowMassage(ShowMsgType.Tip, msg);
+ return false;
+ }
+ return true;
+ }
+
+ #endregion
}
}
--
Gitblit v1.8.0