using System;
|
using Shared;
|
using Shared.Common;
|
using Shared.R;
|
|
namespace Shared.Phone.Device.Logic.DoorLockLogic
|
{
|
public class AddAction : FrameLayout
|
{
|
|
public AddAction()
|
{
|
Tag = "LockLogic";
|
}
|
public void Show()
|
{
|
|
|
#region 最上面的布局代码
|
var topRowLayout = new RowLayout
|
{
|
BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor,
|
Height = Application.GetRealHeight(184),
|
LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor,
|
};
|
this.AddChidren(topRowLayout);
|
|
var titleName = new Button
|
{
|
TextSize = 17,
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth(176),
|
Width = Application.GetRealWidth(600),
|
Height = Application.GetRealHeight(69),
|
Y = Application.GetRealHeight(92),
|
TextID = MyInternationalizationString.addaction,
|
IsBold = true,
|
};
|
topRowLayout.AddChidren(titleName);
|
|
var clickBtn = new Button
|
{
|
Width = Application.GetRealWidth(81 + 51),
|
Height = Application.GetRealHeight(58 + 40),
|
Y = Application.GetRealHeight(98 - 40),
|
};
|
topRowLayout.AddChidren(clickBtn);
|
clickBtn.MouseDownEventHandler += (sender, e) =>
|
{
|
RemoveFromParent();
|
};
|
|
var back = new Button
|
{
|
Width = Application.GetRealWidth(30),
|
Height = Application.GetRealHeight(51),
|
X = Application.GetRealWidth(81),
|
Y = Application.GetRealHeight(98),
|
//Gravity = Gravity.CenterVertical;
|
UnSelectedImagePath = "ZigeeLogic/back.png",
|
};
|
topRowLayout.AddChidren(back);
|
back.MouseDownEventHandler += (sender, e) => {
|
RemoveFromParent();
|
};
|
#endregion
|
|
|
var middle = new FrameLayout
|
{
|
Y = topRowLayout.Bottom,
|
Height = Application.GetRealHeight(1920 - 184),
|
BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
|
};
|
this.AddChidren(middle);
|
|
#region ----- 设备------
|
var deviceframelayout = new FrameLayout
|
{
|
Height = Application.GetRealHeight(160),
|
BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
|
};
|
middle.AddChidren(deviceframelayout);
|
|
var deviceiconBtn = new Button
|
{
|
Width = Application.GetRealWidth(81),
|
Height = Application.GetRealHeight(81),
|
X = Application.GetRealWidth(58),
|
Y = Application.GetRealHeight(55),
|
UnSelectedImagePath = "ZigeeLogic/function.png",
|
|
};
|
deviceframelayout.AddChidren(deviceiconBtn);
|
|
var devicerow = new RowLayout
|
{
|
Y = Application.GetRealHeight(30),
|
Width = Application.GetRealWidth(850),
|
Height = Application.GetRealHeight(130),
|
X = Application.GetRealWidth(176),
|
LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
|
};
|
deviceframelayout.AddChidren(devicerow);
|
|
|
var btndevice = new Button
|
{
|
TextID = MyInternationalizationString.device,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
TextSize = 15,
|
};
|
devicerow.AddChidren(btndevice);
|
|
var btndeviceback = new Button
|
{
|
Width = Application.GetRealWidth(58),
|
Height = Application.GetRealHeight(58),
|
X = Application.GetRealWidth(789),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "ZigeeLogic/next.png",
|
|
};
|
devicerow.AddChidren(btndeviceback);
|
|
EventHandler<MouseEventArgs> devicestateclick = (sender, e) =>
|
{
|
var lockAddDevice = new LockAddDevice();
|
UserView.HomePage.Instance.AddChidren(lockAddDevice);
|
UserView.HomePage.Instance.PageIndex += 1;
|
lockAddDevice.Show();
|
};
|
deviceframelayout.MouseUpEventHandler += devicestateclick;
|
btndevice.MouseUpEventHandler += devicestateclick;
|
btndeviceback.MouseUpEventHandler += devicestateclick;
|
deviceiconBtn.MouseUpEventHandler += devicestateclick;
|
devicerow.MouseUpEventHandler += devicestateclick;
|
#endregion
|
|
#region ----- 场景------
|
|
|
var sceneframelayout = new FrameLayout
|
{
|
Height = Application.GetRealHeight(160),
|
BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
|
Y = deviceframelayout.Bottom,
|
};
|
middle.AddChidren(sceneframelayout);
|
|
var sceneiconBtn = new Button
|
{
|
Width = Application.GetRealWidth(81),
|
Height = Application.GetRealHeight(81),
|
X = Application.GetRealWidth(58),
|
Y = Application.GetRealHeight(55),
|
UnSelectedImagePath = "ZigeeLogic/scene.png",
|
|
};
|
sceneframelayout.AddChidren(sceneiconBtn);
|
|
|
var sceneRowLayout = new RowLayout
|
{
|
Y = Application.GetRealHeight(30),
|
Width = Application.GetRealWidth(850),
|
Height = Application.GetRealHeight(130),
|
X = Application.GetRealWidth(176),
|
LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
|
};
|
sceneframelayout.AddChidren(sceneRowLayout);
|
|
var scene = new Button
|
{
|
TextID = MyInternationalizationString.scene,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
TextSize = 15,
|
};
|
sceneRowLayout.AddChidren(scene);
|
|
var btnsceneback = new Button
|
{
|
Width = Application.GetRealWidth(58),
|
Height = Application.GetRealHeight(58),
|
X = Application.GetRealWidth(789),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "ZigeeLogic/next.png",
|
};
|
sceneRowLayout.AddChidren(btnsceneback);
|
|
EventHandler<MouseEventArgs> sceneclick = (sender, e) =>
|
{
|
var lockAddScene = new LockAddScene();
|
UserView.HomePage.Instance.AddChidren(lockAddScene);
|
UserView.HomePage.Instance.PageIndex += 1;
|
lockAddScene.Show();
|
};
|
sceneRowLayout.MouseUpEventHandler += sceneclick;
|
scene.MouseUpEventHandler += sceneclick;
|
btnsceneback.MouseUpEventHandler += sceneclick;
|
sceneframelayout.MouseUpEventHandler += sceneclick;
|
sceneiconBtn.MouseUpEventHandler += sceneclick;
|
#endregion
|
|
}
|
}
|
}
|