From eb76239882830f3960b8800bb0f2c90ca7b3f378 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期四, 04 八月 2022 09:19:10 +0800 Subject: [PATCH] Merge branch 'release0123' --- HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/BrandListPage.cs | 43 HDL-ON_Android/Properties/AndroidManifest.xml | 2 HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs | 5 HDL_ON/UI/UI2/1-HomePage/HomePage.cs | 18 HDL-ON_Android/Assets/Language.ini | 13 HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/CacControlPage.cs | 8 HDL-ON_iOS/HDL-ON_iOS.csproj | 3 HDL_ON/Common/ApiUtlis.cs | 1 HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs | 17 HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_SupportSpkListPage.cs | 26 HDL_ON/UI/UI0-Public/Widget/WebViewDialog.cs | 13 HDL_ON/DAL/Mqtt/MqttClient.cs | 62 ++ HDL_ON/HDL_ON.projitems | 5 HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandListPage.cs | 239 ++++++++ HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs | 22 HDL-ON_Android/HDL-ON_Android.csproj | 2 HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs | 17 HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandFunctionListPage.cs | 333 +++++++++++ HDL-ON_iOS/Resources/Language.ini | 4 HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs | 18 HDL_ON/DAL/DriverLayer/Control.cs | 15 HDL_ON/UI/MainPage.cs | 2 SiriIntents/Server/HttpUtil.cs | 4 HDL_ON/Entity/Function/Scene.cs | 158 ++++ HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs | 107 +++ HDL-ON_Android/Assets/Phone/Public/Iot_agreement_icon.png | 0 HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs | 2 HDL_ON/Entity/Integratedbrand/IntegratedBrand.cs | 62 ++ HDL-ON_Android/Assets/Phone/Public/LinkIotIcon.png | 0 HDL_ON/UI/UI0-Public/TopViewDiv.cs | 65 +- HDL_ON/DAL/Server/NewAPI.cs | 20 HDL_ON/Entity/Function/Function.cs | 26 HDL_ON/DAL/Server/HttpUtil.cs | 4 HDL-ON_iOS/Resources/Phone/Public/Iot_agreement_icon.png | 0 HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/iot_BindTipPage.cs | 279 +++++++++ HDL_ON/Common/R.cs | 8 HDL_ON/UI/UI2/FuntionControlView/Panel/PanelHelpPage.cs | 2 HDL_ON/DAL/Server/HttpServerRequest.cs | 87 +++ 38 files changed, 1,583 insertions(+), 109 deletions(-) diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index c4deb26..3de2aa2 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -544,6 +544,8 @@ 556=Someone is running 557=Someone is standing 558=Someone is sitting +559=Bind a third-party account +560=Bound @@ -1598,7 +1600,7 @@ 408=纭娣诲姞 409=鍔熻兘鍝佺墝 -410=浣犲綋鍓嶈繕鏈坊鍔犱换浣曞钩鍙拌澶� +410=娌℃湁鎮ㄧ殑璁惧 411=鍏朵粬骞冲彴璁惧鍧囩敱绗笁鏂规湇鍔″晢鎻愪緵鏀寔 412=娣诲姞 413=鎺у埗鍣ㄦ湭寮�鍚� @@ -1619,7 +1621,7 @@ 428=璐熺瀛愭椂闂� 429=灏忔椂 430=鍒嗛挓 -431=浣犲綋鍓嶈繕涓烘坊鍔犱换浣曞钩鍙拌澶� +431=鎮ㄥ綋鍓嶈繕鏈坊鍔犱换浣曞钩鍙拌澶� 432=鍏朵粬骞冲彴璁惧鍧囩敱绗笁鏂规湇鍔″晢鎻愪緵鏀寔 433=姘撮榾 434=瀹氭椂寮�鍏� @@ -1747,6 +1749,8 @@ 556=鏈変汉鍦ㄨ窇 557=鏈変汉绔欑潃 558=鏈変汉鍧愮潃 +559=缁戝畾绗笁鏂硅处鍙� +560=宸茬粦瀹� @@ -2929,6 +2933,8 @@ 556=Someone is running 557=Someone is standing 558=Someone is sitting +559=Bind a third-party account +560=Bound 2532=Visitor Invitation Record @@ -4122,6 +4128,9 @@ 556=Someone is running 557=Someone is standing 558=Someone is sitting +559=Bind a third-party account +560=Bound + 2532=Visitor Invitation Record 2533=Visitor management diff --git a/HDL-ON_Android/Assets/Phone/Public/Iot_agreement_icon.png b/HDL-ON_Android/Assets/Phone/Public/Iot_agreement_icon.png new file mode 100644 index 0000000..a2c5b96 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/Public/Iot_agreement_icon.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/Public/LinkIotIcon.png b/HDL-ON_Android/Assets/Phone/Public/LinkIotIcon.png new file mode 100644 index 0000000..eb33281 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/Public/LinkIotIcon.png Binary files differ diff --git a/HDL-ON_Android/HDL-ON_Android.csproj b/HDL-ON_Android/HDL-ON_Android.csproj index 5bf954c..b8f8906 100644 --- a/HDL-ON_Android/HDL-ON_Android.csproj +++ b/HDL-ON_Android/HDL-ON_Android.csproj @@ -258,6 +258,8 @@ <AndroidAsset Include="Assets\Phone\FunctionIcon\ArmSensor\SomeoneStandBgIcon.png" /> <AndroidAsset Include="Assets\Phone\Collection\FunctionArmOnbg.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\HomeIcon\sensormegahealth.png" /> + <AndroidAsset Include="Assets\Phone\Public\Iot_agreement_icon.png" /> + <AndroidAsset Include="Assets\Phone\Public\LinkIotIcon.png" /> </ItemGroup> <ItemGroup> <AndroidResource Include="Resources\values\colors.xml" /> diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml index 96a61f9..0729416 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="1.5.9" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202207261"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.6.0" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202208031"> <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29" /> <!--鍙嬬洘--> <!--<uses-sdk android:minSdkVersion="8"></uses-sdk>--> diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj index b40f28c..f197eec 100644 --- a/HDL-ON_iOS/HDL-ON_iOS.csproj +++ b/HDL-ON_iOS/HDL-ON_iOS.csproj @@ -1418,8 +1418,7 @@ <BundleResource Include="Resources\Phone\FunctionIcon\ArmSensor\SomeoneRunBgIcon.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\ArmSensor\SomeoneSitBgIcon.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\ArmSensor\SomeoneStandBgIcon.png" /> - <BundleResource Include="Resources\Phone\Collection\FunctionArmOnbg.png" /> - <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\sensormegahealth.png" /> + <BundleResource Include="Resources\Phone\Public\Iot_agreement_icon.png" /> </ItemGroup> <ItemGroup> <ITunesArtwork Include="iTunesArtwork" /> diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index c4deb26..bfc05e6 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -1598,7 +1598,7 @@ 408=纭娣诲姞 409=鍔熻兘鍝佺墝 -410=浣犲綋鍓嶈繕鏈坊鍔犱换浣曞钩鍙拌澶� +410=娌℃湁鎮ㄧ殑璁惧 411=鍏朵粬骞冲彴璁惧鍧囩敱绗笁鏂规湇鍔″晢鎻愪緵鏀寔 412=娣诲姞 413=鎺у埗鍣ㄦ湭寮�鍚� @@ -1619,7 +1619,7 @@ 428=璐熺瀛愭椂闂� 429=灏忔椂 430=鍒嗛挓 -431=浣犲綋鍓嶈繕涓烘坊鍔犱换浣曞钩鍙拌澶� +431=鎮ㄥ綋鍓嶈繕鏈坊鍔犱换浣曞钩鍙拌澶� 432=鍏朵粬骞冲彴璁惧鍧囩敱绗笁鏂规湇鍔″晢鎻愪緵鏀寔 433=姘撮榾 434=瀹氭椂寮�鍏� diff --git a/HDL-ON_iOS/Resources/Phone/Public/Iot_agreement_icon.png b/HDL-ON_iOS/Resources/Phone/Public/Iot_agreement_icon.png new file mode 100644 index 0000000..a2c5b96 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/Public/Iot_agreement_icon.png Binary files differ diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs index 544f3d8..c618e15 100644 --- a/HDL_ON/Common/ApiUtlis.cs +++ b/HDL_ON/Common/ApiUtlis.cs @@ -480,6 +480,7 @@ FileUtlis.Files.DeleteFile(file); } } + FunctionList.List.securities.Clear(); foreach (var function in infoList) { function.SaveFile(); diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index 115ea7f..9cf7833 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -5,6 +5,14 @@ public static class StringId { /// <summary> + /// 宸茬粦瀹� + /// </summary> + public const int Bound = 560; + /// <summary> + /// 缁戝畾绗笁鏂硅处鍙� + /// </summary> + public const int Bind3thIotAccount = 559; + /// <summary> /// 鏈変汉鍧愮潃 /// </summary> public const int SomeoneSitting = 558; diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index 08092a6..2b0623c 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -1032,6 +1032,12 @@ /// <param name="updateBytes"></param> public void UpdataFunctionStatus(string revString, byte[] usefulBytes,bool isCloudData = false) { + ////test 浜戠杩炴帴鎴愬姛鏃讹紝涓嶉�傜敤鏈湴鏁版嵁鏇存柊 + //if (Ins.GatewayOnline_Cloud && !isCloudData) + //{ + // return; + //} + var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<AlinkFunctionStatusObj>(revString); if (temp != null) { @@ -1044,11 +1050,15 @@ if (Ins.GatewayOnline_Local && isCloudData)//鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞� { - if (FunctionList.List.OtherBrandFunction.Count != 0) + if (FunctionList.List.OtherBrandFunction.Count == 0) + { + MainPage.Log($"A鍗忚鏇存柊鐘舵��:鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞�..."); + return; + } + else { if (FunctionList.List.OtherBrandFunction.Find((obj) => obj.sid == updateTemp.sid) == null) { - //MainPage.Log($"A鍗忚鏇存柊鐘舵��:鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞�..."); return; } } @@ -1271,6 +1281,7 @@ case SPK.HvacAirFresh: case SPK.SensorGas: case SPK.HvacCac: + case SPK.SensorHelp: //璁惧鐘舵�佹帹閫� //鐘舵�佹洿鏂� Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid, updateTemp.status); diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs index f5abbf2..ea5e472 100644 --- a/HDL_ON/DAL/Mqtt/MqttClient.cs +++ b/HDL_ON/DAL/Mqtt/MqttClient.cs @@ -205,6 +205,7 @@ QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce }; + #region 鏁版嵁鏇存柊鎺ㄩ�佷富棰� //appHomeRefresh锛氫綇瀹呮暟鎹埛鏂伴�氱煡--鏉ㄦ稕 var appHomeRefresh = new MqttTopicFilter() @@ -273,6 +274,49 @@ } } } + + /// <summary> + /// 璁㈤槄缁戝畾绗笁鏂筰ot璐﹀彿缁撴灉 + /// </summary> + /// <returns></returns> + public static async Task<bool> SubscribeAsync3tyIotbind() + { + var topicFilter = new MqttTopicFilter() + { + Topic = $"/user/{UserInfo.Current.ID}/app/third/bind/send", + QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce + }; + var result = await RemoteMqttClient.SubscribeAsync(topicFilter); + if (result.Items[0].ResultCode == MQTTnet.Client.Subscribing.MqttClientSubscribeResultCode.GrantedQoS0) + { + Utlis.WriteLine("璁㈤槄缁戝畾绗笁鏂筰ot璐﹀彿缁撴灉鎴愬姛锛�"); + return true; + } + return false; + } + /// <summary> + /// 鍙栨秷璁㈤槄缁戝畾绗笁鏂筰ot璐﹀彿缁撴灉 + /// </summary> + /// <returns></returns> + public static async Task<bool> UnsubscribeAsync3tyIotbind() + { + string[] strs = new string[] { + $"/user/{UserInfo.Current.ID}/app/third/bind/send" + }; + + var result = await RemoteMqttClient.UnsubscribeAsync(strs); + + if (result.Items[0].ReasonCode == MQTTnet.Client.Unsubscribing.MqttClientUnsubscribeResultCode.Success) + { + Utlis.WriteLine("鍙栨秷璁㈤槄缁戝畾绗笁鏂筰ot璐﹀彿缁撴灉鎴愬姛锛�"); + return true; + } + return false; + } + /// <summary> + /// 缁戝畾绗笁鏂瑰钩鍙版帴鏀跺洖璋冧簨浠� + /// </summary> + public static Action Bind3tyIotAction; /// <summary> /// 鍚姩杩滅▼Mqtt @@ -352,8 +396,14 @@ //鏂版尋涓嬬嚎涓婚鏂规 鏀跺埌鎸や笅绾夸富棰� ReceiveNotifySqueezeAsync(mMes); } + //缁戝畾绗笁鏂瑰钩鍙扮粨鏋滈�氱煡 + else if(topic == $"/user/{UserInfo.Current.ID}/app/third/bind/send") + { + var revString = Encoding.UTF8.GetString(e.ApplicationMessage.Payload); + Bind3tyIotAction?.Invoke(); + } //璁惧鍦ㄧ嚎绂荤嚎鐘舵�佹帹閫� - else if(topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/son/session/online") + else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/son/session/online") { try { @@ -373,7 +423,7 @@ //} } - catch(Exception ex) + catch (Exception ex) { } @@ -504,7 +554,8 @@ } HomePage.LoadEvent_RefreshSecurityStatus(); } - }catch(Exception ex) + } + catch (Exception ex) { MainPage.Log($"瀹夐槻杩滅▼淇℃伅寮傚父:{ex.Message}"); } @@ -515,12 +566,17 @@ //Tag 缃戠粶鐘舵�佽В鏋� else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/property/send") { + var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey); var revString = Encoding.UTF8.GetString(bytes); MainPage.Log($"mqtt 鐘舵�佹洿鏂�:{revString}"); Control.Ins.UpdataFunctionStatus(revString, null, true); //Control.Ins.MsgInfoList.Add($"mqtt 鐘舵�佹洿鏂�:{revString}"); //Control.Ins.MsgInfoList.Add(revString + "\r\n"); + //if (FunctionList.List.OtherBrandFunction.Find((obj) => obj.sid == updateTemp.sid) == null) + //{ + // return; + //} } //涓�绔彛鏁版嵁瑙f瀽 else diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs index 242ae06..3a6d450 100644 --- a/HDL_ON/DAL/Server/HttpServerRequest.cs +++ b/HDL_ON/DAL/Server/HttpServerRequest.cs @@ -2623,6 +2623,93 @@ return pack; } + + /// <summary> + /// 鑾峰彇绗笁鏂瑰搧鐗屽垪琛╛Iot + /// </summary> + public ResponsePackNew Get3tyIotBrandList() + { + Dictionary<string, object> d = new Dictionary<string, object>(); + var requestJson = HttpUtil.GetSignRequestJson(d); + var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetBrandList_Iot, requestJson); + + return pack; + } + /// <summary> + /// 鎼滅储绗笁鏂硅澶嘷iot + /// </summary> + /// <returns></returns> + public ResponsePackNew Search3tyIotDevice(string companyId) + { + + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("companyId", companyId); + var requestJson = HttpUtil.GetSignRequestJson(d); + + var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Search3tyIotDevice, requestJson); + + return pack; + } + + /// <summary> + /// 鎼滅储绗笁鏂硅澶囧姛鑳藉垪琛╛iot + /// </summary> + /// <returns></returns> + public ResponsePackNew Get3tyIotDeviceFunctionList(string companyId) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("companyId", companyId); + var requestJson = HttpUtil.GetSignRequestJson(d); + + var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Get3tyIotFunction, requestJson); + return pack; + } + /// <summary> + /// 鑾峰彇绗笁鏂瑰钩鍙版敮鎸佺殑璁惧绫诲瀷鍒楄〃 + /// </summary> + /// <returns></returns> + public ResponsePackNew Get3tyIotSupportSpkList(string companyId) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("companyId", companyId); + var requestJson = HttpUtil.GetSignRequestJson(d); + + var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Get3tyIotFunction, requestJson); + return pack; + } + + /// <summary> + /// 璁剧疆绗笁鏂硅澶囩粦瀹氱殑浣忓畢 + /// </summary> + /// <returns></returns> + public ResponsePackNew Set3tyIotFunctionToHouse(string deviceId,string homeId, string companyId) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("deviceId", deviceId); + d.Add("homeId", homeId); + d.Add("companyId", companyId); + var requestJson = HttpUtil.GetSignRequestJson(d); + + var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Setting3tyIotFunctionToHouse, requestJson); + return pack; + } + + /// <summary> + /// 瑙g粦绗笁鏂瑰钩鍙拌处鍙� + /// </summary> + /// <returns></returns> + public ResponsePackNew Unbound3tyIotAccount(string companyId) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("companyId", companyId); + var requestJson = HttpUtil.GetSignRequestJson(d); + + var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Unbound3tyIotAccount, requestJson); + return pack; + } + + + /// <summary> /// 鑾峰彇缁戝畾鐨勭涓夋柟鍝佺墝鍒楄〃 /// </summary> diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs index fef52b7..015e50c 100644 --- a/HDL_ON/DAL/Server/HttpUtil.cs +++ b/HDL_ON/DAL/Server/HttpUtil.cs @@ -18,8 +18,8 @@ /// 鍏叡鍩熷悕灏辫繎瑙f瀽 /// </summary> - public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; - //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm + //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; + public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm /// <summary> /// RegionMark /// </summary> diff --git a/HDL_ON/DAL/Server/NewAPI.cs b/HDL_ON/DAL/Server/NewAPI.cs index 6e52668..bf216a1 100644 --- a/HDL_ON/DAL/Server/NewAPI.cs +++ b/HDL_ON/DAL/Server/NewAPI.cs @@ -609,6 +609,26 @@ /// 鑾峰彇鍝佺墝鍒楄〃 /// </summary> public const string Api_Post_GetBrandList = "/home-wisdom/app/product/brand/list"; + /// <summary> + /// 鑾峰彇鍝佺墝鍒楄〃_iot 骞冲彴 + /// </summary> + public const string Api_Post_GetBrandList_Iot = "/smart-open/platform/auth/brand/list"; + /// <summary> + /// 鍙戠幇绗笁鏂筰ot骞冲彴璁惧 + /// </summary> + public const string Api_Post_Search3tyIotDevice = "/home-wisdom/app/open/discoveryDevice"; + /// <summary> + /// 鑾峰彇绗笁鏂筰ot骞冲彴璁惧鍔熻兘鍒楄〃 + /// </summary> + public const string Api_Post_Get3tyIotFunction = "/home-wisdom/app/open/extDeviceList"; + /// <summary> + /// 閰嶇疆绗笁鏂筰ot骞冲彴璁惧鍔熻兘鍒颁綇瀹� + /// </summary> + public const string Api_Post_Setting3tyIotFunctionToHouse = "/home-wisdom/app/open/assignDeviceToHouse"; + /// <summary> + /// 瑙g粦绗笁鏂筰ot骞冲彴璐﹀彿 + /// </summary> + public const string Api_Post_Unbound3tyIotAccount = "/smart-open/open-platform/tripartite/userUnbind"; #region 鈻� -- 绾㈠瀹濇帴鍙__________________________ /// <summary> diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 1482e07..b9716b4 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -243,7 +243,30 @@ /// <summary> /// 澶囨敞 /// </summary> - public string name; + public string name = ""; + /// <summary> + /// 璁惧缁戝畾鐨刪omeId + /// </summary> + private string _homeId = ""; + public string homeId + { + get + { + if (string.IsNullOrEmpty(_homeId)) + { + return DB_ResidenceData.Instance.CurrentRegion.id; + } + else + { + return _homeId; + } + } + set + { + _homeId = value; + } + } + /// <summary> /// 璁惧ID /// 浜戠璐熻矗鐢熸垚 @@ -1577,6 +1600,7 @@ var spkList = new List<string>(); //spkList.Add(SensorLight); spkList.Add(SensorPir); + spkList.Add(SensorHelp); spkList.Add(SensorDoorWindow); spkList.Add(SensorSmoke); spkList.Add(SensorWater); diff --git a/HDL_ON/Entity/Function/Scene.cs b/HDL_ON/Entity/Function/Scene.cs index e5abff0..a7ac909 100644 --- a/HDL_ON/Entity/Function/Scene.cs +++ b/HDL_ON/Entity/Function/Scene.cs @@ -14,7 +14,7 @@ { get { - if(_ScenePack == null) + if (_ScenePack == null) { _ScenePack = new SceneApiPack(); } @@ -24,7 +24,7 @@ } - public class Scene + public class Scene { public Scene() { @@ -50,10 +50,6 @@ /// 缃戝叧ID /// </summary> public string gatewayId = ""; - /// <summary> - /// 浜戠oss瀛樺偍鍥剧墖鐨勮矾寰� - /// </summary> - public string image = ""; /// <summary> /// 鎵�灞炴埧闂村垪琛� /// </summary> @@ -96,6 +92,11 @@ /// </summary> public string userId = UserInfo.Current.ID; + /// <summary> + /// 浜戠oss瀛樺偍鍥剧墖鐨勮矾寰� + /// </summary> + public string image = ""; + ///// <summary> ///// 鍦烘櫙鑳屾櫙 ///// </summary> @@ -103,21 +104,105 @@ { get { - if (string.IsNullOrEmpty(image)) + //if (string.IsNullOrEmpty(image)) + //{ + // return "Intelligence/Gallery/scenebg1.png"; + //} + //else + //{ + // return image; + //} + + if (image.Contains("Intelligence/Gallery/scenebg")) { - return "Intelligence/Gallery/scenebg1.png"; + return image; } else { - return image; + var sceneImageInfo = OssSceneImages.Find((obj) => obj.defaultIconName == image); + if (sceneImageInfo != null) + { + return sceneImageInfo.defaultIconName; + } + else + { + return "Intelligence/Gallery/scenebg1.png"; + } } } set { - image = value; + var sceneImageInfo = OssSceneImages.Find((obj) => "Intelligence/Gallery/" + obj.defaultIconName + ".png" == value); + if (sceneImageInfo != null) + { + image = sceneImageInfo.defaultIconUrl; + } + else + { + image = value; + } } } - + + /// <summary> + /// 浜戠鍦烘櫙榛樿鍥惧簱鏁版嵁 + /// 2022-08-03 10:57:31 wxr + /// 閰嶅悎璞嗚眴淇敼浜戠鏁版嵁 + /// 璋冭瘯瀹濄�乷n pro鍜屽钩鍙板搴� + /// </summary> + public List<SceneImageInfo> OssSceneImages = new List<SceneImageInfo>() + { + new SceneImageInfo + { + defaultIconName = "scenebg1", + defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/781c397f-611a-48a2-a3ed-2520ffb971bb.png" + }, + new SceneImageInfo + { + defaultIconName = "scenebg2", + defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/be2a7c63-a6c0-427a-bb6d-f5c06f5b2f05.png" + }, + new SceneImageInfo + { + defaultIconName = "scenebg3", + defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/5d801aca-03fb-4ef3-88ec-75ade3aa1c94.png" + }, + new SceneImageInfo + { + defaultIconName = "scenebg4", + defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/a205306c-4fcd-4ea1-8e88-e84282dc0d54.png" + }, + new SceneImageInfo + { + defaultIconName = "scenebg5", + defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/93a0acdc-14be-4776-a9fd-e0fc6f13c909.png" + }, + new SceneImageInfo + { + defaultIconName = "scenebg6", + defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/45074923-2227-422a-be33-e37e6c3f9d23.png" + }, + new SceneImageInfo + { + defaultIconName = "scenebg7", + defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/28b3e459-041e-4ea1-9ff9-57053c5357f4.png" + }, + new SceneImageInfo + { + defaultIconName = "scenebg8", + defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/d470b979-cc06-4701-a2bd-7301856c9195.png" + }, + new SceneImageInfo + { + defaultIconName = "scenebg9", + defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/1a130d03-86b2-4174-b986-6f6c312a959f.png" + }, + new SceneImageInfo + { + defaultIconName = "scenebg10", + defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/54c1c7ab-9b63-4487-a77d-d5d3dadd9801.png" + } + }; /// <summary> /// 鍦烘櫙鍔熻兘鍒楄〃 @@ -205,7 +290,7 @@ } roomNameList += findRoom.floorName + findRoom.roomName; } - if (roomNameList == "" ) + if (roomNameList == "") { roomNameList = Shared.Language.StringByID(StringId.WholeZone); } @@ -330,7 +415,7 @@ { //閲嶇疆鎵ц鍊掕鏃� this.countdownTime = 0; - if(MainPage.NoLoginMode) + if (MainPage.NoLoginMode) { var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); @@ -351,7 +436,7 @@ /// </summary> public string UpdateScene() { - if(MainPage.NoLoginMode) + if (MainPage.NoLoginMode) { var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); @@ -380,8 +465,8 @@ public string GetDelayText() { var delayInt = 0; - int.TryParse(delay,out delayInt); - if(delayInt == 0) + int.TryParse(delay, out delayInt); + if (delayInt == 0) { return Language.StringByID(StringId.NoDelay); } @@ -389,7 +474,8 @@ if (delayInt > 60) { text = (delayInt / 60) + Language.StringByID(StringId.m) + (delayInt % 60) + Language.StringByID(StringId.s); - }else + } + else { text = delayInt + Language.StringByID(StringId.s); } @@ -513,17 +599,17 @@ sceneFunctionInfo += perState.value + "%" + " "; } var cctState = status.Find((obj) => obj.key == FunctionAttributeKey.CCT); - if(cctState != null) + if (cctState != null) { sceneFunctionInfo += cctState.value + "K" + " "; } var rgbState = status.Find((obj) => obj.key == FunctionAttributeKey.RGB); - if(rgbState!=null) + if (rgbState != null) { //sceneFunctionInfo += new cctState.value + "%" + " "; } - + var perAngle = status.Find((obj) => obj.key == FunctionAttributeKey.Angle); if (perAngle != null) { @@ -607,7 +693,7 @@ { var us = ""; var swithchString = key; - if(!string.IsNullOrEmpty(inputKey)) + if (!string.IsNullOrEmpty(inputKey)) { swithchString = inputKey; } @@ -639,7 +725,7 @@ public string GetValueText(string temp = "") { string catchString = value; - if(temp!= "") + if (temp != "") { catchString = temp; } @@ -655,7 +741,7 @@ case FunctionAttributeKey.Percent: case FunctionAttributeKey.Angle: int outT = 0; - int.TryParse(catchString,out outT); + int.TryParse(catchString, out outT); if (outT < 0) catchString = "0"; if (catchString == "") @@ -759,4 +845,28 @@ public List<string> pushTarget = new List<string>(); } -} + public class SceneImageInfoList + { + //public Dictionary<string, string> Dic_SceneImages; + + //public SceneImageInfoList() + //{ + // Dic_SceneImages = new Dictionary<string, string>(); + // foreach(var sceneImage in sceneImages) + // { + // Dic_SceneImages.Add(sceneImage.defaultIconName, sceneImage.defaultIconUrl); + // } + //} + + + } + + public class SceneImageInfo + { + public string defaultIconName; + public string defaultIconUrl; + + } + + +} \ No newline at end of file diff --git a/HDL_ON/Entity/Integratedbrand/IntegratedBrand.cs b/HDL_ON/Entity/Integratedbrand/IntegratedBrand.cs index b4f5d8b..7ba544a 100644 --- a/HDL_ON/Entity/Integratedbrand/IntegratedBrand.cs +++ b/HDL_ON/Entity/Integratedbrand/IntegratedBrand.cs @@ -28,6 +28,68 @@ /// </summary> public string productPlatform; } + /// <summary> + /// 绗笁鏂归泦鎴愬搧鐗屽璞$被 + /// </summary> + public class IntegratedBrand_Iot + { + public IntegratedBrand_Iot() + { + } + /// <summary> + /// id + /// </summary> + public string authBrandId; + + public string brandName + { + get + { + if(Language.CurrentLanguage == "Chinese") + { + return authBrandNameCn; + } + else + { + return authBrandNameEn; + } + } + } + /// <summary> + /// 鍝佺墝鍚嶇О涓枃 + /// </summary> + public string authBrandNameCn; + /// <summary> + /// 鍝佺墝鍚嶇О鑻辨枃 + /// </summary> + public string authBrandNameEn; + /// <summary> + /// 鍝佺墝鍓爣棰�(涓枃) + /// </summary> + public string authBrandSubheadCn; + /// <summary> + /// 鍝佺墝鍓爣棰�(鑻辨枃) + /// </summary> + public string authBrandSubheadEn; + /// <summary> + /// 鍥剧墖url + /// </summary> + public string authrBandIconUrl; + /// <summary> + /// 璁よ瘉鎺堟潈鍦板潃 + /// </summary> + public string authorizationUrl; + /// <summary> + /// 鏄惁宸茬粡鎺堟潈 + /// </summary> + public bool hasAuthorization; + /// <summary> + /// 鍏徃id + /// </summary> + public string companyId; + + public string clientId; + } /// <summary> /// 绗笁鏂硅澶囦俊鎭� diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index f2da282..6002a93 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -507,6 +507,11 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\Visitor\LpTimeDialogCallBak.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\Visitor\LpTipDialogCallBack.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmSensor\SensorMegahealth_AlarmDataStatisticsPage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\Iot_BrandListPage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\iot_BindTipPage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\Iot_BrandFunctionListPage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\Iot_AuthorizedPage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\Iot_SupportSpkListPage.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" /> diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs index 5121da4..573664e 100644 --- a/HDL_ON/UI/MainPage.cs +++ b/HDL_ON/UI/MainPage.cs @@ -26,7 +26,7 @@ /// <summary> /// 鐗堟湰鍙� /// </summary> - public static string VersionString = "1.5.9"; + public static string VersionString = "1.6.0"; ///// <summary> ///// 瀹㈡埛绔被鍨� ///// </summary> diff --git a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs index 0567578..49d4fc1 100644 --- a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs +++ b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs @@ -148,6 +148,11 @@ pirPage.ShowColltionButton = false; pirPage.AddForm(function, btnCollectionIcon, btnName, btnFromFloor); break; + case SPK.SensorHelp: + var helpPage = new PanelHelpPage(); + helpPage.ShowColltionButton = false; + helpPage.AddForm(function, btnCollectionIcon, btnName, btnFromFloor); + break; case SPK.SensorWater: var waterPage = new SensorWaterImmersionPage(); waterPage.ShowColltionButton = false; diff --git a/HDL_ON/UI/UI0-Public/TopViewDiv.cs b/HDL_ON/UI/UI0-Public/TopViewDiv.cs index e20fdc3..63e8ba3 100644 --- a/HDL_ON/UI/UI0-Public/TopViewDiv.cs +++ b/HDL_ON/UI/UI0-Public/TopViewDiv.cs @@ -79,12 +79,12 @@ /// </summary> /// <param name="frame"></param> /// <param name="tilte"></param> - public void LoadTopView() + public void LoadTopView(uint color = CSS_Color.TopViewColor) { contentView = new FrameLayout() { Height = Application.GetRealHeight(64), - BackgroundColor = CSS_Color.TopViewColor, + BackgroundColor = color, }; baseView.AddChidren(contentView); @@ -334,9 +334,9 @@ /// </summary> /// <param name="frame"></param> /// <param name="tilte"></param> - public void LoadTopView_Add3tyIot(string type, Action<string, string> callBack) + public void LoadTopView_Add3tyIot( Action<string, string> callBack) { - LoadTopView(); + LoadTopView(CSS_Color.MainBackgroundColor); var btnAddIcon = new Button() { @@ -344,39 +344,40 @@ Y = Application.GetRealHeight(29), Width = Application.GetMinRealAverage(28), Height = Application.GetMinRealAverage(28), - UnSelectedImagePath = "Public/AddIcon.png", + UnSelectedImagePath = "Public/LinkIotIcon.png", }; contentView.AddChidren(btnAddIcon); btnAddIcon.MouseUpEventHandler += (sender, e) => { - if (type == "floors") - { - Action<string> callBackAction = (floorName) => - { - callBack("add", floorName); - }; - string newFloorName = "1F"; - for (int i = 0; i < SpatialInfo.CurrentSpatial.FloorList.Count + 1;) - { - newFloorName = ++i + "F"; - if (null == SpatialInfo.CurrentSpatial.FloorList.Find((obj) => obj.roomName == newFloorName)) - { - break; - } - } - var fs = new List<string>(); - foreach (var f in SpatialInfo.CurrentSpatial.FloorList) - { - fs.Add(f.roomName); - } - new PublicAssmebly().LoadDialog_EditParater(StringId.AddFloors, newFloorName, callBackAction, StringId.FloorNameCannotBeEmpty, - StringId.AddFloorFailed_FloorAlreadyExist, fs); - } - else - { - callBack("", ""); - } + var page = new Iot_BrandListPage(); + MainPage.BasePageView.AddChidren(page); + page.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + } + + + /// <summary> + /// 鍚慺ramelayout娣诲姞椤堕儴鍖哄煙,绗笁鏂瑰钩鍙� + /// </summary> + public void LoadTopView_3tyIot(Action action) + { + LoadTopView(CSS_Color.MainBackgroundColor); + + var btnAddIcon = new Button() + { + X = Application.GetRealWidth(337), + Y = Application.GetRealHeight(29), + Width = Application.GetMinRealAverage(28), + Height = Application.GetMinRealAverage(28), + UnSelectedImagePath = "Public/Iot_agreement_icon.png", + }; + contentView.AddChidren(btnAddIcon); + + btnAddIcon.MouseUpEventHandler += (sender, e) => + { + action(); }; } diff --git a/HDL_ON/UI/UI0-Public/Widget/WebViewDialog.cs b/HDL_ON/UI/UI0-Public/Widget/WebViewDialog.cs index 63457e1..19ea6e0 100644 --- a/HDL_ON/UI/UI0-Public/Widget/WebViewDialog.cs +++ b/HDL_ON/UI/UI0-Public/Widget/WebViewDialog.cs @@ -19,6 +19,9 @@ /// </summary> public WebView mWebView; + private Action closeAction; + + /// <summary> /// WebViewDialog /// </summary> @@ -26,6 +29,14 @@ { bodyView = new FrameLayout(); } + public WebViewDialog(Action action) + { + closeAction = action; + bodyView = new FrameLayout(); + } + + + /// <summary> /// 鍔犺浇椤甸潰 @@ -34,7 +45,7 @@ { bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; this.AddChidren(bodyView); - new TopViewDiv(this, bodyView, titleStr).LoadTopView(); + new TopViewDiv(this, bodyView, titleStr).LoadTopView(closeAction); //WebView mWebView = new WebView() { diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs index e44aaf9..7c631aa 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs @@ -1047,10 +1047,10 @@ btnbg.SelectedImagePath = "Collection/FunctionArmOnbg.png"; } - if (!function.online) - { - btnbg.UnSelectedImagePath = "Collection/FunctionOfflineBg.png"; - } + //if (!function.online) + //{ + // btnbg.UnSelectedImagePath = "Collection/FunctionOfflineBg.png"; + //} } if (index == 0) @@ -1456,6 +1456,16 @@ btnState.SelectedTextColor = CSS_Color.MainBackgroundColor; btnState.TextColor = CSS_Color.MainColor;//PromptingColor1 } + + //绱ф�ユ眰鍔� + else if (function.spk == SPK.SensorHelp) + { + btnName.TextColor = CSS_Color.MainBackgroundColor; + btnName.SelectedTextColor = CSS_Color.MainBackgroundColor; + btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_white.png"; + btnIcon.SelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_white.png"; + } + else { Button btnSwitch; diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs index dbba017..afe7efb 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs @@ -446,6 +446,14 @@ } } } + else if(function.spk == SPK.SensorHelp) + { + var tempStatus = function.attributes.Find((sta) => sta.key == FunctionAttributeKey.AlarmStatus); + if(tempStatus != null) + { + state = tempStatus.curValue.ToString() == "alarm"; + } + } else { state = function.trait_on_off.curValue.ToString() == "on"; @@ -466,7 +474,14 @@ { if (function.spk != SPK.LightSwitch) { - btn.Text = function.lastState; + if (function.spk == SPK.SensorHelp) + { + btn.TextID = StringId.InAlarming; + } + else + { + btn.Text = function.lastState; + } } } } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/BrandListPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/BrandListPage.cs index b9406c7..55b8dc9 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/BrandListPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/BrandListPage.cs @@ -26,13 +26,20 @@ }; - new TopViewDiv(bodyView, Language.StringByID(StringId.FunctionBrand)).LoadTopView();//.LoadTopView_AddIcon("3ty",action);//.LoadTopView();// + new TopViewDiv(bodyView, Language.StringByID(StringId.FunctionBrand)).LoadTopView_Add3tyIot(action); - bodyView.BackgroundColor = CSS_Color.BackgroundColor; + bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; + + bodyView.AddChidren(new Button + { + Y = Application.GetRealHeight(64), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS_Color.DividingLineColor, + }); contentView = new VerticalRefreshLayout() { - Y = Application.GetRealHeight(64), + Y = Application.GetRealHeight(65), Height = Application.GetRealHeight(603), }; bodyView.AddChidren(contentView); @@ -102,22 +109,23 @@ { var row = new RowLayout() { - Height = Application.GetRealHeight(50), + Height = Application.GetRealHeight(87), BackgroundColor = CSS_Color.MainBackgroundColor, LineColor = 0x00000000, }; contentView.AddChidren(row); - if (isFrist) - { - isFrist = false; - } - else + //if (isFrist) + //{ + // isFrist = false; + //} + //else { Button btnLine = new Button() { - X = Application.GetRealWidth(56), - Width = Application.GetRealWidth(303), + Y = Application.GetRealHeight(86), + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), Height = 1, BackgroundColor = CSS_Color.DividingLineColor, }; @@ -128,9 +136,9 @@ { X = Application.GetRealWidth(12), Gravity = Gravity.CenterVertical, - Width = Application.GetRealWidth(32), - Height = Application.GetRealWidth(32), - Radius = (uint)Application.GetRealWidth(4), + Width = Application.GetRealWidth(47), + Height = Application.GetRealWidth(47), + Radius = (uint)Application.GetRealWidth(9), BackgroundColor = CSS_Color.PromptingColor1 }; row.AddChidren(btnIcon); @@ -146,11 +154,11 @@ Button btnName = new Button() { - X = Application.GetRealWidth(56), - Width = Application.GetRealWidth(303), + X = Application.GetRealWidth(83), + Width = Application.GetRealWidth(210), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = CSS_FontSize.TextFontSize, + TextSize = CSS_FontSize.SubheadingFontSize, Text = brand.brandName, }; row.AddChidren(btnName); @@ -158,6 +166,7 @@ ImageUtlis.Current.Load3tyBrandIconImages(brand.brandName, brand.brandIcon, btnIcon); btnName.MouseUpEventHandler = (sender, e) => { + var page = new DeviceListPage(brand); MainPage.BasePageView.AddChidren(page); page.LoadPage(); diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs new file mode 100644 index 0000000..e3c0244 --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs @@ -0,0 +1,107 @@ +锘縰sing System; +using Shared; +using HDL_ON.Entity; +using HDL_ON.DAL.Server; + +namespace HDL_ON.UI +{ + public class Iot_AuthorizedPage + { + HttpServerRequest http = new HttpServerRequest(); + + IntegratedBrand_Iot brand_Iot; + + Action boudedAction; + + public Iot_AuthorizedPage(IntegratedBrand_Iot brand,Action action) + { + brand_Iot = brand; + boudedAction = action; + } + + + + public void LoadView() + { + string url = brand_Iot.authorizationUrl + $"?companyId={brand_Iot.companyId}&openUId={UserInfo.Current.ID}&client_id={brand_Iot.clientId}"; + var dd = new WebViewDialog(()=> { + UnsubscribeAsync3tyIotbind(); + }); + dd.LoadPage("", url); + DAL.Mqtt.MqttClient.Bind3tyIotAction = () => { + UnsubscribeAsync3tyIotbind(); + Application.RunOnMainThread(() => + { + http.Search3tyIotDevice(brand_Iot.companyId); + boudedAction?.Invoke(); + dd.Close(); + }); + }; + SubscribeAsync3tyIotbind(); + } + + /// <summary> + /// 璁㈤槄缁戝畾绗笁鏂筰ot璐﹀彿缁撴灉 + /// </summary> + private void SubscribeAsync3tyIotbind() + { + new System.Threading.Thread(async () => + { + try + { + var result = await DAL.Mqtt.MqttClient.SubscribeAsync3tyIotbind(); + } + catch { } + finally + { + + } + }) + { IsBackground = true }.Start(); + } + + /// <summary> + /// 鍙栨秷璁㈤槄缁戝畾绗笁鏂筰ot璐﹀彿缁撴灉 + /// </summary> + private void UnsubscribeAsync3tyIotbind() + { + new System.Threading.Thread(async () => + { + try + { + var result = await DAL.Mqtt.MqttClient.UnsubscribeAsync3tyIotbind(); + } + catch { } + finally + { + + } + }) + { IsBackground = true }.Start(); + } + /// <summary> + /// 鎼滅储绗笁鏂硅澶� + /// </summary> + private void SearchDevice() + { + var pack = http.Search3tyIotDevice(brand_Iot.companyId); + if(pack!= null) + { + + } + } + + /// <summary> + /// 鑾峰彇绗笁鏂瑰姛鑳藉垪琛� + /// </summary> + private void GetFunction() + { + var pack = http.Get3tyIotDeviceFunctionList(brand_Iot.companyId); + if(pack != null) + { + + } + } + + } +} diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandFunctionListPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandFunctionListPage.cs new file mode 100644 index 0000000..56c39d1 --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandFunctionListPage.cs @@ -0,0 +1,333 @@ +锘縰sing System; +using System.Collections.Generic; +using HDL_ON.DAL.Server; +using HDL_ON.Entity; +using HDL_ON.UI.CSS; +using Shared; +namespace HDL_ON.UI +{ + public class Iot_BrandFunctionListPage :FrameLayout + { + FrameLayout bodyView; + + FrameLayout contentView; + + + + IntegratedBrand_Iot brand_Iot; + /// <summary> + /// 瑙g粦鍥炶皟 + /// </summary> + public Action unboundAction; + + public Iot_BrandFunctionListPage(IntegratedBrand_Iot brand_Iot) + { + bodyView = this; + this.brand_Iot = brand_Iot; + } + + public void LoadPage() + { + Action action = () => { + var page = new iot_BindTipPage(); + MainPage.BasePageView.AddChidren(page); + page.unboundAction = () => { + this.RemoveFromParent(); + unboundAction?.Invoke(); + }; + page.LoadPage(brand_Iot); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + new TopViewDiv(bodyView, brand_Iot.brandName).LoadTopView_3tyIot(action); + + bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; + + + bodyView.AddChidren(new Button + { + Y = Application.GetRealHeight(64), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS_Color.DividingLineColor, + }); + + Button btnTipText = new Button() + { + Y = Application.GetRealHeight(80), + Width = Application.GetRealWidth(347), + Height = Application.GetRealHeight(65), + Gravity = Gravity.CenterHorizontal, + Radius = (uint)Application.GetRealWidth(5), + BackgroundColor = 0x194484F4, + TextColor = CSS_Color.FirstLevelTitleColor, + Padding = new Padding(12, Application.GetRealWidth(16), 12, Application.GetRealWidth(16)), + TextSize = CSS_FontSize.TextFontSize, + Text = "榛樿灏嗙涓夋柟鍝佺墝鐨勮澶囧叏閮ㄥ叧鑱斿埌On Pro涓�,鎮ㄤ篃鍙互閫氳繃涓嬫柟鐨勫紑鍏虫寜閿紝杩涜閫夋嫨鎬у叧鑱斻��", + IsMoreLines = true, + TextAlignment = TextAlignment.CenterLeft, + }; + bodyView.AddChidren(btnTipText); + + contentView = new FrameLayout() + { + Y = Application.GetRealHeight(150), + Height = Application.GetRealHeight(573), + }; + bodyView.AddChidren(contentView); + + + var waitPage = new Loading(); + contentView.AddChidren(waitPage); + waitPage.Start(""); + new System.Threading.Thread(() => + { + try + { + var pack = http.Get3tyIotDeviceFunctionList(brand_Iot.companyId); + if (pack != null) + { + if (pack.Code == StateCode.SUCCESS) + { + var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Function>>(pack.Data.ToString()); + Application.RunOnMainThread(() => + { + LoadDeviceFunctionControlZone(list); + }); + } + } + } + catch { } + finally + { + Application.RunOnMainThread(() => { + waitPage.Hide(); + waitPage.RemoveFromParent(); + }); + } + }) { IsBackground = true }.Start(); + + } + + + /// <summary> + /// 鍔犺浇璁惧鍔熻兘鏄剧ず鍖哄煙 + /// </summary> + void LoadDeviceFunctionControlZone(List<Function> list) + { + contentView.RemoveAll(); + + if (list.Count == 0) + { + NotListTipView(); + return; + } + + VerticalScrolViewLayout deviceFunctionView = new VerticalScrolViewLayout(); + contentView.AddChidren(deviceFunctionView); + + #region ContextView + var rowView = new FrameLayout(); + try + { + int index = 0; + + foreach (var function in list) + { + if(function.homeId != DB_ResidenceData.Instance.CurrentRegion.id && function.homeId != "0") + { + continue; + } + + if (index % 2 == 0) + { + rowView = new FrameLayout() + { + Height = Application.GetRealWidth(140), + }; + deviceFunctionView.AddChidren(rowView); + } + var functionView_X = Application.GetRealWidth((182 + 7) * (index % 2)); + if (index % 2 == 0) + { + functionView_X += Application.GetRealWidth(7); + } + var functionView = new FrameLayout() + { + X = functionView_X, + Width = Application.GetRealWidth(182), + Height = Application.GetRealWidth(140), + Radius = (uint)Application.GetRealWidth(12), + Tag = function.sid + }; + rowView.AddChidren(functionView); + + var btnbg = new Button() + { + UnSelectedImagePath = "Collection/Functionbg.png", + SelectedImagePath = "Collection/FunctionOnbg.png", + Tag = function.sid + }; + functionView.AddChidren(btnbg); + LoadDeviceFunctionDiv(functionView, function,btnbg); + index++; + + + } + + if (index == 0) + { + var view = new FrameLayout(); + deviceFunctionView.AddChidren(view); + + var btnNoCollectionTip = new Button() + { + Height = Application.GetRealHeight(42), + Y = Application.GetRealHeight(100), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + Text = "娌℃湁浠讳綍璁惧" + }; + view.AddChidren(btnNoCollectionTip); + } + } + catch (Exception ex) + { + } + deviceFunctionView.AddChidren(new Button { Height = Application.GetRealHeight(30) }); + #endregion + + } + + + /// <summary> + /// 鍔犺浇鍔熻兘鎺у埗鍗$墖 + /// </summary> + void LoadDeviceFunctionDiv(FrameLayout view, Function function,Button btnBg) + { + try + { + Button btnIcon; + btnIcon = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(24), + Width = Application.GetMinRealAverage(54), + Height = Application.GetMinRealAverage(54), + }; + view.AddChidren(btnIcon); + + btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_blue.png"; + btnIcon.SelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_white.png"; + + Button btnName; + btnName = new Button() + { + Y = btnIcon.Bottom, + Text = function.name, + IsBold = true, + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainBackgroundColor, + TextSize = CSS_FontSize.TextFontSize, + Height = Application.GetRealWidth(24), + TextAlignment = TextAlignment.Center, + }; + view.AddChidren(btnName); + + + Button btnClick = new Button(); + view.AddChidren(btnClick); + btnClick.MouseUpEventHandler = (sender, e) => { + function.collect = !function.collect; + if (function.collect) + { + var pack = http.Set3tyIotFunctionToHouse(function.deviceId, DB_ResidenceData.Instance.CurrentRegion.id,brand_Iot.companyId); + if (pack != null) + { + if(pack.Code == StateCode.SUCCESS) + { + btnName.IsSelected = btnIcon.IsSelected = btnBg.IsSelected = true; + } + } + } + else + { + btnName.IsSelected = btnIcon.IsSelected = btnBg.IsSelected = false; + var pack = http.Set3tyIotFunctionToHouse(function.deviceId, "0", brand_Iot.companyId); + if (pack != null) + { + if (pack.Code == StateCode.SUCCESS) + { + btnName.IsSelected = btnIcon.IsSelected = btnBg.IsSelected = false; + } + } + } + + }; + + } + catch (Exception ex) + { + MainPage.Log("homepage LoadControlView error : " + ex.Message); + } + } + + + void NotListTipView() + { + contentView.RemoveAll(); + var btnTip = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(88), + Width = Application.GetRealWidth(180), + Height = Application.GetRealWidth(180), + UnSelectedImagePath = "TipNot.png", + }; + contentView.AddChidren(btnTip); + + var btnTipText = new Button() + { + Y = Application.GetRealHeight(252), + Height = Application.GetRealHeight(52), + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.FirstLevelTitleColor, + TextAlignment = TextAlignment.Center, + TextID = StringId.TipNotThirdPartyDevice, + }; + contentView.AddChidren(btnTipText); + + var btnAdd = new Button() + { + Y = Application.GetRealHeight(400), + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(220), + Height = Application.GetRealWidth(44), + BackgroundColor = CSS_Color.MainColor, + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.MainBackgroundColor, + TextSize = CSS_FontSize.SubheadingFontSize, + IsBold = true, + Radius = (uint)Application.GetRealWidth(22), + BorderColor = 0x00000000, + BorderWidth = 0, + Text = "鏌ョ湅璁惧鏀寔鑼冨洿" + }; + contentView.AddChidren(btnAdd); + btnAdd.MouseUpEventHandler = (sender, e) => + { + //var page = new AddThirdPartyBrandListpage(brandList); + //MainPage.BasePageView.AddChidren(page); + //page.LoadPage(); + //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + + + + } + + + HttpServerRequest http = new HttpServerRequest(); + + + } +} diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandListPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandListPage.cs new file mode 100644 index 0000000..32531d7 --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandListPage.cs @@ -0,0 +1,239 @@ +锘縰sing System; +using System.Collections.Generic; +using HDL_ON.DAL.Server; +using HDL_ON.Entity; +using HDL_ON.UI.CSS; +using Shared; + +namespace HDL_ON.UI +{ + /// <summary> + /// 绗笁鏂瑰搧鐗屽垪琛ㄧ晫闈� + /// </summary> + public class Iot_BrandListPage : FrameLayout + { + FrameLayout bodyView; + + VerticalScrolViewLayout contentView;//VerticalRefreshLayout + + List<IntegratedBrand_Iot> brandList; + + public Iot_BrandListPage() + { + bodyView = this; + brandList = new List<IntegratedBrand_Iot>(); + } + + public void LoadPage() + { + + + new TopViewDiv(bodyView, Language.StringByID(StringId.Bind3thIotAccount)).LoadTopView(CSS_Color.MainBackgroundColor); + + bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; + + bodyView.AddChidren(new Button + { + Y = Application.GetRealHeight(64), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS_Color.DividingLineColor, + }); + + Button btnTipText = new Button() + { + Y = Application.GetRealHeight(80), + Width = Application.GetRealWidth(347), + Height = Application.GetRealHeight(65), + Gravity = Gravity.CenterHorizontal, + Radius = (uint)Application.GetRealWidth(5), + BackgroundColor = 0x194484F4, + TextColor = CSS_Color.FirstLevelTitleColor, + Padding = new Padding(12, Application.GetRealWidth(16), 12, Application.GetRealWidth(16)), + TextSize = CSS_FontSize.TextFontSize, + Text = "閫氳繃缁戝畾绗笁鏂瑰钩鍙拌处鍙峰瘎鍝噷浜戠杩炴帴锛屽皢鎮ㄥ湪涓夋柟骞冲彴鐨勮澶囧悓姝ュ埌On Pro杩涜鎺у埗", + IsMoreLines = true, + TextAlignment = TextAlignment.CenterLeft, + }; + bodyView.AddChidren(btnTipText); + + contentView = new VerticalScrolViewLayout() + { + Y = Application.GetRealHeight(150), + Height = Application.GetRealHeight(573), + }; + bodyView.AddChidren(contentView); + + + + + GetBindList(); + + //contentView.BeginHeaderRefreshingAction = () => + //{ + // contentView.EndHeaderRefreshing(); + // GetBindList(); + //}; + + } + /// <summary> + /// 鑾峰彇缁戝畾鍒楄〃 + /// </summary> + void GetBindList() + { + var waitPage = new Loading(); + waitPage.Start(); + new System.Threading.Thread(() => { + try + { + var pm = new DAL.Server.HttpServerRequest(); + var pack = pm.Get3tyIotBrandList(); + if (pack.Code == DAL.Server.StateCode.SUCCESS) + { + brandList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<IntegratedBrand_Iot>>(pack.Data.ToString()); + if (brandList.Count > 0) + { + Application.RunOnMainThread(() => + { + LoadRow(); + }); + } + else + { + Application.RunOnMainThread(() => + { + //NotListTipView(); + LoadRow(); + }); + } + } + else + { + IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); + } + } + catch (Exception ex) + { + MainPage.Log("2--::" + ex.Message); + } + finally + { + Application.RunOnMainThread(() => { waitPage.Hide(); }); + } + }) + { IsBackground = true }.Start(); + } + + + void LoadRow() + { + contentView.RemoveAll(); + //brandList.Add(new IntegratedBrand_Iot + //{ + // authBrandNameCn = "Test Hdl", + // authBrandNameEn = "Test Hdl", + // hasAuthorization = false + //}); + + foreach (var brand in brandList) + { + var row = new RowLayout() + { + Height = Application.GetRealHeight(87), + BackgroundColor = CSS_Color.MainBackgroundColor, + LineColor = 0x00000000, + }; + contentView.AddChidren(row); + + Button btnLine = new Button() + { + Y = Application.GetRealWidth(86), + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = 1, + BackgroundColor = CSS_Color.DividingLineColor, + }; + row.AddChidren(btnLine); + + ImageView btnIcon = new ImageView() + { + X = Application.GetRealWidth(12), + Gravity = Gravity.CenterVertical, + Width = Application.GetRealWidth(47), + Height = Application.GetRealWidth(47), + Radius = (uint)Application.GetRealWidth(9), + BackgroundColor = CSS_Color.PromptingColor1 + }; + row.AddChidren(btnIcon); + + Button btnBindTip = new Button() + { + Width = Application.GetRealWidth(326), + TextAlignment = TextAlignment.CenterRight, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = brand.hasAuthorization ? StringId.Bound : StringId.Unbound, + }; + row.AddChidren(btnBindTip); + + + Button btnRight = new Button() + { + X = Application.GetRealWidth(339), + Gravity = Gravity.CenterVertical, + Width = Application.GetMinRealAverage(16), + Height = Application.GetMinRealAverage(16), + UnSelectedImagePath = "Public/Right.png", + }; + row.AddChidren(btnRight); + + Button btnName = new Button() + { + X = Application.GetRealWidth(83), + Width = Application.GetRealWidth(310), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + Text = brand.authBrandNameCn, + }; + row.AddChidren(btnName); + //涓嬭浇绗笁鏂瑰搧鐗宨con + ImageUtlis.Current.Load3tyBrandIconImages(brand.brandName, brand.authrBandIconUrl, btnIcon); + + btnName.MouseUpEventHandler = (sender, e) => { + if (brand.hasAuthorization) + { + Action unboundAction = () => + { + brand.hasAuthorization = false; + btnBindTip.TextID = StringId.Unbound; + }; + var page = new Iot_BrandFunctionListPage(brand); + MainPage.BasePageView.AddChidren(page); + page.unboundAction = unboundAction; + page.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + else + { + Action action = () => { + brand.hasAuthorization = true; + btnBindTip.TextID = StringId.Bound; + }; + Action action2 = () => { + brand.hasAuthorization = false; + btnBindTip.TextID = StringId.Unbound; + }; + var page = new iot_BindTipPage(); + MainPage.BasePageView.AddChidren(page); + page.boundAction = action; + page.unboundAction = action2; + page.LoadPage(brand); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + }; + } + + } + + } +} diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_SupportSpkListPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_SupportSpkListPage.cs new file mode 100644 index 0000000..eadaa43 --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_SupportSpkListPage.cs @@ -0,0 +1,26 @@ +锘縰sing System; +using HDL_ON.Entity; +using Shared; + +namespace HDL_ON.UI +{ + /// <summary> + /// 鏀寔鐨勭涓夋柟骞冲彴璁惧鍒楄〃鐣岄潰 + /// </summary> + public class Iot_SupportSpkListPage : FrameLayout + { + private FrameLayout bodyView; + + IntegratedBrand_Iot brand_Iot; + + public Iot_SupportSpkListPage() + { + bodyView = this; + } + + public void LoadPage() + { + + } + } +} \ No newline at end of file diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/iot_BindTipPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/iot_BindTipPage.cs new file mode 100644 index 0000000..601da76 --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/iot_BindTipPage.cs @@ -0,0 +1,279 @@ +锘縰sing System; +using HDL_ON.DAL.Server; +using HDL_ON.Entity; +using HDL_ON.UI.CSS; +using Shared; +namespace HDL_ON.UI +{ + public class iot_BindTipPage : FrameLayout + { + FrameLayout bodyView; + + /// <summary> + /// 瑙g粦鍥炶皟 + /// </summary> + public Action unboundAction; + /// <summary> + /// 缁戝畾鍥炶皟 + /// </summary> + public Action boundAction; + + public iot_BindTipPage() + { + bodyView = this; + } + + + public void LoadPage(IntegratedBrand_Iot brand_Iot) + { + + + new TopViewDiv(bodyView, Language.StringByID(StringId.Bind3thIotAccount)).LoadTopView(CSS_Color.MainBackgroundColor); + + bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; + + var contentView = new VerticalScrolViewLayout() + { + Y = Application.GetRealHeight(64), + BackgroundColor = CSS_Color.BackgroundColor, + Height = Application.GetRealHeight(667 - 124) + }; + bodyView.AddChidren(contentView); + + var btnIcon = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(25), + Width = Application.GetRealWidth(106), + Height = Application.GetRealWidth(106), + UnSelectedImagePath = "Public/Logo.png", + }; + contentView.AddChidren(btnIcon); + + var btnTipTitle = new Button() + { + X = Application.GetRealWidth(16), + Y = Application.GetRealHeight(140), + Width = Application.GetRealWidth(300), + Height = Application.GetRealHeight(60), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = 21, + TextAlignment = TextAlignment.CenterLeft, + IsBold = true, + Text = "鍏充簬璐﹀彿缁戝畾鐨勫0鏄�" + }; + contentView.AddChidren(btnTipTitle); + + var btnTipText = new Button() + { + Padding =new Padding(0, Application.GetRealWidth(16), 0, Application.GetRealWidth(16)), + Y = Application.GetRealHeight(140), + Height = Application.GetRealHeight(340), + IsMoreLines = true, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = 14, + TextAlignment = TextAlignment.CenterLeft, + Text = $"璐︽埛缁戝畾鍝佺墝锛歿brand_Iot.brandName} 锛堜互涓嬬畝绉扮涓夋柟鍝佺墝锛�" + "\r\n" + "\r\n" + +"鎮ㄧ粦瀹氱涓夋柟鍝佺墝鐨勮处鍙峰悗锛屽皢鎺堟潈鈥淥n Pro鈥濅娇鐢ㄦ偍鍦ㄧ涓夋柟璐﹀彿锛屽崗鍚岀鐞嗚澶囷紝On Pro涔熷皢鑷姩鍚屾鎮ㄥ湪绗笁鏂瑰搧鐗屼腑娣诲姞鐨勮澶囥��" + "\r\n" + "\r\n" + + +"涓哄疄鐜拌澶囨帶鍒跺姛鑳斤紝鏈簲鐢ㄥ皢浠庣涓夋柟涓幏鍙栦互涓嬫暟鎹細" + "\r\n" + "\r\n" + + +"1.绗笁鏂瑰搧鐗屼笂娣诲姞鐨勯儴鍒嗚澶囧垪琛紝鐢ㄤ簬鍦∣n Pro涓繘琛屾櫤鑳藉寲鎺у埗锛�" + "\r\n" + "\r\n" + + +"2.璁惧鍙婄綉缁滀俊鎭紝鍖呮嫭璁惧鏍囧織绗︺�丮AC鍦板潃銆佽澶囧簭鍒楀彿锛岀敤浜庤瘑鍒綋鍓嶅伐浣滅殑璁惧浠ュ強杩涜璁惧鎺у埗鍔熻兘銆�" + "\r\n" + "\r\n" + + +"濡傛灉鎮ㄤ笉鍚屾剰鎴戜滑鏀堕泦浠ヤ笂淇℃伅锛屽皢鏃犳硶绠$悊绗笁鏂瑰搧鐗岀殑璁惧銆�" + "\r\n" + "\r\n" + + +"濡傞渶缁堟浠ヤ笂淇℃伅鐨勬敹闆嗕笌澶勭悊锛屾偍鍙互鍦ㄢ�滄垜鐨勨��> 鈥滅粦瀹氱涓夋柟璐︽埛鈥�>鈥滆В闄も��" + }; + contentView.AddChidren(btnTipText); + + + var optionView = new FrameLayout() + { + Y = Application.GetRealHeight(667 - 80), + Height = Application.GetRealHeight(90), + Radius = (uint)Application.GetRealWidth(22), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + bodyView.AddChidren(optionView); + + var btnCannel = new Button() + { + X = Application.GetRealWidth(17), + Y = Application.GetRealHeight(14), + Width = Application.GetRealWidth(164), + Height = Application.GetRealHeight(44), + BorderColor = CSS_Color.MainColor, + BackgroundColor = CSS_Color.MainBackgroundColor, + BorderWidth = (uint)Application.GetRealWidth(1), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + Text = "杩斿洖", + Radius = (uint)Application.GetRealHeight(22) + }; + optionView.AddChidren(btnCannel); + btnCannel.MouseUpEventHandler = (sender, e) => { + this.RemoveFromParent(); + }; + + + var btnComfirm = new Button() + { + X = Application.GetRealWidth(196), + Y = Application.GetRealHeight(14), + Width = Application.GetRealWidth(164), + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + BackgroundColor= CSS_Color.MainColor, + TextColor = CSS_Color.MainBackgroundColor, + TextSize = CSS_FontSize.SubheadingFontSize, + Text = "鍚屾剰鎺堟潈", + Radius = (uint)Application.GetRealHeight(22) + }; + optionView.AddChidren(btnComfirm); + + + if (!brand_Iot.hasAuthorization) + { + btnComfirm.MouseUpEventHandler = (sender, e) => + { + + Action action = () => { + brand_Iot.hasAuthorization = true; + boundAction?.Invoke(); + this.RemoveFromParent(); + var page = new Iot_BrandFunctionListPage(brand_Iot); + page.unboundAction = unboundAction; + MainPage.BasePageView.AddChidren(page); + page.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + + var page = new Iot_AuthorizedPage(brand_Iot,action); + page.LoadView(); + + + + }; + } + else + { + btnComfirm.Text = "瑙i櫎鎺堟潈"; + btnComfirm.MouseUpEventHandler = (sender, e) => + { + Dialog dialog = new Dialog() + { + BackgroundColor = CSS_Color.DialogTransparentColor1, + }; + + FrameLayout contentView = new FrameLayout() + { + Gravity = Gravity.Center, + Width = Application.GetRealWidth(305), + Height = Application.GetRealHeight(180), + BackgroundColor = CSS.CSS_Color.MainBackgroundColor, + BorderColor = 0x00000000, + BorderWidth = 0, + Radius = (uint)Application.GetMinRealAverage(10), + }; + dialog.AddChidren(contentView); + + Button btnMsg = new Button() + { + Gravity = Gravity.CenterHorizontal, + Height = Application.GetRealHeight(70), + Y = Application.GetRealHeight(30), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.SubheadingFontSize, + Padding = new Padding(0,Application.GetRealWidth(16),0,Application.GetRealWidth(16)), + Text = "鎾ら攢鎺堟潈鍚庯紝璇ュ搧鐗屽叧鑱斿湪On Pro涓殑璁惧灏嗗叏閮ㄨ瑙g粦锛岀浉鍏充娇鐢ㄤ俊鎭悎璁惧鍊间篃灏嗗け鏁�", + IsMoreLines = true, + }; + contentView.AddChidren(btnMsg); + + Button btnLine = new Button() + { + Y = Application.GetRealHeight(125), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS.CSS_Color.DividingLineColor, + }; + contentView.AddChidren(btnLine); + + Button btnConfirm = new Button() + { + Y = btnLine.Bottom, + Height = Application.GetRealHeight(55), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + SelectedTextColor = CSS_Color.MainBackgroundColor, + SelectedBackgroundColor = CSS_Color.MainColor, + Text = "纭畾鎾ゅ洖鎺堟潈", + }; + btnConfirm.SetCornerWithSameRadius(Application.GetMinRealAverage(10), HDLUtils.RectCornerBottomLeft); + btnConfirm.SetCornerWithSameRadius(Application.GetMinRealAverage(10), HDLUtils.RectCornerBottomRight); + contentView.AddChidren(btnConfirm); + + dialog.Show(); + + btnConfirm.MouseDownEventHandler += (sender, e) => + { + btnConfirm.IsSelected = true; + }; + btnConfirm.MouseUpEventHandler += (sender, e) => + { + var http = new HttpServerRequest(); + var waitPage = new Loading(); + this.AddChidren(waitPage); + waitPage.Start(""); + new System.Threading.Thread(() => + { + try + { + var pack = http.Unbound3tyIotAccount(brand_Iot.companyId); + if (pack != null) + { + if (pack.Code == StateCode.SUCCESS) + { + Application.RunOnMainThread(() => + { + btnConfirm.IsSelected = false; + dialog.Close(); + this.RemoveFromParent(); + brand_Iot.hasAuthorization = false; + unboundAction?.Invoke(); + }); + } + } + else + { + dialog.Close(); + new Alert("", "鎿嶄綔澶辫触", "").Show(); + } + } + catch { } + finally + { + Application.RunOnMainThread(() => { + waitPage.Hide(); + waitPage.RemoveFromParent(); + }); + + } + }) + { IsBackground = true }.Start(); + }; + + }; + } + + + + + + } + } +} \ No newline at end of file diff --git a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/CacControlPage.cs b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/CacControlPage.cs index 4eb1277..bf223e0 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/CacControlPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/CacControlPage.cs @@ -129,7 +129,7 @@ { var btnHumidityIcon = new Button() { - X = Application.GetRealWidth(55), + X = Application.GetRealWidth(194), Y = Application.GetRealHeight(101), Width = Application.GetMinRealAverage(28), Height = Application.GetMinRealAverage(28), @@ -138,7 +138,7 @@ FrameWhiteCentet1.AddChidren(btnHumidityIcon); btnHumidityValues = new TextButton() { - X = Application.GetRealWidth(83), + X = Application.GetRealWidth(222), Y = Application.GetRealHeight(96), Height = Application.GetRealHeight(33), Width = Application.GetRealWidth(100), @@ -151,7 +151,7 @@ Button btnTempIcon = new Button() { - X = Application.GetRealWidth(194), + X = Application.GetRealWidth(55), Y = Application.GetRealHeight(101), Width = Application.GetMinRealAverage(28), Height = Application.GetMinRealAverage(28), @@ -161,7 +161,7 @@ btnTempValues = new TextButton() { - X = Application.GetRealWidth(222), + X = Application.GetRealWidth(83), Y = Application.GetRealHeight(96), Height = Application.GetRealHeight(33), Width = Application.GetRealWidth(100), diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs index 891b2cf..546e051 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs @@ -133,6 +133,24 @@ btnSuctionView.IsSelected = false; } } + + + else + { + temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.AlarmStatus); + if (temp.state == "true") + { + btnIcon.IsSelected = true; + btnSuctionView.TextID = StringId.InAlarming; + btnSuctionView.IsSelected = true; + } + else + { + btnIcon.IsSelected = false; + btnSuctionView.TextID = StringId.SensorNormalState; + btnSuctionView.IsSelected = false; + } + } }); } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs index 9455d9a..495e602 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs @@ -174,20 +174,28 @@ echartsView.AddChidren(myEchartsView_Pie); Dictionary<string, string> list = new Dictionary<string, string>(); + + int count = 0; foreach(var ene in energyList) { + if (count > 10) + { + break; + } double tt = 0; double.TryParse(ene.GetAttrState(FunctionAttributeKey.TotalElectricity), out tt); tt *= 100;//涔樹互100锛屽皬浜�1鏃犳硶鍔犺浇echart tt = Math.Round(tt, 2); - if (list.ContainsKey(ene.name)) + string key = ene.name; + if (list.ContainsKey(key)) { - list.Add(ene.name + "1", tt.ToString()); + list.Add(ene.name + DateTime.Now.ToLongTimeString(), tt.ToString()); } else { list.Add(ene.name, tt.ToString()); } + count++; } myEchartsView_Pie.ShowWithOption(new EchartsOption_Pie().InitDateJson(list)); @@ -219,6 +227,10 @@ int index = 0; foreach (var energy in energyList) { + if (index > 10) + { + break; + } EnergyRow(energy, energyListView, index); index++; new System.Threading.Thread(() => @@ -562,8 +574,14 @@ double totalValue = 0; double realtimeValue = 0; Dictionary<string, string> list = new Dictionary<string, string>();//楗煎浘鏁版嵁 + int count = 0; foreach (var ene in bodyView.energyList) { + if (count > 10) + { + break; + } + count++; double power = 0.00; double.TryParse(ene.GetAttrState(FunctionAttributeKey.TotalElectricity), out power); power = Math.Round(power, 2); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs index 84f44bd..556e3e1 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs @@ -157,10 +157,12 @@ framePickerBack.Y = btnFromFoorAndRoom.Bottom + Application.GetRealHeight(1); framePickerBack.Width = Application.GetMinRealAverage(216); framePickerBack.Height = Application.GetMinRealAverage(216); + //framePickerBack.BackgroundColor = 0xFFFF0000; controlView.AddChidren(framePickerBack); colorPicker = new ColorPicker() { + Gravity = Gravity.Center, ColorImagePath = "FunctionIcon/Light/ColorWheel.png", }; framePickerBack.AddChidren(colorPicker); @@ -176,10 +178,17 @@ //}; //鐧界偣鎺т欢 - this.btnWhiteRound = new Button(); - btnWhiteRound.Width = Application.GetRealWidth(24); - btnWhiteRound.Height = Application.GetRealWidth(24); - btnWhiteRound.UnSelectedImagePath = "FunctionIcon/Light/ColorWheelTip.png"; + var diameter = Application.GetRealWidth(12); + this.btnWhiteRound = new Button() + { + Width = diameter, + Height = diameter, + Radius = (uint)Application.GetRealWidth(6), + BorderWidth = (uint)Application.GetRealWidth(1), + BorderColor = CSS_Color.MainBackgroundColor, + Enable = false, + }; + //btnWhiteRound.UnSelectedImagePath = "FunctionIcon/Light/ColorWheelTip.png"; btnWhiteRound.Visible = false; framePickerBack.AddChidren(btnWhiteRound); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs index b45f539..8dbdfa5 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs @@ -104,7 +104,7 @@ //褰撳墠鐐瑰嚮鐨勩�愮偣銆戞槸鍚︽纭� bool pointIsRight = false; //鍦嗙殑鍗婂緞(鑰冭檻杈圭晫,闇�瑕佽缃畠鐨勫崐寰勬瘮杈冨皬涓�鐐�) - int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12); + int circleR = colorPicker.Width / 2 - Application.GetRealWidth(2); colorPicker.ColorChaged += (sender2, e2) => { if (function.trait_on_off.curValue.ToString() == "off" || pointIsRight == false) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Panel/PanelHelpPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Panel/PanelHelpPage.cs index 1350a45..c52b051 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Panel/PanelHelpPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Panel/PanelHelpPage.cs @@ -4,7 +4,7 @@ using HDL_ON.UI.CSS; using Shared; -namespace HDL_ON.UI.UI2.FuntionControlView.Panel +namespace HDL_ON.UI { public class PanelHelpPage : DeviceFunctionCardCommonForm { diff --git a/SiriIntents/Server/HttpUtil.cs b/SiriIntents/Server/HttpUtil.cs index f61de04..56a78a0 100644 --- a/SiriIntents/Server/HttpUtil.cs +++ b/SiriIntents/Server/HttpUtil.cs @@ -16,8 +16,8 @@ /// 鍥哄畾鍩熷悕,姝e紡鐜 /// 鍏叡鍩熷悕灏辫繎瑙f瀽 /// </summary> - public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; - //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm + //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; + public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm /// <summary> /// RegionMark /// </summary> -- Gitblit v1.8.0