From 3aa397ab145382935492b11c1f18c9634e69910b Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期四, 10 十二月 2020 16:45:00 +0800
Subject: [PATCH] 请合并,门锁和晾衣架第一版代码
---
ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceColorTemperatureCardControl.cs | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 150 insertions(+), 0 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceColorTemperatureCardControl.cs b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceColorTemperatureCardControl.cs
new file mode 100755
index 0000000..a3bbe14
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceColorTemperatureCardControl.cs
@@ -0,0 +1,150 @@
+锘縰sing Shared.Phone.UserCenter;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using ZigBee.Device;
+
+namespace Shared.Phone.MainPage.Controls
+{
+ /// <summary>
+ /// 鑹叉俯鐏崱鐗囨帶浠�
+ /// </summary>
+ public class DeviceColorTemperatureCardControl : DeviceCardCommon
+ {
+ #region 鈻� 鍒濆鍖朹____________________________
+
+ /// <summary>
+ /// 鍒濆鍖栨帶浠�
+ /// </summary>
+ /// <param name="i_device"></param>
+ public override void InitControl(CommonDevice i_device, Common.Room i_nowSelectRoom)
+ {
+ base.InitControl(i_device, i_nowSelectRoom);
+
+ //娣诲姞璺宠浆娣卞害鍗$墖淇℃伅浜嬩欢
+ this.AddDetailInfoEvent(i_device);
+
+ //娣诲姞寮�鍏虫帶浠�
+ var btnSwitch = this.AddSwitchControl();
+ btnSwitch.ButtonClickEvent += (sender, e) =>
+ {
+ //鑾峰彇褰撳墠浜害
+ int level = Convert.ToInt32(i_device.GetType().InvokeMember("Level", System.Reflection.BindingFlags.GetField, null, i_device, null));
+ //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�
+ if (Common.Config.Instance.Home.IsVirtually == true)
+ {
+ //鐩存帴鍙樻洿缂撳瓨
+ ((LightBase)i_device).OnOffStatus = btnSwitch.IsSelected == true ? 0 : 1;
+ if (((LightBase)i_device).OnOffStatus == 1 && level == 0)
+ {
+ //濡傛灉褰撳墠鏄墦寮�鐘舵��,骞朵笖浜害涓�0鐨勮瘽,鍒欓渶瑕佸彉鎴�100%浜害
+ i_device.GetType().InvokeMember("Level", System.Reflection.BindingFlags.SetField, null, i_device, new object[] { 100 });
+ }
+ this.RefreshControlInfo(this.device);
+ return;
+ }
+ bool setStatu = !btnSwitch.IsSelected;
+ //鍙樻洿鍗$墖鐘舵��
+ this.SetCardOpenStatu(setStatu);
+ //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅
+ this.StartCheckResponeResult(!setStatu);
+
+ if (setStatu == true)
+ {
+ //鎵撳紑
+ this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1));
+ if (level == 0)
+ {
+ //濡傛灉褰撳墠鏄墦寮�鐘舵��,骞朵笖浜害涓�0鐨勮瘽,鍒欓渶瑕佸彉鎴�100%浜害
+ i_device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, i_device, new object[] { 254 });
+ }
+ else
+ {
+ i_device.SwitchControl(1);
+ HdlThreadLogic.Current.RunThread(() =>
+ {
+ //鑾峰彇鐏厜浜害
+ System.Threading.Thread.Sleep(300);
+ HdlDeviceAttributeLogic.Current.SendLevelStatuComand(i_device);
+ });
+ }
+ }
+ else
+ {
+ //鍏抽棴
+ this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.Close));
+ i_device.SwitchControl(0);
+ }
+ };
+ }
+
+ #endregion
+
+ #region 鈻� 娣卞害鍗$墖淇℃伅_______________________
+
+ /// <summary>
+ /// 娣诲姞璺宠浆娣卞害鍗$墖淇℃伅浜嬩欢
+ /// </summary>
+ private void AddDetailInfoEvent(CommonDevice i_device)
+ {
+ //娣卞害鍗$墖淇℃伅
+ this.ButtonClickEvent += (sender, e) =>
+ {
+ Common.CommonPage.Instance.IsDrawerLockMode = true;
+
+ if (Common.LocalDevice.Current.IsMiniLight(this.device) == false)
+ {
+ var form = new ControlForm.DeviceColorTemperatureLightDetailCardForm();
+ form.RowOrCardControl = this;
+ form.AddForm(i_device, this.nowSelectRoom, 965, 1466);
+ form.FormCloseEvent += this.CardDetailInfoBackEvent;
+ }
+ else
+ {
+ //mini澶滅伅
+ var form = new ControlForm.DeviceMiniLightDetailCardForm();
+ form.RowOrCardControl = this;
+ form.AddForm(i_device, this.nowSelectRoom, 965, 1466);
+ form.FormCloseEvent += this.CardDetailInfoBackEvent;
+ }
+ };
+ }
+
+ #endregion
+
+ #region 鈻� 妫�娴嬭澶囨墦寮�鐘舵�乢__________________
+
+ /// <summary>
+ /// 妫�娴嬭澶囨墦寮�鐘舵��
+ /// </summary>
+ /// <param name="i_device"></param>
+ /// <returns></returns>
+ public override bool CheckIsOpenStatu(CommonDevice i_device)
+ {
+ return ((LightBase)i_device).OnOffStatus == 1;
+ }
+
+ #endregion
+
+ #region 鈻� 鍙戦�佽幏鍙栫姸鎬佸懡浠__________________
+
+ /// <summary>
+ /// 鍙戦�佽幏鍙栫姸鎬佸懡浠�
+ /// </summary>
+ public override void SendStatuComand()
+ {
+ if (Common.Config.Instance.Home.IsVirtually == true)
+ {
+ //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鍒欐鍔熻兘鏃犳晥
+ return;
+ }
+ //妫�娴嬭兘鍚﹀彂閫佽幏鍙栫姸鎬佸懡浠�
+ if (this.CheckCanSendStatuComand() == true)
+ {
+ HdlDeviceAttributeLogic.Current.SendColorTemperatureLightStatuComand(this.device);
+ }
+ }
+
+ #endregion
+ }
+}
--
Gitblit v1.8.0