From 652243206427f35a256400a149a1734085824cb9 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期三, 02 九月 2020 17:35:03 +0800 Subject: [PATCH] 2020-09-02-4 --- ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs | 365 ++++++++++----------------------------------------- 1 files changed, 76 insertions(+), 289 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs index d40a92b..637efc3 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs @@ -15,326 +15,113 @@ { Tag = "Logic"; } - public void Show () + /// <summary> + /// 娣诲姞鐩爣鍔熻兘绫� + /// </summary> + /// <param name="str1">璁惧鐣岄潰璇嗗埆瀛楃涓�</param> + /// <param name="str2">鍦烘櫙鐣岄潰璇嗗埆瀛楃涓�</param> + public void Show (string str1,string str2) { - - this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor; - var topFrameLayout = new FrameLayout + #region 鏈�涓婇潰鐨勫竷灞�浠g爜 + + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); + view.toptitleNameBtn.TextID = MyInternationalizationString.addaction; + view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; + #endregion + + + var middle = new FrameLayout { - Height = Application.GetRealHeight(140), - Y = Application.GetRealHeight(80), + Y = view.topRowLayout.Bottom, + Height = Application.GetRealHeight(Method.H - 184), + BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; - AddChidren(topFrameLayout); - - - var titleName = new Button { - TextID = MyInternationalizationString.addaction, - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(150), - }; - 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); - middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; this.AddChidren(middle); - #region ----- 璁惧------ - var deviceRowLayout = new RowLayout + #region ----- 璁惧------ + + FunView deviceview= new FunView(); + deviceview.iconBtn.UnSelectedImagePath = "ZigeeLogic/function.png"; + deviceview.funnameBtn.TextID = MyInternationalizationString.device; + middle.AddChidren(deviceview.FunFrameView()); + deviceview.clickviewBtn.MouseUpEventHandler += (sender, e) => { - Height = Application.GetRealHeight(180), - //BackgroundColor = 0xff323232, - }; - middle.AddChidren (deviceRowLayout); - - var device = new Button { - Width = Application.GetRealWidth (400), - TextID = MyInternationalizationString.device, - //Text = "璁惧", - TextSize = 16, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth (40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - deviceRowLayout.AddChidren (device); - - var btndeviceback = 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, - }; - deviceRowLayout.AddChidren (btndeviceback); - - EventHandler<MouseEventArgs> deviceclick = (sender, e) => { - Common.Logic.LogicDviceList.Clear(); - if (Common.Logic.LogicDviceList.Count == 0) - { - Common.Logic.LogicDviceList.AddRange(LocalDevice.Current.listAllDevice.ToArray()); - } - var logicDevicePage = new LogicDevicePage(); - UserView.HomePage.Instance.AddChidren(logicDevicePage); + var roomAndDeviceView = new RoomAndDeviceView(); + UserView.HomePage.Instance.AddChidren(roomAndDeviceView); UserView.HomePage.Instance.PageIndex += 1; - logicDevicePage.Show(); - + roomAndDeviceView.IfType = str1; + roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.addaction)); }; - deviceRowLayout.MouseUpEventHandler += deviceclick; - device.MouseUpEventHandler += deviceclick; - btndeviceback.MouseUpEventHandler += deviceclick; -#endregion - #region ----- 鍦烘櫙------ - var sceneRowLayout = new RowLayout { - Height = Application.GetRealHeight (180), - //BackgroundColor = 0xff323232, - Y=deviceRowLayout.Bottom, - }; - middle.AddChidren (sceneRowLayout); + #endregion - var scene = new Button { - Width = Application.GetRealWidth (400), - TextID = MyInternationalizationString.scene, - //Text = "鍦烘櫙", - TextSize = 16, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth (40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - sceneRowLayout.AddChidren (scene); - - var btnsceneback = 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, - }; - sceneRowLayout.AddChidren (btnsceneback); - - EventHandler<MouseEventArgs> sceneclick = (sender, e) => { - CommonPage.Loading.Start (); - System.Threading.Tasks.Task.Run (() => { - Application.RunOnMainThread (() => { - CommonPage.Loading.Hide (); - 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; -#endregion - - #region ----- 瀹夐槻妯″紡------ - ///瀹夐槻妯″紡 - var securityRowLayout = new RowLayout + #region ----- 鍦烘櫙------ + FunView sceneview= new FunView(); + sceneview.iconBtn.UnSelectedImagePath = "ZigeeLogic/scene.png"; + sceneview.funnameBtn.TextID = MyInternationalizationString.scene; + sceneview.funFrameLayout.Y = deviceview.funFrameLayout.Bottom; + middle.AddChidren(sceneview.FunFrameView()); + sceneview.clickviewBtn.MouseUpEventHandler += (sender, e) => { - Height = Application.GetRealHeight(180), - //BackgroundColor = 0xff323232, - Y = sceneRowLayout.Bottom, + var addScenePage = new AddScenePage(); + UserView.HomePage.Instance.AddChidren(addScenePage); + UserView.HomePage.Instance.PageIndex += 1; + addScenePage.Show(str2); }; - middle.AddChidren(securityRowLayout); + #endregion - var security = new Button + #region ----- 瀹夐槻妯″紡------ + FunView securityview= new FunView(); + securityview.iconBtn.UnSelectedImagePath = "ZigeeLogic/security.png"; + securityview.funnameBtn.TextID = MyInternationalizationString.securitymode; + securityview.funFrameLayout.Y = sceneview.funFrameLayout.Bottom; + if (str1 == LogicView.IfString.Action_Logic) + { ///鑱斿姩浜嬩欢杈撳嚭-涓嶆敮鎸佸畨闃叉ā寮� + ///鑷姩鍖栬緭鍑�-鏀寔瀹夐槻妯″紡 + middle.AddChidren(securityview.FunFrameView()); + } + else { - Width = Application.GetRealWidth(400), - TextID = MyInternationalizationString.securitymode, - //Text = "瀹夐槻妯″紡", - TextSize = 16, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - securityRowLayout.AddChidren(security); - - var btnsecurityback = new Button + ///鏀瑰彉鏈�鍚庡姛鑳藉揩绾挎潯棰滆壊 + sceneview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; + } + securityview.clickviewBtn.MouseUpEventHandler += (sender, e) => { - 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, - }; - securityRowLayout.AddChidren(btnsecurityback); - - EventHandler<MouseEventArgs> securityclick = (sender, e) => { var securityMode = new SecurityMode(); UserView.HomePage.Instance.AddChidren(securityMode); UserView.HomePage.Instance.PageIndex += 1; securityMode.Show(); }; - securityRowLayout.MouseUpEventHandler += securityclick; - security.MouseUpEventHandler += securityclick; - btnsecurityback.MouseUpEventHandler += securityclick; #endregion - #region ----- 宸叉湁鑷姩鍖�------ + #region ----- 寤舵椂------ - ///宸叉湁鑷姩鍖� - var existenceRowLayout = new RowLayout + FunView delayedview = new FunView(); + delayedview.iconBtn.UnSelectedImagePath = "ZigeeLogic/delay.png"; + delayedview.funnameBtn.TextID = MyInternationalizationString.delayed; + delayedview.funFrameLayout.Y = securityview.funFrameLayout.Bottom; + delayedview.funFrameLayout.Height = Application.GetRealHeight(160 + 20);//鏈�鍚庝竴琛屽鍔�20楂樺害; + delayedview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; ///鏀瑰彉鏈�鍚庡姛鑳藉揩绾挎潯棰滆壊 + if (str1 == LogicView.IfString.Action_Logic) { - Height = Application.GetRealHeight(180), - //BackgroundColor = 0xff323232, - Y = securityRowLayout.Bottom, - }; - //middle.AddChidren(existenceRowLayout); - - var existence = new Button + ///鑱斿姩浜嬩欢杈撳嚭-涓嶆敮鎸佸欢鏃� + ///鑷姩鍖栬緭鍑�-鏀寔寤舵椂 + middle.AddChidren(delayedview.FunFrameView()); + } + delayedview.clickviewBtn.MouseUpEventHandler += (sender, e) => { - 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<MouseEventArgs> existenceclick = (sender, e) => { - var logicListPage = new LogicListPage(); - UserView.HomePage.Instance.AddChidren(logicListPage); + var delayTime = new DelayTime(); + UserView.HomePage.Instance.AddChidren(delayTime); UserView.HomePage.Instance.PageIndex += 1; - logicListPage.Show(); + delayTime.Show(); }; - - existenceRowLayout.MouseUpEventHandler += existenceclick; - existence.MouseUpEventHandler += existenceclick; - btnexistenceback.MouseUpEventHandler += existenceclick; + #endregion - - #region ----- 寤舵椂------ - var delayedRowLayout = new RowLayout - { - Height = Application.GetRealHeight(180), - //BackgroundColor = 0xff323232, - Y=securityRowLayout.Bottom, - }; - //middle.AddChidren(delayedRowLayout); - - var delayed = new Button - { - Width = Application.GetRealWidth(400), - TextID = MyInternationalizationString.delayed, - //Text = "寤舵椂", - TextSize = 16, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - delayedRowLayout.AddChidren(delayed); - - var btndelayedback = 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, - }; - delayedRowLayout.AddChidren(btndelayedback); - - EventHandler<MouseEventArgs> delayedclick = (sender, e) => - { - //var delayTime = new DelayTime(); - //UserView.HomePage.Instance.AddChidren(delayTime); - //UserView.HomePage.Instance.PageIndex += 1; - //delayTime.Show(); - DelayTimeView(); - }; - - delayedRowLayout.MouseUpEventHandler += delayedclick; - delayed.MouseUpEventHandler += delayedclick; - btndelayedback.MouseUpEventHandler += delayedclick; -#endregion } - public static void DelayTimeView(Dictionary<string, object> delayactionsInfo=null) - { - var listValues = new List<string>(); - for (int i = 0; i < 60; i++) - { - listValues.Add(i.ToString() + " " + Language.StringByID(MyInternationalizationString.second)); - } - var list = new List<KeyValuePair<string, string[]>> { }; - for (int i = 0; i <= 60; i++) - { - list.Add(new KeyValuePair<string, string[]>(i.ToString() + " " + Language.StringByID(MyInternationalizationString.minute), listValues.ToArray())); - } - - /* - PickerView.Show(list, (obj) => - { - var minute = obj.Split(',')[0].Split(' ')[0]; - var second = obj.Split(',')[1].Split(' ')[0]; - int value = int.Parse(minute) * 60 + int.Parse(second); - if (value == 0) - { - var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt), - "鏃堕棿涓嶈兘涓�0", - Language.StringByID(MyInternationalizationString.complete)); - alert.Show(); - return; - } - if (delayactionsInfo == null) - { - Dictionary<string, object> actionsInfo = new Dictionary<string, object>(); - actionsInfo.Add("LinkType", 10); - actionsInfo.Add("DelayTime", value); - Common.Logic.CurrentLogic.Actions.Add(actionsInfo); - } - else - { - if (delayactionsInfo.ContainsKey("DelayTime")) - { - delayactionsInfo.Remove("DelayTime"); - } - delayactionsInfo.Add("DelayTime", value); - } - var logicCommunalPage = new LogicCommunalPage { }; - UserView.HomePage.Instance.AddChidren(logicCommunalPage); - UserView.HomePage.Instance.PageIndex += 1; - logicCommunalPage.Show(() => { }); - }, Language.StringByID(MyInternationalizationString.complete), ""); - */ - } + } } -- Gitblit v1.8.0