| | |
| | | Common.Logic.CurrentLogic.LogicName = logicName; |
| | | if (Common.Logic.CurrentLogic.Conditions.Count == 1) |
| | | { |
| | | ConditionView(false, frameLayout); |
| | | ConditionView(false, frameLayout,null); |
| | | } |
| | | else |
| | | { |
| | |
| | | break; |
| | | case DeviceType.TemperatureSensor: |
| | | { |
| | | // conditionIcon.UnSelectedImagePath = "ZigeeLogic/temperature.png"; |
| | | var dev = deviceinof as TemperatureSensor; |
| | | if (conditions["Cluster_ID"] == "1026") |
| | | //获取设备类型 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { deviceinof }); |
| | | if (deviceEnumInfo==null) { |
| | | continue; |
| | | } |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | dev.SensorDiv = 1; |
| | | icon = "ZigeeLogic/airquality.png"; |
| | | string s = ""; |
| | | switch (conditions["Range"]) |
| | | { |
| | | case "0": |
| | | { |
| | | s = ">"; |
| | | } |
| | | break; |
| | | case "1": |
| | | { |
| | | s = "="; |
| | | } |
| | | break; |
| | | case "2": |
| | | { |
| | | s = "<"; |
| | | } |
| | | break; |
| | | case "6": |
| | | { |
| | | s = "≥"; |
| | | } |
| | | break; |
| | | case "7": |
| | | { |
| | | s = "≤"; |
| | | } |
| | | break; |
| | | } |
| | | switch (conditions["Cluster_ID"]) { |
| | | case "1066": { |
| | | if (conditions["AttriButeId"] =="57344") { |
| | | if (conditions["AttriButeData1"] == "1") |
| | | { |
| | | state = Language.StringByID(MyInternationalizationString.you); |
| | | } |
| | | else if (conditions["AttriButeData1"] == "2") |
| | | { |
| | | state = Language.StringByID(MyInternationalizationString.liang); |
| | | } |
| | | else { |
| | | state = Language.StringByID(MyInternationalizationString.cha); |
| | | } |
| | | state = Language.StringByID(MyInternationalizationString.kongqizhiliang) + state; |
| | | } else { |
| | | ///Pm2.5 |
| | | int intValue = int.Parse(conditions["AttriButeData1"]); |
| | | if (0< intValue&& intValue<30) { |
| | | state = Language.StringByID(MyInternationalizationString.pmyou); |
| | | } |
| | | else if (36 < intValue && intValue < 75) { |
| | | state = Language.StringByID(MyInternationalizationString.pmliang); |
| | | } |
| | | else if (76 < intValue && intValue < 115) { |
| | | state = Language.StringByID(MyInternationalizationString.pmqingdu); |
| | | } |
| | | else if (intValue >115) { |
| | | state = Language.StringByID(MyInternationalizationString.pmzhongdu); |
| | | } |
| | | state = Language.StringByID(MyInternationalizationString.pm25) + state; |
| | | } |
| | | }break; |
| | | case "1037": |
| | | { |
| | | ///co2 |
| | | int intValue = int.Parse(conditions["AttriButeData1"]); |
| | | if (0 < intValue && intValue < 1000) |
| | | { |
| | | state = Language.StringByID(MyInternationalizationString.co2qingxin); |
| | | } |
| | | else if (1000 < intValue && intValue < 2000) |
| | | { |
| | | state = Language.StringByID(MyInternationalizationString.co2huizhuo); |
| | | } |
| | | else if (2000 < intValue && intValue < 5000) |
| | | { |
| | | state = Language.StringByID(MyInternationalizationString.co2queyang); |
| | | } |
| | | else if (intValue > 5000) |
| | | { |
| | | state = Language.StringByID(MyInternationalizationString.co2yanzhongqueyang); |
| | | } |
| | | state = Language.StringByID(MyInternationalizationString.co2) + state; |
| | | } |
| | | break; |
| | | case "1026": { |
| | | ///转换温度值/100 |
| | | string srtValue = (int.Parse(conditions["AttriButeData1"]) / 100).ToString(); |
| | | state = s + srtValue + "℃"; |
| | | } break; |
| | | case "1029": { |
| | | ///转换温度值/100 |
| | | string srtValue = (int.Parse(conditions["AttriButeData1"]) / 100).ToString(); |
| | | state = s + srtValue + "%"; |
| | | } break; |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | dev.SensorDiv = 2; |
| | | } |
| | | string s = ""; |
| | | switch (conditions["Range"]) |
| | | { |
| | | case "0": |
| | | { |
| | | s = ">"; |
| | | } |
| | | break; |
| | | case "1": |
| | | { |
| | | s = "="; |
| | | } |
| | | break; |
| | | case "2": |
| | | { |
| | | s = "<"; |
| | | } |
| | | break; |
| | | case "6": |
| | | { |
| | | s = "≥"; |
| | | } |
| | | break; |
| | | case "7": |
| | | { |
| | | s = "≤"; |
| | | } |
| | | break; |
| | | } |
| | | ///转换温度值/100 |
| | | string srtValue = (int.Parse(conditions["AttriButeData1"]) / 100).ToString(); |
| | | if (conditions["Cluster_ID"] == "1026") |
| | | { |
| | | icon = "ZigeeLogic/temperature.png"; |
| | | state = s + srtValue + "℃"; |
| | | } |
| | | else |
| | | { |
| | | icon = "ZigeeLogic/humidity.png"; |
| | | state = s + srtValue + "%"; |
| | | |
| | | var dev = deviceinof as TemperatureSensor; |
| | | if (conditions["Cluster_ID"] == "1026") |
| | | { |
| | | dev.SensorDiv = 1; |
| | | } |
| | | else |
| | | { |
| | | dev.SensorDiv = 2; |
| | | } |
| | | string s = ""; |
| | | switch (conditions["Range"]) |
| | | { |
| | | case "0": |
| | | { |
| | | s = ">"; |
| | | } |
| | | break; |
| | | case "1": |
| | | { |
| | | s = "="; |
| | | } |
| | | break; |
| | | case "2": |
| | | { |
| | | s = "<"; |
| | | } |
| | | break; |
| | | case "6": |
| | | { |
| | | s = "≥"; |
| | | } |
| | | break; |
| | | case "7": |
| | | { |
| | | s = "≤"; |
| | | } |
| | | break; |
| | | } |
| | | ///转换温度值/100 |
| | | string srtValue = (int.Parse(conditions["AttriButeData1"]) / 100).ToString(); |
| | | if (conditions["Cluster_ID"] == "1026") |
| | | { |
| | | icon = "ZigeeLogic/temperature.png"; |
| | | state = s + srtValue + "℃"; |
| | | } |
| | | else |
| | | { |
| | | icon = "ZigeeLogic/humidity.png"; |
| | | state = s + srtValue + "%"; |
| | | } |
| | | } |
| | | break; |
| | | |
| | |
| | | selecteddevice.selecetddevicestateBtn.Text = state; |
| | | } |
| | | ///编辑 |
| | | selecteddevice.edit.Tag = i.ToString(); |
| | | selecteddevice.edit.Tag = conditions; |
| | | selecteddevice.edit.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var dic = selecteddevice.edit.Tag as Dictionary<string, string>; |
| | | int isInt = 0; |
| | | if (dic != null) |
| | | { |
| | | //之前标记索引值,一旦删除数据索引值会发生改变; |
| | | //找到数据在列表里最新索引,并且更新索引值 |
| | | isInt = Common.Logic.CurrentLogic.Conditions.IndexOf(dic); |
| | | } |
| | | switch (Type) |
| | | { |
| | | |
| | |
| | | UserView.HomePage.Instance.AddChidren(timePoint); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | timePoint.IsEditor = true; |
| | | timePoint.Show(conditions); |
| | | timePoint.Show(dic); |
| | | } |
| | | break; |
| | | case 5: |
| | |
| | | { |
| | | var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; |
| | | frameLayout.AddChidren(flMain); |
| | | CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "condition_logic",int.Parse(selecteddevice.edit.Tag.ToString())); |
| | | CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "condition_logic", isInt); |
| | | } |
| | | else |
| | | { |
| | |
| | | UserView.HomePage.Instance.AddChidren(memberList); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | MemberList.edit = true; |
| | | memberList.Show(deviceinof, conditions); |
| | | memberList.Show(deviceinof, dic); |
| | | } |
| | | } |
| | | break; |
| | | case 6: |
| | | { |
| | | var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; |
| | | frameLayout.AddChidren(flMain); |
| | | AddLogicPage.SecurityView(flMain, true); |
| | | |
| | | AddLogicPage.SecurityView(frameLayout, true); |
| | | } |
| | | break; |
| | | case 7: |
| | | { |
| | | var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; |
| | | frameLayout.AddChidren(flMain); |
| | | AddLogicPage.LocationView(flMain, true); |
| | | |
| | | AddLogicPage.LocationView(frameLayout, true); |
| | | } |
| | | break; |
| | | } |
| | |
| | | { |
| | | state = seconds.ToString() + Language.StringByID(MyInternationalizationString.second); |
| | | } |
| | | //记录延时; |
| | | actiondevice.edit.Tag = i; |
| | | |
| | | }; |
| | | break; |
| | | } |
| | |
| | | actiondevice.selecetddevicestateBtn.Text = state; |
| | | } |
| | | ///编辑 |
| | | actiondevice.edit.Tag = i.ToString(); |
| | | //记录; |
| | | actiondevice.edit.Tag = actions; |
| | | actiondevice.edit.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var dic = actiondevice.edit.Tag as Dictionary<string, object>; |
| | | int isInt = 0; |
| | | if (dic != null) |
| | | { |
| | | //之前标记索引值,一旦删除数据索引值会发生改变; |
| | | //找到数据在列表里最新索引,并且更新索引值 |
| | | isInt = Common.Logic.CurrentLogic.Actions.IndexOf(dic); |
| | | } |
| | | switch (linkType) |
| | | { |
| | | case 8: |
| | |
| | | var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString()); |
| | | var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; |
| | | frameLayout.AddChidren(flMain); |
| | | CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_logic", int.Parse(actiondevice.edit.Tag.ToString())); |
| | | CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_logic", isInt); |
| | | } |
| | | break; |
| | | case 6: |
| | |
| | | break; |
| | | case 7: |
| | | { |
| | | |
| | | var delayTime = new DelayTime(); |
| | | UserView.HomePage.Instance.AddChidren(delayTime); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | delayTime.Show(int.Parse(actiondevice.edit.Tag.ToString()), true); |
| | | delayTime.Show(isInt, true); |
| | | } |
| | | break; |
| | | |
| | |
| | | /// <summary> |
| | | /// 与或条件布局界面的方法 |
| | | /// </summary> |
| | | /// <param name="edit"></param> |
| | | /// <param name="frameLayout"></param> |
| | | public void ConditionView(bool edit, FrameLayout frameLayout) |
| | | /// <param name="edit">表示是否编辑</param> |
| | | /// <param name="frameLayout">显示在哪个界面</param> |
| | | /// <param name="button">显示选中文本</param> |
| | | public void ConditionView(bool edit, FrameLayout frameLayout,Button button) |
| | | { |
| | | |
| | | #region ------组合条件界面布局部分 |
| | | var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor }; |
| | | frameLayout.AddChidren(flMain); |
| | | CompleteView completeView = new CompleteView(); |
| | | flMain.AddChidren(completeView.Show(2)); |
| | | completeView.Btntitle.TextID = MyInternationalizationString.condition; |
| | | EventHandler<MouseEventArgs> clickcancel = (sender, e) => |
| | | { |
| | | UserView.HomePage.Instance.ScrollEnabled = true; |
| | | flMain.RemoveFromParent(); |
| | | }; |
| | | flMain.MouseUpEventHandler += clickcancel; |
| | | completeView.Btncancel.MouseUpEventHandler += clickcancel; |
| | | |
| | | //满足所有条件 |
| | | 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 |
| | | |
| | | ///满足所有条件点击事件 |
| | | allFunView.clickviewBtn.MouseUpEventHandler += (sedner, e) => |
| | | { |
| | | allFunView.selectedIconBtn.Visible = true; |
| | | ormFunview.selectedIconBtn.Visible = false; |
| | | allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; |
| | | }; |
| | | ///满足其中一个条件点击事件 |
| | | ormFunview.clickviewBtn.MouseUpEventHandler += (sedner, e) => |
| | | { |
| | | allFunView.selectedIconBtn.Visible = false; |
| | | ormFunview.selectedIconBtn.Visible = true; |
| | | allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; |
| | | ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | }; |
| | | |
| | | |
| | | string stateText = ""; |
| | | if (edit) |
| | | { |
| | | if (Common.Logic.CurrentLogic.Relationship == 0) |
| | | { |
| | | allFunView.selectedIconBtn.Visible = true; |
| | | ormFunview.selectedIconBtn.Visible = false; |
| | | allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; |
| | | } |
| | | else |
| | | { |
| | | allFunView.selectedIconBtn.Visible = false; |
| | | ormFunview.selectedIconBtn.Visible = true; |
| | | allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; |
| | | ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | } |
| | | } |
| | | completeView.Btncomplete.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (!allFunView.selectedIconBtn.Visible && !ormFunview.selectedIconBtn.Visible) |
| | | { |
| | | ///可以提示未选中状态; |
| | | return; |
| | | } |
| | | flMain.RemoveFromParent(); |
| | | |
| | | if (allFunView.selectedIconBtn.Visible) |
| | | switch (Common.Logic.CurrentLogic.Relationship) |
| | | { |
| | | case 0: |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.Allconditions); |
| | | } |
| | | break; |
| | | case 1: |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.anycondition); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | } |
| | | |
| | | PublicInterface publicInterface = new PublicInterface(); |
| | | var list = publicInterface.GetViewList("组合条件"); |
| | | publicInterface.SingleSelectionShow(frameLayout, list, MyInternationalizationString.condition, stateText, (str) => |
| | | { |
| | | //显示选中文本 |
| | | if (button!=null) { |
| | | button.Text = Language.StringByID(MyInternationalizationString.followingconditions)+ str; |
| | | } |
| | | if (str == Language.StringByID(MyInternationalizationString.Allconditions)) |
| | | { |
| | | Common.Logic.CurrentLogic.Relationship = 0; |
| | | |
| | | } |
| | | if (ormFunview.selectedIconBtn.Visible) |
| | | else if (str == Language.StringByID(MyInternationalizationString.anycondition)) |
| | | { |
| | | Common.Logic.CurrentLogic.Relationship = 1; |
| | | |
| | | Common.Logic.CurrentLogic.Relationship = 1; |
| | | } |
| | | if (edit) |
| | | { |
| | |
| | | { |
| | | Send.LogicControlSwitch(Common.Logic.CurrentLogic); |
| | | } |
| | | var logicCommunalPage = new LogicCommunalPage(); |
| | | UserView.HomePage.Instance.AddChidren(logicCommunalPage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | logicCommunalPage.Show(() => { }); |
| | | } |
| | | else |
| | | { |
| | |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | addLogicPage.Show(); |
| | | } |
| | | }; |
| | | |
| | | }); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |