| | |
| | | using Shared.R; |
| | | using ZigBee.Device; |
| | | |
| | | namespace Shared.Phone.Logic.DoorLockLogic |
| | | namespace Shared.Phone.Device.Logic.DoorLockLogic |
| | | { |
| | | public class LockLogicCommunalPage : FrameLayout |
| | | { |
| | |
| | | Tag = "Logic"; |
| | | } |
| | | EditText logicTextBox; |
| | | public void Show(Action action) |
| | | public async void Show(Action action) |
| | | { |
| | | |
| | | #region 最上面的布局代码 |
| | | var topRowLayout = new RowLayout |
| | | { |
| | | BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, |
| | | Height = Application.GetRealHeight(184), |
| | | LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, |
| | | }; |
| | | this.AddChidren(topRowLayout); |
| | | |
| | | var titleName = new Button |
| | | { |
| | | TextSize = 16, |
| | | TextColor = ZigbeeColor.Current.LogicTextBlackColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | X = Application.GetRealWidth(176), |
| | | Width = Application.GetRealWidth(400), |
| | | Height = Application.GetRealHeight(69), |
| | | Y = Application.GetRealHeight(92), |
| | | TextID = MyInternationalizationString.selection, |
| | | }; |
| | | topRowLayout.AddChidren(titleName); |
| | | UserView.HomePage.Instance.ScrollEnabled = false;//锁住左滑 |
| | | 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.editlinkageevent); |
| | | } |
| | | else |
| | | { |
| | | titleName.Text = Language.StringByID(MyInternationalizationString.newautomation); |
| | | view.toptitleNameBtn.Text = Language.StringByID(MyInternationalizationString.addlinkageevent); |
| | | } |
| | | |
| | | var clickBtn = new Button |
| | | { |
| | | Width = Application.GetRealWidth(81 + 51), |
| | | Height = Application.GetRealHeight(58 + 40), |
| | | Y = Application.GetRealHeight(98 - 40), |
| | | }; |
| | | topRowLayout.AddChidren(clickBtn); |
| | | clickBtn.MouseDownEventHandler += (sender, e) => |
| | | { |
| | | RemoveFromParent(); |
| | | }; |
| | | |
| | | var back = new Button |
| | | { |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealHeight(51), |
| | | X = Application.GetRealWidth(81), |
| | | Y = Application.GetRealHeight(98), |
| | | //Gravity = Gravity.CenterVertical; |
| | | UnSelectedImagePath = "ZigeeLogic/back.png", |
| | | }; |
| | | topRowLayout.AddChidren(back); |
| | | back.MouseDownEventHandler += (sender, e) => |
| | | view.clickBtn.MouseDownEventHandler += (sender, e) => |
| | | { |
| | | action(); |
| | | RemoveFromParent(); |
| | | }; |
| | | |
| | | #endregion |
| | | |
| | | |
| | | var middle = new VerticalScrolViewLayout |
| | | { |
| | | Y = topRowLayout.Bottom, |
| | | Height = Application.GetRealHeight(1920 - 184 - 180), |
| | | Y = view.topRowLayout.Bottom, |
| | | Height = Application.GetRealHeight(Method.H - 184 - 180), |
| | | BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, |
| | | }; |
| | | this.AddChidren(middle); |
| | | |
| | | var saveBtn = new LogicView.SaveView(); |
| | | saveBtn.frameLayout.Y = middle.Bottom; |
| | | saveBtn.frameLayout.Height = Application.GetRealHeight(180); |
| | | this.AddChidren(saveBtn.Show()); |
| | | #endregion |
| | | |
| | | #region -----自动化名称 设置名称----- |
| | | var logicnamefl = new FrameLayout |
| | |
| | | TextID = MyInternationalizationString.automationname, |
| | | TextColor = ZigbeeColor.Current.LogicTextBlackColor, |
| | | Y = Application.GetRealHeight(35), |
| | | TextSize = 15, |
| | | }; |
| | | logicnamefl.AddChidren(text); |
| | | |
| | |
| | | X = text.Right, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = ZigbeeColor.Current.LogicBtnCancelColor, |
| | | TextSize = 13, |
| | | TextSize = 14, |
| | | Text = Common.Logic.CurrentLogic.LogicName, |
| | | //TextID=MyInternationalizationString.automation1, |
| | | }; |
| | |
| | | #endregion |
| | | |
| | | #region -----显示逻辑条件----- |
| | | |
| | | |
| | | var conditionFrameLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(160), |
| | | BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, |
| | | }; |
| | | middle.AddChidren(conditionFrameLayout); |
| | | |
| | | |
| | | 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 = 16, |
| | | 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); |
| | | LogicView.Addview addconditionview = new LogicView.Addview(); |
| | | addconditionview.iconBtn.Visible = true; |
| | | addconditionview.titleBtn.TextID = MyInternationalizationString.ifcondition; |
| | | middle.AddChidren(addconditionview.AddDeviceView()); |
| | | ///添加条件的点击事件 |
| | | EventHandler<MouseEventArgs> conditionaddclick = (sender, e) => |
| | | addconditionview.clickBtn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (Common.Logic.CurrentLogic.Conditions.Count == 1) |
| | | { |
| | | ConditionView(false); |
| | | } |
| | | else |
| | | { |
| | | var addCondition = new AddCondition(); |
| | | UserView.HomePage.Instance.AddChidren(addCondition); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | addCondition.Show(); |
| | | } |
| | | AddCondition(-1); |
| | | }; |
| | | conditionadd.MouseUpEventHandler += conditionaddclick; |
| | | conditionadd1.MouseUpEventHandler += conditionaddclick; |
| | | |
| | | List<Dictionary<string, string>> ListConditions = new List<Dictionary<string, string>>(); |
| | | ListConditions.Clear(); |
| | | ListConditions.AddRange(Common.Logic.CurrentLogic.Conditions); |
| | | ListConditions.Add(new Dictionary<string, string>()); |
| | | if (Common.Logic.CurrentLogic.Conditions.Count > 1) |
| | | { |
| | | var row = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(60), |
| | | BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, |
| | | }; |
| | | middle.AddChidren(row); |
| | | var relationship = new Button |
| | | { |
| | | Width = Application.GetRealWidth(600), |
| | | Height = Application.GetRealHeight(60), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | X = Application.GetRealWidth(58), |
| | | TextColor = ZigbeeColor.Current.LogicBtnCompleteColor, |
| | | }; |
| | | row.AddChidren(relationship); |
| | | if (Common.Logic.CurrentLogic.Relationship == 0) |
| | | { |
| | | relationship.Text = Language.StringByID(MyInternationalizationString.followingconditions) + Language.StringByID(MyInternationalizationString.Allconditions); |
| | | } |
| | | else |
| | | { |
| | | relationship.Text = Language.StringByID(MyInternationalizationString.followingconditions) + Language.StringByID(MyInternationalizationString.anycondition); |
| | | } |
| | | EventHandler<MouseEventArgs> editclick = (sender, e) => |
| | | { |
| | | |
| | | ConditionView(true); |
| | | }; |
| | | row.MouseUpEventHandler += editclick; |
| | | relationship.MouseUpEventHandler += editclick; |
| | | |
| | | } |
| | | for (int i = 0; i < ListConditions.Count; i++) |
| | | { |
| | | 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); |
| | | LogicView.AddDeviceView addflview = new LogicView.AddDeviceView(); |
| | | addflview.titleBtn.TextID = MyInternationalizationString.selectunlockingmode; |
| | | middle.AddChidren(addflview.AddFl()); |
| | | addflview.clickBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | AddCondition(-1); |
| | | }; |
| | | |
| | | |
| | | var addtextbtn = new Button |
| | | { |
| | | Height = Application.GetRealHeight(58), |
| | | Width = Application.GetRealWidth(300), |
| | | Y = Application.GetRealHeight(45 + 30), |
| | | TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, |
| | | TextID = MyInternationalizationString.addconditions, |
| | | X = Application.GetRealWidth(390), |
| | | }; |
| | | addfl.AddChidren(addtextbtn); |
| | | |
| | | EventHandler<MouseEventArgs> addconditionsclick = (sender, e) => |
| | | { |
| | | if (Common.Logic.CurrentLogic.Conditions.Count == 1) |
| | | { |
| | | ConditionView(false); |
| | | } |
| | | else |
| | | { |
| | | var addCondition = new AddCondition(); |
| | | UserView.HomePage.Instance.AddChidren(addCondition); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | addCondition.Show(); |
| | | } |
| | | }; |
| | | 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/time.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); |
| | | selecteddevice.stateRow.AddRightView(selecteddevice.edit); |
| | | selecteddevice.stateRow.AddRightView(selecteddevice.del); |
| | | |
| | | var Type = int.Parse(ListConditions[i]["Type"]); |
| | | var conditions = ListConditions[i]; |
| | |
| | | { |
| | | 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, |
| | | }; |
| | | 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); |
| | | ///通过设备找到区域(房间)名称 |
| | | Device.Logic.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) => |
| | | { |
| | | |
| | | if (deviceinof.Type != DeviceType.DoorLock) |
| | | { |
| | | var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; |
| | | this.AddChidren(flMain); |
| | | // DeviceStateCondition.CurrentDeviceView(flMain, deviceinof, true); |
| | | } |
| | | else |
| | | { |
| | | //var memberList = new MemberList(); |
| | | //UserView.HomePage.Instance.AddChidren(memberList); |
| | | //UserView.HomePage.Instance.PageIndex += 1; |
| | | //MemberList.edit = true; |
| | | //memberList.Show(deviceinof); |
| | | } |
| | | |
| | | }; |
| | | |
| | | ///显示设备条件状态控件 |
| | | 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, |
| | | }; |
| | | conditionsRowLayout.AddChidren(devicestatus); |
| | | |
| | | var deviceinof = Method.GetCommonDevice(conditions["MacAddr"], conditions["Epoint"]); |
| | | selecteddevice.deviceNameBtn.Visible = true; |
| | | selecteddevice.deviceNameBtn.Text = HdlDeviceCommonLogic.Current.GetDeviceEpointName(deviceinof); |
| | | selecteddevice.regionNameBtn.Visible = true; |
| | | Method.RoomNmae(selecteddevice.regionNameBtn, deviceinof); |
| | | selecteddevice.edit.Tag = i; |
| | | switch (deviceinof.Type) |
| | | { |
| | | |
| | | case DeviceType.DoorLock: |
| | | { |
| | | selecteddevice.iconBtn.UnSelectedImagePath = "ZigeeLogic/doorlock.png"; |
| | | for (int a = 0; a < Common.Logic.CurrentLogic.Accounts.Count; a++) |
| | | { |
| | | if (Common.Logic.CurrentLogic.Accounts[a]["Type"] == "1") |
| | | { |
| | | if (Common.Logic.CurrentLogic.Accounts[a]["UserId"] == conditions["AttriButeData2"]) |
| | | { |
| | | devicestatus.Text = conditions["Account"]; |
| | | selecteddevice.selecetddevicestateBtn.Text = Common.Logic.CurrentLogic.Accounts[a]["AccountName"]; |
| | | break; |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | break; |
| | | |
| | | } |
| | | |
| | | } |
| | | break; |
| | | |
| | | |
| | | } |
| | | ///删除控件 |
| | | var del = new Button |
| | | |
| | | ///编辑 |
| | | selecteddevice.edit.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | BackgroundColor = ZigbeeColor.Current.LogicDelBlackColor1, |
| | | Text = Language.StringByID(MyInternationalizationString.del), |
| | | int intvalue = int.Parse(selecteddevice.edit.Tag.ToString()); |
| | | AddCondition(intvalue); |
| | | }; |
| | | conditionsRowLayout.AddRightView(del); |
| | | |
| | | del.MouseUpEventHandler += (sender, e) => |
| | | ///删除控件 |
| | | selecteddevice.del.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | var alert = new Alert(Language.StringByID(MyInternationalizationString.tip), Language.StringByID(MyInternationalizationString.doyouwanttodelete), |
| | | Language.StringByID(MyInternationalizationString.cancel), Language.StringByID(MyInternationalizationString.confrim)); |
| | | alert.ResultEventHandler += (sender1, e1) => |
| | | { |
| | | if (e1) |
| | | { |
| | | var lockLogicCommunalPage = new LockLogicCommunalPage(); |
| | | UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | lockLogicCommunalPage.Show(()=> { }); |
| | | } |
| | | }; |
| | | var alert = new ShowMsgControl(ShowMsgType.Confirm, |
| | | Language.StringByID(MyInternationalizationString.doyouwanttodelete), |
| | | Language.StringByID(MyInternationalizationString.confrim)); |
| | | alert.Show(); |
| | | |
| | | alert.ConfirmClickEvent += () => |
| | | { |
| | | Common.Logic.CurrentLogic.Conditions.Remove(conditions); |
| | | selecteddevice.selecetdFrameLayout.RemoveFromParent(); |
| | | //var lockLogicCommunalPage = new LockLogicCommunalPage(); |
| | | //UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage); |
| | | //UserView.HomePage.Instance.PageIndex += 1; |
| | | //lockLogicCommunalPage.Show(() => { }); |
| | | }; |
| | | }; |
| | | |
| | | } |
| | |
| | | #endregion |
| | | |
| | | #region ----显示执行目标---- |
| | | LogicView.Addview addactionview = new LogicView.Addview(); |
| | | addactionview.iconBtn.Visible = true; |
| | | addactionview.titleBtn.TextID = MyInternationalizationString.execute; |
| | | middle.AddChidren(addactionview.AddDeviceView()); |
| | | |
| | | 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 = 16, |
| | | 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) => |
| | | addactionview.clickBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); |
| | | var addAction = new Device.Logic.DoorLockLogic.AddAction(); |
| | | UserView.HomePage.Instance.AddChidren(addAction); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | addAction.Show(); |
| | | Method.View(LogicView.IfString.Action_LockAction, LogicView.IfString.Action_LockScene); |
| | | }; |
| | | 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 |
| | | { |
| | | 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(300), |
| | | Y = Application.GetRealHeight(45 + 30), |
| | | TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, |
| | | TextID = MyInternationalizationString.addfunction, |
| | | X = Application.GetRealWidth(390), |
| | | }; |
| | | addfl.AddChidren(addtextbtn); |
| | | EventHandler<MouseEventArgs> addfunctionclick = (sender, e) => |
| | | LogicView.AddDeviceView addflview = new LogicView.AddDeviceView(); |
| | | addflview.titleBtn.TextID = MyInternationalizationString.addaction; |
| | | middle.AddChidren(addflview.AddFl()); |
| | | addflview.clickBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); |
| | | var addAction = new Device.Logic.DoorLockLogic.AddAction(); |
| | | UserView.HomePage.Instance.AddChidren(addAction); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | addAction.Show(); |
| | | Method.View(LogicView.IfString.Action_LockAction, LogicView.IfString.Action_LockScene); |
| | | }; |
| | | 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]; |
| | | |
| | | string name = ""; |
| | | string icon = ""; |
| | | string state = ""; |
| | | switch (linkType) |
| | | { |
| | | |
| | | case 0: |
| | | case 8: |
| | | { |
| | | 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, |
| | | }; |
| | | 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); |
| | | ///通过设备找到区域(房间)名称 |
| | | Device.Logic.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, |
| | | }; |
| | | 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 deviceStatePage = new DeviceStatePage(); |
| | | //UserView.HomePage.Instance.AddChidren(deviceStatePage); |
| | | //UserView.HomePage.Instance.PageIndex += 1; |
| | | //deviceStatePage.IsDeviceEditor = true; |
| | | //deviceStatePage.Show(deviceinof); |
| | | |
| | | //ActionModifyDeviceStateView(deviceinof); |
| | | var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; |
| | | this.AddChidren(flMain); |
| | | //LogicDevicePage.CurrentDeviceStateView(flMain, deviceinof, true); |
| | | }; |
| | | |
| | | var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString()); |
| | | name =HdlDeviceCommonLogic.Current.GetDeviceEpointName(deviceinof); |
| | | actiondevice.regionNameBtn.Visible = true; |
| | | Method.RoomNmae(actiondevice.regionNameBtn, deviceinof); |
| | | |
| | | switch (deviceinof.Type) |
| | | { |
| | | case DeviceType.OnOffOutput: |
| | | { |
| | | actionsIcon.UnSelectedImagePath = "ZigeeLogic/light.png"; |
| | | icon = "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); |
| | | state = Language.StringByID(MyInternationalizationString.close); |
| | | |
| | | } |
| | | else if (status["Data1"].ToString() == "1") |
| | | { |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.open); |
| | | state = Language.StringByID(MyInternationalizationString.open); |
| | | |
| | | } |
| | | else if (status["Data1"].ToString() == "2") |
| | | { |
| | | |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff); |
| | | state = Language.StringByID(MyInternationalizationString.onoff); |
| | | } |
| | | } |
| | | |
| | |
| | | break; |
| | | case DeviceType.DimmableLight: |
| | | { |
| | | actionsIcon.UnSelectedImagePath = "ZigeeLogic/dimmableLight.png"; |
| | | icon = "ZigeeLogic/dimmableLight.png"; |
| | | var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; |
| | | if (TaskList == null) |
| | | { |
| | |
| | | { |
| | | var intvalue = int.Parse(status["Data1"]); |
| | | var lightbrightnessvalue = (intvalue * 100) / 254; |
| | | devicestatus.Text = lightbrightnessvalue.ToString() + "%"; |
| | | state = lightbrightnessvalue.ToString() + "%"; |
| | | } |
| | | else if (status["TaskType"].ToString() == "1") |
| | | { |
| | | |
| | | if (status["Data1"].ToString() == "0") |
| | | { |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.close); |
| | | state = Language.StringByID(MyInternationalizationString.close); |
| | | } |
| | | else if (status["Data1"].ToString() == "2") |
| | | { |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff); |
| | | state = Language.StringByID(MyInternationalizationString.onoff); |
| | | } |
| | | } |
| | | |
| | |
| | | break; |
| | | case DeviceType.WindowCoveringDevice: |
| | | { |
| | | actionsIcon.UnSelectedImagePath = "ZigeeLogic/curtain.png"; |
| | | icon = "ZigeeLogic/curtain.png"; |
| | | var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; |
| | | if (TaskList == null) |
| | | { |
| | |
| | | { |
| | | if (status["Data1"] == "0") |
| | | { |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.open); |
| | | state = Language.StringByID(MyInternationalizationString.open); |
| | | } |
| | | else if (status["Data1"] == "1") |
| | | { |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.close); |
| | | state = Language.StringByID(MyInternationalizationString.close); |
| | | } |
| | | else if (status["Data1"] == "5") |
| | | { |
| | | devicestatus.Text = status["Data2"] + "%"; |
| | | state = status["Data2"] + "%"; |
| | | } |
| | | } |
| | | |
| | |
| | | break; |
| | | case DeviceType.AirSwitch: |
| | | { |
| | | actionsIcon.UnSelectedImagePath = "ZigeeLogic/airswitch.png"; |
| | | icon = "ZigeeLogic/airswitch.png"; |
| | | |
| | | var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; |
| | | if (TaskList == null) |
| | |
| | | { |
| | | if (status["Data1"].ToString() == "0") |
| | | { |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.close); |
| | | state = Language.StringByID(MyInternationalizationString.close); |
| | | |
| | | } |
| | | else if (status["Data1"].ToString() == "1") |
| | | { |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.open); |
| | | state = Language.StringByID(MyInternationalizationString.open); |
| | | |
| | | } |
| | | else if (status["Data1"].ToString() == "2") |
| | | { |
| | | |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff); |
| | | state = Language.StringByID(MyInternationalizationString.onoff); |
| | | } |
| | | } |
| | | |
| | |
| | | break; |
| | | case DeviceType.Thermostat: |
| | | { |
| | | actionsIcon.UnSelectedImagePath = "ZigeeLogic/ac.png"; |
| | | icon = "ZigeeLogic/ac.png"; |
| | | |
| | | var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; |
| | | if (TaskList == null) |
| | |
| | | bool ifclose = false; |
| | | foreach (var status in TaskList) |
| | | { |
| | | if (status["TaskType"].ToString() == "1") |
| | | |
| | | if (TaskList.Count == 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; |
| | | } |
| | | |
| | | //数组只有一个元素说明当前空调状态为关; |
| | | ifclose = false; |
| | | //如果空调状态是关;直接跳出for循坏; |
| | | break; |
| | | } |
| | | else if (status["TaskType"].ToString() == "5") |
| | | else |
| | | { |
| | | ifclose = true; |
| | | } |
| | | if (status["TaskType"].ToString() == "5") |
| | | { |
| | | if (status["Data1"] == "3") |
| | | {//3---设置工作模式(1:自动;3:制冷;4:制热;7:送风;8:除湿) |
| | |
| | | } |
| | | if (ifclose) |
| | | { |
| | | devicestatus.Text = modetext + ";" + temperaturetext + "℃;" + speedtext; |
| | | state = modetext + ";" + temperaturetext + "℃;" + speedtext; |
| | | } |
| | | else |
| | | { |
| | | devicestatus.Text = Language.StringByID(MyInternationalizationString.close); |
| | | state = Language.StringByID(MyInternationalizationString.close); |
| | | |
| | | } |
| | | } |
| | | break; |
| | | case DeviceType.DoorLock: |
| | | { |
| | | //门锁特殊 |
| | | icon = "ZigeeLogic/doorlock.png"; |
| | | if (actions["PassData"].ToString() == "055704010112") |
| | | { |
| | | state = Language.StringByID(MyInternationalizationString.logicopen); |
| | | } |
| | | else |
| | | { |
| | | state = Language.StringByID(MyInternationalizationString.logicclose); |
| | | } |
| | | } |
| | | break; |
| | | case DeviceType.ColorTemperatureLight: |
| | | { |
| | | icon = "ZigeeLogic/nightLight.png"; |
| | | var taskList = actions["TaskList"] as List<Dictionary<string, string>>; |
| | | if (taskList == null) |
| | | { |
| | | continue; |
| | | } |
| | | foreach (var tasks in taskList) |
| | | { |
| | | switch (tasks["TaskType"]) |
| | | { |
| | | case "1": |
| | | { |
| | | if (tasks["Data1"] == "0") |
| | | { |
| | | state += Language.StringByID(MyInternationalizationString.close) + ";"; |
| | | } |
| | | else |
| | | { |
| | | state += Language.StringByID(MyInternationalizationString.open) + ";"; |
| | | } |
| | | } |
| | | break; |
| | | |
| | | } |
| | | } |
| | | foreach (var tasks in taskList) |
| | | { |
| | | switch (tasks["TaskType"]) |
| | | { |
| | | |
| | | case "3": |
| | | { |
| | | var intvalue = int.Parse(tasks["Data1"]); |
| | | var lightbrightnessvalue = (intvalue * 100) / 254; |
| | | state += Language.StringByID(MyInternationalizationString.brightness) + lightbrightnessvalue.ToString() + "%;"; |
| | | } |
| | | break; |
| | | |
| | | } |
| | | } |
| | | foreach (var tasks in taskList) |
| | | { |
| | | switch (tasks["TaskType"]) |
| | | { |
| | | |
| | | case "7": |
| | | { |
| | | if (tasks["Data1"] == "0") |
| | | { |
| | | state += Language.StringByID(MyInternationalizationString.buzzer) + Language.StringByID(MyInternationalizationString.close) + ";"; |
| | | } |
| | | else |
| | | { |
| | | state += Language.StringByID(MyInternationalizationString.buzzer) + Language.StringByID(MyInternationalizationString.open) + ";"; |
| | | } |
| | | } |
| | | break; |
| | | |
| | | } |
| | | } |
| | | foreach (var tasks in taskList) |
| | | { |
| | | switch (tasks["TaskType"]) |
| | | { |
| | | |
| | | case "8": |
| | | { |
| | | var intvalue = int.Parse(tasks["Data1"]); |
| | | var colorTemperatureValue = 1000000 / (intvalue * 100); |
| | | state += Language.StringByID(MyInternationalizationString.colorTemperature) + colorTemperatureValue.ToString() + "K"; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | state = state.TrimEnd(';');//去掉最后那个";" |
| | | } |
| | | break; |
| | | } |
| | | |
| | | |
| | |
| | | break; |
| | | case 2: |
| | | { |
| | | |
| | | var sceneinof = Common.Room.AllRoomSceneUIList.Find((obj) => { return obj.Id.ToString() == actions["DeviceAddr"].ToString(); }); |
| | | actiondevice.edit.Visible = false;//隐藏编辑按钮(场景不需要编辑) |
| | | //在本地查找该场景; |
| | | var sceneinof = HdlSceneLogic.Current.GetSceneUIBySceneId(Convert.ToInt32(actions["DeviceAddr"].ToString())); |
| | | //本地没有存在; |
| | | if (sceneinof == null) |
| | | { |
| | | continue; |
| | | //实现目的:显示出来让可以自己是否删除 |
| | | sceneinof = new SceneUI(); |
| | | #region -------- |
| | | ////在网关查找该场景; |
| | | ////标记问题:网络请求,存在视图加载快慢的问题; |
| | | //sceneinof = await Send.GetScene(int.Parse(actions["DeviceAddr"].ToString())); |
| | | ////网关没有存在; |
| | | //if (sceneinof == null) |
| | | //{ |
| | | // //注解:本地和网关都不存在该场景,界面将不会显示该场景; |
| | | // //sceneinof = new SceneUI(); |
| | | // //移除该场景数据; |
| | | // Common.Logic.CurrentLogic.Actions.Remove(actions); |
| | | // //移除该场景视图; |
| | | // devicesFrameLayout.RemoveFromParent(); |
| | | // continue; |
| | | //} |
| | | #endregion |
| | | } |
| | | |
| | | actionsIcon.UnSelectedImagePath = "ZigeeLogic/scene.png"; |
| | | ///设备名称Button |
| | | var btndevicename = new Button |
| | | { |
| | | Y = Application.GetRealHeight(20), |
| | | Height = Application.GetRealHeight(50), |
| | | Width = Application.GetRealWidth(500), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = sceneinof.Name, |
| | | TextColor = ZigbeeColor.Current.LogicTextBlackColor, |
| | | }; |
| | | actionsrowLayout.AddChidren(btndevicename); |
| | | |
| | | ///区域(房间)名称Button |
| | | var btnregionname = new Button |
| | | { |
| | | Y = btndevicename.Bottom + Application.GetRealHeight(10), |
| | | Width = Application.GetRealWidth(500), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Height = Application.GetRealHeight(50), |
| | | Text = "",//Language.StringByID(MyInternationalizationString.customroom), |
| | | TextColor = ZigbeeColor.Current.LogicBtnCancelColor, |
| | | }; |
| | | actionsrowLayout.AddChidren(btnregionname); |
| | | icon = "ZigeeLogic/scene.png"; |
| | | name = sceneinof.Name; |
| | | actiondevice.regionNameBtn.Visible = true; |
| | | /////通过设备找到区域(房间)名称 |
| | | Common.Room room = new Common.Room(); |
| | | btnregionname.Text = room.GetRoomNameBySceneId(sceneinof.Id); |
| | | //Send.RoomNmae(btnregionname, deviceinof); |
| | | |
| | | |
| | | actiondevice.regionNameBtn.Text = HdlRoomLogic.Current.GetRoomNameBySceneId(sceneinof.Id); |
| | | |
| | | } |
| | | break; |
| | | |
| | | } |
| | | ///删除控件 |
| | | var del = new Button |
| | | if (linkType != 2) |
| | | { |
| | | BackgroundColor = ZigbeeColor.Current.LogicDelBlackColor1, |
| | | Text = Language.StringByID(MyInternationalizationString.del), |
| | | }; |
| | | actionsrowLayout.AddRightView(del); |
| | | actiondevice.stateRow.AddRightView(actiondevice.edit); |
| | | } |
| | | actiondevice.stateRow.AddRightView(actiondevice.del); |
| | | //状态 |
| | | actiondevice.deviceNameBtn.Visible = true; |
| | | actiondevice.deviceNameBtn.Text = name; |
| | | actiondevice.iconBtn.UnSelectedImagePath = icon; |
| | | actiondevice.selecetddevicestateBtn.Text = state; |
| | | |
| | | del.MouseUpEventHandler += (sender, e) => |
| | | ///编辑 |
| | | actiondevice.edit.Tag = i.ToString(); |
| | | actiondevice.edit.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var alert = new Alert(Language.StringByID(MyInternationalizationString.tip), Language.StringByID(MyInternationalizationString.doyouwanttodelete), |
| | | Language.StringByID(MyInternationalizationString.cancel), Language.StringByID(MyInternationalizationString.confrim)); |
| | | alert.ResultEventHandler += (sender1, e1) => |
| | | switch (linkType) |
| | | { |
| | | if (e1) |
| | | { |
| | | Common.Logic.CurrentLogic.Actions.Remove(actions); |
| | | //var logicCommunalPage = new LogicCommunalPage(); |
| | | //UserView.HomePage.Instance.AddChidren(logicCommunalPage); |
| | | //UserView.HomePage.Instance.PageIndex += 1; |
| | | //logicCommunalPage.Show(() => { }); |
| | | } |
| | | }; |
| | | case 0: |
| | | case 8: |
| | | { |
| | | var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString()); |
| | | var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; |
| | | this.AddChidren(flMain); |
| | | CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_lockaction", int.Parse(actiondevice.edit.Tag.ToString())); |
| | | } |
| | | break; |
| | | |
| | | |
| | | } |
| | | }; |
| | | ///删除控件 |
| | | actiondevice.del.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | var alert = new ShowMsgControl(ShowMsgType.Confirm, |
| | | Language.StringByID(MyInternationalizationString.doyouwanttodelete), |
| | | Language.StringByID(MyInternationalizationString.confrim)); |
| | | alert.Show(); |
| | | |
| | | alert.ConfirmClickEvent += () => |
| | | { |
| | | Common.Logic.CurrentLogic.Actions.Remove(actions); |
| | | actiondevice.selecetdFrameLayout.RemoveFromParent(); |
| | | //var lockLogicCommunalPage = new LockLogicCommunalPage(); |
| | | //UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage); |
| | | //UserView.HomePage.Instance.PageIndex += 1; |
| | | //lockLogicCommunalPage.Show(() => { }); |
| | | }; |
| | | }; |
| | | |
| | | } |
| | |
| | | #endregion |
| | | |
| | | #region ----推送设置---- |
| | | |
| | | var fraline1 = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(30), |
| | | }; |
| | | middle.AddChidren(fraline1); |
| | | |
| | | 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, |
| | | }; |
| | | 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); |
| | | btnswitch.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | btnswitch.IsSelected = !btnswitch.IsSelected; |
| | | if (btnswitch.IsSelected) |
| | | { |
| | | |
| | | } |
| | | else |
| | | { |
| | | |
| | | } |
| | | }; |
| | | |
| | | |
| | | var custompushFrameLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(160), |
| | | 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, |
| | | }; |
| | | 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 Device.Logic.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 |
| | | |
| | | |
| | | 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.Save, |
| | | TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, |
| | | }; |
| | | saveFrameLayout.AddChidren(btnsave); |
| | | btnsave.MouseUpEventHandler += async (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())) |
| | | { |
| | | new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.PleaseEnterLogicName), Language.StringByID(MyInternationalizationString.Close)).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 Device.Logic.Send.AddModifyLogic(Common.Logic.CurrentLogic); |
| | | if (logicifon != null && logicifon.LogicId != 0) |
| | | { |
| | | Common.Logic.CurrentLogic.LogicId = logicifon.LogicId; |
| | | Common.Logic.LogicList.Add(Common.Logic.CurrentLogic); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //发送修改逻辑命令 |
| | | Device.Logic.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); |
| | | }; |
| | | |
| | | saveBtn.clickviewBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var name = logicTextBox.Text.Trim(); |
| | | Method.SaveLogic(LogicView.IfString._LockLogic, name,LogicView.IfString.Tag, Common.Logic.CurrentLogic); |
| | | }; |
| | | |
| | | } |
| | | |
| | | |
| | | void ConditionView(bool edit) |
| | | public void AddCondition(int value) |
| | | { |
| | | Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); |
| | | |
| | | #region 组合条件View |
| | | FrameLayout flMain = new FrameLayout { BackgroundColor = 0x50000000 }; |
| | | this.AddChidren(flMain); |
| | | flMain.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | 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, |
| | | }; |
| | | timetype.AddChidren(Btncancel); |
| | | Btncancel.MouseUpEventHandler += (sender16, e16) => |
| | | { |
| | | flMain.RemoveFromParent(); |
| | | UserView.HomePage.Instance.ScrollEnabled = true; |
| | | }; |
| | | |
| | | 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), |
| | | |
| | | }; |
| | | timetype.AddChidren(Btncomplete); |
| | | #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, |
| | | |
| | | }; |
| | | androw.AddChidren(andbtn); |
| | | |
| | | var andSelected = new Device.Logic.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, |
| | | }; |
| | | orrow.AddChidren(orbtn); |
| | | |
| | | var orSelected = new Device.Logic.SelectedButton(); |
| | | orrow.AddChidren(orSelected); |
| | | #endregion |
| | | ///满足所有条件点击事件 |
| | | EventHandler<MouseEventArgs> andclick = (sedner14, e14) => |
| | | { |
| | | andSelected.Visible = true; |
| | | orSelected.Visible = false; |
| | | andbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | orbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; |
| | | }; |
| | | androw.MouseUpEventHandler += andclick; |
| | | andbtn.MouseUpEventHandler += andclick; |
| | | andSelected.MouseUpEventHandler += andclick; |
| | | andFrameLayout.MouseUpEventHandler += andclick; |
| | | |
| | | |
| | | ///满足其中一个条件点击事件 |
| | | EventHandler<MouseEventArgs> orclick = (sedner15, e15) => |
| | | { |
| | | andSelected.Visible = false; |
| | | orSelected.Visible = true; |
| | | andbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; |
| | | orbtn.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; |
| | | } |
| | | else |
| | | { |
| | | andSelected.Visible = false; |
| | | orSelected.Visible = true; |
| | | andbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; |
| | | orbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | } |
| | | } |
| | | Btncomplete.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (!andSelected.Visible && !orSelected.Visible) |
| | | { |
| | | ///可以提示未选中状态; |
| | | return; |
| | | } |
| | | flMain.RemoveFromParent(); |
| | | |
| | | if (andSelected.Visible) |
| | | { |
| | | Common.Logic.CurrentLogic.Relationship = 0; |
| | | |
| | | } |
| | | if (orSelected.Visible) |
| | | { |
| | | Common.Logic.CurrentLogic.Relationship = 1; |
| | | |
| | | } |
| | | if (edit) |
| | | { |
| | | if (Common.Logic.CurrentLogic.LogicId != 0) |
| | | { |
| | | Device.Logic.Send.LogicControlSwitch(Common.Logic.CurrentLogic); |
| | | } |
| | | var addCondition = new AddCondition(); |
| | | UserView.HomePage.Instance.AddChidren(addCondition); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | addCondition.Show(); |
| | | } |
| | | else |
| | | { |
| | | var addCondition = new AddCondition(); |
| | | UserView.HomePage.Instance.AddChidren(addCondition); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | addCondition.Show(); |
| | | } |
| | | }; |
| | | |
| | | var addCondition = new AddCondition(); |
| | | addCondition.conditionsIndex = value; |
| | | UserView.HomePage.Instance.AddChidren(addCondition); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | addCondition.Show(); |
| | | } |
| | | } |
| | | } |