using System;
|
using System.Collections.Generic;
|
|
namespace Shared.SimpleControl.Phone
|
{
|
public class UserSensorAutomationDeviceTypeChoose : FrameLayout
|
{
|
SensorAutomation sensorAutomation;
|
Action<SensorAutomation> action;
|
public UserSensorAutomationDeviceTypeChoose(SensorAutomation sa, Action<SensorAutomation> ac)
|
{
|
sensorAutomation = sa;
|
action = ac;
|
}
|
|
/// <summary>
|
/// 加载手机上的设备列表,配置自动化界面
|
/// </summary>
|
public void ShowPage ()
|
{
|
FrameLayout bodyView = new FrameLayout () {
|
BackgroundColor = SkinStyle.Current.MainColor,
|
};
|
AddChidren (bodyView);
|
#region 标题
|
var topView = new FrameLayout () {
|
Y = Application.GetRealHeight (36),
|
Height = Application.GetRealHeight (90),
|
BackgroundColor = SkinStyle.Current.MainColor
|
};
|
bodyView.AddChidren (topView);
|
|
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,
|
Height = Application.GetRealHeight (1136 - 126),
|
BackgroundColor = SkinStyle.Current.ViewColor,
|
ScrollEnabled = false
|
};
|
bodyView.AddChidren (bodyScrolView);
|
|
Button btnTipChooseType = new Button () {
|
X = Application.GetRealWidth (60),
|
Height = Application.GetRealHeight(100),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextID = R.MyInternationalizationString.PlsSelectDeviceType,
|
TextSize = 16,
|
TextColor = SkinStyle.Current.TextColor1,
|
};
|
bodyScrolView.AddChidren (btnTipChooseType);
|
|
#region 灯光类型
|
var rowLightView = new RowLayout () {
|
Height = Application.GetRealHeight (100),
|
BackgroundColor = SkinStyle.Current.MainColor,
|
};
|
bodyScrolView.AddChidren (rowLightView);
|
|
var btnLightType = new Button () {
|
Width = Application.GetRealWidth (400),
|
TextColor = SkinStyle.Current.TextColor1,
|
TextID = R.MyInternationalizationString.Lights,
|
SelectedTextColor = SkinStyle.Current.SelectedColor,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (60),
|
};
|
rowLightView.AddChidren (btnLightType);
|
|
var rightButton = new Button () {
|
Width = Application.GetRealWidth (28),
|
Height = Application.GetRealHeight (40),
|
Gravity = Gravity.CenterVertical,
|
X = Application.GetRealWidth (580),
|
UnSelectedImagePath = "Item/Right.png",
|
SelectedImagePath = "Item/RightSelected.png",
|
};
|
rowLightView.AddChidren (rightButton);
|
|
EventHandler<MouseEventArgs> eventHandlerLights = (ddd, fff) => {
|
var usp = new UserSensorAutomationDeviceSetPage (sensorAutomation, action);
|
UserMiddle.DevicePageView.AddChidren (usp);
|
usp.ShowPage ("Light");
|
UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
|
};
|
rowLightView.MouseUpEventHandler += eventHandlerLights;
|
btnLightType.MouseUpEventHandler += eventHandlerLights;
|
rightButton.MouseUpEventHandler += eventHandlerLights;
|
#endregion
|
|
#region 窗帘
|
var rowCurtainView = new RowLayout () {
|
Height = Application.GetRealHeight (100),
|
BackgroundColor = SkinStyle.Current.MainColor,
|
};
|
bodyScrolView.AddChidren (rowCurtainView);
|
|
var btnCurtainType = new Button () {
|
Width = Application.GetRealWidth (400),
|
TextColor = SkinStyle.Current.TextColor1,
|
TextID = R.MyInternationalizationString.Curtain,
|
SelectedTextColor = SkinStyle.Current.SelectedColor,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (60),
|
};
|
rowCurtainView.AddChidren (btnCurtainType);
|
|
var btnCurtainRight = new Button () {
|
Width = Application.GetRealWidth (28),
|
Height = Application.GetRealHeight (40),
|
Gravity = Gravity.CenterVertical,
|
X = Application.GetRealWidth (580),
|
UnSelectedImagePath = "Item/Right.png",
|
SelectedImagePath = "Item/RightSelected.png",
|
};
|
rowCurtainView.AddChidren (btnCurtainRight);
|
EventHandler<MouseEventArgs> eventHandlerCurtain = (ddd, fff) => {
|
var usp = new UserSensorAutomationDeviceSetPage (sensorAutomation, action);
|
UserMiddle.DevicePageView.AddChidren (usp);
|
usp.ShowPage ("Curatin");
|
UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
|
};
|
rowCurtainView.MouseUpEventHandler += eventHandlerCurtain;
|
btnCurtainType.MouseUpEventHandler += eventHandlerCurtain;
|
btnCurtainRight.MouseUpEventHandler += eventHandlerCurtain;
|
#endregion
|
|
#region 空调
|
var rowACView = new RowLayout () {
|
Height = Application.GetRealHeight (100),
|
BackgroundColor = SkinStyle.Current.MainColor,
|
};
|
bodyScrolView.AddChidren (rowACView);
|
var btnACType = new Button () {
|
TextColor = SkinStyle.Current.TextColor1,
|
TextID = R.MyInternationalizationString.AC,
|
SelectedTextColor = SkinStyle.Current.SelectedColor,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (60),
|
};
|
rowACView.AddChidren (btnACType);
|
var btnACRight = new Button () {
|
Width = Application.GetRealWidth (28),
|
Height = Application.GetRealHeight (40),
|
Gravity = Gravity.CenterVertical,
|
X = Application.GetRealWidth (580),
|
UnSelectedImagePath = "Item/Right.png",
|
SelectedImagePath = "Item/RightSelected.png",
|
};
|
rowACView.AddChidren (btnACRight);
|
EventHandler<MouseEventArgs> eventHandlerAC = (ddd, fff) => {
|
var usp = new UserSensorAutomationDeviceSetPage (sensorAutomation, action);
|
UserMiddle.DevicePageView.AddChidren (usp);
|
usp.ShowPage ("AC");
|
UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
|
};
|
rowACView.MouseUpEventHandler += eventHandlerAC;
|
btnACType.MouseUpEventHandler += eventHandlerAC;
|
btnACRight.MouseUpEventHandler += eventHandlerAC;
|
#endregion
|
#region 地热
|
var rowFoolHeatView = new RowLayout () {
|
Height = Application.GetRealHeight (100),
|
BackgroundColor = SkinStyle.Current.MainColor,
|
};
|
bodyScrolView.AddChidren (rowFoolHeatView);
|
var btnFoolHeatType = new Button () {
|
Width = Application.GetRealWidth (400),
|
TextColor = SkinStyle.Current.TextColor1,
|
TextID = R.MyInternationalizationString.FoolHeat,
|
SelectedTextColor = SkinStyle.Current.SelectedColor,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (60),
|
};
|
rowFoolHeatView.AddChidren (btnFoolHeatType);
|
var btnFoolHeatRight = new Button () {
|
Width = Application.GetRealWidth (28),
|
Height = Application.GetRealHeight (40),
|
Gravity = Gravity.CenterVertical,
|
X = Application.GetRealWidth (580),
|
UnSelectedImagePath = "Item/Right.png",
|
SelectedImagePath = "Item/RightSelected.png",
|
};
|
rowFoolHeatView.AddChidren (btnFoolHeatRight);
|
EventHandler<MouseEventArgs> eventHandlerFoolHeat = (ddd, fff) => {
|
var usp = new UserSensorAutomationDeviceSetPage (sensorAutomation, action);
|
UserMiddle.DevicePageView.AddChidren (usp);
|
usp.ShowPage ("FoolHeat");
|
UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
|
};
|
rowFoolHeatView.MouseUpEventHandler += eventHandlerFoolHeat;
|
btnFoolHeatType.MouseUpEventHandler += eventHandlerFoolHeat;
|
btnFoolHeatRight.MouseUpEventHandler += eventHandlerFoolHeat;
|
#endregion
|
var deviceScrolView = new VerticalScrolViewLayout () {
|
Y = bodyScrolView.Bottom,
|
Height = Application.GetRealHeight (1136 - 126 - 120 - 110),
|
BackgroundColor = SkinStyle.Current.ViewColor,
|
};
|
bodyView.AddChidren (deviceScrolView);
|
|
}
|
}
|
}
|