using System;
using System.Collections.Generic;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI
{
///
/// 场景模板类型选择界面
/// 功能
/// 自动化
///
public class SceneTargetTypeChoosePage : FrameLayout
{
FrameLayout bodyView;
Scene scene;
///
/// 更新功能row
///
Action refreshFunctionRowAction;
public SceneTargetTypeChoosePage(Scene function, Action action)
{
bodyView = this;
scene = function;
refreshFunctionRowAction = () =>
{
this.RemoveFromParent();
action();
};
}
public void LoadPage()
{
bodyView.BackgroundColor = CSS_Color.MainBackgroundColor;
bodyView.AddChidren(new Button()
{
Height = Application.GetRealHeight(20),
BackgroundColor = CSS_Color.BackgroundColor
});
var topView = new TopViewDiv(bodyView,Language.StringByID(StringId.AddExecutionAction));
topView.maginY = 10;
topView.LoadTopView();
var contentView = new VerticalScrolViewLayout()
{
Y = Application.GetRealHeight(74),
Height = Application.GetRealHeight(530),
ScrollEnabled = false,
};
bodyView.AddChidren(contentView);
var funtionView = new FrameLayout()
{
Height = Application.GetRealHeight(50),
};
contentView.AddChidren(funtionView);
var btnFunctionIcon = new Button()
{
Gravity = Gravity.CenterVertical,
X = Application.GetRealWidth(16),
Width = Application.GetMinRealAverage(22),
Height = Application.GetMinRealAverage(22),
UnSelectedImagePath = "Navigation/ClassificationIcon.png",
};
funtionView.AddChidren(btnFunctionIcon);
var btnFunctionRight = new Button()
{
X = Application.GetRealWidth(339),
Gravity = Gravity.CenterVertical,
Width = Application.GetMinRealAverage(16),
Height = Application.GetMinRealAverage(16),
UnSelectedImagePath = "Public/Right.png",
};
funtionView.AddChidren(btnFunctionRight);
var btnFunctionTitle = new Button()
{
X = Application.GetRealWidth(50),
TextAlignment = TextAlignment.CenterLeft,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.SubheadingFontSize,
TextID = StringId.Functions,
};
funtionView.AddChidren(btnFunctionTitle);
btnFunctionTitle.MouseUpEventHandler = (sender, e) => {
refreshFunctionRowAction += () => {
this.RemoveFromParent();
};
var sefp = new SceneFunctionListChoosePage(scene, refreshFunctionRowAction);
MainPage.BasePageView.AddChidren(sefp);
sefp.LoadPage();
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
};
contentView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor });
var automationView = new FrameLayout()
{
Height = Application.GetRealHeight(50),
};
contentView.AddChidren(automationView);
var btnAutomationRight = new Button()
{
X = Application.GetRealWidth(339),
Gravity = Gravity.CenterVertical,
Width = Application.GetMinRealAverage(16),
Height = Application.GetMinRealAverage(16),
UnSelectedImagePath = "Public/Right.png",
};
automationView.AddChidren(btnAutomationRight);
var btnAutomationIcon = new Button()
{
Gravity = Gravity.CenterVertical,
X = Application.GetRealWidth(16),
Width = Application.GetMinRealAverage(22),
Height = Application.GetMinRealAverage(22),
UnSelectedImagePath = "Navigation/IntellectualizationIcon.png",
};
automationView.AddChidren(btnAutomationIcon);
var btnAutomationTitle = new Button()
{
X = Application.GetRealWidth(50),
TextAlignment = TextAlignment.CenterLeft,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.SubheadingFontSize,
TextID = StringId.Automation,
};
automationView.AddChidren(btnAutomationTitle);
btnAutomationTitle.MouseUpEventHandler = (sender, e) => {
refreshFunctionRowAction += () => {
this.RemoveFromParent();
};
var sefp = new SceneAutomationListChoosePage(scene, refreshFunctionRowAction);
MainPage.BasePageView.AddChidren(sefp);
sefp.LoadPage();
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
};
contentView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor });
}
}
}