using System;
using System.Collections.Generic;
using System.Text;
using ZigBee.Device;
namespace Shared.Phone.MainPage.Controls
{
///
/// 干接点卡片控件(暂时废止)
///
public class DeviceDryContactCardControl: DeviceCardCommon
{
#region ■ 初始化_____________________________
///
/// 初始化控件
///
///
public override void InitControl(CommonDevice i_device)
{
base.InitControl(i_device);
//添加开关控件
var btnSwitch = this.AddSwitchControl();
btnSwitch.ButtonClickEvent += (sender, e) =>
{
bool setStatu = !btnSwitch.IsSelected;
//变更卡片状态
this.SetCardOpenStatu(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 ■ 检测设备打开状态___________________
///
/// 检测设备打开状态
///
///
///
public override bool CheckIsOpenStatu(CommonDevice i_device)
{
return true;
//return ((LightBase)i_device).OnOffStatus == 1;
}
#endregion
#region ■ 发送获取状态命令___________________
///
/// 发送获取状态命令
///
public override void SendStatuComand()
{
Device.DeviceLogic.ReadDeviceAttributeLogic.Instance.SendLightStatuComand(this.device);
}
#endregion
}
}