HDL Home App 第二版本 旧平台金堂用 正在使用
hxb
2022-08-30 25429f085093d89d543a0b90e30d0d62d1b7dac9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
using Shared.Phone.UserCenter;
using System;
using System.Collections.Generic;
using System.Text;
using ZigBee.Device;
 
namespace Shared.Phone.MainPage.Controls
{
  /// <summary>
  /// 晾衣架卡片控件
  /// </summary>
  public class DeviceAirerCardControl : 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);
    }
 
    #endregion
 
    #region ■ 深度卡片信息_______________________
 
    /// <summary>
    /// 添加跳转深度卡片信息事件
    /// </summary>
    private void AddDetailInfoEvent(CommonDevice i_device)
    {
      //深度卡片信息
      this.ButtonClickEvent += (sender, e) =>
      {
        Common.CommonPage.Instance.IsDrawerLockMode = true;
        //晾衣架类型的深度卡片界面
        var form = new MainPage.ControlForm.DeviceAirerDetailCardForm();
        form.RowOrCardControl = this;
        form.AddForm(i_device, this.nowSelectRoom, 965, 1316);
        form.FormCloseEvent += this.CardDetailInfoBackEvent;
      };
    }
 
    #endregion
 
    #region ■ 检测设备打开状态___________________
 
    /// <summary>
    /// 检测设备打开状态
    /// </summary>
    /// <param name="i_device"></param>
    /// <returns></returns>
    public override bool CheckIsOpenStatu(CommonDevice i_device)
    {
      bool isOpen = false;
      var airer = device as Airer;
      if (airer.OnOffStatus == 1
        || airer.DryOnOffStatus == 1 ||
      airer.WindOnOffStatus == 1 ||
      airer.DisinfectOnOffStatus == 1)
      {
        isOpen = true;
      }
      return isOpen;
    }
 
    #endregion
 
    #region ■ 发送获取状态命令___________________
 
    /// <summary>
    /// 发送获取状态命令
    /// </summary>
    public override void SendStatuComand()
    {
      if (Common.Config.Instance.Home.IsVirtually == true)
      {
        //如果住宅为虚拟住宅,则此功能无效
        return;
      }
      //检测能否发送获取状态命令
      if (this.CheckCanSendStatuComand() == true)
      {
        for (int i = 2; i < 6; i++)
        {
          //注意,衣架中的状态由不同端点获取
          //回路2:读取照明开关状态
          //回路3:读取风干开关状态和时间值 
          //回路4:读取烘干开关状态和时间值
          //回路5:读取消毒开关状态和时间值
          HdlDeviceAttributeLogic.Current.SendAirerComand(this.device, i);
        }
      }
    }
 
    #endregion
  }
}