From 6129e717a8b3265e9b35ac5823f7c95fd306da04 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期五, 26 一月 2024 17:17:16 +0800 Subject: [PATCH] 修复可视对讲无法收到推送的问题,传感器无法动态获取等级的问题 --- HDL-ON_Android/HDL-ON_Android.csproj | 2 HDL-ON_Android/Properties/AndroidManifest.xml | 2 HDL-ON_iOS/Info.plist | 4 HDL_ON/Common/HDLCommon.cs | 17 +- HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs | 69 +++++----- HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/A_EnvironmentalDataCenter.cs | 42 +++--- DLL/IOS/EZSDK.IOS.dll | 0 HDL_ON/UI/MainPage.cs | 2 HDL-ON_iOS/AppDelegate.cs | 22 +- HDL_ON/UI/UI1-Login/LoginPage.cs | 38 +++--- HDL_ON/Entity/Function/Sensor.cs | 133 ++++++++++++++-------- 11 files changed, 185 insertions(+), 146 deletions(-) diff --git a/DLL/IOS/EZSDK.IOS.dll b/DLL/IOS/EZSDK.IOS.dll index 7ce30f9..ff649e0 100644 --- a/DLL/IOS/EZSDK.IOS.dll +++ b/DLL/IOS/EZSDK.IOS.dll Binary files differ diff --git a/HDL-ON_Android/HDL-ON_Android.csproj b/HDL-ON_Android/HDL-ON_Android.csproj index 74933af..a3706fa 100644 --- a/HDL-ON_Android/HDL-ON_Android.csproj +++ b/HDL-ON_Android/HDL-ON_Android.csproj @@ -196,7 +196,7 @@ <HintPath>..\DLL\Android\Shared.Droid.dll</HintPath> </Reference> <Reference Include="HdlEzvizDroid"> - <HintPath>..\..\App-Pages\2024\On Pro\Android\SDK\ez\2024-01-11\HdlEzvizDroid.dll</HintPath> + <HintPath>..\DLL\HdlEzvizDroid.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml index e513f6a..d8e42dd 100644 --- a/HDL-ON_Android/Properties/AndroidManifest.xml +++ b/HDL-ON_Android/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@ 锘�<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.4.3" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202401111"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.4.3" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202401161"> <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29" /> <uses-permission android:name="android.permission.RECEIVE_SMS" /> <!--鍙嬬洘--> diff --git a/HDL-ON_iOS/AppDelegate.cs b/HDL-ON_iOS/AppDelegate.cs index 731a1c1..003de6d 100644 --- a/HDL-ON_iOS/AppDelegate.cs +++ b/HDL-ON_iOS/AppDelegate.cs @@ -268,16 +268,16 @@ /// </summary> void SetCurrentLanguage() { - if (string.IsNullOrEmpty(OnAppConfig.Instance.SetLanguage)) - { + //if (string.IsNullOrEmpty(OnAppConfig.Instance.SetLanguage)) + //{ if (NSLocale.PreferredLanguages[0].Contains("zh-")) { Language.CurrentLanguage = "Chinese"; } - else if (NSLocale.PreferredLanguages[0].Contains("cs-")) - { - Language.CurrentLanguage = "Czech"; - } + //else if (NSLocale.PreferredLanguages[0].Contains("cs-")) + //{ + // Language.CurrentLanguage = "Czech"; + //} else if (NSLocale.PreferredLanguages[0].Contains("ru-")) { Language.CurrentLanguage = "russian"; @@ -297,11 +297,11 @@ { Language.CurrentLanguage = "English"; } - } - else - { - Language.CurrentLanguage = OnAppConfig.Instance.SetLanguage; - } + //} + //else + //{ + // Language.CurrentLanguage = OnAppConfig.Instance.SetLanguage; + //} } public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) diff --git a/HDL-ON_iOS/Info.plist b/HDL-ON_iOS/Info.plist index d8aee60..1eb9e94 100644 --- a/HDL-ON_iOS/Info.plist +++ b/HDL-ON_iOS/Info.plist @@ -11,7 +11,7 @@ <key>CFBundleName</key> <string>On Pro</string> <key>CFBundleShortVersionString</key> - <string>2.4.3</string> + <string>2.4.4</string> <key>CFBundleURLTypes</key> <array> <dict> @@ -36,7 +36,7 @@ </dict> </array> <key>CFBundleVersion</key> - <string>2.4.3</string> + <string>2.4.4</string> <key>LSApplicationQueriesSchemes</key> <array> <string>weixinULAPI</string> diff --git a/HDL_ON/Common/HDLCommon.cs b/HDL_ON/Common/HDLCommon.cs index 75dcc1b..8ef0a0d 100644 --- a/HDL_ON/Common/HDLCommon.cs +++ b/HDL_ON/Common/HDLCommon.cs @@ -258,7 +258,7 @@ { try { - //Console.WriteLine($"鎺ユ敹鍒版帹閫侊紝锛岋紝锛�.{Newtonsoft.Json.JsonConvert.SerializeObject(jpushMessageInfo).ToString()}"); + Console.WriteLine($"鎺ユ敹鍒版帹閫侊紝锛岋紝锛�.{Newtonsoft.Json.JsonConvert.SerializeObject(jpushMessageInfo).ToString()}"); //Extras涓虹┖涓嶅鐞� if (string.IsNullOrEmpty(jpushMessageInfo.Extras)) return; @@ -320,16 +320,19 @@ // return; //} var pushTime = json["pushTime"]; - if(pushTime == null) + if (pushTime == null) { - return; + //return; } - if (!string.IsNullOrEmpty(pushTime.ToString())) + else { - var pushDateTime = Utlis.UnixToDateTimeMS(Convert.ToInt64(pushTime)); - if (pushDateTime.AddSeconds(30) < DateTime.Now) + if (!string.IsNullOrEmpty(pushTime.ToString())) { - return; + var pushDateTime = Utlis.UnixToDateTimeMS(Convert.ToInt64(pushTime)); + if (pushDateTime.AddSeconds(30) < DateTime.Now) + { + return; + } } } } diff --git a/HDL_ON/Entity/Function/Sensor.cs b/HDL_ON/Entity/Function/Sensor.cs index 8a06e8b..51e0716 100644 --- a/HDL_ON/Entity/Function/Sensor.cs +++ b/HDL_ON/Entity/Function/Sensor.cs @@ -1,5 +1,7 @@ 锘縰sing System; using System.Collections.Generic; +using Newtonsoft.Json.Linq; +using Shared; namespace HDL_ON.Entity { @@ -82,24 +84,29 @@ function.SetAttrState(FunctionAttributeKey.Value, value); } - List<string> _intervalValue = new List<string>(); - - public void SetIntervalValue(List<string> intervalValue) - { - _intervalValue = intervalValue; - } /// <summary> /// 姣忎釜绛夌骇瀵瑰尯闂村�� /// </summary> - public List<string> GetIntervalValue(string spk) + public List<string> GetIntervalValue(Function function) { - //if (_intervalValue.Count != 0) - //{ - // return _intervalValue; - //} - _intervalValue = new List<string>(); - switch (spk) + List<string> _intervalValue = new List<string>(); + if (function.attrKeyConfigs.Count > 0) + { + foreach (var attrKey in function.attrKeyConfigs) + { + if (function.spk.Replace(".", "").Contains(attrKey.key.Replace(".", ""))) + { + foreach (var info in attrKey.configs) + { + _intervalValue.Add(info.start + " ~ " + info.end); + } + return _intervalValue; + } + } + } + + switch (function.spk) { case SPK.SensorPm25: _intervalValue.Add("0 ~ 50"); @@ -155,7 +162,6 @@ if (function.attrKeyConfigs.Count > 0) { - foreach (var attrKey in function.attrKeyConfigs) { if (function.spk.Replace(".", "").Contains(attrKey.key.Replace(".", ""))) @@ -194,10 +200,25 @@ /// <summary> /// 姣忎釜绛夌骇鐨勯鑹插�� /// </summary> - public List<uint> GetLevelColorList(string spk) + public List<uint> GetLevelColorList(Function function) { var _levelColorList = new List<uint>(); - switch (spk) + if (function.attrKeyConfigs.Count > 0) + { + foreach (var attrKey in function.attrKeyConfigs) + { + if (function.spk.Replace(".", "").Contains(attrKey.key.Replace(".", ""))) + { + foreach (var info in attrKey.configs) + { + _levelColorList.Add(Convert.ToUInt32(info.color, 16)); + } + return _levelColorList; + } + } + } + + switch (function.spk) { case SPK.SensorPm25: _levelColorList.Add(0xFFADE764); @@ -251,53 +272,69 @@ /// <summary> /// 姣忎釜绛夌骇鐨勫悕绉� /// </summary> - public List<int> GetLevelTextList(string spk) + public List<string> GetLevelTextList(Function function) { - var _levelTextList = new List<int>(); - switch (spk) + var _levelTextList = new List<string>(); + if (function.attrKeyConfigs.Count > 0) + { + foreach (var attrKey in function.attrKeyConfigs) + { + if (function.spk.Replace(".", "").Contains(attrKey.key.Replace(".", ""))) + { + foreach (var info in attrKey.configs) + { + _levelTextList.Add(info.desc); + } + return _levelTextList; + } + } + } + + + switch (function.spk) { case SPK.SensorPm25: case SPK.SensorPm10: - _levelTextList.Add(StringId.Great); - _levelTextList.Add(StringId.Good); - _levelTextList.Add(StringId.MildPollution); - _levelTextList.Add(StringId.HeavyPollution); + _levelTextList.Add(Language.StringByID(StringId.Great)); + _levelTextList.Add(Language.StringByID(StringId.Good)); + _levelTextList.Add(Language.StringByID(StringId.MildPollution)); + _levelTextList.Add(Language.StringByID(StringId.HeavyPollution)); break; case SPK.SensorCO2: - _levelTextList.Add(StringId.SensorReferenceTipCO2Level1); - _levelTextList.Add(StringId.SensorReferenceTipCO2Level2); - _levelTextList.Add(StringId.SensorReferenceTipCO2Level3); - _levelTextList.Add(StringId.SensorReferenceTipCO2Level4); + _levelTextList.Add(Language.StringByID(StringId.SensorReferenceTipCO2Level1)); + _levelTextList.Add(Language.StringByID(StringId.SensorReferenceTipCO2Level2)); + _levelTextList.Add(Language.StringByID(StringId.SensorReferenceTipCO2Level3)); + _levelTextList.Add(Language.StringByID(StringId.SensorReferenceTipCO2Level4)); break; case SPK.SensorTemperature: - _levelTextList.Add(StringId.ExtremelyCold); - _levelTextList.Add(StringId.Cold); - _levelTextList.Add(StringId.SlightlyCold); - _levelTextList.Add(StringId.Comfortable); - _levelTextList.Add(StringId.TepidFever); - _levelTextList.Add(StringId.Heat_SensorTip); - _levelTextList.Add(StringId.ExtremeHeat); + _levelTextList.Add(Language.StringByID(StringId.ExtremelyCold)); + _levelTextList.Add(Language.StringByID(StringId.Cold)); + _levelTextList.Add(Language.StringByID(StringId.SlightlyCold)); + _levelTextList.Add(Language.StringByID(StringId.Comfortable)); + _levelTextList.Add(Language.StringByID(StringId.TepidFever)); + _levelTextList.Add(Language.StringByID(StringId.Heat_SensorTip)); + _levelTextList.Add(Language.StringByID(StringId.ExtremeHeat)); break; case SPK.SensorTVOC: - _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel1); - _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel2); - _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel3); - _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel4); + _levelTextList.Add(Language.StringByID(StringId.SensorReferenceTVOCTipLevel1)); + _levelTextList.Add(Language.StringByID(StringId.SensorReferenceTVOCTipLevel2)); + _levelTextList.Add(Language.StringByID(StringId.SensorReferenceTVOCTipLevel3)); + _levelTextList.Add(Language.StringByID(StringId.SensorReferenceTVOCTipLevel4)); break; case SPK.SensorHumidity: - _levelTextList.Add(StringId.SensorReferenceHumidityTipLevel1); - _levelTextList.Add(StringId.SensorReferenceHumidityTipLevel2); - _levelTextList.Add(StringId.SensorReferenceHumidityTipLevel3); + _levelTextList.Add(Language.StringByID(StringId.SensorReferenceHumidityTipLevel1));//娼箍 + _levelTextList.Add(Language.StringByID(StringId.SensorReferenceHumidityTipLevel2)); + _levelTextList.Add(Language.StringByID(StringId.SensorReferenceHumidityTipLevel3));//骞茬嚗 break; case SPK.SensorHcho: - _levelTextList.Add(StringId.Class_I_BuildingStandard); - _levelTextList.Add(StringId.SecondaryBuildingStandard); - _levelTextList.Add(StringId.ExceedingTheStandard); + _levelTextList.Add(Language.StringByID(StringId.Class_I_BuildingStandard)); + _levelTextList.Add(Language.StringByID(StringId.SecondaryBuildingStandard)); + _levelTextList.Add(Language.StringByID(StringId.ExceedingTheStandard)); break; default: - _levelTextList.Add(99999999); - _levelTextList.Add(99999999); - _levelTextList.Add(99999999); + _levelTextList.Add(""); + _levelTextList.Add(""); + _levelTextList.Add(""); break; } return _levelTextList; @@ -390,7 +427,7 @@ } foreach (var info in attrKey.configs) { - if ((Convert.ToDouble(info.start) < values) && (Convert.ToDouble(info.end) >= values)) + if ((Convert.ToDouble(info.start) <= values) && (Convert.ToDouble(info.end) >= values)) { return level; } diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs index 5685fc8..765f05c 100644 --- a/HDL_ON/UI/MainPage.cs +++ b/HDL_ON/UI/MainPage.cs @@ -26,7 +26,7 @@ /// <summary> /// 鐗堟湰鍙� /// </summary> - public static string VersionString = "2.4.3"; + public static string VersionString = "2.4.4"; ///// <summary> ///// 瀹㈡埛绔被鍨� ///// </summary> diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs index 6584a1e..2f877b9 100644 --- a/HDL_ON/UI/UI1-Login/LoginPage.cs +++ b/HDL_ON/UI/UI1-Login/LoginPage.cs @@ -310,30 +310,30 @@ //etAccount.Text = "13288623489";//缃楁檽涓� //etAccount.Text = "18244942707"; //etAccount.Text = "13143792049"; - etAccount.Text = "18688414428";//澶╂渤3妤� + //etAccount.Text = "18688414428";//澶╂渤3妤� //etAccount.Text = "13418062953"; - etAccount.Text = "13138683659"; + //etAccount.Text = "13138683659"; //etAccount.Text = "15217626103"; //etAccount.Text = "18100573477"; //etAccount.Text = "18321091245"; //etAccount.Text = "13751916353"; - etAccount.Text = "13549566666"; - etAccount.Text = "13375012446";//娴嬭瘯鏈嶅姟鍣� - etAccount.Text = "15855403939"; - etAccount.Text = "15006564444"; - etAccount.Text = "pjh@hdlchina.com.cn"; + //etAccount.Text = "13549566666"; + //etAccount.Text = "13375012446";//娴嬭瘯鏈嶅姟鍣� + //etAccount.Text = "15855403939"; + //etAccount.Text = "15006564444"; + //etAccount.Text = "pjh@hdlchina.com.cn"; //etAccount.Text = "12345678904";//2.0 娴嬭瘯 钀ょ煶 - etAccount.Text = "18316672920"; - etAccount.Text = "18244942707"; - etAccount.Text = "1272061968@qq.com";//涓囩鍩庡競涔嬪厜E鍖�8鏍�206 - etAccount.Text = "13533335801"; - etAccount.Text = "13682244600"; - etAccount.Text = "marketing@australindo.co.id"; - etAccount.Text = "13922115008";//鍒樻�� - etAccount.Text = "1272061968@qq.com"; - etAccount.Text = "info@hdlegypt.com"; + //etAccount.Text = "18316672920"; + //etAccount.Text = "18244942707"; + //etAccount.Text = "1272061968@qq.com";//涓囩鍩庡競涔嬪厜E鍖�8鏍�206 + //etAccount.Text = "13533335801"; + //etAccount.Text = "13682244600"; + //etAccount.Text = "marketing@australindo.co.id"; + //etAccount.Text = "13922115008";//鍒樻�� + //etAccount.Text = "1272061968@qq.com"; + //etAccount.Text = "info@hdlegypt.com"; + //etAccount.Text = "18402017839"; etAccount.Text = "support7@hdlautomation.com"; - etAccount.Text = "18402017839"; } @@ -341,9 +341,9 @@ { //etAccount.Text = "464027401@qq.com";// //etAccount.Text = "15217626103";// - etAccount.Text = "13168123446";//鏄嗘槑閲戣寕椤圭洰锛屾柊椋庨棶棰� + //etAccount.Text = "13168123446";//鏄嗘槑閲戣寕椤圭洰锛屾柊椋庨棶棰� //etAccount.Text = "2949126848@qq.com";//闄堢惓 - etAccount.Text = "15014291819 "; + //etAccount.Text = "15014291819 "; //etAccount.Text = "13676202754";//宸存灄鏈嶅姟鍣� //etAccount.Text = "13602944661";//kx //etAccount.Text = "18666455392";//13375012446//13602944661//tzy 18778381374 diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/A_EnvironmentalDataCenter.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/A_EnvironmentalDataCenter.cs index 2b41c7d..a492590 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/A_EnvironmentalDataCenter.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/A_EnvironmentalDataCenter.cs @@ -497,7 +497,7 @@ { if (view.Tag.ToString() == flag) { - view.UpdataStatus(flag,updateTemp.sid, sensorAttr.state); + view.UpdataStatus(flag,updateTemp, sensorAttr.state); } } @@ -703,14 +703,12 @@ List<Function> sensorList = new List<Function>(); string imagePath = ""; string iconPath = ""; - string sensorSPK = ""; Sensor sensorTemp = new Sensor(); double assembleValues = 0.0; public SensorView(List<Function> showList, int index)//,,string spk,double value) { sensorList = showList; - sensorSPK = showList[0].spk; foreach (var s in showList) { assembleValues += Convert.ToDouble(s.GetAttrState("value").Replace(",", ".")); @@ -721,7 +719,7 @@ this.Width = Application.GetRealWidth(182); this.Height = Application.GetRealWidth(124); this.Y = Application.GetRealWidth(124 * (index / 2)); - this.Tag = sensorSPK; + this.Tag = showList[0].spk; if (index % 2 != 0) { @@ -729,7 +727,7 @@ } - switch (sensorSPK) + switch (showList[0].spk) { case SPK.SensorCO2: imagePath = "FunctionIcon/EnvirSensor/Co2Bg.png"; @@ -794,11 +792,11 @@ this.AddChidren(btnInfoIcon); btnInfoIcon.MouseUpEventHandler = (sender, e) => { - LoadInfo(sensorSPK); + LoadInfo(sensor); }; - var curLevel = sensorTemp.GetCurLevel(sensorSPK, assembleValues); - var levelTextList = sensorTemp.GetLevelTextList(sensorSPK); + var curLevel = sensorTemp.GetCurLevel(sensor); + var levelTextList = sensorTemp.GetLevelTextList(sensor); btnLevel = new Button() { X = Application.GetRealWidth(25), @@ -806,9 +804,9 @@ Width = Application.GetRealWidth(100), Height = Application.GetRealWidth(32), TextAlignment = TextAlignment.CenterLeft, - TextColor = sensorTemp.GetLevelColorList(sensorSPK)[curLevel - 1], + TextColor = sensorTemp.GetLevelColorList(sensor)[curLevel - 1], TextSize = CSS_FontSize.SubheadingFontSize, - TextID = levelTextList[curLevel - 1], + Text = levelTextList[curLevel - 1], Tag = "SensorLevel", }; this.AddChidren(btnLevel); @@ -853,10 +851,10 @@ /// <summary> /// 鍔犺浇浼犳劅鍣ㄧ瓑绾х浉鍏充俊鎭� /// </summary> - void LoadInfo(string sensorSPK) + void LoadInfo(Function sensor) { - var levelColorList = sensorTemp.GetLevelColorList(sensorSPK); - var levelTextList = sensorTemp.GetLevelTextList(sensorSPK); + var levelColorList = sensorTemp.GetLevelColorList(sensor); + var levelTextList = sensorTemp.GetLevelTextList(sensor); Dialog dialog = new Dialog(); FrameLayout dialogBodyView = new FrameLayout(); @@ -889,7 +887,7 @@ }; infoView.AddChidren(btnTitle); - switch (sensorSPK) + switch (sensor.spk) { case SPK.SensorPm25: btnTitle.Text = "PM2.5(ug/m鲁)"; @@ -973,7 +971,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, IsBold = true, - Text = sensorTemp.GetIntervalValue(sensorSPK)[index] + Text = sensorTemp.GetIntervalValue(sensor)[index] }); subInfoView.AddChidren(new Button() @@ -984,7 +982,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, IsBold = true, - TextID = levelTextList[index] + Text = levelTextList[index] }); subInfoView.AddChidren(new Button() @@ -1019,13 +1017,13 @@ /// 鏇存柊鐘舵�� /// </summary> /// <param name="updateTemp"></param> - public void UpdataStatus(string spk ,string sid,string value) + public void UpdataStatus(string spk ,Function function,string value) { try { - if (spk == sensorSPK) + if (spk == function.spk) { - var temp = sensorList.Find((obj) => obj.sid == sid); + var temp = sensorList.Find((obj) => obj.sid == function.sid); if(temp!= null) { temp.SetAttrState("value", value); @@ -1035,10 +1033,10 @@ btnSensorValues.Text = assembleValues.ToString(); - var curLevel = sensorTemp.GetCurLevel(sensorSPK, assembleValues); + var curLevel = sensorTemp.GetCurLevel(function); - btnLevel.TextID = sensorTemp.GetLevelTextList(sensorSPK)[curLevel- 1]; - btnLevel.TextColor = sensorTemp.GetLevelColorList(sensorSPK)[curLevel - 1]; + btnLevel.Text = sensorTemp.GetLevelTextList(temp)[curLevel- 1]; + btnLevel.TextColor = sensorTemp.GetLevelColorList(function)[curLevel - 1]; } } catch (Exception ex) diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs index 2f82535..9e31a22 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs @@ -1,5 +1,6 @@ 锘縰sing System; using System.Collections.Generic; +using System.Reflection; using HDL_ON.DriverLayer; using HDL_ON.Entity; using HDL_ON.UI.CSS; @@ -348,8 +349,8 @@ /// </summary> void LoadSensorDiv(Function sensor,int index) { - var levelColorList = sensorTemp.GetLevelColorList(sensor.spk); - var levelTextList = sensorTemp.GetLevelTextList(sensor.spk); + var levelColorList = sensorTemp.GetLevelColorList(sensor); + var levelTextList = sensorTemp.GetLevelTextList(sensor); { var sensorTag = sensor.spk + sensor.sid + sensor.deviceId; FrameLayout sensorView = new FrameLayout() @@ -511,8 +512,8 @@ } else { - btnLevel.TextID = levelTextList[sensorTemp.GetCurLevel(sensor) - 1]; - btnLevel.TextColor = sensorTemp.GetLevelColorList(sensor.spk)[sensorTemp.GetCurLevel(sensor) - 1]; + btnLevel.Text = levelTextList[sensorTemp.GetCurLevel(sensor) - 1]; + btnLevel.TextColor = sensorTemp.GetLevelColorList(sensor)[sensorTemp.GetCurLevel(sensor) - 1]; btnSensorValues.Text = sensor.GetAttrState(FunctionAttributeKey.Value); } } @@ -524,34 +525,34 @@ void LoadInfo(Function sensor) { List<uint> levelColorList = new List<uint>(); - List<int> levelTextList = new List<int>(); - List<string> levelText = new List<string>(); + List<string> levelTextList = new List<string>(); + //List<string> levelText = new List<string>(); List<string> intervalList = new List<string>(); var configs = sensor.GetAttrKeyConfigs(sensor.SpkClassification); - int i = 0; - foreach(var info in configs) + //int i = 0; + //foreach(var info in configs) + //{ + // foreach(var config in info.configs) + // { + // var color = Convert.ToUInt32(config.color,16); + // var text = config.desc; + // levelColorList.Add(color); + // //levelText.Add(text); + // levelTextList.Add(i++); + // intervalList.Add(config.start + " ~ " + config.end); + // } + //} + //if (levelColorList.Count == 0) { - foreach(var config in info.configs) - { - var color = Convert.ToUInt32(config.color,16); - var text = config.desc; - levelColorList.Add(color); - levelText.Add(text); - levelTextList.Add(i++); - } - } - if (levelColorList.Count == 0) - { - levelColorList = sensorTemp.GetLevelColorList(sensor.spk); - levelTextList = sensorTemp.GetLevelTextList(sensor.spk); - intervalList = sensorTemp.GetIntervalValue(sensor.spk); - - foreach (var iii in levelTextList) - { - levelText.Add(Language.StringByID(iii)); - } + levelColorList = sensorTemp.GetLevelColorList(sensor); + levelTextList = sensorTemp.GetLevelTextList(sensor); + intervalList = sensorTemp.GetIntervalValue(sensor); + //foreach (var iii in levelTextList) + //{ + // levelText.Add(Language.StringByID(iii)); + //} } Dialog dialog = new Dialog(); @@ -650,7 +651,7 @@ }); try { - for (int index = 0; index < levelText.Count; index++) + for (int index = 0; index < levelTextList.Count; index++) { //if(sensorTemp.GetIntervalValue(sensor.spk).Count >= index) //{ @@ -678,7 +679,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, IsBold = true, - Text = sensorTemp.GetIntervalValue(sensor.spk)[index] + Text = intervalList[index] }); subInfoView.AddChidren(new Button() @@ -689,7 +690,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, IsBold = true, - Text = levelText[index] + Text = levelTextList[index] }); subInfoView.AddChidren(new Button() @@ -967,17 +968,17 @@ { if (updateTemp.spk != SPK.SensorLight) { - (btn as Button).TextID = bodyView.sensorTemp.GetLevelTextList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1]; - (btn as Button).TextColor = bodyView.sensorTemp.GetLevelColorList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1]; + (btn as Button).Text = bodyView.sensorTemp.GetLevelTextList(updateTemp)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1]; + (btn as Button).TextColor = bodyView.sensorTemp.GetLevelColorList(updateTemp)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1]; } } } } else if (btn.GetType() == typeof(ArcSeekBar)) { - (btn as ArcSeekBar).ProgressBarColor = bodyView.sensorTemp.GetLevelColorList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1]; + (btn as ArcSeekBar).ProgressBarColor = bodyView.sensorTemp.GetLevelColorList(updateTemp)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1]; - (btn as ArcSeekBar).Progress = (96 / bodyView.sensorTemp.GetLevelColorList(updateTemp.spk).Count) * bodyView.sensorTemp.GetCurLevel(updateTemp); + (btn as ArcSeekBar).Progress = (96 / bodyView.sensorTemp.GetLevelColorList(updateTemp).Count) * bodyView.sensorTemp.GetCurLevel(updateTemp); } } } -- Gitblit v1.8.0