From 9904031f5291daaf56985146bb671f25e18ebbdf Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 02 四月 2020 19:51:31 +0800 Subject: [PATCH] 最新代码 --- ZigbeeApp/Shared/Phone/Device/Logic/Method.cs | 90 +++++++++++++++++++++++++++++++++++---------- 1 files changed, 70 insertions(+), 20 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs index e0e8a72..3d3bdf5 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs @@ -97,40 +97,47 @@ { List<string> devicetypelist = new List<string>(); devicetypelist.Clear(); + var lightjosn = devicelist.Find((device) => device.Type == DeviceType.DimmableLight || device.Type == DeviceType.OnOffOutput); if (lightjosn != null) { devicetypelist.Add(Language.StringByID(MyInternationalizationString.Lights)); } - var iASZonejosn = devicelist.Find((device) => device.Type == DeviceType.IASZone || device.Type == DeviceType.TemperatureSensor); - if (iASZonejosn != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.sensor)); - } - var onOffSwitchjson = devicelist.Find((device) => device.Type == DeviceType.OnOffSwitch); - if (onOffSwitchjson != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.OnOffSwitch)); - } - var doorLock = devicelist.Find((device) => device.Type == DeviceType.DoorLock); - if (doorLock != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.doorLock)); - } + var curtainjosn = devicelist.Find((device) => device.Type == DeviceType.WindowCoveringDevice); if (curtainjosn != null) { devicetypelist.Add(Language.StringByID(MyInternationalizationString.Curtains)); } + var ac = devicelist.Find((device) => device.Type == DeviceType.Thermostat); if (ac != null) { devicetypelist.Add(Language.StringByID(MyInternationalizationString.AC)); } + + var onOffSwitchjson = devicelist.Find((device) => device.Type == DeviceType.OnOffSwitch); + if (onOffSwitchjson != null) + { + devicetypelist.Add(Language.StringByID(MyInternationalizationString.OnOffSwitch)); + } + + var doorLock = devicelist.Find((device) => device.Type == DeviceType.DoorLock); + if (doorLock != null) + { + devicetypelist.Add(Language.StringByID(MyInternationalizationString.doorLock)); + } + var airSwitch = devicelist.Find((device) => device.Type == DeviceType.AirSwitch); if (airSwitch != null) { devicetypelist.Add(Language.StringByID(MyInternationalizationString.Airswitch)); + } + + var iASZonejosn = devicelist.Find((device) => device.Type == DeviceType.IASZone || device.Type == DeviceType.TemperatureSensor); + if (iASZonejosn != null) + { + devicetypelist.Add(Language.StringByID(MyInternationalizationString.sensor)); } return devicetypelist; @@ -334,7 +341,7 @@ deviceTypeList.Add(DeviceType.Thermostat); deviceTypeList.Add(DeviceType.AirSwitch); ///闂ㄩ攣鐗规畩 - deviceTypeList.Add(DeviceType.DoorLock); + // deviceTypeList.Add(DeviceType.DoorLock); } break; case "condition_mould": @@ -356,7 +363,7 @@ deviceTypeList.Add(DeviceType.Thermostat); deviceTypeList.Add(DeviceType.AirSwitch); ///闂ㄩ攣鐗规畩 - deviceTypeList.Add(DeviceType.DoorLock); + // deviceTypeList.Add(DeviceType.DoorLock); } break; @@ -654,6 +661,7 @@ custompushview.iconBtn.Visible = true; custompushview.iconBtn.UnSelectedImagePath = "ZigeeLogic/next.png"; custompushview.titleBtn.TextID = MyInternationalizationString.custompush; + custompushview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; middle.AddChidren(custompushview.AddDeviceView()); EventHandler<MouseEventArgs> customclick = (sender, e) => @@ -674,6 +682,7 @@ LogicView.IfString.Tag = true; custompushview.frameLayout.Height = Application.GetRealHeight(160); Common.Logic.CurrentLogic.LogicIsCustomPushText = 1; + pushview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor; } else @@ -681,6 +690,7 @@ LogicView.IfString.Tag = false; custompushview.frameLayout.Height = Application.GetRealHeight(0); Common.Logic.CurrentLogic.LogicIsCustomPushText = 0; + pushview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; } Send.Zj(LogicView.IfString.Tag, Common.Logic.CurrentLogic); }; @@ -690,12 +700,14 @@ LogicView.IfString.Tag = false; pushview.switchBtn.IsSelected = false; custompushview.frameLayout.Height = Application.GetRealHeight(0); + pushview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; } else { LogicView.IfString.Tag = true; pushview.switchBtn.IsSelected = true; custompushview.frameLayout.Height = Application.GetRealHeight(160); + pushview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor; } } /// <summary> @@ -707,6 +719,16 @@ /// <param name="CurrentLogic">褰撳墠閫昏緫</param> public async static void SaveLogic(string if_logic, string name, bool tag, Common.Logic CurrentLogic) { + + if (CurrentLogic.Conditions.Count == 0 || CurrentLogic.Actions.Count == 0) + { + var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, + Language.StringByID(MyInternationalizationString.addnull), + Language.StringByID(MyInternationalizationString.confrim)); + alert.Show(); + return; + } + if (string.IsNullOrEmpty(name)) { var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, @@ -735,7 +757,17 @@ { succeed = true; CurrentLogic.LogicId = logicifon.LogicId; - Common.Logic.LogicList.Add(CurrentLogic); + if (LogicView.IfString._LockLogic == if_logic) + { + //闂ㄩ攣鑱斿姩浜嬩欢閫昏緫鍒楄〃 + Common.Logic.LockLogicList.Add(CurrentLogic); + } + else + { + //鑷姩鍖栭�昏緫鍒楄〃 + Common.Logic.LogicList.Add(CurrentLogic); + + } if (tag) { Send.Zj(tag, CurrentLogic); @@ -760,13 +792,29 @@ //TipView("娣诲姞鑷姩鍖栧け璐�"); //return; } - UserView.HomePage.Instance.RemoveViewByTag("Logic"); + + if (LogicView.IfString._Logic == if_logic) { - Category.Category.instance?.RefreshBodyView(); + UserView.HomePage.Instance.RemoveViewByTag("Logic"); + if (CurrentLogic.LogicType == 0) + { + //鍙埛鏂板垎绫讳笂涓嬫粦鍔╲iew锛� + Phone.Category.CategoryMainForm.instance?.RefreshBodyView(); + // Category.Category.instance?.RefreshBodyView(); + } + else if (CurrentLogic.LogicType == 2) + { + //鍒锋柊鏁翠釜鍒嗙被锛� + //闂ㄩ攣甯稿紑妯″紡鐗规畩; + UserView.UserPage.Instance.ShowCategoryAutoListForm(); + + } } else if (LogicView.IfString._LockLogic == if_logic) { + UserView.HomePage.Instance.RemoveViewByTag("Logic");//绉婚櫎鎵�鏈夋爣璁癓ogic鐣岄潰 + UserView.HomePage.Instance.RemoveViewByTag("LockListView");//绉婚櫎鎵�鏈夋爣璁癓ockListView鐣岄潰 var doorLockLogicList = new DoorLockLogic.LockLogicList(); UserView.HomePage.Instance.AddChidren(doorLockLogicList); UserView.HomePage.Instance.PageIndex += 1; @@ -786,5 +834,7 @@ UserView.HomePage.Instance.PageIndex += 1; deviceTarget.Show(str1, str2); } + + } } -- Gitblit v1.8.0