using System;
|
using Shared;
|
using Shared.Common;
|
using Shared.Phone;
|
using Shared.R;
|
using ZigBee.Device;
|
|
namespace Shared.Phone.Device.Logic
|
{
|
public class LogicListAutomation : FrameLayout
|
{
|
public LogicListAutomation ()
|
{
|
Tag = "Logic";
|
}
|
Button beforeClickButton = new Button ();
|
|
public void Show ()
|
{
|
this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor;
|
this.AddChidren (new Button {
|
Height = Application.GetRealHeight (80),
|
});
|
|
var topFrameLayout = new FrameLayout {
|
Height = Application.GetRealHeight (140),
|
Y = Application.GetRealHeight (80),
|
};
|
AddChidren (topFrameLayout);
|
|
var titleName = new Button {
|
TextID = MyInternationalizationString.automation,
|
TextSize = 16,
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
IsBold = true,
|
};
|
topFrameLayout.AddChidren (titleName);
|
|
var back = new Button {
|
Width = Application.GetRealWidth (110),
|
Height = Application.GetRealHeight (110),
|
X = Application.GetRealWidth (20),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "ZigeeLogic/Back.png",
|
};
|
topFrameLayout.AddChidren (back);
|
back.MouseDownEventHandler += (sender, e) => {
|
RemoveFromParent ();
|
};
|
|
|
var middle = new VerticalScrolViewLayout ();
|
middle.Y = topFrameLayout.Bottom;
|
middle.Height = Application.GetRealHeight (1920 - 220 - 174);
|
middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
|
this.AddChidren (middle);
|
|
|
|
Common.Logic Logic = null;
|
foreach (var logics in Shared.Common.Logic.LogicList) {
|
var deviceRowLayout = new RowLayout {
|
Height = Application.GetRealHeight (180),
|
};
|
middle.AddChidren (deviceRowLayout);
|
|
|
var btn = new Button {
|
Height = Application.GetRealHeight (180),
|
Width = LayoutParams.MatchParent,
|
SelectedBackgroundColor = 0xfffe5e00,
|
};
|
deviceRowLayout.AddChidren (btn);
|
|
|
var btnlogic = new Button {
|
Width = Application.GetRealWidth (600),
|
Text = logics.LogicName,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
};
|
deviceRowLayout.AddChidren (btnlogic);
|
|
|
var btnlogicback = new Button {
|
Width = Application.GetRealWidth (110),
|
Height = Application.GetRealHeight (110),
|
UnSelectedImagePath = "ZigeeLogic/next.png",
|
X = Application.GetRealWidth (1080-140),
|
Gravity=Gravity.CenterVertical,
|
};
|
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 (174),
|
TextID = MyInternationalizationString.complete,
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
TextSize=16,
|
};
|
AddChidren (btncomplete);
|
|
btncomplete.MouseUpEventHandler += (sedder, e) => {
|
if (Shared.Common.Logic.LogicList.Count == 0||Logic==null) {
|
var alert = new Alert (Language.StringByID (MyInternationalizationString.Prompt),
|
Language.StringByID (MyInternationalizationString.selectlogiccondition),
|
Language.StringByID (MyInternationalizationString.complete));
|
alert.Show ();
|
return;
|
}
|
var selectedLogicStatus = new SelectedLogicStatus ();
|
UserView.HomePage.Instance.AddChidren (selectedLogicStatus);
|
UserView.HomePage.Instance.PageIndex += 1;
|
selectedLogicStatus.Show (Logic);
|
};
|
|
}
|
}
|
}
|