using System;
|
namespace Shared.SimpleControl.Phone
|
{
|
public class UserSensorAutomationTargetSet : FrameLayout
|
{
|
|
public void ShowPage (byte[] targetBytes)
|
{
|
this.BackgroundColor = SkinStyle.Current.MainColor;
|
#region 标题
|
var topView = new FrameLayout () {
|
Y = Application.GetRealHeight (36),
|
Height = Application.GetRealHeight (90),
|
BackgroundColor = SkinStyle.Current.MainColor
|
};
|
AddChidren (topView);
|
|
var title = new Button () {
|
TextAlignment = TextAlignment.Center,
|
Text = "目标配置",
|
//TextID = R.MyInternationalizationString.SetPush,
|
TextColor = SkinStyle.Current.TextColor1,
|
TextSize = 19,
|
};
|
topView.AddChidren (title);
|
|
var logo = new Button () {
|
Width = Application.GetRealWidth (154),
|
Height = Application.GetRealHeight (90),
|
X = Application.GetRealWidth (486),
|
UnSelectedImagePath = MainPage.LogoString,
|
};
|
topView.AddChidren (logo);
|
var back = new Button () {
|
Height = Application.GetRealHeight (90),
|
Width = Application.GetRealWidth (85),
|
UnSelectedImagePath = "Item/Back.png",
|
SelectedImagePath = "Item/BackSelected.png",
|
};
|
topView.AddChidren (back);
|
back.MouseUpEventHandler += (sender, e) => {
|
(Parent as PageLayout).PageIndex -= 1;
|
};
|
#endregion
|
|
|
var bodyScrolView = new VerticalScrolViewLayout () {
|
Y = topView.Bottom,
|
BackgroundColor = SkinStyle.Current.ViewColor,
|
Height = Application.GetRealHeight (1140 - 126),
|
ScrollEnabled = false
|
};
|
AddChidren (bodyScrolView);
|
|
FrameLayout typeView = new FrameLayout () {
|
Height = Application.GetRealHeight(100),
|
};
|
bodyScrolView.AddChidren (typeView);
|
|
Button btnTypeText = new Button () {
|
X = Application.GetRealWidth(60),
|
Width = Application.GetRealWidth(100),
|
Text = "控制类型:",
|
TextColor = SkinStyle.Current.TextColor1,
|
TextAlignment = TextAlignment.CenterLeft,
|
};
|
typeView.AddChidren (btnTypeText);
|
|
Button btnType = new Button () {
|
X = btnTypeText.Right,
|
Width = Application.GetRealWidth(500),
|
Text = GetControlTypeText(targetBytes[3]),
|
TextColor = SkinStyle.Current.TextColor1,
|
TextAlignment = TextAlignment.CenterLeft,
|
};
|
typeView.AddChidren (btnType);
|
|
HorizontalScrolViewLayout targetTextView = new HorizontalScrolViewLayout () {
|
Height = Application.GetRealHeight(60),
|
};
|
bodyScrolView.AddChidren (targetTextView);
|
|
Button btnSubnetIdText = new Button () {
|
Width = Application.GetRealWidth(220),
|
Text = "子网号",
|
TextAlignment = TextAlignment.Center,
|
TextColor = SkinStyle.Current.TextColor1,
|
};
|
targetTextView.AddChidren (btnSubnetIdText);
|
|
Button btnDeviceIdText = new Button () {
|
Width = Application.GetRealWidth(200),
|
Text = "设备号",
|
TextAlignment = TextAlignment.Center,
|
TextColor = SkinStyle.Current.TextColor1,
|
};
|
targetTextView.AddChidren (btnDeviceIdText);
|
|
Button btnLoopIdText = new Button () {
|
Width = Application.GetRealWidth(220),
|
Text = "回路号",
|
TextAlignment = TextAlignment.Center,
|
TextColor = SkinStyle.Current.TextColor1,
|
};
|
targetTextView.AddChidren (btnLoopIdText);
|
|
HorizontalScrolViewLayout targetView = new HorizontalScrolViewLayout () {
|
Height = Application.GetRealHeight (60),
|
};
|
bodyScrolView.AddChidren (targetView);
|
|
Button btnSubnetId = new Button () {
|
Width = Application.GetRealWidth (220),
|
Text = "子网号",
|
TextAlignment = TextAlignment.Center,
|
TextColor = SkinStyle.Current.TextColor1,
|
};
|
targetView.AddChidren (btnSubnetId);
|
|
Button btnDeviceId = new Button () {
|
Width = Application.GetRealWidth (200),
|
Text = "设备号",
|
TextAlignment = TextAlignment.Center,
|
TextColor = SkinStyle.Current.TextColor1,
|
};
|
targetView.AddChidren (btnDeviceId);
|
|
Button btnLoopId = new Button () {
|
Width = Application.GetRealWidth (220),
|
Text = "回路号",
|
TextAlignment = TextAlignment.Center,
|
TextColor = SkinStyle.Current.TextColor1,
|
};
|
targetView.AddChidren (btnLoopId);
|
|
}
|
|
|
|
public string GetControlTypeText (byte readTargetByte)
|
{
|
string targetDeviceControlType = "";
|
switch (readTargetByte) {
|
case 0://0 无效 Invalid
|
targetDeviceControlType = "无效";
|
break;
|
case 85://0x55 场景 Scene ||0x0002
|
targetDeviceControlType = "场景";
|
break;
|
case 86://0x56 序列 Sequence ||0x001A
|
targetDeviceControlType = "序列";
|
break;
|
case 88://0x58 通用开关 Universal Switch ||0xe01c
|
targetDeviceControlType = "通用开关";
|
break;
|
case 89: //0x59 单路调节 Single Channel Lighting Control 0031
|
targetDeviceControlType = "单路调节";
|
break;
|
case 92://0x5c 窗帘开关 Curtain Switch e3e0
|
targetDeviceControlType = "窗帘开关";
|
break;
|
case 94://0x5e GPRS控制 GPRS Control E3D4
|
targetDeviceControlType = "GPRS控制";
|
break;
|
case 95://0x5f 面板控制 Panel Control e3d8
|
targetDeviceControlType = "面板控制";
|
break;
|
case 100://0x64 广播场景 Broadcast Scene ||0x0002
|
targetDeviceControlType = "广播场景";
|
break;
|
case 101://0x65 广播回路 Broadcast Channel 0031
|
targetDeviceControlType = "广播回路";
|
break;
|
case 102://0x66 消防模块 Security Module 011E
|
targetDeviceControlType = "消防模块";
|
break;
|
case 103://0x67 音乐播放 Music Control 0218
|
targetDeviceControlType = "音乐播放";
|
break;
|
}
|
return targetDeviceControlType;
|
}
|
}
|
}
|