using System; using System.Collections.Generic; using Shared; using Shared.Common; using Shared.Phone; using Shared.R; using ZigBee.Device; namespace Shared.Phone.Device.Logic { public class DeviceTarget : FrameLayout { public DeviceTarget () { Tag = "Logic"; } 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 = 16, 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, }; 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, }; 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 devicestateclick = (sender, e) => { var logicDevicePage = new LogicDevicePage(); UserView.HomePage.Instance.AddChidren(logicDevicePage); UserView.HomePage.Instance.PageIndex += 1; logicDevicePage.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, }; 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 sceneclick = (sender, e) => { var addScenePage = new AddScenePage(); UserView.HomePage.Instance.AddChidren(addScenePage); UserView.HomePage.Instance.PageIndex += 1; addScenePage.Show(); }; sceneRowLayout.MouseUpEventHandler += sceneclick; scene.MouseUpEventHandler += sceneclick; btnsceneback.MouseUpEventHandler += sceneclick; sceneframelayout.MouseUpEventHandler += sceneclick; sceneiconBtn.MouseUpEventHandler += sceneclick; #endregion #region ----- 安防模式------ var securityframelayout = new FrameLayout { Height = Application.GetRealHeight(160), Y = sceneframelayout.Bottom, BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, }; middle.AddChidren(securityframelayout); var securityiconBtn = new Button { Width = Application.GetRealWidth(81), Height = Application.GetRealHeight(81), UnSelectedImagePath = "ZigeeLogic/security.png", X = Application.GetRealWidth(58), Y = Application.GetRealHeight(55), }; securityframelayout.AddChidren(securityiconBtn); var securityrow = new RowLayout { Y = Application.GetRealHeight(30), Width = Application.GetRealWidth(850), Height = Application.GetRealHeight(130), X = Application.GetRealWidth(176), LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, }; securityframelayout.AddChidren(securityrow); var btnsecurity = new Button { TextAlignment = TextAlignment.CenterLeft, TextID = MyInternationalizationString.securitymode, TextColor = ZigbeeColor.Current.LogicTextBlackColor, }; securityrow.AddChidren(btnsecurity); var btnsecurityback = new Button { Width = Application.GetRealWidth(58), Height = Application.GetRealHeight(58), UnSelectedImagePath = "ZigeeLogic/next.png", X = Application.GetRealWidth(789), Gravity = Gravity.CenterVertical, }; securityrow.AddChidren(btnsecurityback); EventHandler securityclick = (sender, e) => { var securityMode = new SecurityMode(); UserView.HomePage.Instance.AddChidren(securityMode); UserView.HomePage.Instance.PageIndex += 1; securityMode.Show(); }; securityframelayout.MouseUpEventHandler += securityclick; btnsecurity.MouseUpEventHandler += securityclick; btnsecurityback.MouseUpEventHandler += securityclick; securityiconBtn.MouseUpEventHandler += securityclick; securityrow.MouseUpEventHandler += securityclick; #endregion #region ----- 已有自动化------ ///已有自动化 var existenceRowLayout = new RowLayout { Height = Application.GetRealHeight(180), //BackgroundColor = 0xff323232, Y = securityframelayout.Bottom, }; //middle.AddChidren(existenceRowLayout); var existence = new Button { Width = Application.GetRealWidth(400), TextID = MyInternationalizationString.Alreadyautomated, //Text = "已有自动化", TextSize = 16, TextAlignment = TextAlignment.CenterLeft, X = Application.GetRealWidth(40), TextColor = ZigbeeColor.Current.LogicTextBlackColor, }; existenceRowLayout.AddChidren(existence); var btnexistenceback = new Button { Width = Application.GetRealWidth(110), Height = Application.GetRealHeight(110), UnSelectedImagePath = "ZigeeLogic/next.png", SelectedImagePath = "ZigeeLogic/NextSelecte.png", X = Application.GetRealWidth(1080 - 140),//550 Gravity = Gravity.CenterVertical, }; existenceRowLayout.AddChidren(btnexistenceback); EventHandler existenceclick = (sender, e) => { var logicListPage = new LogicListPage(); UserView.HomePage.Instance.AddChidren(logicListPage); UserView.HomePage.Instance.PageIndex += 1; logicListPage.Show(); }; existenceRowLayout.MouseUpEventHandler += existenceclick; existence.MouseUpEventHandler += existenceclick; btnexistenceback.MouseUpEventHandler += existenceclick; #endregion #region ----- 延时------ var delayedframelayout = new FrameLayout { Height = Application.GetRealHeight(160), BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, Y = securityframelayout.Bottom, }; middle.AddChidren(delayedframelayout); var delayediconBtn = new Button { Width = Application.GetRealWidth(81), Height = Application.GetRealHeight(81), X = Application.GetRealWidth(58), Y = Application.GetRealHeight(55), UnSelectedImagePath = "ZigeeLogic/delay.png", }; delayedframelayout.AddChidren(delayediconBtn); var delayedRowLayout = new RowLayout { Y = Application.GetRealHeight(30), Width = Application.GetRealWidth(850), Height = Application.GetRealHeight(130), X = Application.GetRealWidth(176), LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor, }; delayedframelayout.AddChidren(delayedRowLayout); var delayed = new Button { TextAlignment = TextAlignment.CenterLeft, TextID = MyInternationalizationString.delayed, TextColor = ZigbeeColor.Current.LogicTextBlackColor, }; delayedRowLayout.AddChidren(delayed); var btndelayedback = new Button { Width = Application.GetRealWidth(58), Height = Application.GetRealHeight(58), UnSelectedImagePath = "ZigeeLogic/next.png", X = Application.GetRealWidth(789), Gravity = Gravity.CenterVertical, }; delayedRowLayout.AddChidren(btndelayedback); EventHandler delayedclick = (sender, e) => { var delayTime = new DelayTime(); UserView.HomePage.Instance.AddChidren(delayTime); UserView.HomePage.Instance.PageIndex += 1; delayTime.Show(); }; delayedRowLayout.MouseUpEventHandler += delayedclick; delayed.MouseUpEventHandler += delayedclick; btndelayedback.MouseUpEventHandler += delayedclick; delayedframelayout.MouseUpEventHandler += delayedclick; delayediconBtn.MouseUpEventHandler += delayedclick; #endregion } } }