| | |
| | | { |
| | | |
| | | #region 最上面的布局代码 |
| | | UserView.HomePage.Instance.ScrollEnabled = false;//锁住左滑 |
| | | TopView view = new TopView(); |
| | | this.AddChidren(view.TopRowView()); |
| | | if (Common.Logic.CurrentLogic.LogicId != 0) |
| | |
| | | var middle = new VerticalScrolViewLayout |
| | | { |
| | | Y = view.topRowLayout.Bottom, |
| | | Height = Application.GetRealHeight(1920 - 184 - 180), |
| | | Height = Application.GetRealHeight(Method.H - 184 - 180), |
| | | BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, |
| | | }; |
| | | this.AddChidren(middle); |
| | |
| | | { |
| | | 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]; |
| | | switch (Type) |
| | |
| | | { |
| | | var deviceinof = Method.GetCommonDevice(conditions["MacAddr"], conditions["Epoint"]); |
| | | selecteddevice.deviceNameBtn.Visible = true; |
| | | selecteddevice.deviceNameBtn.Text = deviceinof.DeviceEpointName; |
| | | selecteddevice.deviceNameBtn.Text = HdlDeviceCommonLogic.Current.GetDeviceEpointName(deviceinof); |
| | | selecteddevice.regionNameBtn.Visible = true; |
| | | Method.RoomNmae(selecteddevice.regionNameBtn, deviceinof); |
| | | selecteddevice.edit.Tag = i; |
| | |
| | | { |
| | | if (Common.Logic.CurrentLogic.Accounts[a]["UserId"] == conditions["AttriButeData2"]) |
| | | { |
| | | selecteddevice.selecetddevicestateBtn.Text = Common.Logic.CurrentLogic.Accounts[a]["Account"]; |
| | | selecteddevice.selecetddevicestateBtn.Text = Common.Logic.CurrentLogic.Accounts[a]["AccountName"]; |
| | | break; |
| | | } |
| | | } |
| | |
| | | ///删除控件 |
| | | selecteddevice.del.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm, |
| | | var alert = new ShowMsgControl(ShowMsgType.Confirm, |
| | | Language.StringByID(MyInternationalizationString.doyouwanttodelete), |
| | | Language.StringByID(MyInternationalizationString.confrim)); |
| | | alert.Show(); |
| | | alert.ConfirmClickEvent += () => |
| | | { |
| | | Common.Logic.CurrentLogic.Conditions.Remove(conditions); |
| | | var lockLogicCommunalPage = new LockLogicCommunalPage(); |
| | | UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | lockLogicCommunalPage.Show(() => { }); |
| | | selecteddevice.selecetdFrameLayout.RemoveFromParent(); |
| | | //var lockLogicCommunalPage = new LockLogicCommunalPage(); |
| | | //UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage); |
| | | //UserView.HomePage.Instance.PageIndex += 1; |
| | | //lockLogicCommunalPage.Show(() => { }); |
| | | }; |
| | | }; |
| | | |
| | |
| | | addactionview.clickBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); |
| | | var addAction = new AddAction(); |
| | | UserView.HomePage.Instance.AddChidren(addAction); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | addAction.Show(); |
| | | Method.View(LogicView.IfString.Action_LockAction, LogicView.IfString.Action_LockScene); |
| | | }; |
| | | |
| | | List<Dictionary<string, object>> ListActions = new List<Dictionary<string, object>>(); |
| | |
| | | { |
| | | |
| | | LogicView.AddDeviceView addflview = new LogicView.AddDeviceView(); |
| | | addflview.titleBtn.TextID = MyInternationalizationString.selectunlockingmode; |
| | | addflview.titleBtn.TextID = MyInternationalizationString.addaction; |
| | | middle.AddChidren(addflview.AddFl()); |
| | | addflview.clickBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); |
| | | var addAction = new AddAction(); |
| | | UserView.HomePage.Instance.AddChidren(addAction); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | addAction.Show(); |
| | | Method.View(LogicView.IfString.Action_LockAction, LogicView.IfString.Action_LockScene); |
| | | }; |
| | | } |
| | | else |
| | |
| | | string state = ""; |
| | | switch (linkType) |
| | | { |
| | | |
| | | case 0: |
| | | case 8: |
| | | { |
| | | |
| | | var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString()); |
| | | name = deviceinof.DeviceEpointName; |
| | | name =HdlDeviceCommonLogic.Current.GetDeviceEpointName(deviceinof); |
| | | actiondevice.regionNameBtn.Visible = true; |
| | | Method.RoomNmae(actiondevice.regionNameBtn, deviceinof); |
| | | |
| | |
| | | } |
| | | } |
| | | 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 = UserCenter.HdlSceneLogic.Current.GetSceneUIBySceneId(Convert.ToInt32(actions["DeviceAddr"].ToString())); |
| | | { |
| | | actiondevice.edit.Visible = false;//隐藏编辑按钮(场景不需要编辑) |
| | | //在本地查找该场景; |
| | | var sceneinof = HdlSceneLogic.Current.GetSceneUIBySceneId(Convert.ToInt32(actions["DeviceAddr"].ToString())); |
| | | //本地没有存在; |
| | | if (sceneinof == null) |
| | | { |
| | |
| | | name = sceneinof.Name; |
| | | actiondevice.regionNameBtn.Visible = true; |
| | | /////通过设备找到区域(房间)名称 |
| | | actiondevice.regionNameBtn.Text = UserCenter.HdlRoomLogic.Current.GetRoomNameBySceneId(sceneinof.Id); |
| | | actiondevice.regionNameBtn.Text = HdlRoomLogic.Current.GetRoomNameBySceneId(sceneinof.Id); |
| | | |
| | | } |
| | | break; |
| | | } |
| | | |
| | | if (linkType != 2) |
| | | { |
| | | actiondevice.stateRow.AddRightView(actiondevice.edit); |
| | | } |
| | | actiondevice.stateRow.AddRightView(actiondevice.del); |
| | | //状态 |
| | | actiondevice.deviceNameBtn.Visible = true; |
| | | actiondevice.deviceNameBtn.Text = name; |
| | |
| | | actiondevice.selecetddevicestateBtn.Text = state; |
| | | |
| | | ///编辑 |
| | | actiondevice.edit.Tag = i.ToString(); |
| | | actiondevice.edit.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | switch (linkType) |
| | | { |
| | | 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"); |
| | | CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_lockaction", int.Parse(actiondevice.edit.Tag.ToString())); |
| | | } |
| | | break; |
| | | |
| | |
| | | actiondevice.del.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm, |
| | | var alert = new ShowMsgControl(ShowMsgType.Confirm, |
| | | Language.StringByID(MyInternationalizationString.doyouwanttodelete), |
| | | Language.StringByID(MyInternationalizationString.confrim)); |
| | | alert.Show(); |
| | |
| | | alert.ConfirmClickEvent += () => |
| | | { |
| | | Common.Logic.CurrentLogic.Actions.Remove(actions); |
| | | var lockLogicCommunalPage = new LockLogicCommunalPage(); |
| | | UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | lockLogicCommunalPage.Show(() => { }); |
| | | actiondevice.selecetdFrameLayout.RemoveFromParent(); |
| | | //var lockLogicCommunalPage = new LockLogicCommunalPage(); |
| | | //UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage); |
| | | //UserView.HomePage.Instance.PageIndex += 1; |
| | | //lockLogicCommunalPage.Show(() => { }); |
| | | }; |
| | | }; |
| | | |
| | |
| | | Method.Push(middle); |
| | | #endregion |
| | | |
| | | |
| | | saveBtn.clickviewBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var name = logicTextBox.Text.Trim(); |
| | |
| | | } |
| | | public void AddCondition(int value) |
| | | { |
| | | Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); |
| | | var addCondition = new AddCondition(); |
| | | addCondition.conditionsIndex = value; |
| | | UserView.HomePage.Instance.AddChidren(addCondition); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | addCondition.Show(); |
| | | |
| | | } |
| | | } |
| | | } |