New file |
| | |
| | | using Shared.Phone.UserCenter; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using ZigBee.Device; |
| | | namespace Shared.Phone.Category.Controls |
| | | { |
| | | /// <summary> |
| | | /// 分类界面的晾衣架设备行控件 |
| | | /// </summary> |
| | | public class DeviceAirerRowControl : DeviceRowCommon |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 打开控件 |
| | | /// </summary> |
| | | private MostRightIconControl btnOpen = null; |
| | | /// <summary> |
| | | /// 停止控件 |
| | | /// </summary> |
| | | private MostRightIconControl btnStop = null; |
| | | /// <summary> |
| | | /// 关闭控件 |
| | | /// </summary> |
| | | private MostRightIconControl btnClose = null; |
| | | #endregion |
| | | |
| | | #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); |
| | | |
| | | //打开控件 |
| | | this.btnOpen = new MostRightIconControl(69, 69); |
| | | btnOpen.btnIcon.UseClickStatu = true; |
| | | this.frameTable.AddChidren(btnOpen, ChidrenBindMode.NotBind); |
| | | btnOpen.InitControl(); |
| | | btnOpen.X = Application.GetRealWidth(625) - btnOpen.XOffset; |
| | | btnOpen.ButtonClickEvent += (sender, e) => |
| | | { |
| | | ((Airer)i_device).AirerUpDownStopControl(0); |
| | | base.RefreshControlInfo(i_device); |
| | | return; |
| | | }; |
| | | |
| | | //停止控件 |
| | | this.btnStop = new MostRightIconControl(69, 69); |
| | | btnStop.btnIcon.UseClickStatu = true; |
| | | btnStop.UnSelectedImagePath = "Airer/StopOffline.png"; |
| | | btnStop.SelectedImagePath = "Airer/Stop.png"; |
| | | this.frameTable.AddChidren(btnStop, ChidrenBindMode.NotBind); |
| | | btnStop.InitControl(); |
| | | btnStop.X = Application.GetRealWidth(769) - btnOpen.XOffset; |
| | | btnStop.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //如果住宅为虚拟住宅,此功能无效 |
| | | if (Common.Config.Instance.Home.IsVirtually == false) |
| | | { |
| | | ((Airer)i_device).AirerUpDownStopControl(2); |
| | | } |
| | | }; |
| | | |
| | | //关闭 |
| | | this.btnClose = new MostRightIconControl(69, 69); |
| | | btnClose.btnIcon.UseClickStatu = true; |
| | | this.frameTable.AddChidren(btnClose, ChidrenBindMode.NotBind); |
| | | btnClose.InitControl(); |
| | | btnClose.X = Application.GetRealWidth(896) - btnOpen.XOffset; |
| | | btnClose.ButtonClickEvent += (sender, e) => |
| | | { |
| | | ((Airer)i_device).AirerUpDownStopControl(1); |
| | | base.RefreshControlInfo(i_device); |
| | | return; |
| | | }; |
| | | |
| | | //刷新图标控件的图标 |
| | | this.RefreshIconControlImage(i_device); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 深度卡片信息_______________________ |
| | | |
| | | /// <summary> |
| | | /// 添加跳转深度卡片信息事件 |
| | | /// </summary> |
| | | private void AddDetailInfoEvent(CommonDevice i_device) |
| | | { |
| | | //深度卡片信息 |
| | | this.frameTable.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //晾衣架类型的深度卡片界面 |
| | | 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 |
| | | |
| | | #region ■ 刷新控件状态_______________________ |
| | | /// <summary> |
| | | /// 刷新控件状态 |
| | | /// </summary> |
| | | /// <param name="i_device"></param> |
| | | public override void RefreshControlInfo(CommonDevice i_device) |
| | | { |
| | | //刷新图标控件的图标 |
| | | this.RefreshIconControlImage(i_device); |
| | | base.RefreshControlInfo(i_device); |
| | | } |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | /// <summary> |
| | | /// 刷新图标控件的图标 |
| | | /// </summary> |
| | | /// <param name="i_device"></param> |
| | | private void RefreshIconControlImage(CommonDevice i_device) |
| | | { |
| | | //还没有初始化完成 |
| | | if (btnOpen == null) { return; } |
| | | btnOpen.UnSelectedImagePath = "Airer/UpOffline.png"; |
| | | btnOpen.SelectedImagePath = "Airer/Up.png"; |
| | | btnClose.UnSelectedImagePath = "Airer/DownOffline.png"; |
| | | btnClose.SelectedImagePath = "Airer/Down.png"; |
| | | } |
| | | #endregion |
| | | } |
| | | } |