using System;
|
using Shared;
|
using Shared.SimpleControl;
|
using Shared.SimpleControl.R;
|
using SmartHome;
|
|
namespace SuperGateWay
|
{
|
public class LogicListAutomation : FrameLayout
|
{
|
public LogicListAutomation ()
|
{
|
Tag = "Logic";
|
}
|
Button beforeClickButton = new Button ();
|
|
public void Show (GateWay gateWay)
|
{
|
this.BackgroundColor = 0xFF1F1F1F;
|
this.AddChidren (new Button {
|
Height = Application.GetRealHeight (30),
|
});
|
|
var topFrameLayout = new FrameLayout {
|
Height = Application.GetRealHeight (100),
|
Y = Application.GetRealHeight (30),
|
};
|
AddChidren (topFrameLayout);
|
|
var titleName = new Button {
|
TextID = MyInternationalizationString.automation,
|
TextSize = 17,
|
};
|
topFrameLayout.AddChidren (titleName);
|
|
var back = new Button {
|
Width = Application.GetRealWidth (82),
|
Height = Application.GetRealHeight (89),
|
X = Application.GetRealWidth (10),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "MusicIcon/HomepageBack.png",
|
};
|
topFrameLayout.AddChidren (back);
|
back.MouseDownEventHandler += (sender, e) => {
|
RemoveFromParent ();
|
};
|
|
var tetleframeLayout = new FrameLayout {
|
Y = topFrameLayout.Bottom,
|
Height = Application.GetRealHeight (100),
|
BackgroundColor = 0xff0f0f0f,
|
|
};
|
AddChidren (tetleframeLayout);
|
|
var tetlebtn = new Button {
|
Width = Application.GetRealWidth (400),
|
TextID = MyInternationalizationString.selectsavedautomation,
|
//Text = "请选择已保存自动化",
|
TextSize = 16,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
};
|
tetleframeLayout.AddChidren (tetlebtn);
|
|
var middle = new VerticalScrolViewLayout ();
|
middle.Y = tetleframeLayout.Bottom;
|
middle.Height = Application.GetRealHeight (Application.DesignHeight - 130 - 100 - 80);
|
middle.BackgroundColor = 0xff2F2F2F;
|
this.AddChidren (middle);
|
|
|
|
Logic Logic = null;
|
foreach (var logics in gateWay.Logics) {
|
var deviceRowLayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (deviceRowLayout);
|
|
|
var btn = new Button {
|
Height = Application.GetRealHeight (100),
|
Width = LayoutParams.MatchParent,
|
SelectedBackgroundColor = 0xfffe5e00,
|
};
|
deviceRowLayout.AddChidren (btn);
|
|
|
var btnlogic = new Button {
|
Width = Application.GetRealWidth (400),
|
Text = logics.name,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
};
|
deviceRowLayout.AddChidren (btnlogic);
|
|
|
var btnlogicback = new Button {
|
Width = Application.GetRealWidth (87),
|
Height = Application.GetRealHeight (100),
|
UnSelectedImagePath = "MusicIcon/Next.png",
|
SelectedImagePath = "MusicIcon/NextSelecte.png",
|
X = Application.GetRealWidth (525),
|
};
|
deviceRowLayout.AddChidren (btnlogicback);
|
|
EventHandler<MouseEventArgs> logicclick = (sender, e) => {
|
Logic = logics;
|
beforeClickButton.IsSelected = false;
|
beforeClickButton = btn;
|
btn.IsSelected = true;
|
};
|
btnlogic.MouseUpEventHandler += logicclick;
|
deviceRowLayout.MouseUpEventHandler += logicclick;
|
btnlogicback.MouseUpEventHandler += logicclick;
|
btn.MouseUpEventHandler += logicclick;
|
|
}
|
|
|
var btncomplete = new Button {
|
Y = middle.Bottom,
|
Height = Application.GetRealHeight (80),
|
TextID = MyInternationalizationString.complete,
|
BackgroundColor = 0xff1f1f1f,
|
TextSize=16,
|
};
|
AddChidren (btncomplete);
|
|
btncomplete.MouseUpEventHandler += (sedder, e) => {
|
if (gateWay.Logics.Count == 0||Logic==null) {
|
var alert = new Alert (Language.StringByID (MyInternationalizationString.Prompt),
|
Language.StringByID (MyInternationalizationString.selectlogiccondition),
|
Language.StringByID (MyInternationalizationString.OK));
|
alert.Show ();
|
return;
|
}
|
var selectedLogicStatus = new SelectedLogicStatus ();
|
MainPage.MainFrameLayout.AddChidren (selectedLogicStatus);
|
selectedLogicStatus.Show (gateWay,Logic);
|
};
|
|
}
|
}
|
}
|