using Shared;
|
using HDL_ON.Stan;
|
using HDL_ON.UI.CSS;
|
using HDL_ON.Entity;
|
|
namespace HDL_ON.UI
|
{
|
public class SensorDoorWinwsPage : DeviceFunctionCardCommonForm
|
{
|
#region ■ 变量声明___________________________
|
|
/// <summary>
|
/// 图标
|
/// </summary>
|
private IconViewControl btnIcon = null;
|
/// <summary>
|
/// 文本控件
|
/// </summary>
|
private NormalViewControl btnSuctionView = null;
|
|
#endregion
|
|
#region ■ 初始化_____________________________
|
|
/// <summary>
|
/// 初始化白色区域的内容
|
/// </summary>
|
public override void InitFrameWhiteContent()
|
{
|
base.SetTitleText(device.name);
|
|
//添加第二索引页
|
this.AddSecondPage();
|
//初始化第一个索引页的内容
|
this.InitFrameWhiteContent1();
|
//初始化第二个索引页的内容
|
this.InitFrameWhiteContent2();
|
|
//刷新当前设备的状态缓存
|
this.RefreshNowDeviceStatuMemory(this.device);
|
//刷新界面状态
|
this.RefreshFormStatu();
|
}
|
|
/// <summary>
|
/// 初始化第一个索引页的内容
|
/// </summary>
|
private void InitFrameWhiteContent1()
|
{
|
btnIcon = new IconViewControl(198)
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Y = Application.GetRealWidth(146),
|
UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorDoorStateBgIcon.png",
|
SelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorDoorStateBgIconOn.png",
|
};
|
FrameWhiteCentet1.AddChidren(btnIcon);
|
|
btnSuctionView = new NormalViewControl(300, 84, true)
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Y = btnIcon.Bottom,
|
TextAlignment = TextAlignment.Center,
|
TextSize = CSS_FontSize.TextFontSize,
|
TextColor = CSS_Color.TextualColor,
|
SelectedTextColor = CSS_Color.MainColor,
|
};
|
FrameWhiteCentet1.AddChidren(btnSuctionView);
|
}
|
|
/// <summary>
|
/// 初始化第二个索引页的内容
|
/// </summary>
|
private void InitFrameWhiteContent2()
|
{
|
}
|
|
#endregion
|
|
#region ■ 设备状态反馈_______________________
|
|
/// <summary>
|
/// 设备状态反馈
|
/// </summary>
|
/// <param name="i_LocalDevice"></param>
|
public override void DeviceStatuPush(Function i_LocalDevice)
|
{
|
//不是同一个东西
|
if (this.device.sid != i_LocalDevice.sid) { return; }
|
|
//刷新当前设备的状态缓存
|
this.RefreshNowDeviceStatuMemory(i_LocalDevice);
|
//刷新界面状态
|
this.RefreshFormStatu();
|
}
|
|
#endregion
|
|
#region ■ 发送各种命令_______________________
|
|
#endregion
|
|
#region ■ 刷新界面状态_______________________
|
|
/// <summary>
|
/// 刷新界面状态
|
/// </summary>
|
private void RefreshFormStatu()
|
{
|
Application.RunOnMainThread(() => {
|
var temp = device.status.Find((sta) => sta.key == FunctionAttributeKey.Status);
|
if (temp != null)
|
{
|
if (temp.value == "true")
|
{
|
btnIcon.IsSelected = true;
|
btnSuctionView.TextID = StringId.Open;
|
btnSuctionView.IsSelected = true;
|
}
|
else
|
{
|
btnIcon.IsSelected = false;
|
btnSuctionView.TextID = StringId.Close;
|
btnSuctionView.IsSelected = false;
|
}
|
}
|
});
|
}
|
|
#endregion
|
|
#region ■ 一般方法___________________________
|
|
/// <summary>
|
/// 刷新当前设备的状态缓存
|
/// </summary>
|
private void RefreshNowDeviceStatuMemory(Function i_LocalDevice)
|
{
|
foreach (var data in i_LocalDevice.status)
|
{
|
//开关
|
//if (data.key == "on_off") { this.weepRobotData.Cleaning = data.value.ToLower() == "on"; }
|
}
|
}
|
|
#endregion
|
}
|
}
|