| | |
| | | List<string> devicetypelist = new List<string>(); |
| | | devicetypelist.Clear(); |
| | | |
| | | var lightjosn = devicelist.Find((device) => device.Type == DeviceType.DimmableLight || device.Type == DeviceType.OnOffOutput); |
| | | var lightjosn = devicelist.Find((device) => device.Type == DeviceType.DimmableLight || device.Type == DeviceType.OnOffOutput || device.Type == DeviceType.ColorTemperatureLight); |
| | | if (lightjosn != null) |
| | | { |
| | | devicetypelist.Add(Language.StringByID(MyInternationalizationString.Lights)); |
| | |
| | | { |
| | | DeviceTypeList.Add(DeviceType.OnOffOutput);//0x0101十进制257 |
| | | DeviceTypeList.Add(DeviceType.DimmableLight); |
| | | DeviceTypeList.Add(DeviceType.ColorTemperatureLight); |
| | | } |
| | | else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains)) |
| | | { |
| | |
| | | selectedpatm = "ZigeeLogic/selectedairswitch.png"; |
| | | } |
| | | break; |
| | | case DeviceType.ColorTemperatureLight: |
| | | { |
| | | patm = "ZigeeLogic/nightLight.png"; |
| | | selectedpatm = "ZigeeLogic/nightLightSelected.png"; |
| | | } |
| | | break; |
| | | } |
| | | button.UnSelectedImagePath = patm; |
| | | button.SelectedImagePath = selectedpatm; |
| | |
| | | deviceTypeList.Add(DeviceType.WindowCoveringDevice); |
| | | deviceTypeList.Add(DeviceType.Thermostat); |
| | | deviceTypeList.Add(DeviceType.AirSwitch); |
| | | deviceTypeList.Add(DeviceType.ColorTemperatureLight); |
| | | ///门锁特殊 |
| | | // deviceTypeList.Add(DeviceType.DoorLock); |
| | | } |
| | |
| | | deviceTypeList.Add(DeviceType.WindowCoveringDevice); |
| | | deviceTypeList.Add(DeviceType.Thermostat); |
| | | deviceTypeList.Add(DeviceType.AirSwitch); |
| | | deviceTypeList.Add(DeviceType.ColorTemperatureLight); |
| | | ///门锁特殊 |
| | | // deviceTypeList.Add(DeviceType.DoorLock); |
| | | } |
| | |
| | | Common.Logic.CurrentLogic.LogicIsCustomPushText = 0; |
| | | pushview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; |
| | | } |
| | | Send.Zj(LogicView.IfString.Tag, Common.Logic.CurrentLogic); |
| | | if (!Config.Instance.Home.IsVirtually) |
| | | { |
| | | Send.Zj(LogicView.IfString.Tag, Common.Logic.CurrentLogic); |
| | | |
| | | } |
| | | }; |
| | | |
| | | if (Common.Logic.CurrentLogic.LogicIsCustomPushText == 0) |
| | |
| | | bool succeed = false; |
| | | //判断是新添加逻辑(默认0)还是修改逻辑 |
| | | CommonPage.Loading.Start(); |
| | | if (CurrentLogic.LogicId == 0) |
| | | { |
| | | //发送添加逻辑命令 |
| | | var logicifon = await Send.AddModifyLogic(CurrentLogic); |
| | | if (logicifon != null && logicifon.LogicId != 0) |
| | | { |
| | | succeed = true; |
| | | CurrentLogic.LogicId = logicifon.LogicId; |
| | | if (LogicView.IfString._Logic == if_logic || LogicView.IfString._SoneLogic == if_logic) |
| | | { |
| | | //自动化逻辑列表 |
| | | Common.Logic.LogicList.Add(CurrentLogic); |
| | | } |
| | | if (LogicView.IfString._LockLogic == if_logic) |
| | | { |
| | | //门锁联动事件逻辑列表 |
| | | Common.Logic.LockLogicList.Add(CurrentLogic); |
| | | } |
| | | if (LogicView.IfString._SoneLogic == if_logic) |
| | | { |
| | | //Sone门锁联动事件逻辑列表 |
| | | Common.Logic.SoneLogicList.Add(CurrentLogic); |
| | | |
| | | } |
| | | if (tag) |
| | | { |
| | | Send.Zj(tag, CurrentLogic); |
| | | } |
| | | if (Config.Instance.Home.IsVirtually) |
| | | { |
| | | if (Common.Logic.LogicList.Count == 0) |
| | | { |
| | | CurrentLogic.LogicId = 1; |
| | | Common.Logic.LogicList.Add(CurrentLogic); |
| | | } |
| | | |
| | | if (CurrentLogic.LogicId == 0) |
| | | { |
| | | bool d = false; |
| | | for (int i = 1; i < 50; i++) |
| | | { |
| | | |
| | | for (int j = 0; j < Common.Logic.LogicList.Count; j++) |
| | | { |
| | | if (i != Common.Logic.LogicList[j].LogicId) |
| | | { |
| | | CurrentLogic.LogicId = i; |
| | | Common.Logic.LogicList.Add(CurrentLogic); |
| | | d = true; |
| | | break; |
| | | } |
| | | } |
| | | if (d) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | for (int j = 0; j < Common.Logic.LogicList.Count; j++) |
| | | { |
| | | if (CurrentLogic.LogicId == Common.Logic.LogicList[j].LogicId) |
| | | { |
| | | Common.Logic.LogicList.RemoveAt(j); |
| | | Common.Logic.LogicList.Insert(j,CurrentLogic); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | //自动化逻辑列表 |
| | | } |
| | | else |
| | | { |
| | | //发送修改逻辑命令; |
| | | //修改命令不需要等待回复; |
| | | Send.AddModifyLogic(CurrentLogic); |
| | | //编辑默认成功(不考虑网络情况); |
| | | succeed = true; |
| | | if (CurrentLogic.LogicId == 0) |
| | | { |
| | | //发送添加逻辑命令 |
| | | var logicifon = await Send.AddModifyLogic(CurrentLogic); |
| | | if (logicifon != null && logicifon.LogicId != 0) |
| | | { |
| | | succeed = true; |
| | | CurrentLogic.LogicId = logicifon.LogicId; |
| | | if (LogicView.IfString._Logic == if_logic || LogicView.IfString._SoneLogic == if_logic) |
| | | { |
| | | //自动化逻辑列表 |
| | | Common.Logic.LogicList.Add(CurrentLogic); |
| | | } |
| | | if (LogicView.IfString._LockLogic == if_logic) |
| | | { |
| | | //门锁联动事件逻辑列表 |
| | | Common.Logic.LockLogicList.Add(CurrentLogic); |
| | | } |
| | | if (LogicView.IfString._SoneLogic == if_logic) |
| | | { |
| | | //Sone门锁常开模式逻辑列表 |
| | | Common.Logic.SoneLogicList.Add(CurrentLogic); |
| | | |
| | | } |
| | | if (tag) |
| | | { |
| | | Send.Zj(tag, CurrentLogic); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //发送修改逻辑命令; |
| | | //修改命令不需要等待回复; |
| | | Send.AddModifyLogic(CurrentLogic); |
| | | //编辑默认成功(不考虑网络情况); |
| | | succeed = true; |
| | | } |
| | | } |
| | | CommonPage.Loading.Hide(); |
| | | |
| | |
| | | else if (LogicView.IfString._SoneLogic == if_logic) |
| | | { |
| | | //跳到Sone门锁联动事件列表界面 |
| | | UserView.HomePage.Instance.RemoveViewByTag("SoneLogic");//移除所有标记LockListView界面 |
| | | var soneLogicList = new SoneLogicList(); |
| | | UserView.HomePage.Instance.AddChidren(soneLogicList); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | soneLogicList.Show(); |
| | | //UserView.HomePage.Instance.RemoveViewByTag("SoneLogic");//移除所有标记LockListView界面 |
| | | //var soneLogicList = new SoneLogicList(); |
| | | //UserView.HomePage.Instance.AddChidren(soneLogicList); |
| | | //UserView.HomePage.Instance.PageIndex += 1; |
| | | //soneLogicList.Show(); |
| | | |
| | | SoneLogicList.soneLogicList?.RefreshView(); |
| | | } |
| | | |
| | | } |