| | |
| | | 5415=栋 |
| | | 5416=单元 |
| | | 5417=室外机 |
| | | 5418=空气质量传感器 |
| | | 5419=PM2.5浓度 |
| | | 5420=温度 |
| | | 5421=湿度 |
| | | 5422=CO² |
| | | 5423=优 |
| | | 5424=良 |
| | | 5425=差 |
| | | 5426=优(0~35ug/m³) |
| | | 5427=良(36~75ug/m³) |
| | | 5428=轻度污染(76~115ug/m³) |
| | | 5429=重度污染(>115ug/m³) |
| | | 5430=空气清新(0~1000ppm) |
| | | 5431=空气浑浊(1000~2000ppm) |
| | | 5432=空气缺氧(2000~5000ppm) |
| | | 5433=严重缺氧(>5000ppm) |
| | | 5434=空气质量 |
| | | |
| | | |
| | | |
| | | |
| | |
| | | <ItemGroup>
|
| | | <AndroidAsset Include="Assets\Phone\AirQualitySensor\lightOn.png" />
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <AndroidAsset Include="Assets\Phone\ZigeeLogic\airquality.png" />
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <AndroidAsset Include="Assets\Phone\ZigeeLogic\airqualityselected.png" />
|
| | | </ItemGroup>
|
| | | <Import Project="..\Shared\Shared.projitems" Label="Shared" Condition="Exists('..\Shared\Shared.projitems')" />
|
| | | <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
| | | <Import Project="..\packages\Xamarin.Android.Support.Annotations.26.0.2\build\MonoAndroid80\Xamarin.Android.Support.Annotations.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Annotations.26.0.2\build\MonoAndroid80\Xamarin.Android.Support.Annotations.targets')" />
|
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.evoyo.home" android:versionCode="0120123101" android:installLocation="auto" android:versionName="1.1.0120123101"> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.evoyo.home" android:versionCode="0121010601" android:installLocation="auto" android:versionName="1.1.0121010601"> |
| | | <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="26" /> |
| | | <permission android:name="com.evoyo.home.permission.JPUSH_MESSAGE" android:protectionLevel="signature" /> |
| | | <uses-permission android:name="android.permission.WAKE_LOCK" /> |
| | |
| | | /// <summary> |
| | | /// 版本号 |
| | | /// </summary> |
| | | public static string CodeIDString = "1.1.0120123101"; |
| | | public static string CodeIDString = "1.1.0121010601"; |
| | | /// <summary> |
| | | /// 注册来源(0:HDL On 1:Zigbee) |
| | | /// </summary> |
| | |
| | | if (level == 0)
|
| | | {
|
| | | //如果当前是打开状态,并且亮度为0的话,则需要变成100%亮度
|
| | | i_device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, i_device, new object[] { 254 });
|
| | | i_device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, i_device, new object[] { 255 });
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | if (level == 0)
|
| | | {
|
| | | //如果当前是打开状态,并且亮度为0的话,则需要变成100%亮度
|
| | | i_device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, i_device, new object[] { 254 });
|
| | | i_device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, i_device, new object[] { 255 });
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | break; |
| | | case DeviceType.IASZone: |
| | |
| | | break; |
| | | case DeviceType.TemperatureSensor: |
| | | { |
| | | //编辑时的状态值 |
| | | string str1 = ""; |
| | | string str2 = ""; |
| | | if (edit && devices != null) |
| | | { |
| | | //温度值 |
| | | str1 = devices["AttriButeData1"]; |
| | | //比较关系值 |
| | | str2 = devices["Range"]; |
| | | |
| | | } |
| | | var temperatureSensor = common as TemperatureSensor; |
| | | if (temperatureSensor.SensorDiv == 1) |
| | | //获取设备类型 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { common }); |
| | | |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | Send.dictionary(deviceConditionsInfo, "Cluster_ID", "1026"); |
| | | AirSonser(flMain, SelectedDeviceStatus, edit, common, devices); |
| | | } |
| | | else |
| | | { |
| | | Send.dictionary(deviceConditionsInfo, "Cluster_ID", "1029"); |
| | | } |
| | | Send.dictionary(deviceConditionsInfo, "AttriButeId", "0"); |
| | | Send.dictionary(deviceConditionsInfo, "AttriButeData2", "0"); |
| | | completeView.Show(4); |
| | | PublicInterface publicInterface = new PublicInterface(); |
| | | publicInterface.TemperatureShow(completeView.fraView, common, str2, str1, (relationValueStr, tempValueStr) => |
| | | { |
| | | SelectedDeviceStatus = "TemperatureSensor"; |
| | | Send.dictionary(deviceConditionsInfo, "AttriButeData1", tempValueStr); |
| | | Send.dictionary(deviceConditionsInfo, "Range", relationValueStr); |
| | | }); |
| | | |
| | | |
| | | //编辑时的状态值 |
| | | string str1 = ""; |
| | | string str2 = ""; |
| | | string str3 = ""; |
| | | if (edit && devices != null) |
| | | { |
| | | //温度值 |
| | | str1 = devices["AttriButeData1"]; |
| | | //比较关系值 |
| | | str2 = devices["Range"]; |
| | | |
| | | } |
| | | var temperatureSensor = common as TemperatureSensor; |
| | | if (temperatureSensor.SensorDiv == 1) |
| | | { |
| | | str3 = "℃"; |
| | | Send.dictionary(deviceConditionsInfo, "Cluster_ID", "1026"); |
| | | } |
| | | else |
| | | { |
| | | str3 = "%"; |
| | | Send.dictionary(deviceConditionsInfo, "Cluster_ID", "1029"); |
| | | } |
| | | Send.dictionary(deviceConditionsInfo, "AttriButeId", "0"); |
| | | Send.dictionary(deviceConditionsInfo, "AttriButeData2", "0"); |
| | | completeView.Show(4); |
| | | PublicInterface publicInterface = new PublicInterface(); |
| | | publicInterface.TemperatureShow(completeView.fraView, str3, str2, str1, (relationValueStr, tempValueStr) => |
| | | { |
| | | SelectedDeviceStatus = "TemperatureSensor"; |
| | | Send.dictionary(deviceConditionsInfo, "AttriButeData1", tempValueStr); |
| | | Send.dictionary(deviceConditionsInfo, "Range", relationValueStr); |
| | | }); |
| | | } |
| | | } |
| | | break; |
| | | ///调光灯光 |
| | |
| | | var lightbrightnessvalue = (254 * horizontalSeekBarVol.Progress) / 100; |
| | | Send.dictionary(switchdictionary, "Data1", lightbrightnessvalue.ToString()); |
| | | }; |
| | | |
| | | ///取消事件 |
| | | closeView.clickviewBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | Send.dictionary(switchdictionary, "TaskType", "1"); |
| | | Send.dictionary(switchdictionary, "Data1", "0");//默认值 |
| | | }; |
| | | |
| | | //取反 |
| | | takebackView.clickviewBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | |
| | | } |
| | | break; |
| | | |
| | | |
| | | } |
| | | completeView.Btncomplete.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | |
| | | }; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// <summary> |
| | | /// 空调模式的状态 |
| | | /// </summary> |
| | | /// <param name="modestring"></param> |
| | |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 空气质量传感器View(特殊处理) |
| | | /// </summary> |
| | | /// <param name="flMain"></param> |
| | | /// <param name="SelectedDeviceStatus"></param> |
| | | /// <param name="edit"></param> |
| | | /// <param name="common"></param> |
| | | /// <param name="dic"></param> |
| | | private static void AirSonser(FrameLayout flMain,string SelectedDeviceStatus,bool edit,CommonDevice common, Dictionary<string, string> dic=null) { |
| | | flMain.RemoveAll(); |
| | | if (edit&&dic!=null) { |
| | | AirProperty(flMain, dic, common,"", edit, SelectedDeviceStatus); |
| | | } |
| | | else |
| | | { |
| | | PublicInterface publicInterface = new PublicInterface(); |
| | | var list0 = publicInterface.GetViewList("空气质量传感器"); |
| | | publicInterface.SingleSelectionShow(flMain, list0, MyInternationalizationString.airqualitysensor, "", (tagText) => |
| | | { |
| | | flMain.RemoveAll(); |
| | | SelectedDeviceStatus = "TemperatureSensor"; |
| | | AirProperty(flMain, dic, common,tagText, edit, SelectedDeviceStatus); |
| | | }, () => { flMain.RemoveFromParent(); }); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 空气质量传感器属性值(特殊处理) |
| | | /// </summary> |
| | | /// <param name="flMain"></param> |
| | | /// <param name="dic"></param> |
| | | /// <param name="common"></param> |
| | | /// <param name="tagText"></param> |
| | | /// <param name="edit"></param> |
| | | /// <param name="SelectedDeviceStatus"></param> |
| | | private static void AirProperty(FrameLayout flMain, Dictionary<string, string> dic,CommonDevice common,string tagText,bool edit, string SelectedDeviceStatus) { |
| | | PublicInterface publicInterface = new PublicInterface(); |
| | | string range = ""; |
| | | string stateText = ""; |
| | | if (edit&& dic!=null) |
| | | { |
| | | range = dic["Range"]; |
| | | switch (dic["Cluster_ID"]) |
| | | { |
| | | case "1066": |
| | | { |
| | | if (dic["AttriButeId"] == "57344") |
| | | { |
| | | tagText = Language.StringByID(MyInternationalizationString.kongqizhiliang); |
| | | switch (dic["AttriButeData1"]) |
| | | { |
| | | |
| | | case "1": |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.you); |
| | | } |
| | | break; |
| | | case "2": |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.liang); |
| | | } |
| | | break; |
| | | case "3": |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.cha); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | tagText = Language.StringByID(MyInternationalizationString.pm25); |
| | | ///Pm2.5 |
| | | int intValue = int.Parse(dic["AttriButeData1"]); |
| | | if (0 < intValue && intValue < 30) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.pmyou); |
| | | } |
| | | else if (36 < intValue && intValue < 75) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.pmliang); |
| | | } |
| | | else if (76 < intValue && intValue < 115) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.pmqingdu); |
| | | } |
| | | else if (intValue > 115) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.pmzhongdu); |
| | | } |
| | | |
| | | } |
| | | } |
| | | break; |
| | | case "1037": |
| | | { |
| | | tagText = Language.StringByID(MyInternationalizationString.co2); |
| | | ///co2 |
| | | int intValue = int.Parse(dic["AttriButeData1"]); |
| | | if (0 < intValue && intValue < 1000) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.co2qingxin); |
| | | } |
| | | else if (1000 < intValue && intValue < 2000) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.co2huizhuo); |
| | | } |
| | | else if (2000 < intValue && intValue < 5000) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.co2queyang); |
| | | } |
| | | else if (intValue > 5000) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.co2yanzhongqueyang); |
| | | } |
| | | } |
| | | break; |
| | | case "1026": |
| | | { |
| | | tagText = Language.StringByID(MyInternationalizationString.sensortemperature); |
| | | stateText = dic["AttriButeData1"]; |
| | | } |
| | | break; |
| | | case "1029": |
| | | { |
| | | tagText = Language.StringByID(MyInternationalizationString.sensorhumidity); |
| | | stateText = dic["AttriButeData1"]; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | Dictionary<string, string> airqualitysensorDic = new Dictionary<string, string>(); |
| | | Send.dictionary(airqualitysensorDic, "Type", "1"); |
| | | Send.dictionary(airqualitysensorDic, "IsValid", "1"); |
| | | Send.dictionary(airqualitysensorDic, "MacAddr", common.DeviceAddr); |
| | | Send.dictionary(airqualitysensorDic, "Epoint", common.DeviceEpoint.ToString()); |
| | | if (tagText == Language.StringByID(MyInternationalizationString.kongqizhiliang)) |
| | | { |
| | | |
| | | var list1 = publicInterface.GetViewList("空气质量"); |
| | | publicInterface.SingleSelectionShow(flMain, list1, MyInternationalizationString.airqualitysensor, stateText, (strText) => |
| | | { |
| | | SelectedDeviceStatus = "TemperatureSensor"; |
| | | string valuaStr = ""; |
| | | if (strText == Language.StringByID(MyInternationalizationString.you)) |
| | | { |
| | | valuaStr = "1"; |
| | | } |
| | | else if (strText == Language.StringByID(MyInternationalizationString.liang)) |
| | | { |
| | | valuaStr = "2"; |
| | | } |
| | | else if (strText == Language.StringByID(MyInternationalizationString.cha)) |
| | | { |
| | | valuaStr = "3"; |
| | | } |
| | | Send.dictionary(airqualitysensorDic, "Cluster_ID", "1066"); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeId", "57344"); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData1", valuaStr); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData2", "0"); |
| | | Send.dictionary(airqualitysensorDic, "Range", "1"); |
| | | AddDic(flMain, SelectedDeviceStatus, edit, common, airqualitysensorDic); |
| | | |
| | | |
| | | }, () => { |
| | | if (edit) { flMain.RemoveFromParent(); } |
| | | else |
| | | { |
| | | AirSonser(flMain, SelectedDeviceStatus, edit, common); |
| | | } }); |
| | | |
| | | } |
| | | else if (tagText == Language.StringByID(MyInternationalizationString.pm25)) |
| | | { |
| | | var list2 = publicInterface.GetViewList("pm2.5"); |
| | | publicInterface.SingleSelectionShow(flMain, list2, MyInternationalizationString.pm25, stateText, (strText) => |
| | | { |
| | | SelectedDeviceStatus = "TemperatureSensor"; |
| | | string valuaStr = ""; |
| | | if (strText == Language.StringByID(MyInternationalizationString.pmyou)) |
| | | { |
| | | valuaStr = "18"; |
| | | } |
| | | else if (strText == Language.StringByID(MyInternationalizationString.pmliang)) |
| | | { |
| | | valuaStr = "54"; |
| | | } |
| | | else if (strText == Language.StringByID(MyInternationalizationString.pmqingdu)) |
| | | { |
| | | valuaStr = "105"; |
| | | } |
| | | else if (strText == Language.StringByID(MyInternationalizationString.pmzhongdu)) |
| | | { |
| | | valuaStr = "130"; |
| | | } |
| | | Send.dictionary(airqualitysensorDic, "Cluster_ID", "1066"); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeId", "0"); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData1", valuaStr); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData2", "0"); |
| | | Send.dictionary(airqualitysensorDic, "Range", "1"); |
| | | AddDic(flMain, SelectedDeviceStatus, edit, common, airqualitysensorDic); |
| | | |
| | | |
| | | }, () => { |
| | | if (edit) { flMain.RemoveFromParent(); } |
| | | else |
| | | { |
| | | AirSonser(flMain, SelectedDeviceStatus, edit, common); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | else if (tagText == Language.StringByID(MyInternationalizationString.co2)) |
| | | { |
| | | |
| | | var list2 = publicInterface.GetViewList("co2"); |
| | | publicInterface.SingleSelectionShow(flMain, list2, MyInternationalizationString.co2, stateText, (strText) => |
| | | { |
| | | SelectedDeviceStatus = "TemperatureSensor"; |
| | | string valuaStr = ""; |
| | | if (strText == Language.StringByID(MyInternationalizationString.co2qingxin)) |
| | | { |
| | | valuaStr = "500"; |
| | | } |
| | | else if (strText == Language.StringByID(MyInternationalizationString.co2huizhuo)) |
| | | { |
| | | valuaStr = "1500"; |
| | | } |
| | | else if (strText == Language.StringByID(MyInternationalizationString.co2queyang)) |
| | | { |
| | | valuaStr = "2500"; |
| | | } |
| | | else if (strText == Language.StringByID(MyInternationalizationString.co2yanzhongqueyang)) |
| | | { |
| | | valuaStr = "5500"; |
| | | } |
| | | Send.dictionary(airqualitysensorDic, "Cluster_ID", "1037"); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeId", "0"); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData1", valuaStr); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData2", "0"); |
| | | Send.dictionary(airqualitysensorDic, "Range", "1"); |
| | | AddDic(flMain, SelectedDeviceStatus, edit, common, airqualitysensorDic); |
| | | |
| | | |
| | | }, () => { |
| | | if (edit) { flMain.RemoveFromParent(); } |
| | | else |
| | | { |
| | | AirSonser(flMain, SelectedDeviceStatus, edit, common); |
| | | } |
| | | }); |
| | | |
| | | |
| | | |
| | | } |
| | | else if (tagText == Language.StringByID(MyInternationalizationString.sensortemperature)) |
| | | { |
| | | //编辑时的状态值 |
| | | string str1 = range; |
| | | string str2 = stateText; |
| | | publicInterface.TemperatureShow1(flMain, tagText, "℃", str1, str2, (relationValueStr, tempValueStr) => |
| | | { |
| | | |
| | | SelectedDeviceStatus = "TemperatureSensor"; |
| | | Send.dictionary(airqualitysensorDic, "Cluster_ID", "1026"); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeId", "0"); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData1", tempValueStr); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData2", "0"); |
| | | Send.dictionary(airqualitysensorDic, "Range", relationValueStr); |
| | | AddDic(flMain, SelectedDeviceStatus, edit, common, airqualitysensorDic); |
| | | |
| | | |
| | | }, () => |
| | | { |
| | | if (edit) { flMain.RemoveFromParent(); } |
| | | else |
| | | { |
| | | AirSonser(flMain, SelectedDeviceStatus, edit, common); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | else if (tagText == Language.StringByID(MyInternationalizationString.sensorhumidity)) |
| | | { |
| | | //编辑时的状态值 |
| | | string str1 = range; |
| | | string str2 = stateText; |
| | | publicInterface.TemperatureShow1(flMain, tagText, "%", str1, str2, (relationValueStr, tempValueStr) => |
| | | { |
| | | SelectedDeviceStatus = "TemperatureSensor"; |
| | | Send.dictionary(airqualitysensorDic, "Cluster_ID", "1029"); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeId", "0"); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData1", tempValueStr); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData2", "0"); |
| | | Send.dictionary(airqualitysensorDic, "Range", relationValueStr); |
| | | AddDic(flMain, SelectedDeviceStatus, edit, common, airqualitysensorDic); |
| | | }, () => { |
| | | if (edit) { flMain.RemoveFromParent(); } |
| | | else |
| | | { |
| | | AirSonser(flMain, SelectedDeviceStatus, edit, common); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 空气质量传感器(特殊处理) |
| | | /// </summary> |
| | | /// <param name="flMain"></param> |
| | | /// <param name="SelectedDeviceStatus"></param> |
| | | /// <param name="edit"></param> |
| | | /// <param name="common"></param> |
| | | /// <param name="dic"></param> |
| | | private static void AddDic(FrameLayout flMain, string SelectedDeviceStatus, bool edit, CommonDevice common, Dictionary<string, string> dic ) |
| | | { |
| | | UserView.HomePage.Instance.ScrollEnabled = true; |
| | | if (SelectedDeviceStatus != "") |
| | | { |
| | | //添加条件 |
| | | LogicIfon.AddDeviceconditions(common, dic); |
| | | } |
| | | else |
| | | { |
| | | if (!edit) |
| | | { |
| | | var alert = new UserCenter.ShowMsgControl(ShowMsgType.Normal, |
| | | Language.StringByID(MyInternationalizationString.selectdevicestatuscondition), |
| | | Language.StringByID(MyInternationalizationString.confrim)); |
| | | alert.Show(); |
| | | return; |
| | | } |
| | | |
| | | } |
| | | flMain.RemoveFromParent(); |
| | | //自动化 |
| | | var logicCommunalPage = new LogicCommunalPage(); |
| | | UserView.HomePage.Instance.AddChidren(logicCommunalPage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | logicCommunalPage.Show(() => { }); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | { |
| | | 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> |
| | | /// <param name="common">Common.</param> |
| | | /// <param name="objecttype">Objecttype.</param> |
| | | public static void AddDeviceconditions(CommonDevice common, Dictionary<string, string> objecttype) |
| | | public static void AddDeviceconditions(CommonDevice common, Dictionary<string, string> objecttype) |
| | | { |
| | | for (int i = 0; i < Common.Logic.CurrentLogic.Conditions.Count; i++) |
| | | { |
| | |
| | | { |
| | | if ((Common.Logic.CurrentLogic.Conditions[i]["MacAddr"] == common.DeviceAddr) && (Common.Logic.CurrentLogic.Conditions[i]["Epoint"] == common.DeviceEpoint.ToString())) |
| | | { |
| | | if (common.Type == DeviceType.TemperatureSensor)//设备温度传感器有点特别 |
| | | if (common.Type == DeviceType.TemperatureSensor) |
| | | { |
| | | var dev = common as TemperatureSensor; |
| | | string str = ""; |
| | | if (dev.SensorDiv == 1) |
| | | |
| | | //获取设备类型 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { common }); |
| | | |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | str = "1026"; |
| | | var cluster_ID1 = Common.Logic.CurrentLogic.Conditions[i]["Cluster_ID"]; |
| | | var attriButeId1 = Common.Logic.CurrentLogic.Conditions[i]["AttriButeId"]; |
| | | var cluster_ID2 = objecttype["Cluster_ID"]; |
| | | var attriButeId2 = objecttype["AttriButeId"]; |
| | | |
| | | bool cluster_ID = false; |
| | | if (cluster_ID1 == cluster_ID2 && attriButeId1 == attriButeId2) |
| | | { |
| | | cluster_ID = true; |
| | | } |
| | | |
| | | if (cluster_ID) |
| | | { |
| | | //已经存在移除再重新添加 |
| | | Common.Logic.CurrentLogic.Conditions.RemoveAt(i); |
| | | Common.Logic.CurrentLogic.Conditions.Insert(i, objecttype); |
| | | return; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | str = "1029"; |
| | | } |
| | | if (Common.Logic.CurrentLogic.Conditions[i]["Cluster_ID"] == str) |
| | | { |
| | | Common.Logic.CurrentLogic.Conditions.RemoveAt(i); |
| | | Common.Logic.CurrentLogic.Conditions.Insert(i, objecttype); |
| | | return; |
| | | } |
| | | //设备温度传感器 |
| | | var dev = common as TemperatureSensor; |
| | | string str = ""; |
| | | if (dev.SensorDiv == 1) |
| | | { |
| | | str = "1026"; |
| | | } |
| | | else |
| | | { |
| | | str = "1029"; |
| | | } |
| | | if (Common.Logic.CurrentLogic.Conditions[i]["Cluster_ID"] == str) |
| | | { |
| | | Common.Logic.CurrentLogic.Conditions.RemoveAt(i); |
| | | Common.Logic.CurrentLogic.Conditions.Insert(i, objecttype); |
| | | return; |
| | | } |
| | | |
| | | } |
| | | } |
| | | else if (common.Type == DeviceType.IASZone) |
| | | { |
| | |
| | | /// <summary> |
| | | /// 添加Logic条件的方法 |
| | | /// </summary> |
| | | /// <param name="common">Common.</param> |
| | | /// <param name="logic">Common.</param> |
| | | /// <param name="objecttype">Objecttype.</param> |
| | | public static void AddLogicconditions(Common.Logic logic, Dictionary<string, string> objecttype) |
| | | { |
| | |
| | | Common.Logic.CurrentLogic.Accounts.Add(accountsInfo); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | break; |
| | | case DeviceType.TemperatureSensor: |
| | | { |
| | | var temperatureSensor = device as TemperatureSensor; |
| | | if (temperatureSensor.SensorDiv == 1) |
| | | |
| | | |
| | | //获取设备类型 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | patm = $"ZigeeLogic/temperature.png"; |
| | | selectedpatm = $"ZigeeLogic/selectedtemperature.png"; |
| | | patm = $"ZigeeLogic/airquality.png"; |
| | | selectedpatm = $"ZigeeLogic/airqualityselected.png"; |
| | | } |
| | | else |
| | | { |
| | | patm = "ZigeeLogic/humidity.png"; |
| | | selectedpatm = "ZigeeLogic/selectedhumidity.png"; |
| | | var temperatureSensor = device as TemperatureSensor; |
| | | if (temperatureSensor.SensorDiv == 1) |
| | | { |
| | | patm = $"ZigeeLogic/temperature.png"; |
| | | selectedpatm = $"ZigeeLogic/selectedtemperature.png"; |
| | | } |
| | | else |
| | | { |
| | | patm = "ZigeeLogic/humidity.png"; |
| | | selectedpatm = "ZigeeLogic/selectedhumidity.png"; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | |
| | | public class PublicInterface |
| | | { |
| | | |
| | | |
| | | /// <summary> |
| | | /// 单选择 |
| | | /// </summary> |
| | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 单选择 |
| | | /// </summary> |
| | | /// <param name="frame">显示在哪个界面的父控件</param> |
| | | /// <param name="list">显示数据源</param> |
| | | /// <param name="titleText">标题文本</param> |
| | | /// <param name="stateText">之前状态文本</param> |
| | | /// <param name="completeAction">完成返回值</param> |
| | | /// <param name="cancelAction">取消返回值</param> |
| | | public void SingleSelectionShow(FrameLayout frame, List<string> list, int titleText, string stateText, Action<string> completeAction, Action cancelAction) |
| | | { |
| | | FrameLayout frameLayout = new FrameLayout |
| | | { |
| | | BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor, |
| | | }; |
| | | frame.AddChidren(frameLayout); |
| | | CompleteView view = new CompleteView(); |
| | | view.Btntitle.TextID = titleText; |
| | | frameLayout.AddChidren(view.Show(list.Count)); |
| | | UserView.HomePage.Instance.ScrollEnabled = false; |
| | | EventHandler<MouseEventArgs> cancelClick= (sender, e) => |
| | | { |
| | | UserView.HomePage.Instance.ScrollEnabled = true; |
| | | //移除fLayout界面 |
| | | frameLayout.RemoveFromParent(); |
| | | cancelAction(); |
| | | }; |
| | | view.Btncancel.MouseUpEventHandler += cancelClick; |
| | | frameLayout.MouseUpEventHandler += cancelClick; |
| | | ///定义一个Btn记录选中状态 |
| | | Button checkIconBtn = new Button |
| | | { |
| | | Tag = "unknown", |
| | | }; |
| | | Button checkTextBtn = new Button |
| | | { |
| | | Tag = "unknown", |
| | | }; |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | string str = list[i]; |
| | | mFunView mFun = new mFunView(); |
| | | mFun.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; |
| | | mFun.titleBtn.SelectedTextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | mFun.frameLayout.Y = Application.GetRealHeight(140 + 20 + 160 * i); |
| | | view.fraView.AddChidren(mFun.Show()); |
| | | mFun.titleBtn.Text = str; |
| | | mFun.clickviewBtn.Tag = str;//标记 |
| | | if (list.Count - 1 == i) |
| | | { |
| | | //改变最后一条的颜色 |
| | | mFun.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; |
| | | } |
| | | if (stateText == str) |
| | | { |
| | | //图标改变 |
| | | checkIconBtn.Visible = false; |
| | | mFun.selectedIconBtn.Visible = true; |
| | | checkIconBtn = mFun.selectedIconBtn; |
| | | checkIconBtn.Tag = mFun.clickviewBtn.Tag.ToString(); |
| | | //字体改变 |
| | | checkTextBtn.IsSelected = false; |
| | | mFun.titleBtn.IsSelected = true; |
| | | checkTextBtn = mFun.titleBtn; |
| | | |
| | | } |
| | | //点击事件 |
| | | mFun.clickviewBtn.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | //图标改变 |
| | | checkIconBtn.Visible = false; |
| | | mFun.selectedIconBtn.Visible = true; |
| | | checkIconBtn = mFun.selectedIconBtn; |
| | | checkIconBtn.Tag = mFun.clickviewBtn.Tag.ToString(); |
| | | //字体改变 |
| | | checkTextBtn.IsSelected = false; |
| | | mFun.titleBtn.IsSelected = true; |
| | | checkTextBtn = mFun.titleBtn; |
| | | }; |
| | | |
| | | } |
| | | view.Btncomplete.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | if (checkIconBtn.Tag.ToString() == "unknown") |
| | | { |
| | | return; |
| | | } |
| | | completeAction(checkIconBtn.Tag.ToString()); |
| | | UserView.HomePage.Instance.ScrollEnabled = true; |
| | | //移除fLayout界面 |
| | | frameLayout.RemoveFromParent(); |
| | | }; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 温湿度方法 |
| | | /// </summary> |
| | | /// <param name="frame">显示在哪个界面的父控件</param> |
| | | /// <param name="common">当前设备</param> |
| | | /// <param name="state1">之前状态</param> |
| | | /// <param name="symbol">符号(%,℃)</param> |
| | | /// <param name="state1">之前状态(比较符号)</param> |
| | | /// <param name="state2">之前状态</param> |
| | | /// <param name="action">返回值</param> |
| | | public void TemperatureShow1(FrameLayout frameLayout, CommonDevice common, string state1, string state2, Action<string, string> action) |
| | | public void TemperatureShow1(FrameLayout frame, string tlite,string symbol, string state1, string state2, Action<string, string> action, Action cancelAction) |
| | | { |
| | | //FrameLayout frameLayout = new FrameLayout |
| | | //{ |
| | | // BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor, |
| | | //}; |
| | | //frame.AddChidren(frameLayout); |
| | | FrameLayout frameLayout = new FrameLayout |
| | | { |
| | | BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor, |
| | | }; |
| | | frame.AddChidren(frameLayout); |
| | | CompleteView view = new CompleteView(); |
| | | view.Btntitle.Text= LocalDevice.Current.GetDeviceEpointName(common); |
| | | view.Btntitle.Text= tlite; |
| | | frameLayout.AddChidren(view.Show(4)); |
| | | UserView.HomePage.Instance.ScrollEnabled = false; |
| | | view.Btncancel.MouseUpEventHandler += (sender, e) => |
| | | |
| | | EventHandler<MouseEventArgs> cancelClick = (sender, e) => |
| | | { |
| | | UserView.HomePage.Instance.ScrollEnabled = true; |
| | | //移除fLayout界面 |
| | | frameLayout.RemoveFromParent(); |
| | | cancelAction(); |
| | | }; |
| | | view.Btncancel.MouseUpEventHandler += cancelClick; |
| | | frameLayout.MouseUpEventHandler += cancelClick; |
| | | |
| | | #region 布局View |
| | | var PickerViewfra = new FrameLayout |
| | |
| | | |
| | | var mList1 = new List<string> { ">", "<", "=", "≥", "≤" }; |
| | | var mList2 = new List<string>(); |
| | | var mList3 = new List<string>(); |
| | | var mList3 = new List<string>() { symbol }; |
| | | for (int i = 1; i <= 100; i++) |
| | | { |
| | | mList2.Add(i.ToString()); |
| | | } |
| | | switch (common.Type) |
| | | { |
| | | case DeviceType.TemperatureSensor: |
| | | { |
| | | var temperatureSensor = common as TemperatureSensor; |
| | | if (temperatureSensor.SensorDiv == 1) |
| | | { |
| | | mList3.Add("℃"); |
| | | } |
| | | else |
| | | { |
| | | mList3.Add("%"); |
| | | |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | |
| | | |
| | | mUIPickerView.setNPicker(mList1, mList2, mList3); |
| | | |
| | |
| | | //返回索引值 |
| | | index1 = s1; |
| | | index2 = s2; |
| | | |
| | | string relationValueStr = ""; |
| | | switch (mList1[index1]) |
| | | { |
| | | case ">": |
| | | { |
| | | relationValueStr = "0"; |
| | | } |
| | | break; |
| | | case "<": |
| | | { |
| | | relationValueStr = "2"; |
| | | |
| | | } |
| | | break; |
| | | case "=": |
| | | { |
| | | relationValueStr = "1"; |
| | | |
| | | } |
| | | break; |
| | | case "≥": |
| | | { |
| | | |
| | | relationValueStr = "6"; |
| | | |
| | | } |
| | | break; |
| | | case "≤": |
| | | { |
| | | relationValueStr = "7"; |
| | | } |
| | | break; |
| | | } |
| | | ///温度进率转换*100 |
| | | string tempValueStr = (int.Parse(mList2[index2]) * 100).ToString(); |
| | | action(relationValueStr, tempValueStr); |
| | | }; |
| | | view.Btncomplete.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | |
| | | }; |
| | | |
| | | } |
| | | public void TemperatureShow(FrameLayout frameLayout, CommonDevice common, string state1, string state2, Action<string, string> action) |
| | | public void TemperatureShow(FrameLayout frameLayout, string symbol, string state1, string state2, Action<string, string> action) |
| | | { |
| | | #region 布局View |
| | | var PickerViewfra = new FrameLayout |
| | |
| | | |
| | | var mList1 = new List<string> { ">", "<", "=", "≥", "≤" }; |
| | | var mList2 = new List<string>(); |
| | | var mList3 = new List<string>(); |
| | | var mList3 = new List<string>() { symbol }; |
| | | for (int i = 1; i <= 100; i++) |
| | | { |
| | | mList2.Add(i.ToString()); |
| | | } |
| | | switch (common.Type) |
| | | { |
| | | case DeviceType.TemperatureSensor: |
| | | { |
| | | var temperatureSensor = common as TemperatureSensor; |
| | | if (temperatureSensor.SensorDiv == 1) |
| | | { |
| | | mList3.Add("℃"); |
| | | } |
| | | else |
| | | { |
| | | mList3.Add("%"); |
| | | |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | |
| | | mUIPickerView.setNPicker(mList1, mList2, mList3); |
| | |
| | | }; |
| | | } |
| | | break; |
| | | case "时间": { |
| | | case "时间": |
| | | { |
| | | list = new List<string> { |
| | | Language.StringByID(MyInternationalizationString.immediateexecution), |
| | | Language.StringByID(MyInternationalizationString.timeframe), |
| | |
| | | }; |
| | | } |
| | | break; |
| | | |
| | | case "空气质量传感器": |
| | | { |
| | | list = new List<string> { |
| | | Language.StringByID(MyInternationalizationString.kongqizhiliang), |
| | | Language.StringByID(MyInternationalizationString.pm25), |
| | | Language.StringByID(MyInternationalizationString.co2), |
| | | Language.StringByID(MyInternationalizationString.sensortemperature), |
| | | Language.StringByID(MyInternationalizationString.sensorhumidity), |
| | | }; |
| | | } |
| | | break; |
| | | case "空气质量": |
| | | { |
| | | list = new List<string> { |
| | | Language.StringByID(MyInternationalizationString.you), |
| | | Language.StringByID(MyInternationalizationString.liang), |
| | | Language.StringByID(MyInternationalizationString.cha), |
| | | }; |
| | | } |
| | | break; |
| | | case "pm2.5": |
| | | { |
| | | list = new List<string> { |
| | | Language.StringByID(MyInternationalizationString.pmyou), |
| | | Language.StringByID(MyInternationalizationString.pmliang), |
| | | Language.StringByID(MyInternationalizationString.pmqingdu), |
| | | Language.StringByID(MyInternationalizationString.pmzhongdu), |
| | | }; |
| | | } |
| | | break; |
| | | case "co2": |
| | | { |
| | | list = new List<string> { |
| | | Language.StringByID(MyInternationalizationString.co2qingxin), |
| | | Language.StringByID(MyInternationalizationString.co2huizhuo), |
| | | Language.StringByID(MyInternationalizationString.co2queyang), |
| | | Language.StringByID(MyInternationalizationString.co2yanzhongqueyang), |
| | | }; |
| | | } |
| | | break; |
| | | |
| | | } |
| | | return list; |
| | |
| | | /// </summary>
|
| | | private List<ButtonBase> listControl = new List<ButtonBase>();
|
| | | /// <summary>
|
| | | /// MaxLevel
|
| | | /// </summary>
|
| | | private const int MaxLevel = 254;
|
| | | /// <summary>
|
| | | /// 彩灯控件
|
| | | /// </summary>
|
| | | private WaveSeekBar waveSeekBar = null;
|
| | |
| | | waveSeekBar.Gravity = Gravity.CenterHorizontal;
|
| | | waveSeekBar.WavePadding = Application.GetRealWidth(8);
|
| | | waveSeekBar.MaxValue = 100;
|
| | | waveSeekBar.Progress = (int)(((DimmableLight)this.device).Level * 1.0 / MaxLevel * 100);
|
| | | waveSeekBar.Progress = HdlDeviceCommonLogic.Current.CalculateLightLevelPersent(((DimmableLight)this.device).Level);
|
| | | waveSeekBar.CornerRadius = Application.GetRealHeight(58);
|
| | | if (this.IsLightOpen == true)
|
| | | {
|
| | |
| | | else
|
| | | {
|
| | | //如果住宅为虚拟住宅,直接改缓存
|
| | | ((DimmableLight)this.device).Level = value * MaxLevel / 100;
|
| | | ((DimmableLight)this.device).Level = HdlDeviceCommonLogic.Current.CalculateLightLevel(value);
|
| | | //亮度 XX
|
| | | this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
|
| | | }
|
| | |
| | | }
|
| | | oldProgressValue = nowProgressValue;
|
| | | //发送进度值
|
| | | ((DimmableLight)this.device).SetLevel((int)(oldProgressValue * MaxLevel / 100.0));
|
| | | ((DimmableLight)this.device).SetLevel(HdlDeviceCommonLogic.Current.CalculateLightLevel(oldProgressValue));
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | if (level == 0)
|
| | | {
|
| | | //如果当前是打开状态,并且亮度为0的话,则需要变成100%亮度
|
| | | this.device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, this.device, new object[] { 254 });
|
| | | this.device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, this.device, new object[] { 255 });
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | if (this.isProgressing == false)
|
| | | {
|
| | | //当进度值在手动变更中时,不接收推送
|
| | | waveSeekBar.Progress = (int)(((DimmableLight)this.device).Level * 1.0 / MaxLevel * 100);
|
| | | int progress = HdlDeviceCommonLogic.Current.CalculateLightLevelPersent(((DimmableLight)this.device).Level);
|
| | | if (waveSeekBar.Progress != progress)
|
| | | {
|
| | | waveSeekBar.Progress = progress;
|
| | | }
|
| | | }
|
| | |
|
| | | if (listControl[0].IsSelected != isOpen)
|
| | |
| | | /// </summary>
|
| | | private List<ButtonBase> listControl = new List<ButtonBase>();
|
| | | /// <summary>
|
| | | /// MaxLevel
|
| | | /// </summary>
|
| | | private const int MaxLevel = 254;
|
| | | /// <summary>
|
| | | /// 彩灯控件
|
| | | /// </summary>
|
| | | private WaveSeekBar waveSeekBar = null;
|
| | |
| | | waveSeekBar.Gravity = Gravity.CenterHorizontal;
|
| | | waveSeekBar.WavePadding = Application.GetRealWidth(8);
|
| | | waveSeekBar.MaxValue = 100;
|
| | | waveSeekBar.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100);
|
| | | waveSeekBar.Progress = HdlDeviceCommonLogic.Current.CalculateLightLevelPersent(((ColorTemperatureLight)this.device).Level);
|
| | | waveSeekBar.CornerRadius = Application.GetRealHeight(58);
|
| | | if (this.IsLightOpen == true)
|
| | | {
|
| | |
| | | else
|
| | | {
|
| | | //如果住宅为虚拟住宅,直接改缓存
|
| | | ((ColorTemperatureLight)this.device).Level = value * MaxLevel / 100;
|
| | | ((ColorTemperatureLight)this.device).Level = HdlDeviceCommonLogic.Current.CalculateLightLevel(value);
|
| | | //亮度 XX
|
| | | this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
|
| | | }
|
| | |
| | | if (nowProgressValue != oldProgressValue)
|
| | | {
|
| | | oldProgressValue = nowProgressValue;
|
| | | ((ColorTemperatureLight)this.device).SetLevel((int)(oldProgressValue * MaxLevel / 100.0));
|
| | | ((ColorTemperatureLight)this.device).SetLevel(HdlDeviceCommonLogic.Current.CalculateLightLevel(oldProgressValue));
|
| | | }
|
| | | //发送色温值
|
| | | if (nowColorValue != oldColorValue)
|
| | |
| | | if (nowProgressValue != oldProgressValue)
|
| | | {
|
| | | //发送亮度值
|
| | | ((ColorTemperatureLight)this.device).SetLevel((int)(nowProgressValue * MaxLevel / 100.0));
|
| | | ((ColorTemperatureLight)this.device).SetLevel(HdlDeviceCommonLogic.Current.CalculateLightLevel(nowProgressValue));
|
| | | }
|
| | | if (nowColorValue != oldColorValue)
|
| | | {
|
| | |
| | | if (level == 0)
|
| | | {
|
| | | //如果当前是打开状态,并且亮度为0的话,则需要变成100%亮度
|
| | | this.device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, this.device, new object[] { 254 });
|
| | | this.device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, this.device, new object[] { 255 });
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | if (this.isProgressing == false)
|
| | | {
|
| | | //当进度值在手动变更中时,不接收推送
|
| | | waveSeekBar.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100);
|
| | | int progress = HdlDeviceCommonLogic.Current.CalculateLightLevelPersent(((ColorTemperatureLight)this.device).Level);
|
| | | if (waveSeekBar.Progress != progress)
|
| | | {
|
| | | waveSeekBar.Progress = progress;
|
| | | }
|
| | | }
|
| | |
|
| | | this.IsLightOpen = isOpen;
|
| | |
| | | /// </summary>
|
| | | private SeekBarControl seekBarColor = null;
|
| | | /// <summary>
|
| | | /// MaxLevel
|
| | | /// </summary>
|
| | | private const int MaxLevel = 254;
|
| | | /// <summary>
|
| | | /// 亮度进度值是否在改变中
|
| | | /// </summary>
|
| | | private bool isLightProgressing = false;
|
| | |
| | | seekBarLight.ProgressTextSize = 14;
|
| | | seekBarLight.ProgressTextColor = UserCenterColor.Current.TextGrayColor2;
|
| | | seekBarLight.Gravity = Gravity.Frame;
|
| | | seekBarLight.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100);
|
| | | seekBarLight.Progress = HdlDeviceCommonLogic.Current.CalculateLightLevelPersent(((ColorTemperatureLight)this.device).Level);
|
| | | frameWhiteBack.AddChidren(seekBarLight);
|
| | |
|
| | | //色温
|
| | |
| | | else
|
| | | {
|
| | | //如果住宅为虚拟住宅,直接改缓存
|
| | | ((ColorTemperatureLight)this.device).Level = value * MaxLevel / 100;
|
| | | ((ColorTemperatureLight)this.device).Level = HdlDeviceCommonLogic.Current.CalculateLightLevel(value);
|
| | | //亮度 XX
|
| | | this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
|
| | | }
|
| | |
| | | if (nowLightValue != oldLightValue)
|
| | | {
|
| | | oldLightValue = nowLightValue;
|
| | | ((ColorTemperatureLight)this.device).SetLevel((int)(oldLightValue * MaxLevel / 100.0));
|
| | | ((ColorTemperatureLight)this.device).SetLevel(HdlDeviceCommonLogic.Current.CalculateLightLevel(oldLightValue));
|
| | | }
|
| | | //发送色温值
|
| | | if (nowColorValue != oldColorValue)
|
| | |
| | | if (nowLightValue != oldLightValue)
|
| | | {
|
| | | //发送亮度值
|
| | | ((ColorTemperatureLight)this.device).SetLevel((int)(nowLightValue * MaxLevel / 100.0));
|
| | | ((ColorTemperatureLight)this.device).SetLevel(HdlDeviceCommonLogic.Current.CalculateLightLevel(nowLightValue));
|
| | | }
|
| | | if (nowColorValue != oldColorValue)
|
| | | {
|
| | |
| | | if (level == 0)
|
| | | {
|
| | | //如果当前是打开状态,并且亮度为0的话,则需要变成100%亮度
|
| | | this.device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, this.device, new object[] { 254 });
|
| | | this.device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, this.device, new object[] { 255 });
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | if (this.isLightProgressing == false)
|
| | | {
|
| | | //当进度值在手动变更中时,不接收推送
|
| | | seekBarLight.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100);
|
| | | int progress = HdlDeviceCommonLogic.Current.CalculateLightLevelPersent(((ColorTemperatureLight)this.device).Level);
|
| | | if (seekBarLight.Progress != progress)
|
| | | {
|
| | | seekBarLight.Progress = progress;
|
| | | }
|
| | | }
|
| | | if (this.isColorProgressing == false)
|
| | | {
|
| | |
| | | if (level == 0)
|
| | | {
|
| | | //如果当前是打开状态,并且亮度为0的话,则需要变成100%亮度
|
| | | i_device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, i_device, new object[] { 254 });
|
| | | i_device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, i_device, new object[] { 255 });
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | if (level == 0)
|
| | | {
|
| | | //如果当前是打开状态,并且亮度为0的话,则需要变成100%亮度
|
| | | i_device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, i_device, new object[] { 254 });
|
| | | i_device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, i_device, new object[] { 255 });
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | | /// 计算灯的亮度值所占的百分比(例如:返回35,代表是35%) |
| | | /// </summary> |
| | | /// <param name="i_Level">灯的亮度值</param> |
| | | /// <returns></returns> |
| | | public int CalculateLightLevelPersent(decimal i_Level) |
| | | { |
| | | return (int)((i_Level / 255) * 100); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 计算指定百分比对应灯的亮度值 |
| | | /// </summary> |
| | | /// <param name="i_Persent">百分比值(比如35,代表35%)</param> |
| | | /// <returns></returns> |
| | | public int CalculateLightLevel(decimal i_Persent) |
| | | { |
| | | //需要向上取整,才能得出 |
| | | return (int)Math.Ceiling((i_Persent / 100) * 255); |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Close); |
| | | } |
| | | return $"{(int)((device as DimmableLight).Level * 1.0 / 254 * 100)}%"; |
| | | return HdlDeviceCommonLogic.Current.CalculateLightLevelPersent((device as DimmableLight).Level) + "%"; |
| | | } |
| | | else if (device.Type == DeviceType.ColorTemperatureLight) |
| | | { |
| | |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Close); |
| | | } |
| | | return $"{(int)((device as ColorTemperatureLight).Level * 1.0 / 254 * 100)}%"; |
| | | return HdlDeviceCommonLogic.Current.CalculateLightLevelPersent((device as ColorTemperatureLight).Level) + "%"; |
| | | } |
| | | else if (device.Type == DeviceType.WindowCoveringDevice) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | dicSort[persentNo] = $"{(int)(info.Data1 * 1.0 / 254 * 100)}%"; |
| | | dicSort[persentNo] = HdlDeviceCommonLogic.Current.CalculateLightLevelPersent(info.Data1) + "%"; |
| | | } |
| | | } |
| | | #endregion |
| | |
| | | {
|
| | | listSelect.Add(i + "%");
|
| | | }
|
| | | //让它处于10的整倍数
|
| | | this.pirConfigure.dimmerLevel = (this.pirConfigure.dimmerLevel / 10) * 10;
|
| | | int index = listSelect.IndexOf(this.pirConfigure.dimmerLevel + "%");
|
| | | //这个百分比的值,直接算
|
| | | int persentValue = HdlDeviceCommonLogic.Current.CalculateLightLevelPersent(this.pirConfigure.dimmerLevel);
|
| | | int index = listSelect.IndexOf(persentValue + "%");
|
| | |
|
| | | //开灯亮度
|
| | | var row1 = new FrameRowControl(listView.rowSpace / 2);
|
| | |
| | | var btnCaption1 = row1.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uTurnOnBrightness), 400);
|
| | | btnCaption1.TextSize = 15;
|
| | | row1.AddRightArrow();
|
| | | var btnStatu = row1.AddMostRightView(pirConfigure.dimmerLevel + "%", 400);
|
| | | var btnStatu = row1.AddMostRightView(persentValue + "%", 400);
|
| | | row1.AddBottomLine();
|
| | | row1.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | PickerView.Show(listSelect, (value) =>
|
| | | {
|
| | | btnStatu.Text = listSelect[value];
|
| | | pirConfigure.dimmerLevel = Convert.ToInt32(listSelect[value].Replace("%", string.Empty));
|
| | |
|
| | | string myValue = listSelect[value].Replace("%", string.Empty);
|
| | | pirConfigure.dimmerLevel = HdlDeviceCommonLogic.Current.CalculateLightLevel(Convert.ToDecimal(myValue));
|
| | | index = value;
|
| | |
|
| | | }, index == -1 ? 0 : index, Language.StringByID(R.MyInternationalizationString.uBrightness),
|
| | | Language.StringByID(R.MyInternationalizationString.uFinish),
|
| | |
| | | /// 动作信息 1 开关/ 3亮度调节
|
| | | /// </summary>
|
| | | private Dictionary<int, Safeguard.TaskListInfo> dicTaskinfo = new Dictionary<int, Safeguard.TaskListInfo>();
|
| | | /// <summary>
|
| | | /// 进度条最大值
|
| | | /// </summary>
|
| | | private int MaxValue = 254;
|
| | |
|
| | | #endregion
|
| | |
|
| | |
| | | detailBackFrame.AddChidren(btnPersent);
|
| | | if (dicTaskinfo.ContainsKey(3) == true)
|
| | | {
|
| | | btnPersent.Text = ((int)(dicTaskinfo[3].Data1 * 1.0 / MaxValue * 100)) + "%";
|
| | | btnPersent.Text = HdlDeviceCommonLogic.Current.CalculateLightLevelPersent(dicTaskinfo[3].Data1) + "%";
|
| | | }
|
| | |
|
| | | //进度条
|
| | | var seekBar = new SeekBarControl(919);
|
| | | seekBar.Y = Application.GetRealHeight(268);
|
| | | seekBar.ProgressBarColor = 0xfffdb500;
|
| | | seekBar.MaxValue = this.MaxValue;
|
| | | seekBar.MaxValue = 100;
|
| | | seekBar.Enable = false;
|
| | | if (dicTaskinfo.ContainsKey(3) == true)
|
| | | {
|
| | | //3:亮度调节
|
| | | seekBar.Progress = dicTaskinfo[3].Data1;
|
| | | seekBar.Progress = HdlDeviceCommonLogic.Current.CalculateLightLevelPersent(dicTaskinfo[3].Data1);
|
| | | }
|
| | | detailBackFrame.AddChidren(seekBar);
|
| | | seekBar.ProgressChangedEvent += (div, value) =>
|
| | | {
|
| | | btnPersent.Text = ((int)(value * 1.0 / MaxValue * 100)) + "%";
|
| | | btnPersent.Text = value + "%";
|
| | | };
|
| | |
|
| | | //线
|
| | |
| | | seekBar.Enable = true;
|
| | | if (seekBar.Progress == 0)
|
| | | {
|
| | | seekBar.Progress = MaxValue;
|
| | | seekBar.Progress = 100;
|
| | | btnPersent.Text = "100%";
|
| | | }
|
| | |
|
| | |
| | | //百分比调节
|
| | | dicTaskinfo[3] = new Safeguard.TaskListInfo();
|
| | | dicTaskinfo[3].TaskType = 3;
|
| | | dicTaskinfo[3].Data1 = seekBar.Progress;
|
| | | dicTaskinfo[3].Data1 = HdlDeviceCommonLogic.Current.CalculateLightLevel(seekBar.Progress);
|
| | | }
|
| | |
|
| | | var listData = new List<Safeguard.TaskListInfo>();
|
| | |
| | | public readonly static int dong = 5415; |
| | | public readonly static int unit = 5416; |
| | | public readonly static int theOutdoorUnit = 5417; |
| | | public const int airqualitysensor = 5418; |
| | | public const int pm25 = 5419; |
| | | public const int sensortemperature= 5420; |
| | | public const int sensorhumidity = 5421; |
| | | public const int co2 = 5422; |
| | | public const int you = 5423; |
| | | public const int liang = 5424; |
| | | public const int cha = 5425; |
| | | public const int pmyou = 5426; |
| | | public const int pmliang = 5427; |
| | | public const int pmqingdu = 5428; |
| | | public const int pmzhongdu = 5429; |
| | | public const int co2qingxin = 5430; |
| | | public const int co2huizhuo = 5431; |
| | | public const int co2queyang = 5432; |
| | | public const int co2yanzhongqueyang= 5433; |
| | | public const int kongqizhiliang = 5434; |
| | | |
| | | |
| | | |