From d6fb0646531172f23648441c224cdcccd721b894 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期一, 14 十二月 2020 09:59:01 +0800
Subject: [PATCH] 请合并代码,完成晾衣架最终功能。

---
 ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceAirerDetailCardForm.cs |  812 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 812 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceAirerDetailCardForm.cs b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceAirerDetailCardForm.cs
new file mode 100644
index 0000000..4bd6c18
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceAirerDetailCardForm.cs
@@ -0,0 +1,812 @@
+锘縰sing Shared.Common;
+using Shared.Phone.UserCenter;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using ZigBee.Device;
+namespace Shared.Phone.MainPage.ControlForm
+{
+  /// <summary>
+  /// 鏅捐。鏋剁被鍨嬬殑娣卞害鍗$墖鐣岄潰
+  /// </summary>
+  public class DeviceAirerDetailCardForm : DeviceDetailCardCommonForm
+  {
+    #region 鈻� 鍙橀噺澹版槑___________________________
+    /// <summary>
+    /// 褰撳墠鏅捐。鏋�
+    /// </summary>
+    Airer airer = null;
+    /// <summary>
+    /// 鎵撳紑鎺т欢
+    /// </summary>
+    private IconBigViewControl btnOpen = null;
+    /// <summary>
+    /// 鍋滄鎺т欢
+    /// </summary>
+    private IconBigViewControl btnStop = null;
+    /// <summary>
+    /// 鍏抽棴鎺т欢
+    /// </summary>
+    private IconBigViewControl btnClose = null;
+    /// <summary>
+    /// 鐓ф槑
+    /// </summary>
+    private IconViewControl btnLight = null;
+    /// <summary>
+    /// 娑堟瘨
+    /// </summary>
+    private IconViewControl btnDisinfect = null;
+    /// <summary>
+    /// 椋庡共
+    /// </summary>
+    private IconViewControl btnWind = null;
+    /// <summary>
+    /// 鐑樺共
+    /// </summary>
+    private IconViewControl btnDry = null;
+
+    /// <summary>
+    /// 寮�鍚堝笜鎺т欢
+    /// </summary>
+    private CurtainSeekBar SeekBarOpenCurtain = null;
+    /// <summary>
+    /// 杩涘害鍊兼槸鍚﹀湪鏀瑰彉涓�
+    /// </summary>
+    private bool isProgressing = false;
+    /// <summary>
+    /// 鏄惁宸茬粡鍒濆鍖栦簡鎺т欢(鍥犱负搴曞眰鏈夊彲鑳戒細鍒锋柊鏁翠釜鐣岄潰)
+    /// </summary>
+    private bool hadInitControl = false;
+    /// <summary>
+    /// 鐑樺共鏃堕棿
+    /// </summary>
+    Button btnDryTimeText;
+    /// <summary>
+    /// 椋庡共鏃堕棿 
+    /// </summary>
+    Button btnWindTimeText;
+    /// <summary>
+    /// 娑堟瘨鏃堕棿
+    /// </summary>
+    Button btnDisinfectTimeText;
+    /// <summary>
+    /// 鐑樺共鏂囨湰鏃堕棿澶勭悊
+    /// </summary>
+    public Action<string> actionDry = null;
+    /// <summary>
+    /// 椋庡共鏂囨湰鏃堕棿澶勭悊
+    /// </summary>
+    public Action<string> actionWind = null;
+    /// <summary>
+    /// 娑堟瘨鏂囨湰鏃堕棿澶勭悊
+    /// </summary>
+    public Action<string> actionDisinfect = null;
+    #endregion
+
+    #region 鈻� 鍒濆鍖朹____________________________
+
+    /// <summary>
+    /// 搴曞眰鍒濆鍖栦腑閮ㄦ帶浠跺畬鎴愪箣鍚�
+    /// </summary>
+    /// <param name="frameWhiteBack"></param>
+    public override void InitMiddleFrameAfter(FrameLayout frameWhiteBack)
+    {
+      airer = this.device as Airer;
+      //宸︽粦涓嶈兘
+      this.ScrollEnabled = false;
+      //璁剧疆鐘舵�佹枃瀛�
+      this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
+
+      var btnDoorLockPic = new Button()
+      {
+        Width = Application.GetMinReal(432),
+        Height = Application.GetMinReal(302),
+        Y = Application.GetRealHeight(228),
+        UnSelectedImagePath = "Airer/DetailAirerPic.png",
+        Gravity = Gravity.CenterHorizontal,
+      };
+      frameWhiteBack.AddChidren(btnDoorLockPic);
+
+      //鎵撳紑鎺т欢
+      this.btnOpen = new IconBigViewControl(81, 81);
+      btnOpen.btnIcon.UseClickStatu = true;
+      frameWhiteBack.AddChidren(btnOpen);
+      btnOpen.InitControl();
+      btnOpen.UnSelectedImagePath = "Airer/UpOffline.png";
+      btnOpen.SelectedImagePath = "Airer/Up.png";
+      btnOpen.X = Application.GetRealWidth(132) - btnOpen.XOffset;
+      btnOpen.Y = Application.GetRealHeight(671);
+
+      //鍋滄鎺т欢
+      this.btnStop = new IconBigViewControl(81, 81);
+      btnStop.btnIcon.UseClickStatu = true;
+      btnStop.UnSelectedImagePath = "Airer/StopOffline.png";
+      btnStop.SelectedImagePath = "Airer/Stop.png";
+      frameWhiteBack.AddChidren(btnStop);
+      btnStop.InitControl();
+      btnStop.X = Application.GetRealWidth(444) - btnStop.XOffset;
+      btnStop.Y = btnOpen.Y;
+
+      //鍏抽棴
+      this.btnClose = new IconBigViewControl(81, 81);
+      btnClose.btnIcon.UseClickStatu = true;
+      frameWhiteBack.AddChidren(btnClose);
+      btnClose.InitControl();
+      btnClose.UnSelectedImagePath = "Airer/DownOffline.png";
+      btnClose.SelectedImagePath = "Airer/Down.png";
+      btnClose.X = Application.GetRealWidth(752) - btnClose.XOffset;
+      btnClose.Y = btnOpen.Y;
+
+      //鐑樺共
+      btnDry = new IconViewControl(81);
+      btnDry.UnSelectedImagePath = "Airer/DryOffline.png";
+      btnDry.SelectedImagePath = "Airer/Dry.png";
+      btnDry.X = Application.GetRealWidth(98);
+      btnDry.Y = Application.GetRealHeight(913);
+      btnDry.IsSelected = ((Airer)this.device).DryOnOffStatus == 1 ? true : false;
+      frameWhiteBack.AddChidren(btnDry);
+
+      //椋庡共
+      btnWind = new IconViewControl(81);
+      frameWhiteBack.AddChidren(btnWind);
+      btnWind.UnSelectedImagePath = "Airer/WindOffline.png";
+      btnWind.SelectedImagePath = "Airer/Wind.png";
+      btnWind.X = Application.GetRealWidth(328);
+      btnWind.IsSelected = ((Airer)this.device).WindOnOffStatus == 1 ? true : false;
+      btnWind.Y = btnDry.Y;
+
+      //娑堟瘨
+      btnDisinfect = new IconViewControl(81);
+      frameWhiteBack.AddChidren(btnDisinfect);
+      btnDisinfect.UnSelectedImagePath = "Airer/DisinfectOffline.png";
+      btnDisinfect.SelectedImagePath = "Airer/DisinfectSelected.png";
+      btnDisinfect.IsSelected = ((Airer)this.device).DisinfectOnOffStatus == 1 ? true : false;
+      btnDisinfect.X = Application.GetRealWidth(556);
+      btnDisinfect.Y = btnDry.Y;
+
+      //鐓ф槑
+      btnLight = new IconViewControl(81);
+      frameWhiteBack.AddChidren(btnLight);
+      btnLight.UnSelectedImagePath = "Airer/LightOffline.png";
+      btnLight.SelectedImagePath = "Airer/LightSelected.png";
+      btnLight.IsSelected = ((Airer)this.device).OnOffStatus == 1 ? true : false;
+      btnLight.X = Application.GetRealWidth(786);
+      btnLight.Y = btnDry.Y;
+
+      string[] stringText = {
+               Language.StringByID(R.MyInternationalizationString.AirerUp),
+               Language.StringByID(R.MyInternationalizationString.AirerStop),
+               Language.StringByID(R.MyInternationalizationString.AirerDown),
+               Language.StringByID(R.MyInternationalizationString.AirerDry),
+               Language.StringByID(R.MyInternationalizationString.AirerWind),
+               Language.StringByID(R.MyInternationalizationString.AirerDisinfect),
+               Language.StringByID(R.MyInternationalizationString.AirerLight)
+            };
+
+      for (int i = 0; i < stringText.Length; i++)
+      {
+        var btnText = new Button()
+        {
+          Width = Application.GetRealWidth(69 + 20),
+          Height = Application.GetRealHeight(46),
+          TextColor = ZigbeeColor.Current.XMGray2,
+          TextSize = 12,
+          Text = stringText[i],
+        };
+        frameWhiteBack.AddChidren(btnText);
+
+        switch (i)
+        {
+          case 0:
+            btnText.X = Application.GetRealWidth(128);
+            btnText.Y = Application.GetRealHeight(780);
+            break;
+          case 1:
+            btnText.X = Application.GetRealWidth(439);
+            btnText.Y = Application.GetRealHeight(780);
+            break;
+          case 2:
+            btnText.X = Application.GetRealWidth(747);
+            btnText.Y = Application.GetRealHeight(780);
+            break;
+          case 3:
+            btnText.X = Application.GetRealWidth(94);
+            btnText.Y = Application.GetRealHeight(1022);
+            btnText.BackgroundColor = 0xff00ff;
+            break;
+          case 4:
+            btnText.X = Application.GetRealWidth(324);
+            btnText.Y = Application.GetRealHeight(1022);
+            btnText.BackgroundColor = 0xff00ff;
+            break;
+          case 5:
+            btnText.X = Application.GetRealWidth(552);
+            btnText.Y = Application.GetRealHeight(1022);
+            break;
+          case 6:
+            btnText.X = Application.GetRealWidth(782);
+            btnText.BackgroundColor = 0xff00ff;
+            btnText.Y = Application.GetRealHeight(1022);
+            break;
+        }
+      }
+
+      //鍙崇澶�  {鐑樺共銆侀骞插拰娑堟瘨鐨勮缃粯璁ゆ椂闂存殏鏃跺彇鍘绘帀锛屼笖鍊掕鏃朵篃鍘绘帀锛屽洜涓虹涓夋柟璁惧涓嶆敮鎸併��
+      //TimeShow(frameWhiteBack);
+
+      ClickEventHander();
+
+    }
+
+    #endregion
+
+    #region 鈻� 鏃堕棿鏄剧ず_______________________
+
+    /// <summary>
+    /// 鍙戦�佺獥甯樺懡浠�
+    /// </summary>
+    /// <param name="comand"></param>
+    private void TimeShow(FrameLayout frameWhiteBack)
+    {
+      //鐑樺共鏃堕棿
+      btnDryTimeText = new Button()
+      {
+        Width = Application.GetRealWidth(109 + 10),
+        Height = Application.GetRealHeight(40),
+        X = Application.GetRealWidth(81),
+        Y = Application.GetRealHeight(1092),
+        TextColor = ZigbeeColor.Current.XMOrange,
+        TextSize = 10,
+        Text = GetTimeString(airer.DryRemainTime),
+      };
+      frameWhiteBack.AddChidren(btnDryTimeText);
+
+      //椋庡共鏃堕棿
+      btnWindTimeText = new Button()
+      {
+        Width = Application.GetRealWidth(109 + 10),
+        Height = Application.GetRealHeight(40),
+        TextColor = ZigbeeColor.Current.XMOrange,
+        TextSize = 10,
+        X = Application.GetRealWidth(311),
+        Y = btnDryTimeText.Y,
+        Text = GetTimeString(airer.WindRemainTime),
+      };
+      frameWhiteBack.AddChidren(btnWindTimeText);
+
+      //娑堟瘨鏃堕棿
+      btnDisinfectTimeText = new Button()
+      {
+        Width = Application.GetRealWidth(109 + 10),
+        Height = Application.GetRealHeight(40),
+        TextColor = ZigbeeColor.Current.XMOrange,
+        TextSize = 10,
+        Text = GetTimeString(airer.DisinfectRemainTime),
+        X = Application.GetRealWidth(539),
+        Y = btnDryTimeText.Y,
+      };
+      frameWhiteBack.AddChidren(btnDisinfectTimeText);
+
+      var rowAirer = new AiererTimeControl(0);
+      rowAirer.DetailCardActionTimeEvent += (timeCur, typeCur) =>
+      {
+        switch (typeCur)
+        {
+          case 1:
+            btnDryTimeText.Text = GetTimeString(timeCur);
+            break;
+          case 2:
+            btnWindTimeText.Text = GetTimeString(timeCur);
+            break;
+          case 3:
+            btnDisinfectTimeText.Text = GetTimeString(timeCur);
+            break;
+        }
+      };
+      actionDry = (textTime) =>
+      {
+        btnDryTimeText.Text = textTime;
+        TimerHandler(airer);
+      };
+      actionWind = (textTime) =>
+     {
+       btnWindTimeText.Text = textTime;
+       TimerHandler(airer);
+     };
+      actionDisinfect = (textTime) =>
+      {
+        btnDisinfectTimeText.Text = textTime;
+        TimerHandler(airer);
+      };
+
+      TimerHandler(airer);
+    }
+
+    #endregion
+
+    #region 鈻� 鐐瑰嚮浜嬩欢澶勭悊_______________________
+    /// <summary>
+    /// 鐐瑰嚮浜嬩欢澶勭悊
+    /// </summary>
+    void ClickEventHander()
+    {
+      btnOpen.ButtonClickEvent += (sender, e) =>
+      {
+        //鍙戦�佺獥甯樺懡浠�
+        this.SetCurtainCommand(0);
+      };
+      btnStop.ButtonClickEvent += (sender, e) =>
+      {
+        //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鍒欐鍔熻兘鏃犳晥
+        if (Common.Config.Instance.Home.IsVirtually == true)
+        {
+          return;
+        }
+        //鍙戦�佺獥甯樺懡浠�
+        this.SetCurtainCommand(2);
+      };
+      btnClose.ButtonClickEvent += (sender, e) =>
+      {
+        //鍙戦�佺獥甯樺懡浠�
+        this.SetCurtainCommand(1);
+      };
+
+      btnDry.ButtonClickEvent += (sender, e) =>
+      {
+        //鍙戦�佸紑鍏冲懡浠�
+        this.SetSwitchCommand(!btnDry.IsSelected, 4);
+      };
+      btnWind.ButtonClickEvent += (sender, e) =>
+      {
+        //鍙戦�佸紑鍏冲懡浠�
+        this.SetSwitchCommand(!btnWind.IsSelected, 3);
+      };
+      btnDisinfect.ButtonClickEvent += (sender, e) =>
+      {
+        //鍙戦�佸紑鍏冲懡浠�
+        this.SetSwitchCommand(!btnDisinfect.IsSelected, 5);
+      };
+      btnLight.ButtonClickEvent += (sender, e) =>
+      {
+        //鍙戦�佸紑鍏冲懡浠�
+        this.SetSwitchCommand(!btnLight.IsSelected, 2);
+      };
+    }
+    #endregion
+
+    #region 鈻� 鍙戦�佸紑鍏冲懡浠______________________ 
+    /// <summary>
+    /// 鍙戦�佸紑鍏冲懡浠�
+    ///娉ㄦ剰锛岃。鏋朵腑涓嶅悓绔偣浠h〃涓嶅悓鍔熻兘
+    ///鍥炶矾1:绐楀笜鎺у埗
+    ///鍥炶矾2:鐓ф槑鎺у埗
+    ///鍥炶矾3:椋庡共鎺у埗  
+    ///鍥炶矾4:鐑樺共鎺у埗
+    ///鍥炶矾5:娑堟瘨鎺у埗
+    /// </summary>
+    /// <param name="isOpen">鍙戦�佺姸鎬�</param>
+    /// <param name="type">鍙戦�佺被鍨嬶細2:鐓ф槑锛�3:椋庡共锛�4:鐑樺共锛�5娑堟瘨</param>
+    private void SetSwitchCommand(bool isOpen, int type)
+    {
+      //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹� 
+      if (Common.Config.Instance.Home.IsVirtually == true)
+      {
+        switch (type)
+        {
+          case 2:
+            ((Airer)this.device).OnOffStatus = isOpen == true ? 1 : 0;
+            //鍙樻洿鍗$墖鐘舵��
+            this.RefreshSwitchStatu(((Airer)this.device).OnOffStatus == 1, 2);
+            break;
+          case 3:
+            ((Airer)this.device).WindOnOffStatus = isOpen == true ? 1 : 0;
+            if (isOpen)
+            {
+              airer.WindRemainTime = airer.WindTime;
+            }
+            //鍙樻洿鍗$墖鐘舵��
+            this.RefreshSwitchStatu(((Airer)this.device).WindOnOffStatus == 1, 3);
+            break;
+          case 4:
+            ((Airer)this.device).DryOnOffStatus = isOpen == true ? 1 : 0;
+            if (isOpen)
+            {
+              airer.DryRemainTime = airer.DryTime;
+            }
+            //鍙樻洿鍗$墖鐘舵��
+            this.RefreshSwitchStatu(((Airer)this.device).DryOnOffStatus == 1, 4);
+            break;
+          case 5:
+            ((Airer)this.device).DisinfectOnOffStatus = isOpen == true ? 1 : 0;
+            if (isOpen)
+            {
+              airer.DisinfectRemainTime = airer.DisinfectTime;
+            }
+            //鍙樻洿鍗$墖鐘舵��
+            this.RefreshSwitchStatu(((Airer)this.device).DisinfectOnOffStatus == 1, 5);
+            break;
+        }
+        return;
+      }
+
+      //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅
+      var listControl = new List<ButtonBase>();
+      listControl.Add(btnDry);
+      listControl.Add(btnWind);
+      listControl.Add(btnDisinfect);
+      listControl.Add(btnLight);
+      this.StartCheckResponeResult(listControl, (result) =>
+      {
+        //鎺ユ敹鍒扮綉鍏冲洖澶�
+        if (result == true)
+        {
+          HdlThreadLogic.Current.RunMain(() =>
+                {
+                  //鍙樻洿鍗$墖鐘舵��
+                  switch (type)
+                  {
+                    case 2:
+                      bool statu = ((Airer)this.device).OnOffStatus == 1;
+                      this.RefreshSwitchStatu(statu, type);
+                      break;
+                    case 3:
+                      bool statu5 = ((Airer)this.device).WindOnOffStatus == 1;
+                      this.RefreshSwitchStatu(statu5, type);
+                      break;
+                    case 4:
+                      bool statu4 = ((Airer)this.device).DryOnOffStatus == 1;
+                      this.RefreshSwitchStatu(statu4, type);
+                      break;
+                    case 5:
+                      bool statu3 = ((Airer)this.device).DisinfectOnOffStatus == 1;
+                      this.RefreshSwitchStatu(statu3, type);
+                      break;
+                  }
+
+                });
+        }
+      });
+
+      //鎵撳紑
+      //switch (type)
+      //{ 
+      //  case 3:
+      //鍙戦�侀粯璁ゆ椂闂�
+      //if (airer.WindTime == 0)
+      //{
+      //  airer.WindTime = 180;
+      //}
+      //airer.SetAirerFunTimeDevice(airer.WindTime, 3);
+      //  break;
+      //case 4:
+      //鍙戦�侀粯璁ゆ椂闂�
+      //if (airer.DryTime == 0)
+      //{
+      //  airer.DryTime = 180;
+      //}
+      //airer.SetAirerFunTimeDevice(airer.DryTime, 4);
+      //  break;
+      //case 5:
+      //鍙戦�侀粯璁ゆ椂闂� 
+      //if (airer.DisinfectTime == 0)
+      //{
+      //  airer.DisinfectTime = 30;
+      //}
+      //airer.SetAirerFunTimeDevice(airer.DisinfectTime, 5);
+      //    break;
+      //}
+      if (isOpen == true)
+      {
+        airer.SwitchControl(1, type);
+      }
+      else
+      {
+        airer.SwitchControl(0, type);
+      }
+    }
+
+    #endregion
+
+    #region 鈻� 鍙戦�佺獥甯樺懡浠______________________
+
+    /// <summary>
+    /// 鍙戦�佺獥甯樺懡浠�
+    ///娉ㄦ剰锛岃。鏋朵腑涓嶅悓绔偣浠h〃涓嶅悓鍔熻兘
+    ///鍥炶矾1:绐楀笜鎺у埗
+    ///鍥炶矾2:鐓ф槑鎺у埗
+    ///鍥炶矾3:椋庡共鎺у埗  
+    ///鍥炶矾4:鐑樺共鎺у埗
+    ///鍥炶矾5:娑堟瘨鎺у埗
+    /// </summary>
+    /// <param name="comand"></param>
+    private void SetCurtainCommand(int comand)
+    {
+      //
+      this.device.DeviceEpoint = 1;
+      //鍙戦�佸懡浠�
+      ((Airer)device).AirerUpDownStopControl(comand);
+    }
+
+    #endregion
+
+    #region 鈻� 鍒锋柊寮�鍏崇姸鎬乢______________________
+
+    /// <summary>
+    /// 鍒锋柊寮�鍏崇姸鎬�
+    /// </summary>
+    /// <param name="isOpen">鎵撳紑鐘舵��</param>
+    /// <param name="type">鍙戦�佺被鍨嬶細2:鐓ф槑锛�3:椋庡共锛�4:鐑樺共锛�5娑堟瘨</param>
+    private void RefreshSwitchStatu(bool isOpen, int type)
+    {
+      switch (type)
+      {
+        case 2:
+          btnLight.IsSelected = isOpen;
+          break;
+        case 3:
+          btnWind.IsSelected = isOpen;
+          //btnWindTimeText.Text = GetTimeString(airer.WindRemainTime);
+          //if (!isOpen)
+          //{
+          //  airer.WindRemainTime = 0;
+          //}
+          break;
+        case 4:
+          btnDry.IsSelected = isOpen;
+          //btnDryTimeText.Text = GetTimeString(airer.DryRemainTime);
+          //if (!isOpen)
+          //{
+          //  airer.DryRemainTime = 0;
+          //}
+          break;
+        case 5:
+          btnDisinfect.IsSelected = isOpen;
+          //btnDisinfectTimeText.Text = GetTimeString(airer.DisinfectRemainTime);
+          //if (!isOpen)
+          //{
+          //  airer.DisinfectRemainTime = 0;
+          //}
+          break;
+      }
+      //璁剧疆鐘舵�佹枃瀛�
+      this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
+    }
+
+    #endregion
+
+    #region 鈻� 鏄惁鑾峰彇缃戝叧鍙嶉鐨勭粨鏋淿____________
+
+    /// <summary>
+    /// 妫�娴嬬綉鍏崇殑鍙嶉缁撴灉(灞炴�т笂鎶ョ殑瀵硅薄锛歞evice.DeviceStatusReport)
+    /// </summary>
+    /// <param name="comandDiv">鍛戒护鍖哄垎</param>
+    /// <param name="report">涓婃姤鏁版嵁</param>
+    /// <returns></returns>
+    public override bool CheckResponeResultStatu(ReceiveComandDiv comandDiv, CommonDevice report)
+    {
+      if (comandDiv == ReceiveComandDiv.A璁惧灞炴�т笂鎶�)
+      {
+        HdlThreadLogic.Current.RunMain(() =>
+        {
+          //鍙樻洿鍗$墖鐘舵��
+          switch (report.DeviceEpoint)
+          {
+            case 2:
+              this.RefreshSwitchStatu(((Airer)this.device).OnOffStatus == 1, 2);
+              break;
+            case 3:
+              this.RefreshSwitchStatu(((Airer)this.device).WindOnOffStatus == 1, 3);
+              break;
+            case 4:
+              this.RefreshSwitchStatu(((Airer)this.device).DryOnOffStatus == 1, 4);
+              break;
+            case 5:
+              this.RefreshSwitchStatu(((Airer)this.device).DisinfectOnOffStatus == 1, 5);
+              break;
+          }
+        });
+        return true;
+      }
+      return false;
+    }
+
+    #endregion
+
+    /// <summary>
+    /// 鏃堕棿鍊掕鏃惰缃�
+    /// <param name="type">鏅捐。鏋舵椂闂� 锛�1鐑樺共锛�2:椋庡共锛�3娑堟瘨</param>
+    /// </summary>
+    /// <param name="sceneContr"></param>
+    public async void TimerHandler(Airer airer)
+    {
+      if (airer.DryOnOffStatus == 1 && airer.DryRemainTime != 0)
+      {
+        new System.Threading.Thread(async () =>
+       {
+         while (airer.DryRemainTime > 0 && this.Parent != null)
+         {
+           System.Threading.Thread.Sleep(1000);
+           HdlThreadLogic.Current.RunMain(() =>
+                   {
+                     actionDry?.Invoke(GetTimeString(airer.DryRemainTime));
+                   }, ShowErrorMode.NO);
+           airer.DryRemainTime--;
+         }
+         HdlThreadLogic.Current.RunMain(() =>
+                 {
+                   if (this.Parent != null)
+                   {
+                     //鐩存帴寮�鍚疞oading鐗规晥
+                     actionDry?.Invoke("");
+                   }
+                 }, ShowErrorMode.NO);
+       })
+        { IsBackground = true }.Start();
+      }
+      if (airer.WindOnOffStatus == 1 && airer.WindRemainTime != 0)
+      {
+        //寮�鍚骞叉椂闂�
+        new System.Threading.Thread(async () =>
+        {
+          while (airer.WindRemainTime > 0 && this.Parent != null)
+          {
+            System.Threading.Thread.Sleep(1000);
+            HdlThreadLogic.Current.RunMain(() =>
+                    {
+                      actionWind?.Invoke(GetTimeString(airer.WindRemainTime));
+                    }, ShowErrorMode.NO);
+            airer.WindRemainTime--;
+          }
+          HdlThreadLogic.Current.RunMain(() =>
+                 {
+                   if (this.Parent != null)
+                   {
+                     //鐩存帴寮�鍚疞oading鐗规晥
+                     actionWind?.Invoke("");
+                   }
+                 }, ShowErrorMode.NO);
+        })
+        { IsBackground = true }.Start();
+      }
+      if (airer.DisinfectOnOffStatus == 1 && airer.DisinfectRemainTime != 0)
+      {
+        //寮�鍚秷姣掓椂闂�
+        new System.Threading.Thread(async () =>
+        {
+          while (airer.DisinfectRemainTime > 0 && this.Parent != null)
+          {
+            System.Threading.Thread.Sleep(1000);
+            HdlThreadLogic.Current.RunMain(() =>
+                    {
+                      actionDisinfect?.Invoke(GetTimeString(airer.DisinfectRemainTime));
+                    }, ShowErrorMode.NO);
+            airer.DisinfectRemainTime--;
+          }
+
+          HdlThreadLogic.Current.RunMain(() =>
+                  {
+                    if (this.Parent != null)
+                    {
+                      //鐩存帴寮�鍚疞oading鐗规晥 
+                      actionDisinfect?.Invoke("");
+                    }
+                  }, ShowErrorMode.NO);
+        })
+        { IsBackground = true }.Start();
+      }
+    }
+
+    /// <summary>
+    /// 鑾峰彇鍦烘櫙寤舵椂瀛楃涓�
+    /// </summary>
+    /// <param name="second"></param>
+    /// <returns></returns>
+    public static string GetTimeString(int second)
+    {
+      if (second == 0)
+      {
+        return null;
+      }
+      string timeStr = string.Empty;
+      int hour = second / 3600;
+      int minu = second % 3600 / 60;
+      int sec = second % 60;
+      string h = string.Empty;
+      string m = string.Empty;
+      string s = string.Empty;
+
+      if (hour > 0)
+      {
+        if (hour < 10)
+        {
+          h = "0" + hour;
+        }
+        else
+        {
+          h = hour.ToString();
+        }
+        timeStr += $"{h}:";
+
+        if (minu >= 0)
+        {
+          if (minu < 10)
+          {
+            m = "0" + minu;
+          }
+          else
+          {
+            m = minu.ToString();
+          }
+          timeStr += $"{m}:";
+        }
+
+        if (sec >= 0)
+        {
+          if (sec < 10)
+          {
+            s = "0" + sec;
+          }
+          else
+          {
+            s = minu.ToString();
+          }
+          timeStr += $"{s}";
+        }
+
+        return timeStr;
+      }
+      else
+      {
+        if (minu > 0)
+        {
+          timeStr = "00:";
+          if (minu < 10)
+          {
+            m = "0" + minu;
+          }
+          else
+          {
+            m = minu.ToString();
+          }
+          timeStr += $"{m}:";
+
+          if (sec >= 0)
+          {
+            if (sec < 10)
+            {
+              s = "0" + sec;
+            }
+            else
+            {
+              s = sec.ToString();
+            }
+            timeStr += $"{s}";
+          }
+
+          return timeStr;
+        }
+        else
+        {
+          if (sec > 0)
+          {
+            timeStr = "00:00:";
+            if (sec < 10)
+            {
+              s = "0" + sec;
+            }
+            else
+            {
+              s = sec.ToString();
+            }
+            timeStr += $"{s}";
+            return timeStr;
+          }
+          else
+          {
+            return "";
+          }
+        }
+      }
+    }
+  }
+}

--
Gitblit v1.8.0