From f71e74b5f0d2716fbf05da016cdaa18d64e09f80 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期四, 31 十二月 2020 17:01:18 +0800
Subject: [PATCH] 又换完成最新门锁。空气质量传感器完成数据和基本配置功能。开发图表和自动化的同事可下载此代码

---
 ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/DeviceRelayRowControl.cs |  132 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 132 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/DeviceRelayRowControl.cs b/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/DeviceRelayRowControl.cs
new file mode 100644
index 0000000..8567af8
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/DeviceRelayRowControl.cs
@@ -0,0 +1,132 @@
+锘縰sing Shared.Phone.UserCenter;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using ZigBee.Device;
+
+namespace Shared.Phone.Category.Controls
+{
+  /// <summary>
+  /// 鍒嗙被鐣岄潰鐨勭户鐢靛櫒璁惧琛屾帶浠�
+  /// </summary>
+  public class DeviceRelayRowControl : DeviceRowCommon
+  {
+    #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) =>
+      {
+              //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�
+              if (Common.Config.Instance.Home.IsVirtually == true)
+        {
+                //鐩存帴鍙樻洿缂撳瓨
+                ((LightBase)i_device).OnOffStatus = btnSwitch.IsSelected == true ? 0 : 1;
+          this.RefreshControlInfo(this.device);
+          return;
+        }
+
+        bool setStatu = !btnSwitch.IsSelected;
+              //鍙樻洿鍗$墖鐘舵��
+              this.SetRowOpenStatu(setStatu);
+              //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅
+              this.StartCheckResponeResult(!setStatu);
+
+        if (setStatu == true)
+        {
+                //鎵撳紑
+                this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1));
+          i_device.SwitchControl(1);
+        }
+        else
+        {
+                //鍏抽棴
+                this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.Close));
+          i_device.SwitchControl(0);
+        }
+      };
+    }
+
+    #endregion
+
+    #region 鈻� 娣卞害鍗$墖淇℃伅_______________________
+
+    /// <summary>
+    /// 娣诲姞璺宠浆娣卞害鍗$墖淇℃伅浜嬩欢
+    /// </summary>
+    private void AddDetailInfoEvent(CommonDevice i_device)
+    {
+      //娣卞害鍗$墖淇℃伅
+      this.frameTable.ButtonClickEvent += (sender, e) =>
+      {
+        int backHeight = 0;
+        if (i_device.DfunctionType == DeviceFunctionType.A寮�鍏�)
+        {
+          backHeight = 1290;
+        }
+        else if (i_device.DfunctionType == DeviceFunctionType.A鎻掑骇)
+        {
+          backHeight = 1290;
+        }
+        else
+        {
+          backHeight = 1316;
+        }
+
+              //缁х數鍣ㄧ被鍨嬬殑娣卞害鍗$墖鐣岄潰(鍚┖姘斿紑鍏�)
+              var form = new MainPage.ControlForm.DeviceRelayDetailCardForm();
+        form.RowOrCardControl = this;
+        form.AddForm(i_device, this.nowSelectRoom, 965, backHeight);
+        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.SendLightStatuComand(this.device);
+      }
+    }
+
+    #endregion
+  }
+}

--
Gitblit v1.8.0