using System;
using HDL_ON.DriverLayer;
using HDL_ON.Entity;
using HDL_ON.Stan;
using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI
{
public class IrLearnPage : DeviceFunctionCardCommonForm
{
#region ■ 变量声明___________________________
#endregion
#region ■ 初始化_____________________________
///
/// 初始化白色区域的内容
///
public override void InitFrameWhiteContent()
{
base.ShowColltionButton = false;
base.SetTitleText(Language.StringByID(StringId.RemoteControl));
//初始化第一个索引页的内容
this.InitFrameWhiteContent1();
}
///
/// 初始化第一个索引页的内容
///
private void InitFrameWhiteContent1()
{
var contentView = new VerticalScrolViewLayout()
{
Y = Application.GetRealHeight(94),
Gravity = Gravity.CenterHorizontal,
Width = Application.GetRealWidth(296),
Height = Application.GetRealHeight(376),
};
FrameWhiteCentet1.AddChidren(contentView);
var row = new FrameLayout()
{
Height = Application.GetRealHeight(56),
};
contentView.AddChidren(row);
int index = 0;
foreach(var attr in device.attributes)
{
if (index != 0 && index % 3 == 0)
{
row = new FrameLayout()
{
Height = Application.GetRealHeight(56),
};
contentView.AddChidren(row);
}
var btn = new Button()
{
Width = Application.GetRealWidth(88),
Height = Application.GetRealHeight(40),
Radius = (uint)Application.GetRealHeight(18),
BorderColor = CSS_Color.PromptingColor1,
BorderWidth = (uint)Application.GetRealWidth(2),
TextAlignment = TextAlignment.Center,
TextSize = CSS_FontSize.TextFontSize,
TextColor = CSS_Color.FirstLevelTitleColor,
SelectedTextColor = CSS_Color.MainBackgroundColor,
SelectedBackgroundColor = CSS_Color.MainColor,
};
if (attr.value.Count > 0)
{
btn.Text = attr.value[0];
}
if (index % 3 == 1)
{
btn.Gravity = Gravity.CenterHorizontal;
}
else if (index % 3 == 2)
{
btn.X = Application.GetRealWidth(208);
}
row.AddChidren(btn);
btn.MouseUpEventHandler = (sender, e) => {
System.Collections.Generic.Dictionary d = new System.Collections.Generic.Dictionary();
d.Add(attr.key, "");
Control.Ins.SendWriteCommand(device, d);
new System.Threading.Thread(() => {
System.Threading.Thread.Sleep(2000);
Application.RunOnMainThread(() => {
btn.IsSelected = false;
});
}) { IsBackground = true }.Start();
};
index++;
}
}
#endregion
#region ■ 设备状态反馈_______________________
///
/// 设备状态反馈
///
///
public override void DeviceStatuPush(Function i_LocalDevice)
{
return;
}
#endregion
#region ■ 发送各种命令_______________________
#endregion
#region ■ 刷新界面状态_______________________
///
/// 刷新界面状态
///
private void RefreshFormStatu()
{
return;
}
#endregion
}
}