| | |
| | | { |
| | | 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 最上面的布局代码 |
| | | |
| | | 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 { |
| | | //Text = "添加执行目标", |
| | | //TextID = MyInternationalizationString.addImplementationgoals, |
| | | TextSize = 17, |
| | | TextColor = ZigbeeColor.Current.LogicTextBlackColor, |
| | | }; |
| | | 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); |
| | | |
| | | 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; |
| | | |
| | | 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; |
| | | |
| | | |
| | | ///已有自动化 |
| | | var existenceRowLayout = 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, |
| | | }; |
| | | 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<MouseEventArgs> existenceclick = (sender, e) => { |
| | | var logicListPage = new LogicListPage(); |
| | | UserView.HomePage.Instance.AddChidren(logicListPage); |
| | | var addScenePage = new AddScenePage(); |
| | | UserView.HomePage.Instance.AddChidren(addScenePage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | logicListPage.Show(); |
| | | addScenePage.Show(str2); |
| | | }; |
| | | #endregion |
| | | |
| | | existenceRowLayout.MouseUpEventHandler += existenceclick; |
| | | existence.MouseUpEventHandler += existenceclick; |
| | | btnexistenceback.MouseUpEventHandler += existenceclick; |
| | | |
| | | ///安防模式 |
| | | var securityRowLayout = new RowLayout |
| | | #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 |
| | | { |
| | | Height = Application.GetRealHeight(180), |
| | | //BackgroundColor = 0xff323232, |
| | | Y = existenceRowLayout.Bottom, |
| | | }; |
| | | middle.AddChidren(securityRowLayout); |
| | | |
| | | var security = new Button |
| | | ///改变最后功能快线条颜色 |
| | | sceneview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; |
| | | } |
| | | securityview.clickviewBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | 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 |
| | | { |
| | | 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 ----- 延时------ |
| | | |
| | | |
| | | var delayedRowLayout = 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(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; |
| | | |
| | | } |
| | | |
| | | 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)); |
| | | ///联动事件输出-不支持延时 |
| | | ///自动化输出-支持延时 |
| | | middle.AddChidren(delayedview.FunFrameView()); |
| | | } |
| | | var list = new List<KeyValuePair<string, string[]>> { }; |
| | | for (int i = 0; i <= 60; i++) |
| | | delayedview.clickviewBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | 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); |
| | | var delayTime = new DelayTime(); |
| | | UserView.HomePage.Instance.AddChidren(delayTime); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | logicCommunalPage.Show(() => { }); |
| | | }, Language.StringByID(MyInternationalizationString.complete), ""); |
| | | */ |
| | | delayTime.Show(); |
| | | }; |
| | | |
| | | #endregion |
| | | } |
| | | |
| | | |
| | | } |
| | | } |