| | |
| | | { |
| | | |
| | | #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.selection, |
| | | IsBold = true, |
| | | }; |
| | | topRowLayout.AddChidren(titleName); |
| | | TopView view = new TopView(); |
| | | this.AddChidren(view.TopRowView()); |
| | | if (Common.Logic.CurrentLogic.LogicId != 0) |
| | | { |
| | | titleName.Text = Language.StringByID(MyInternationalizationString.editautomation); |
| | | view.toptitleNameBtn.Text = Language.StringByID(MyInternationalizationString.editautomation); |
| | | } |
| | | else |
| | | { |
| | | titleName.Text = Language.StringByID(MyInternationalizationString.newautomation); |
| | | view.toptitleNameBtn.Text = Language.StringByID(MyInternationalizationString.newautomation); |
| | | } |
| | | |
| | | var clickBtn = new Button |
| | | view.clickBtn.MouseDownEventHandler += (sender, e) => |
| | | { |
| | | 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 VerticalScrolViewLayout |
| | | { |
| | | Y = topRowLayout.Bottom, |
| | | Y = view.topRowLayout.Bottom, |
| | | Height = Application.GetRealHeight(1920 - 184 - 180), |
| | | BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, |
| | | }; |
| | |
| | | #region -----显示逻辑条件----- |
| | | |
| | | |
| | | var conditionFrameLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(160), |
| | | BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, |
| | | }; |
| | | middle.AddChidren(conditionFrameLayout); |
| | | LogicView.Addview addconditionview = new LogicView.Addview(); |
| | | addconditionview.iconBtn.Visible = true; |
| | | addconditionview.titleBtn.TextID = MyInternationalizationString.ifcondition; |
| | | middle.AddChidren(addconditionview.AddDeviceView()); |
| | | |
| | | |
| | | var conditionRowLayout = new RowLayout |
| | | { |
| | | Y = Application.GetRealHeight(30), |
| | | Width = Application.GetRealWidth(965), |
| | | Height = Application.GetRealHeight(130), |
| | | X = Application.GetRealWidth(58), |
| | | LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, |
| | | }; |
| | | conditionFrameLayout.AddChidren(conditionRowLayout); |
| | | |
| | | |
| | | conditionRowLayout.AddChidren(new Button |
| | | { |
| | | |
| | | Text = Language.StringByID(MyInternationalizationString.ifcondition), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = ZigbeeColor.Current.LogicTextBlackColor, |
| | | Width = Application.GetRealWidth(300), |
| | | Height = Application.GetRealHeight(60), |
| | | TextSize = 15, |
| | | Gravity = Gravity.CenterVertical, |
| | | }); |
| | | |
| | | var conditionadd1 = new Button |
| | | { |
| | | |
| | | Y = Application.GetRealHeight(30), |
| | | Width = Application.GetRealWidth(57), |
| | | Height = Application.GetRealHeight(130), |
| | | X = Application.GetRealWidth(965 + 58), |
| | | |
| | | }; |
| | | conditionFrameLayout.AddChidren(conditionadd1); |
| | | |
| | | var conditionadd = new Button |
| | | { |
| | | |
| | | Width = Application.GetRealWidth(58), |
| | | Height = Application.GetRealHeight(58), |
| | | UnSelectedImagePath = "ZigeeLogic/add.png", |
| | | X = Application.GetRealWidth(965 - 58), |
| | | Gravity = Gravity.CenterVertical, |
| | | |
| | | }; |
| | | conditionRowLayout.AddChidren(conditionadd); |
| | | ///添加条件的点击事件 |
| | | EventHandler<MouseEventArgs> conditionaddclick = (sender, e) => |
| | | addconditionview.clickBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (Common.Logic.CurrentLogic.Conditions.Count == 1) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | Common.Logic.LogicDviceList.Clear(); |
| | | if (Common.Logic.LogicDviceList.Count == 0) |
| | | { |
| | | Common.Logic.LogicDviceList.AddRange(LocalDevice.Current.listAllDevice.ToArray()); |
| | | } |
| | | var templateDeviceCondition = new TemplateDeviceCondition(); |
| | | UserView.HomePage.Instance.AddChidren(templateDeviceCondition); |
| | | var roomAndDeviceView = new RoomAndDeviceView(); |
| | | UserView.HomePage.Instance.AddChidren(roomAndDeviceView); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | templateDeviceCondition.Show(); |
| | | roomAndDeviceView.IfType = "condition_mould"; |
| | | roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.addsensor)); |
| | | } |
| | | }; |
| | | conditionadd.MouseUpEventHandler += conditionaddclick; |
| | | conditionadd1.MouseUpEventHandler += conditionaddclick; |
| | | |
| | | List<Dictionary<string, string>> ListConditions = new List<Dictionary<string, string>>(); |
| | | ListConditions.Clear(); |
| | | ListConditions.AddRange(Common.Logic.CurrentLogic.Conditions); |
| | |
| | | { |
| | | if (i == (ListConditions.Count - 1)) |
| | | { |
| | | |
| | | var addfl = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(160 + 30 + 50), |
| | | BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, |
| | | }; |
| | | middle.AddChidren(addfl); |
| | | var addbtn = new Button |
| | | { |
| | | Height = Application.GetRealHeight(130 + 50), |
| | | Width = Application.GetRealWidth(908), |
| | | Y = Application.GetRealHeight(30), |
| | | X = Application.GetRealWidth(86), |
| | | UnSelectedImagePath = "ZigeeLogic/logicaddcolor.png", |
| | | }; |
| | | addfl.AddChidren(addbtn); |
| | | |
| | | |
| | | var addtextbtn = new Button |
| | | { |
| | | Height = Application.GetRealHeight(58), |
| | | Width = Application.GetRealWidth(400), |
| | | Y = Application.GetRealHeight(45 + 30), |
| | | TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, |
| | | TextID = MyInternationalizationString.addsensor, |
| | | X = Application.GetRealWidth(340), |
| | | TextSize = 14, |
| | | }; |
| | | addfl.AddChidren(addtextbtn); |
| | | |
| | | EventHandler<MouseEventArgs> addconditionsclick = (sender, e) => |
| | | LogicView.AddDeviceView addflview = new LogicView.AddDeviceView(); |
| | | addflview.titleBtn.TextID = MyInternationalizationString.addsensor; |
| | | middle.AddChidren(addflview.AddFl()); |
| | | addflview.clickBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (Common.Logic.CurrentLogic.Conditions.Count == 1) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | var templateDeviceCondition = new TemplateDeviceCondition(); |
| | | UserView.HomePage.Instance.AddChidren(templateDeviceCondition); |
| | | |
| | | var roomAndDeviceView = new RoomAndDeviceView(); |
| | | UserView.HomePage.Instance.AddChidren(roomAndDeviceView); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | templateDeviceCondition.Show(); |
| | | roomAndDeviceView.IfType = "condition_mould"; |
| | | roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.addsensor)); |
| | | } |
| | | }; |
| | | addbtn.MouseUpEventHandler += addconditionsclick; |
| | | addtextbtn.MouseUpEventHandler += addconditionsclick; |
| | | } |
| | | else |
| | | { |
| | | var devicesFrameLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(130), |
| | | BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, |
| | | }; |
| | | middle.AddChidren(devicesFrameLayout); |
| | | |
| | | ///显示图标 |
| | | var conditionIcon = new Button |
| | | { |
| | | Width = Application.GetRealWidth(81), |
| | | Height = Application.GetRealHeight(81), |
| | | X = Application.GetRealWidth(104), |
| | | Y = Application.GetRealHeight(25), |
| | | UnSelectedImagePath = "ZigeeLogic/sensor13.png", |
| | | |
| | | }; |
| | | devicesFrameLayout.AddChidren(conditionIcon); |
| | | |
| | | |
| | | var conditionsRowLayout = new RowLayout |
| | | { |
| | | Width = Application.GetRealWidth(800), |
| | | Height = Application.GetRealHeight(130), |
| | | X = Application.GetRealWidth(222), |
| | | LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, |
| | | }; |
| | | devicesFrameLayout.AddChidren(conditionsRowLayout); |
| | | |
| | | SelectedDeviceView selecteddevice = new SelectedDeviceView(); |
| | | selecteddevice.Show(middle); |
| | | var Type = int.Parse(ListConditions[i]["Type"]); |
| | | var conditions = ListConditions[i]; |
| | | switch (Type) |
| | | { |
| | | |
| | | /// (0:时间点条件;1:设备状态变化条件;2:其他逻辑条件;3:计数器条件;4:倒计时;5:时间段条件;6:安防条件;7:地理位置) |
| | | /// 1:设备状态变化条件; |
| | | case 1: |
| | | { |
| | | var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return obj.DeviceAddr == conditions["MacAddr"] && obj.DeviceEpoint.ToString() == conditions["Epoint"]; }); |
| | | if (deviceinof == null) |
| | | { |
| | | continue; |
| | | } |
| | | ///显示设备名称 |
| | | var btndevice = new Button |
| | | { |
| | | Y = Application.GetRealHeight(20), |
| | | Height = Application.GetRealHeight(50), |
| | | Width = Application.GetRealWidth(400), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = deviceinof.DeviceEpointName, |
| | | TextColor = ZigbeeColor.Current.LogicTextBlackColor, |
| | | TextSize = 14, |
| | | }; |
| | | conditionsRowLayout.AddChidren(btndevice); |
| | | |
| | | ///区域(房间)名称Button |
| | | var btnregionname = new Button |
| | | { |
| | | Y = btndevice.Bottom + Application.GetRealHeight(10), |
| | | Width = Application.GetRealWidth(400), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Height = Application.GetRealHeight(50), |
| | | Text = "",//Language.StringByID(MyInternationalizationString.customroom), |
| | | TextColor = ZigbeeColor.Current.LogicBtnCancelColor, |
| | | }; |
| | | conditionsRowLayout.AddChidren(btnregionname); |
| | | ///通过设备找到区域(房间)名称 |
| | | Send.RoomNmae(btnregionname, deviceinof); |
| | | |
| | | |
| | | var deviceedit = new Button |
| | | { |
| | | BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1, |
| | | Text = Language.StringByID(MyInternationalizationString.edit), |
| | | TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, |
| | | }; |
| | | conditionsRowLayout.AddRightView(deviceedit); |
| | | deviceedit.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; |
| | | this.AddChidren(flMain); |
| | | TemplateDeviceCondition.CurrentDeviceView(flMain, deviceinof, true); |
| | | |
| | | }; |
| | | |
| | | ///显示设备条件状态控件 |
| | | var devicestatus = new Button |
| | | { |
| | | Width = Application.GetRealWidth(400), |
| | | Height = Application.GetRealHeight(130), |
| | | Gravity = Gravity.CenterVertical, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | X = Application.GetRealWidth(400), |
| | | TextColor = ZigbeeColor.Current.LogicBtnCancelColor, |
| | | TextSize = 14, |
| | | }; |
| | | conditionsRowLayout.AddChidren(devicestatus); |
| | | |
| | | var deviceinof = Method.GetCommonDevice(conditions["MacAddr"], conditions["Epoint"]); |
| | | selecteddevice.deviceNameBtn.Visible = true; |
| | | selecteddevice.deviceNameBtn.Text = deviceinof.DeviceEpointName; |
| | | selecteddevice.regionNameBtn.Visible = true; |
| | | Method.RoomNmae(selecteddevice.regionNameBtn, deviceinof); |
| | | selecteddevice.iconBtn.UnSelectedImagePath ="ZigeeLogic/sensor13.png"; |
| | | switch (deviceinof.Type) |
| | | { |
| | | case DeviceType.IASZone: |
| | |
| | | { |
| | | if (intvalue == "1") |
| | | { |
| | | devicestatus.TextID = MyInternationalizationString.someone; |
| | | selecteddevice.selecetddevicestateBtn.TextID = MyInternationalizationString.someone; |
| | | } |
| | | else |
| | | { |
| | |
| | | int second = int.Parse(conditions["IgnoreTime"]) % 60; |
| | | if (minute != 0 && second != 0) |
| | | { |
| | | devicestatus.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.minute) + second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1); |
| | | selecteddevice.selecetddevicestateBtn.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.minute) + second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1); |
| | | |
| | | } |
| | | else |
| | | { |
| | | if (minute == 0 && second != 0) |
| | | { |
| | | devicestatus.Text = second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1); |
| | | selecteddevice.selecetddevicestateBtn.Text = second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1); |
| | | |
| | | } |
| | | if (minute != 0 && second == 0) |
| | | { |
| | | devicestatus.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.unattendedtime1); |
| | | selecteddevice.selecetddevicestateBtn.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.unattendedtime1); |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | break; |
| | | |
| | | default: |
| | | { |
| | | conditionIcon.UnSelectedImagePath = "ZigeeLogic/infraredsensor.png"; |
| | | if (intvalue == "1") |
| | | { |
| | | devicestatus.TextID = MyInternationalizationString.callthepolice; |
| | | } |
| | | } |
| | | break; |
| | | |
| | | } |
| | | } |
| | | break; |
| | |
| | | } |
| | | break; |
| | | } |
| | | ///删除控件 |
| | | var del = new Button |
| | | |
| | | ///编辑 |
| | | selecteddevice.edit.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | BackgroundColor = ZigbeeColor.Current.LogicDelBlackColor1, |
| | | Text = Language.StringByID(MyInternationalizationString.del), |
| | | }; |
| | | conditionsRowLayout.AddRightView(del); |
| | | var deviceinof = Method.GetCommonDevice(conditions["MacAddr"], conditions["Epoint"]); |
| | | var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; |
| | | this.AddChidren(flMain); |
| | | CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "condition_mould"); |
| | | |
| | | del.MouseUpEventHandler += (sender, e) => |
| | | }; |
| | | ///删除控件 |
| | | selecteddevice.del.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm, |
| | | Language.StringByID(MyInternationalizationString.doyouwanttodelete), |
| | | Language.StringByID(MyInternationalizationString.confrim)); |
| | | Language.StringByID(MyInternationalizationString.doyouwanttodelete), |
| | | Language.StringByID(MyInternationalizationString.confrim)); |
| | | alert.Show(); |
| | | alert.ConfirmClickEvent += () => |
| | | { |
| | |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | templatePage.Show(); |
| | | }; |
| | | |
| | | }; |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | #region ----显示执行目标---- |
| | | |
| | | var targetFrameLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(160), |
| | | BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, |
| | | }; |
| | | middle.AddChidren(targetFrameLayout); |
| | | |
| | | |
| | | var targetRowLayout = new RowLayout |
| | | { |
| | | Y = Application.GetRealHeight(30), |
| | | Width = Application.GetRealWidth(965), |
| | | Height = Application.GetRealHeight(130), |
| | | X = Application.GetRealWidth(58), |
| | | LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, |
| | | }; |
| | | targetFrameLayout.AddChidren(targetRowLayout); |
| | | |
| | | |
| | | var btntargettitle = new Button |
| | | { |
| | | |
| | | Text = Language.StringByID(MyInternationalizationString.execute), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = ZigbeeColor.Current.LogicTextBlackColor, |
| | | Width = Application.GetRealWidth(300), |
| | | Height = Application.GetRealHeight(60), |
| | | TextSize = 15, |
| | | Gravity = Gravity.CenterVertical, |
| | | }; |
| | | targetRowLayout.AddChidren(btntargettitle); |
| | | |
| | | var btntargetadd1 = new Button |
| | | { |
| | | |
| | | Y = Application.GetRealHeight(30), |
| | | Width = Application.GetRealWidth(57), |
| | | Height = Application.GetRealHeight(130), |
| | | X = Application.GetRealWidth(965 + 58), |
| | | }; |
| | | targetFrameLayout.AddChidren(btntargetadd1); |
| | | |
| | | var btntargetadd = new Button |
| | | { |
| | | Width = Application.GetRealWidth(58), |
| | | Height = Application.GetRealHeight(58), |
| | | UnSelectedImagePath = "ZigeeLogic/add.png", |
| | | X = Application.GetRealWidth(965 - 58), |
| | | Gravity = Gravity.CenterVertical, |
| | | }; |
| | | targetRowLayout.AddChidren(btntargetadd); |
| | | EventHandler<MouseEventArgs> btntargetaddclick = (sender, e) => |
| | | LogicView.Addview addactionview = new LogicView.Addview(); |
| | | addactionview.iconBtn.Visible = true; |
| | | addactionview.titleBtn.TextID = MyInternationalizationString.execute; |
| | | middle.AddChidren(addactionview.AddDeviceView()); |
| | | addactionview.clickBtn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); |
| | | var templateDeviceAction = new TemplateDeviceAction(); |
| | | UserView.HomePage.Instance.AddChidren(templateDeviceAction); |
| | | |
| | | var roomAndDeviceView = new RoomAndDeviceView(); |
| | | UserView.HomePage.Instance.AddChidren(roomAndDeviceView); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | templateDeviceAction.Show(); |
| | | roomAndDeviceView.IfType = "action_mould"; |
| | | roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.addlighting)); |
| | | }; |
| | | btntargetadd1.MouseUpEventHandler += btntargetaddclick; |
| | | btntargetadd.MouseUpEventHandler += btntargetaddclick; |
| | | |
| | | List<Dictionary<string, object>> ListActions = new List<Dictionary<string, object>>(); |
| | | ListActions.Clear(); |
| | |
| | | { |
| | | if (i == (ListActions.Count - 1)) |
| | | { |
| | | |
| | | var addfl = new FrameLayout |
| | | LogicView.AddDeviceView addflview = new LogicView.AddDeviceView(); |
| | | addflview.titleBtn.TextID = MyInternationalizationString.addlighting; |
| | | middle.AddChidren(addflview.AddFl()); |
| | | addflview.clickBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | Height = Application.GetRealHeight(160 + 30 + 50), |
| | | BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, |
| | | }; |
| | | middle.AddChidren(addfl); |
| | | var addbtn = new Button |
| | | { |
| | | Height = Application.GetRealHeight(130 + 50), |
| | | Width = Application.GetRealWidth(908), |
| | | Y = Application.GetRealHeight(30), |
| | | X = Application.GetRealWidth(86), |
| | | UnSelectedImagePath = "ZigeeLogic/logicaddcolor.png", |
| | | }; |
| | | addfl.AddChidren(addbtn); |
| | | |
| | | |
| | | var addtextbtn = new Button |
| | | { |
| | | Height = Application.GetRealHeight(58), |
| | | Width = Application.GetRealWidth(400), |
| | | Y = Application.GetRealHeight(45 + 30), |
| | | TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, |
| | | TextID = MyInternationalizationString.addlighting, |
| | | X = Application.GetRealWidth(340), |
| | | TextSize = 14, |
| | | }; |
| | | addfl.AddChidren(addtextbtn); |
| | | EventHandler<MouseEventArgs> addfunctionclick = (sender, e) => |
| | | { |
| | | Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); |
| | | var templateDeviceAction = new TemplateDeviceAction(); |
| | | UserView.HomePage.Instance.AddChidren(templateDeviceAction); |
| | | var roomAndDeviceView = new RoomAndDeviceView(); |
| | | UserView.HomePage.Instance.AddChidren(roomAndDeviceView); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | templateDeviceAction.Show(); |
| | | roomAndDeviceView.IfType = "action_mould"; |
| | | roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.addlighting)); |
| | | }; |
| | | addbtn.MouseUpEventHandler += addfunctionclick; |
| | | addtextbtn.MouseUpEventHandler += addfunctionclick; |
| | | |
| | | } |
| | | else |
| | | { |
| | | |
| | | var devicesFrameLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(130), |
| | | BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, |
| | | }; |
| | | middle.AddChidren(devicesFrameLayout); |
| | | |
| | | ///显示图标 |
| | | var actionsIcon = new Button |
| | | { |
| | | Width = Application.GetRealWidth(81), |
| | | Height = Application.GetRealHeight(81), |
| | | X = Application.GetRealWidth(104), |
| | | Y = Application.GetRealHeight(25), |
| | | // UnSelectedImagePath = "ZigeeLogic/time.png", |
| | | |
| | | }; |
| | | devicesFrameLayout.AddChidren(actionsIcon); |
| | | |
| | | |
| | | var actionsrowLayout = new RowLayout |
| | | { |
| | | Width = Application.GetRealWidth(800), |
| | | Height = Application.GetRealHeight(130), |
| | | X = Application.GetRealWidth(222), |
| | | LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, |
| | | }; |
| | | devicesFrameLayout.AddChidren(actionsrowLayout); |
| | | |
| | | |
| | | SelectedDeviceView actiondevice = new SelectedDeviceView(); |
| | | actiondevice.Show(middle); |
| | | var linkType = int.Parse(ListActions[i]["LinkType"].ToString()); |
| | | var actions = ListActions[i]; |
| | | |
| | |
| | | { |
| | | case 0: |
| | | { |
| | | var obj1 = actions["DeviceAddr"].ToString(); |
| | | var obj2 = actions["Epoint"].ToString(); |
| | | var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return ((obj.DeviceAddr == obj1) && (obj.DeviceEpoint.ToString() == obj2)); }); |
| | | if (deviceinof == null) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | ///设备名称Button |
| | | var btndevicename = new Button |
| | | { |
| | | Y = Application.GetRealHeight(20), |
| | | Height = Application.GetRealHeight(50), |
| | | Width = Application.GetRealWidth(450), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = deviceinof.DeviceEpointName, |
| | | TextColor = ZigbeeColor.Current.LogicTextBlackColor, |
| | | TextSize = 14, |
| | | }; |
| | | actionsrowLayout.AddChidren(btndevicename); |
| | | |
| | | ///区域(房间)名称Button |
| | | var btnregionname = new Button |
| | | { |
| | | Y = btndevicename.Bottom + Application.GetRealHeight(10), |
| | | Width = Application.GetRealWidth(450), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Height = Application.GetRealHeight(50), |
| | | Text = "",//Language.StringByID(MyInternationalizationString.customroom), |
| | | TextColor = ZigbeeColor.Current.LogicBtnCancelColor, |
| | | }; |
| | | actionsrowLayout.AddChidren(btnregionname); |
| | | ///通过设备找到区域(房间)名称 |
| | | Send.RoomNmae(btnregionname, deviceinof); |
| | | ///显示设备条件状态控件 |
| | | var devicestatus = new Button |
| | | { |
| | | Width = Application.GetRealWidth(350), |
| | | Height = Application.GetRealHeight(130), |
| | | Gravity = Gravity.CenterVertical, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | X = Application.GetRealWidth(450), |
| | | TextColor = ZigbeeColor.Current.LogicBtnCancelColor, |
| | | TextSize = 14, |
| | | }; |
| | | actionsrowLayout.AddChidren(devicestatus); |
| | | |
| | | ///编辑设备状态Button |
| | | var deviceedit = new Button |
| | | { |
| | | BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1, |
| | | Text = Language.StringByID(MyInternationalizationString.edit), |
| | | TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, |
| | | }; |
| | | actionsrowLayout.AddRightView(deviceedit); |
| | | |
| | | ///编辑点击事件 |
| | | deviceedit.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; |
| | | this.AddChidren(flMain); |
| | | TemplateDeviceAction.CurrentDeviceStateView(flMain, deviceinof, true); |
| | | }; |
| | | |
| | | |
| | | var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString()); |
| | | actiondevice.deviceNameBtn.Visible = true; |
| | | actiondevice.deviceNameBtn.Text = deviceinof.DeviceEpointName; |
| | | actiondevice.regionNameBtn.Visible = true; |
| | | Method.RoomNmae(actiondevice.regionNameBtn, deviceinof); |
| | | switch (deviceinof.Type) |
| | | { |
| | | case DeviceType.OnOffOutput: |
| | | { |
| | | actionsIcon.UnSelectedImagePath = "ZigeeLogic/light.png"; |
| | | actiondevice.iconBtn.UnSelectedImagePath = "ZigeeLogic/light.png"; |
| | | |
| | | var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; |
| | | if (TaskList == null) |
| | |
| | | { |
| | | if (status["Data1"].ToString() == "0") |
| | | { |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.close); |
| | | actiondevice.selecetddevicestateBtn.Text = Language.StringByID(MyInternationalizationString.close); |
| | | |
| | | } |
| | | else if (status["Data1"].ToString() == "1") |
| | | { |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.open); |
| | | actiondevice.selecetddevicestateBtn.Text = Language.StringByID(MyInternationalizationString.open); |
| | | |
| | | } |
| | | else if (status["Data1"].ToString() == "2") |
| | | { |
| | | |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case DeviceType.DimmableLight: |
| | | { |
| | | actionsIcon.UnSelectedImagePath = "ZigeeLogic/dimmableLight.png"; |
| | | var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; |
| | | if (TaskList == null) |
| | | { |
| | | continue; |
| | | } |
| | | foreach (var status in TaskList) |
| | | { |
| | | if (status["TaskType"].ToString() == "3") |
| | | { |
| | | var intvalue = int.Parse(status["Data1"]); |
| | | var lightbrightnessvalue = (intvalue * 100) / 254; |
| | | devicestatus.Text = lightbrightnessvalue.ToString() + "%"; |
| | | } |
| | | else if (status["TaskType"].ToString() == "1") |
| | | { |
| | | |
| | | if (status["Data1"].ToString() == "0") |
| | | { |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.close); |
| | | } |
| | | else if (status["Data1"].ToString() == "2") |
| | | { |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case DeviceType.WindowCoveringDevice: |
| | | { |
| | | actionsIcon.UnSelectedImagePath = "ZigeeLogic/curtain.png"; |
| | | var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; |
| | | if (TaskList == null) |
| | | { |
| | | continue; |
| | | } |
| | | foreach (var status in TaskList) |
| | | { |
| | | if (status["TaskType"] == "6") |
| | | { |
| | | if (status["Data1"] == "0") |
| | | { |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.open); |
| | | } |
| | | else if (status["Data1"] == "1") |
| | | { |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.close); |
| | | } |
| | | else if (status["Data1"] == "5") |
| | | { |
| | | devicestatus.Text = status["Data2"] + "%"; |
| | | actiondevice.selecetddevicestateBtn.Text = Language.StringByID(MyInternationalizationString.onoff); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | break; |
| | | case DeviceType.AirSwitch: |
| | | { |
| | | actionsIcon.UnSelectedImagePath = "ZigeeLogic/airswitch.png"; |
| | | |
| | | var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; |
| | | if (TaskList == null) |
| | | { |
| | | continue; |
| | | } |
| | | foreach (var status in TaskList) |
| | | { |
| | | if (status["TaskType"].ToString() == "1") |
| | | { |
| | | if (status["Data1"].ToString() == "0") |
| | | { |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.close); |
| | | |
| | | } |
| | | else if (status["Data1"].ToString() == "1") |
| | | { |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.open); |
| | | |
| | | } |
| | | else if (status["Data1"].ToString() == "2") |
| | | { |
| | | |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case DeviceType.Thermostat: |
| | | { |
| | | actionsIcon.UnSelectedImagePath = "ZigeeLogic/ac.png"; |
| | | |
| | | var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; |
| | | if (TaskList == null) |
| | | { |
| | | continue; |
| | | } |
| | | string modetext = "", temperaturetext = "", speedtext = ""; |
| | | bool ifclose = false; |
| | | foreach (var status in TaskList) |
| | | { |
| | | if (status["TaskType"].ToString() == "1") |
| | | { |
| | | if (status["Data1"].ToString() == "0") |
| | | { |
| | | // devicestatus.Text = Language.StringByID(MyInternationalizationString.close); |
| | | |
| | | ifclose = false; |
| | | } |
| | | else if (status["Data1"].ToString() == "1") |
| | | { |
| | | //devicestatus.Text = Language.StringByID(MyInternationalizationString.open); |
| | | ifclose = true; |
| | | } |
| | | |
| | | } |
| | | else if (status["TaskType"].ToString() == "5") |
| | | { |
| | | if (status["Data1"] == "3") |
| | | {//3---设置工作模式(1:自动;3:制冷;4:制热;7:送风;8:除湿) |
| | | switch (status["Data2"]) |
| | | { |
| | | case "3": |
| | | { |
| | | modetext = Language.StringByID(MyInternationalizationString.logiccool); |
| | | } |
| | | break; |
| | | case "4": |
| | | { |
| | | modetext = Language.StringByID(MyInternationalizationString.logicheat); |
| | | } |
| | | break; |
| | | case "1": |
| | | { |
| | | modetext = Language.StringByID(MyInternationalizationString.logicauto); |
| | | } |
| | | break; |
| | | case "8": |
| | | { |
| | | modetext = Language.StringByID(MyInternationalizationString.logicdry); |
| | | } |
| | | break; |
| | | case "7": |
| | | { |
| | | modetext = Language.StringByID(MyInternationalizationString.logicfanonly); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | else if (status["Data1"] == "6") |
| | | {//6---设置风扇模式(1:低风;2:中风;3:高风;) |
| | | switch (status["Data2"]) |
| | | { |
| | | case "1": |
| | | { |
| | | speedtext = Language.StringByID(MyInternationalizationString.logiclow); |
| | | } |
| | | break; |
| | | |
| | | case "2": |
| | | { |
| | | speedtext = Language.StringByID(MyInternationalizationString.logicmedium); |
| | | } |
| | | break; |
| | | case "3": |
| | | { |
| | | speedtext = Language.StringByID(MyInternationalizationString.logichigh); |
| | | } |
| | | break; |
| | | |
| | | } |
| | | } |
| | | //4---设置加热度数;5---设置制冷、除湿度数;7---设置自动度数 |
| | | else if (status["Data1"] == "4" || status["Data1"] == "5" || status["Data1"] == "7") |
| | | { |
| | | var s = int.Parse(status["Data2"]) / 100; |
| | | temperaturetext = s.ToString(); |
| | | } |
| | | else if (status["Data1"] == "20") |
| | | { |
| | | temperaturetext = "无"; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | if (ifclose) |
| | | { |
| | | devicestatus.Text = modetext + ";" + temperaturetext + "℃;" + speedtext; |
| | | } |
| | | else |
| | | { |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.close); |
| | | |
| | | } |
| | | } |
| | | break; |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | break; |
| | | } |
| | | ///删除控件 |
| | | var del = new Button |
| | | { |
| | | BackgroundColor = ZigbeeColor.Current.LogicDelBlackColor1, |
| | | Text = Language.StringByID(MyInternationalizationString.del), |
| | | ///编辑 |
| | | actiondevice.edit.MouseUpEventHandler += (sender, e) => { |
| | | var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; |
| | | this.AddChidren(flMain); |
| | | var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString()); |
| | | CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_mould"); |
| | | }; |
| | | actionsrowLayout.AddRightView(del); |
| | | |
| | | del.MouseUpEventHandler += (sender, e) => |
| | | ///删除控件 |
| | | actiondevice.del.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | |
| | | |
| | | var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm, |
| | | Language.StringByID(MyInternationalizationString.doyouwanttodelete), |
| | | Language.StringByID(MyInternationalizationString.confrim)); |
| | |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | templatePage.Show(); |
| | | }; |
| | | |
| | | }; |
| | | |
| | | } |
| | |
| | | middle.AddChidren(fraline1); |
| | | |
| | | |
| | | var weekFrameLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(160), |
| | | BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, |
| | | }; |
| | | middle.AddChidren(weekFrameLayout); |
| | | var weekRowLayout = new RowLayout |
| | | { |
| | | Y = Application.GetRealHeight(30), |
| | | Width = Application.GetRealWidth(965), |
| | | Height = Application.GetRealHeight(130), |
| | | X = Application.GetRealWidth(58), |
| | | LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, |
| | | }; |
| | | weekFrameLayout.AddChidren(weekRowLayout); |
| | | |
| | | var settxet = new Button |
| | | { |
| | | Text = Language.StringByID(MyInternationalizationString.setupcycle), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = ZigbeeColor.Current.LogicTextBlackColor, |
| | | Width = Application.GetRealWidth(300), |
| | | Height = Application.GetRealHeight(60), |
| | | Gravity = Gravity.CenterVertical, |
| | | TextSize = 14, |
| | | }; |
| | | weekRowLayout.AddChidren(settxet); |
| | | var btnweektext = new Button |
| | | LogicView.Addview weekview = new LogicView.Addview(); |
| | | weekview.iconBtn.Visible = true; |
| | | weekview.iconBtn.UnSelectedImagePath = "ZigeeLogic/next.png"; |
| | | weekview.titleBtn.TextID = MyInternationalizationString.setupcycle; |
| | | middle.AddChidren(weekview.AddDeviceView()); |
| | | var weekBtn = new Button |
| | | { |
| | | Width = Application.GetRealWidth(595), |
| | | Height = Application.GetRealHeight(60), |
| | |
| | | //Text = "每天", |
| | | TextColor = ZigbeeColor.Current.LogicBtnCancelColor, |
| | | TextID = MyInternationalizationString.everyday, |
| | | Y = Application.GetRealHeight(35), |
| | | X = settxet.Right, |
| | | Y = Application.GetRealHeight(35 + 30), |
| | | X = weekview.titleBtn.Right, |
| | | TextSize = 14, |
| | | }; |
| | | weekRowLayout.AddChidren(btnweektext); |
| | | weekview.frameLayout.AddChidren(weekBtn); |
| | | |
| | | var nextBtn = new Button |
| | | { |
| | | |
| | | Width = Application.GetRealWidth(58), |
| | | Height = Application.GetRealHeight(58), |
| | | UnSelectedImagePath = "ZigeeLogic/next.png", |
| | | X = Application.GetRealWidth(965 - 58), |
| | | Gravity = Gravity.CenterVertical, |
| | | |
| | | }; |
| | | weekRowLayout.AddChidren(nextBtn); |
| | | |
| | | UpdateWeek(btnweektext); |
| | | Method.UpdateWeek(weekBtn, Common.Logic.CurrentLogic); |
| | | EventHandler<MouseEventArgs> cycleclick = (sender, e) => |
| | | { |
| | | /*------保留每月,每年类型*/ |
| | | var cycle = new Cycle(() => { UpdateWeek(btnweektext); }); |
| | | var cycle = new Cycle(() => { Method.UpdateWeek(weekBtn, Common.Logic.CurrentLogic); }); |
| | | UserView.HomePage.Instance.AddChidren(cycle); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | cycle.Show(); |
| | |
| | | //UserView.HomePage.Instance.PageIndex += 1; |
| | | //cyclicCycle.Show(); |
| | | }; |
| | | btnweektext.MouseUpEventHandler += cycleclick; |
| | | nextBtn.MouseUpEventHandler += cycleclick; |
| | | weekBtn.MouseUpEventHandler += cycleclick; |
| | | weekview.clickBtn.MouseUpEventHandler += cycleclick; |
| | | #endregion |
| | | |
| | | #region ----推送设置---- |
| | | |
| | | var pushFrameLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(160), |
| | | BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, |
| | | }; |
| | | middle.AddChidren(pushFrameLayout); |
| | | |
| | | var pushswitchRowlayout = new RowLayout |
| | | { |
| | | Y = Application.GetRealHeight(30), |
| | | Width = Application.GetRealWidth(965), |
| | | Height = Application.GetRealHeight(130), |
| | | X = Application.GetRealWidth(58), |
| | | LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, |
| | | }; |
| | | pushFrameLayout.AddChidren(pushswitchRowlayout); |
| | | |
| | | var btnswitchtxet = new Button |
| | | { |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = ZigbeeColor.Current.LogicTextBlackColor, |
| | | Width = Application.GetRealWidth(300), |
| | | Height = Application.GetRealHeight(60), |
| | | Gravity = Gravity.CenterVertical, |
| | | TextID = MyInternationalizationString.pushswitch, |
| | | TextSize = 14, |
| | | }; |
| | | pushswitchRowlayout.AddChidren(btnswitchtxet); |
| | | |
| | | var btnswitch = new Button |
| | | { |
| | | Width = Application.GetMinRealAverage(104), |
| | | Height = Application.GetMinRealAverage(63), |
| | | UnSelectedImagePath = "ZigeeLogic/logicclose.png", |
| | | SelectedImagePath = "ZigeeLogic/logicopen.png", |
| | | X = Application.GetRealWidth(965 - 104), |
| | | Gravity = Gravity.CenterVertical, |
| | | }; |
| | | pushswitchRowlayout.AddChidren(btnswitch); |
| | | |
| | | |
| | | |
| | | var custompushFrameLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(0), |
| | | BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, |
| | | }; |
| | | middle.AddChidren(custompushFrameLayout); |
| | | |
| | | var custompushRowLayout = new RowLayout |
| | | { |
| | | Y = Application.GetRealHeight(30), |
| | | Width = Application.GetRealWidth(965), |
| | | Height = Application.GetRealHeight(130), |
| | | X = Application.GetRealWidth(58), |
| | | LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor, |
| | | }; |
| | | custompushFrameLayout.AddChidren(custompushRowLayout); |
| | | |
| | | var btncustompush = new Button |
| | | { |
| | | TextID = MyInternationalizationString.custompush, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = ZigbeeColor.Current.LogicTextBlackColor, |
| | | Width = Application.GetRealWidth(300), |
| | | Height = Application.GetRealHeight(60), |
| | | Gravity = Gravity.CenterVertical, |
| | | TextSize = 14, |
| | | }; |
| | | custompushRowLayout.AddChidren(btncustompush); |
| | | |
| | | |
| | | var custompushback = new Button |
| | | { |
| | | Width = Application.GetRealWidth(58), |
| | | Height = Application.GetRealHeight(58), |
| | | UnSelectedImagePath = "ZigeeLogic/next.png", |
| | | X = Application.GetRealWidth(965 - 58), |
| | | Gravity = Gravity.CenterVertical, |
| | | }; |
| | | custompushRowLayout.AddChidren(custompushback); |
| | | EventHandler<MouseEventArgs> customclick = (sender, e) => |
| | | { |
| | | var CustomText = new CustomText(); |
| | | UserView.HomePage.Instance.AddChidren(CustomText); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | CustomText.Show(); |
| | | |
| | | }; |
| | | btncustompush.MouseUpEventHandler += customclick; |
| | | custompushback.MouseUpEventHandler += customclick; |
| | | custompushRowLayout.MouseUpEventHandler += customclick; |
| | | |
| | | Method.Push(middle); |
| | | #endregion |
| | | |
| | | bool tag = false;//标记开关状态; |
| | | btnswitch.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | btnswitch.IsSelected = !btnswitch.IsSelected; |
| | | if (btnswitch.IsSelected) |
| | | { |
| | | tag = true; |
| | | custompushFrameLayout.Height = Application.GetRealHeight(160); |
| | | Common.Logic.CurrentLogic.LogicIsCustomPushText = 1; |
| | | |
| | | } |
| | | else |
| | | { |
| | | tag = false; |
| | | custompushFrameLayout.Height = Application.GetRealHeight(0); |
| | | Common.Logic.CurrentLogic.LogicIsCustomPushText = 0; |
| | | |
| | | } |
| | | Send.Zj(tag, Common.Logic.CurrentLogic); |
| | | }; |
| | | if (Common.Logic.CurrentLogic.LogicIsCustomPushText == 0) |
| | | { |
| | | tag = false; |
| | | btnswitch.IsSelected = false; |
| | | custompushFrameLayout.Height = Application.GetRealHeight(0); |
| | | } |
| | | else |
| | | { |
| | | tag = true; |
| | | btnswitch.IsSelected = true; |
| | | custompushFrameLayout.Height = Application.GetRealHeight(160); |
| | | } |
| | | var saveFrameLayout = new FrameLayout |
| | | { |
| | | Y = middle.Bottom, |
| | | Height = Application.GetRealHeight(180), |
| | | BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, |
| | | }; |
| | | this.AddChidren(saveFrameLayout); |
| | | |
| | | var btnsave = new Button |
| | | { |
| | | X = Application.GetRealWidth(85), |
| | | Height = Application.GetRealHeight(130),//194 |
| | | Width = Application.GetRealWidth(910), |
| | | Radius = (uint)Application.GetRealHeight(60), |
| | | BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor, |
| | | TextID = MyInternationalizationString.application, |
| | | TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, |
| | | }; |
| | | saveFrameLayout.AddChidren(btnsave); |
| | | btnsave.MouseUpEventHandler += async (sender, e) => |
| | | var saveBtn = new LogicView.SaveView(); |
| | | saveBtn.frameLayout.Y = middle.Bottom; |
| | | saveBtn.frameLayout.Height = Application.GetRealHeight(180); |
| | | this.AddChidren(saveBtn.Show()); |
| | | saveBtn.clickviewBtn.MouseUpEventHandler +=(sender, e) => |
| | | { |
| | | var name = logicTextBox.Text.Trim(); |
| | | //if (Common.Logic.CurrentLogic.Conditions.Count != 0 && Common.Logic.CurrentLogic.Actions.Count != 0) |
| | | //{ |
| | | // AddChidren(btnsave); |
| | | //} |
| | | if (string.IsNullOrEmpty(logicTextBox.Text.Trim())) |
| | | { |
| | | var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, |
| | | Language.StringByID(MyInternationalizationString.PleaseEnterLogicName), |
| | | Language.StringByID(MyInternationalizationString.confrim)); |
| | | alert.Show(); |
| | | return; |
| | | } |
| | | //var logicname = Common.Logic.LogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name); |
| | | //if (logicname != null) |
| | | //{ |
| | | // new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show(); |
| | | // return; |
| | | //} |
| | | |
| | | Common.Logic.CurrentLogic.LogicName = name; |
| | | |
| | | //判断是新添加逻辑(默认0)还是修改逻辑 |
| | | CommonPage.Loading.Start(); |
| | | if (Common.Logic.CurrentLogic.LogicId == 0) |
| | | { |
| | | //发送添加逻辑命令 |
| | | var logicifon = await Send.AddModifyLogic(Common.Logic.CurrentLogic); |
| | | if (logicifon != null && logicifon.LogicId != 0) |
| | | { |
| | | Common.Logic.CurrentLogic.LogicId = logicifon.LogicId; |
| | | Common.Logic.LogicList.Add(Common.Logic.CurrentLogic); |
| | | if (tag) |
| | | { |
| | | Send.Zj(tag, Common.Logic.CurrentLogic); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //发送修改逻辑命令 |
| | | Send.AddModifyLogic(Common.Logic.CurrentLogic); |
| | | } |
| | | |
| | | CommonPage.Loading.Hide(); |
| | | UserView.HomePage.Instance.RemoveViewByTag("Logic"); |
| | | Category.Category.instance?.RefreshBodyView(); |
| | | //UserView.HomePage.Instance.RemoveAt("Logic1"); |
| | | //Category.Category category = new Category.Category(); |
| | | //UserView.HomePage.Instance.AddChidren(category); |
| | | //UserView.HomePage.Instance.PageIndex += 1; |
| | | //category.Show(2); |
| | | Method.SaveLogic(LogicView.IfString._Logic, name, LogicView.IfString.Tag, Common.Logic.CurrentLogic); |
| | | }; |
| | | |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 更新执行周期的方法 |
| | | /// </summary> |
| | | /// <param name="btndisplaycycle">Btndisplaycycle.</param> |
| | | void UpdateWeek(Button btndisplaycycle) |
| | | { |
| | | |
| | | switch (Common.Logic.CurrentLogic.TimeAttribute.Repeat) |
| | | { |
| | | ///0:只执行一次,执行后IsEnable值置;1,今年内执行;2:每天执行;3:每月执行;4:每年执行;5:周重复。 |
| | | case 0: |
| | | { |
| | | btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.executeonce); |
| | | }; break; |
| | | case 1: { }; break; |
| | | case 2: |
| | | { |
| | | btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyday); |
| | | }; break; |
| | | case 3: |
| | | { |
| | | |
| | | string len = "", value = ""; |
| | | var stringvalue = Convert.ToString(Common.Logic.CurrentLogic.TimeAttribute.MonthDate, 2); |
| | | var str = stringvalue.Insert(0, new string('0', 32 - stringvalue.Length)); |
| | | for (int j = 31; j >= 0; j--) |
| | | { |
| | | len += str.Substring(j, 1); |
| | | } |
| | | for (int j = 0; j < len.Length; j++) |
| | | { |
| | | var strvalue = len.Substring(j, 1); |
| | | if (strvalue == "1") |
| | | { |
| | | value += (j + 1).ToString() + ","; |
| | | } |
| | | } |
| | | btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.monthly) + value.TrimEnd(',') + Language.StringByID(MyInternationalizationString.day); |
| | | |
| | | }; break; |
| | | case 4: |
| | | { |
| | | |
| | | Dictionary<int, int> dictionary = new Dictionary<int, int>(); |
| | | ///找出执行的月份和天数 |
| | | if (Common.Logic.CurrentLogic.TimeAttribute.SelectMonDate.Count != 0) |
| | | { |
| | | for (int i = 0; i < Common.Logic.CurrentLogic.TimeAttribute.SelectMonDate.Count; i++) |
| | | { |
| | | var dayvalue = Common.Logic.CurrentLogic.TimeAttribute.SelectMonDate[i]; |
| | | if (dayvalue != 0) |
| | | { |
| | | dictionary.Add(i + 1, dayvalue); |
| | | } |
| | | } |
| | | } |
| | | if (dictionary.Count != 0 && dictionary.Count == 1) |
| | | { |
| | | string len = "", leng = ""; |
| | | int minvalue = 0, Maximum = 0; |
| | | foreach (var value in dictionary) |
| | | { |
| | | ///取出月份 |
| | | var month = value.Key; |
| | | ///取出日数 |
| | | var day = value.Value; |
| | | var maxvalue = Convert.ToString(day, 2); |
| | | var str = maxvalue.Insert(0, new string('0', 32 - maxvalue.Length)); |
| | | for (int j = 31; j >= 0; j--) |
| | | { |
| | | len += str.Substring(j, 1); |
| | | } |
| | | |
| | | for (int j = 0; j < len.Length; j++) |
| | | { |
| | | var strvalue = len.Substring(j, 1); |
| | | if (strvalue == "1") |
| | | { |
| | | minvalue = j + 1; |
| | | break; |
| | | } |
| | | } |
| | | for (int j = 0; j < len.Length; j++) |
| | | { |
| | | var strvalue = len.Substring(j, 1); |
| | | if (strvalue == "1") |
| | | { |
| | | Maximum = j + 1; |
| | | } |
| | | } |
| | | |
| | | if (month.ToString().Length < 2) |
| | | { |
| | | leng = "0" + month.ToString(); |
| | | } |
| | | else |
| | | { |
| | | leng = month.ToString(); |
| | | } |
| | | if (minvalue == Maximum) |
| | | { |
| | | btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyyear) + leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()); |
| | | } |
| | | else |
| | | { |
| | | btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyyear) + leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()) + "-" + leng + "/" + (Maximum.ToString().Length < 2 ? "0" + Maximum.ToString() : Maximum.ToString()); |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | int b = 0; |
| | | string stringtext = ""; |
| | | foreach (var value in dictionary) |
| | | { |
| | | string len = "", leng = ""; |
| | | int minvalue = 0, Maximum = 0; |
| | | ///取出月份 |
| | | var month = value.Key; |
| | | ///取出日数 |
| | | var day = value.Value; |
| | | var maxvalue = Convert.ToString(day, 2); |
| | | var str = maxvalue.Insert(0, new string('0', 32 - maxvalue.Length)); |
| | | for (int j = 31; j >= 0; j--) |
| | | { |
| | | len += str.Substring(j, 1); |
| | | } |
| | | |
| | | |
| | | if (month.ToString().Length < 2) |
| | | { |
| | | leng = "0" + month.ToString(); |
| | | } |
| | | else |
| | | { |
| | | leng = month.ToString(); |
| | | } |
| | | |
| | | |
| | | |
| | | if (b == 0) |
| | | { |
| | | for (int j = 0; j < len.Length; j++) |
| | | { |
| | | var strvalue = len.Substring(j, 1); |
| | | if (strvalue == "1") |
| | | { |
| | | minvalue = j + 1; |
| | | break; |
| | | } |
| | | } |
| | | stringtext += leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()) + "-"; |
| | | |
| | | } |
| | | |
| | | if (b == dictionary.Count - 1) |
| | | { |
| | | for (int j = 0; j < len.Length; j++) |
| | | { |
| | | var strvalue = len.Substring(j, 1); |
| | | if (strvalue == "1") |
| | | { |
| | | Maximum = j + 1; |
| | | } |
| | | } |
| | | stringtext += leng + "/" + (Maximum.ToString().Length < 2 ? "0" + Maximum.ToString() : Maximum.ToString()); |
| | | |
| | | } |
| | | b++; |
| | | } |
| | | btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyyear) + stringtext; |
| | | } |
| | | |
| | | }; break; |
| | | case 5: |
| | | { |
| | | string len = "", text = ""; |
| | | List<int> listvalueInt = new List<int>(); |
| | | listvalueInt.Clear(); |
| | | var maxvalue = Convert.ToString(Common.Logic.CurrentLogic.TimeAttribute.WeekDay, 2); |
| | | var str = maxvalue.Insert(0, new string('0', 8 - maxvalue.Length)); |
| | | for (int j = 7; j >= 0; j--) |
| | | { |
| | | len += str.Substring(j, 1); |
| | | } |
| | | |
| | | for (int j = 0; j < len.Length; j++) |
| | | { |
| | | var strvalue = len.Substring(j, 1); |
| | | if (strvalue == "1") |
| | | { |
| | | listvalueInt.Add(j + 1); |
| | | |
| | | |
| | | if ((j + 1) == 1) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.mon1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.mon) + ","; |
| | | } |
| | | else if ((j + 1) == 2) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.tue1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.tue) + ","; |
| | | } |
| | | else if ((j + 1) == 3) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.wed1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.wed) + ","; |
| | | } |
| | | else if ((j + 1) == 4) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.thu1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.thu) + ","; |
| | | } |
| | | else if ((j + 1) == 5) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.frl1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.frl) + ","; |
| | | } |
| | | else if ((j + 1) == 6) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.sat1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.sat) + ","; |
| | | } |
| | | else if ((j + 1) == 7) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.sun1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.sun) + ","; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | //暂时隐藏掉,需要显示周末和工作日再放开; |
| | | //if (listvalueInt.Count == 5 && !listvalueInt.Contains(6) && !listvalueInt.Contains(7)) |
| | | //{ |
| | | // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.workingday); |
| | | //} |
| | | //else if (listvalueInt.Count == 2 && listvalueInt.Contains(6) && listvalueInt.Contains(7)) |
| | | //{ |
| | | // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.weekend); |
| | | //} |
| | | //else if (listvalueInt.Count == 7) |
| | | //{ |
| | | // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyday); |
| | | //} |
| | | //else |
| | | //{ |
| | | // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.week1) + text.Replace(Language.StringByID(MyInternationalizationString.week1), "").TrimEnd(','); |
| | | //} |
| | | btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.week1) + text.Replace(Language.StringByID(MyInternationalizationString.week1), "").TrimEnd(','); |
| | | //btndisplaycycle.Text = text.TrimEnd(','); |
| | | }; break; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | void ConditionView(bool edit) |
| | | { |
| | | Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); |
| | | |
| | | #region 组合条件View |
| | | FrameLayout flMain = new FrameLayout { BackgroundColor = 0x50000000 }; |
| | | #region ------组合条件界面布局部分 |
| | | var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor }; |
| | | this.AddChidren(flMain); |
| | | flMain.MouseUpEventHandler += (sender2, e2) => |
| | | CompleteView completeView = new CompleteView(); |
| | | flMain.AddChidren(completeView.Show(2)); |
| | | completeView.Btntitle.TextID = MyInternationalizationString.condition; |
| | | EventHandler<MouseEventArgs> clickcancel = (sender, e) => |
| | | { |
| | | flMain.RemoveFromParent(); |
| | | }; |
| | | |
| | | var timetypeframelayout1 = new FrameLayout |
| | | { |
| | | Width = Application.GetRealWidth(1080), |
| | | Height = Application.GetRealHeight(100), |
| | | Y = Application.GetRealHeight(1920 - 100), |
| | | BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, |
| | | }; |
| | | flMain.AddChidren(timetypeframelayout1); |
| | | var framelayout = new FrameLayout |
| | | { |
| | | Width = Application.GetRealWidth(1080), |
| | | Height = Application.GetRealHeight(530), |
| | | Y = Application.GetRealHeight(1920 - 530), |
| | | BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, |
| | | Radius = (uint)Application.GetRealHeight(60), |
| | | }; |
| | | flMain.AddChidren(framelayout); |
| | | |
| | | #region -------取消 完成 |
| | | var timetype = new RowLayout |
| | | { |
| | | Height = Application.GetRealHeight(140), |
| | | LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, |
| | | }; |
| | | framelayout.AddChidren(timetype); |
| | | var Btncancel = new Button |
| | | { |
| | | TextID = MyInternationalizationString.cancel, |
| | | TextColor = ZigbeeColor.Current.LogicBtnCancelColor, |
| | | Height = Application.GetRealHeight(140), |
| | | Width = Application.GetRealWidth(200), |
| | | X = Application.GetRealWidth(80), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = 14, |
| | | }; |
| | | timetype.AddChidren(Btncancel); |
| | | Btncancel.MouseUpEventHandler += (sender16, e16) => |
| | | { |
| | | flMain.RemoveFromParent(); |
| | | UserView.HomePage.Instance.ScrollEnabled = true; |
| | | flMain.RemoveFromParent(); |
| | | }; |
| | | flMain.MouseUpEventHandler += clickcancel; |
| | | completeView.Btncancel.MouseUpEventHandler += clickcancel; |
| | | |
| | | var Btntitle = new Button |
| | | { |
| | | TextID = MyInternationalizationString.condition, |
| | | TextColor = ZigbeeColor.Current.LogicBtnTypeColor, |
| | | Height = Application.GetRealHeight(140), |
| | | Width = Application.GetRealWidth(320), |
| | | TextAlignment = TextAlignment.Center, |
| | | X = Btncancel.Right + Application.GetRealWidth(100), |
| | | TextSize = 16, |
| | | }; |
| | | timetype.AddChidren(Btntitle); |
| | | var Btncomplete = new Button |
| | | { |
| | | TextID = MyInternationalizationString.complete, |
| | | TextColor = ZigbeeColor.Current.LogicBtnCompleteColor, |
| | | Height = Application.GetRealHeight(140), |
| | | Width = Application.GetRealWidth(200), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | X = Btntitle.Right + Application.GetRealWidth(100), |
| | | TextSize = 14, |
| | | |
| | | }; |
| | | timetype.AddChidren(Btncomplete); |
| | | //满足所有条件 |
| | | mFunView allFunView = new mFunView(); |
| | | allFunView.frameLayout.Y = Application.GetRealHeight(140 + 20); |
| | | completeView.Show(2).AddChidren(allFunView.Show()); |
| | | allFunView.titleBtn.TextID = MyInternationalizationString.Allconditions; |
| | | //满足其中一个条件 |
| | | mFunView ormFunview = new mFunView(); |
| | | ormFunview.frameLayout.Y = allFunView.frameLayout.Bottom; |
| | | completeView.Show(2).AddChidren(ormFunview.Show()); |
| | | ormFunview.titleBtn.TextID = MyInternationalizationString.anycondition; |
| | | ormFunview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; |
| | | #endregion |
| | | |
| | | #region -------满足所有条件 满足其中一个条件 |
| | | |
| | | |
| | | #region -------满足所有条件 |
| | | |
| | | |
| | | var andFrameLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(160), |
| | | Y = timetype.Bottom + Application.GetRealHeight(20), |
| | | }; |
| | | framelayout.AddChidren(andFrameLayout); |
| | | |
| | | |
| | | var androw = new RowLayout |
| | | { |
| | | Y = Application.GetRealHeight(30), |
| | | Width = Application.GetRealWidth(920), |
| | | Height = Application.GetRealHeight(130), |
| | | X = Application.GetRealWidth(80), |
| | | LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, |
| | | }; |
| | | andFrameLayout.AddChidren(androw); |
| | | var andbtn = new Button |
| | | { |
| | | |
| | | Width = Application.GetRealWidth(600), |
| | | TextID = MyInternationalizationString.Allconditions, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, |
| | | TextSize = 14, |
| | | |
| | | }; |
| | | androw.AddChidren(andbtn); |
| | | |
| | | var andSelected = new SelectedButton(); |
| | | androw.AddChidren(andSelected); |
| | | #endregion |
| | | #region -------满足其中一个条件 |
| | | |
| | | var orFrameLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(160), |
| | | Y = andFrameLayout.Bottom, |
| | | |
| | | }; |
| | | framelayout.AddChidren(orFrameLayout); |
| | | |
| | | |
| | | |
| | | var orrow = new RowLayout |
| | | { |
| | | Y = Application.GetRealHeight(30), |
| | | Width = Application.GetRealWidth(920), |
| | | Height = Application.GetRealHeight(130), |
| | | X = Application.GetRealWidth(80), |
| | | LineColor = ZigbeeColor.Current.LogicBackgroundColor, |
| | | }; |
| | | orFrameLayout.AddChidren(orrow); |
| | | var orbtn = new Button |
| | | { |
| | | |
| | | Width = Application.GetRealWidth(600), |
| | | TextID = MyInternationalizationString.anycondition, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, |
| | | TextSize = 14, |
| | | }; |
| | | orrow.AddChidren(orbtn); |
| | | |
| | | var orSelected = new SelectedButton(); |
| | | orrow.AddChidren(orSelected); |
| | | #endregion |
| | | ///满足所有条件点击事件 |
| | | EventHandler<MouseEventArgs> andclick = (sedner14, e14) => |
| | | allFunView.clickviewBtn.MouseUpEventHandler += (sedner, e) => |
| | | { |
| | | andSelected.Visible = true; |
| | | orSelected.Visible = false; |
| | | andbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | orbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; |
| | | allFunView.selectedIconBtn.Visible = true; |
| | | ormFunview.selectedIconBtn.Visible = false; |
| | | allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; |
| | | }; |
| | | androw.MouseUpEventHandler += andclick; |
| | | andbtn.MouseUpEventHandler += andclick; |
| | | andSelected.MouseUpEventHandler += andclick; |
| | | andFrameLayout.MouseUpEventHandler += andclick; |
| | | |
| | | |
| | | ///满足其中一个条件点击事件 |
| | | EventHandler<MouseEventArgs> orclick = (sedner15, e15) => |
| | | ormFunview.clickviewBtn.MouseUpEventHandler += (sedner, e) => |
| | | { |
| | | andSelected.Visible = false; |
| | | orSelected.Visible = true; |
| | | andbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; |
| | | orbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | allFunView.selectedIconBtn.Visible = false; |
| | | ormFunview.selectedIconBtn.Visible = true; |
| | | allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; |
| | | ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | }; |
| | | orrow.MouseUpEventHandler += orclick; |
| | | orbtn.MouseUpEventHandler += orclick; |
| | | orSelected.MouseUpEventHandler += orclick; |
| | | orFrameLayout.MouseUpEventHandler += orclick; |
| | | |
| | | #endregion |
| | | #endregion |
| | | |
| | | if (edit) |
| | | { |
| | | if (Common.Logic.CurrentLogic.Relationship == 0) |
| | | { |
| | | andSelected.Visible = true; |
| | | orSelected.Visible = false; |
| | | andbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | orbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; |
| | | allFunView.selectedIconBtn.Visible = true; |
| | | ormFunview.selectedIconBtn.Visible = false; |
| | | allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; |
| | | } |
| | | else |
| | | { |
| | | andSelected.Visible = false; |
| | | orSelected.Visible = true; |
| | | andbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; |
| | | orbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | allFunView.selectedIconBtn.Visible = false; |
| | | ormFunview.selectedIconBtn.Visible = true; |
| | | allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; |
| | | ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | } |
| | | } |
| | | Btncomplete.MouseUpEventHandler += (sender, e) => |
| | | completeView.Btncomplete.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (!andSelected.Visible && !orSelected.Visible) |
| | | if (!allFunView.selectedIconBtn.Visible && !ormFunview.selectedIconBtn.Visible) |
| | | { |
| | | ///可以提示未选中状态; |
| | | return; |
| | | } |
| | | flMain.RemoveFromParent(); |
| | | |
| | | if (andSelected.Visible) |
| | | if (allFunView.selectedIconBtn.Visible) |
| | | { |
| | | Common.Logic.CurrentLogic.Relationship = 0; |
| | | |
| | | } |
| | | if (orSelected.Visible) |
| | | if (ormFunview.selectedIconBtn.Visible) |
| | | { |
| | | Common.Logic.CurrentLogic.Relationship = 1; |
| | | |
| | | } |
| | | var templateDeviceCondition = new TemplateDeviceCondition(); |
| | | UserView.HomePage.Instance.AddChidren(templateDeviceCondition); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | templateDeviceCondition.Show(); |
| | | if (edit) |
| | | { |
| | | if (Common.Logic.CurrentLogic.LogicId != 0) |
| | | { |
| | | Send.LogicControlSwitch(Common.Logic.CurrentLogic); |
| | | } |
| | | |
| | | var templatePage = new TemplatePage(); |
| | | UserView.HomePage.Instance.AddChidren(templatePage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | templatePage.Show(); |
| | | } |
| | | else |
| | | { |
| | | var roomAndDeviceView = new RoomAndDeviceView(); |
| | | UserView.HomePage.Instance.AddChidren(roomAndDeviceView); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | roomAndDeviceView.IfType = "condition_mould"; |
| | | roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.addsensor)); |
| | | } |
| | | }; |
| | | |
| | | } |