using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using ZigBee.Device;
|
|
namespace Shared.Phone.MainPage.Controls
|
{
|
/// <summary>
|
/// 空调卡片的控件
|
/// </summary>
|
public class DeviceAcCardControl : DeviceCardCommon
|
{
|
#region ■ 初始化_____________________________
|
|
/// <summary>
|
/// 初始化控件
|
/// </summary>
|
/// <param name="i_device"></param>
|
public override void InitControl(CommonDevice i_device)
|
{
|
base.InitControl(i_device);
|
|
//添加跳转深度卡片信息事件
|
this.AddDetailInfoEvent(i_device);
|
|
//添加开关控件
|
var btnSwitch = this.AddSwitchControl();
|
btnSwitch.ButtonClickEvent += (sender, e) =>
|
{
|
bool setStatu = !btnSwitch.IsSelected;
|
//变更卡片状态
|
this.SetCardStatu(setStatu);
|
//检测是否获取网关反馈的结果,如果网关没有回复,则会弹出消息
|
this.StartCheckResponeResult(!setStatu);
|
|
if (setStatu == true)
|
{
|
//打开
|
this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1));
|
(i_device as AC).Open();
|
}
|
else
|
{
|
//关闭
|
this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.Close));
|
(i_device as AC).Close();
|
}
|
};
|
}
|
|
#endregion
|
|
#region ■ 深度卡片信息_______________________
|
|
/// <summary>
|
/// 添加跳转深度卡片信息事件
|
/// </summary>
|
private void AddDetailInfoEvent(CommonDevice i_device)
|
{
|
//深度卡片信息
|
this.ButtonClickEvent += (sender, e) =>
|
{
|
Common.CommonPage.Instance.IsDrawerLockMode = true;
|
|
var lightControl = new Phone.Device.AC.ACControl();
|
UserView.HomePage.Instance.AddChidren(lightControl);
|
UserView.HomePage.Instance.PageIndex += 1;
|
lightControl.IsDrawerLockMode = true;
|
lightControl.Show(i_device, UserCenter.HdlRoomLogic.Current.CurrentRoom);
|
lightControl.action += this.CardDetailInfoBackEvent;
|
};
|
}
|
|
#endregion
|
|
#region ■ 检测设备打开状态___________________
|
|
/// <summary>
|
/// 检测设备打开状态
|
/// </summary>
|
/// <param name="i_device"></param>
|
/// <returns></returns>
|
public override bool CheckIsOpenStatu(CommonDevice i_device)
|
{
|
return ((AC)i_device).currentSystemMode != 0;
|
}
|
|
#endregion
|
|
#region ■ 发送获取状态命令___________________
|
|
/// <summary>
|
/// 发送获取状态命令
|
/// </summary>
|
/// <param name="i_device"></param>
|
public override void SendStatuComand(CommonDevice i_device)
|
{
|
Device.DeviceLogic.ReadDeviceAttributeLogic.Instance.SendACStatuComand(i_device);
|
}
|
|
#endregion
|
}
|
}
|