From 7d5d552de16a149fafdc2d255ce50a86e7bef431 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 11 三月 2021 09:37:47 +0800 Subject: [PATCH] 临时上传一个安卓蓝牙的版本 --- HDL_ON/UI/UI0-Stan/Form/Base/CommonFormBase.cs | 13 HDL-ON_Android/Assets/Language.ini | 27 HDL_ON/UI/UI0-Stan/Controls/BottomControls/BottomClickButton.cs | 3 HDL_ON/UI/UI0-Stan/Controls/CompoundControls/ProgressRowBar.cs | 251 ++++++ HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/UploadToClound.png | 0 HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/WifiAndPhoneConnect.png | 0 HDL_ON/UI/UI0-Stan/Controls/BottomControls/BottomItemSelectControl.cs | 2 HDL_ON/DAL/Mqtt/MqttClient.cs | 8 HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs | 424 ++++++++++ HDL_ON/UI/UI0-Stan/Logic/HdlAndroidBluetoothLogic.cs | 567 +++++++++++++ HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs | 10 HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddThirdPartyDeviceMenuListPage.cs | 92 ++ HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/ConnectSuccess.png | 0 HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/MiniRemoteControlMenuIcon.png | 0 HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs | 2 HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/ConnectSuccessSelect.png | 0 HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/NetConnectSelect.png | 0 HDL_ON/UI/UI0-Stan/Form/Base/EditorCommonForm.cs | 111 ++ HDL_ON/UI/UI0-Stan/Controls/NormalControls/NormalViewControl.cs | 2 HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/UploadToCloundSelect.png | 0 HDL_ON/UI/UI0-Stan/Logic/HdlCloudReceiveLogic.cs | 138 +++ HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection1Page.cs | 80 + DLL/Android/AndriodBluetoothLibrary.dll | 0 HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection3Page.cs | 173 ++++ /dev/null | 77 - HDL_ON/UI/UI0-Stan/Logic/HdlWifiLogic.cs | 99 ++ HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection2Page.cs | 242 +++++ HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaAirCleanerPage.cs | 2 HDL_ON/Common/R.cs | 110 ++ HDL_ON/UI/UI0-Stan/Controls/BaseControl/TextInputBase.cs | 2 HDL-ON_Android/Assets/Phone/Public/ProgressMsg.png | 0 HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/MiniRemoteControlBigPictrue.png | 0 32 files changed, 2,337 insertions(+), 98 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml deleted file mode 100644 index e19ddc8..0000000 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ /dev/null @@ -1,77 +0,0 @@ -锘�<Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default"> - <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008020-000404163432002E" /> - <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs"> - <Files> - <File FileName="HDL_ON/Entity/FunctionList.cs" Line="370" Column="38" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs" Line="58" Column="22" /> - <File FileName="HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs" Line="153" Column="41" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWaterValvePage.cs" /> - <File FileName="HDL_ON/Common/ApiUtlis.cs" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs" Line="98" Column="21" /> - <File FileName="HDL_ON/UI/UI0-Stan/Logic/HdlDeviceStatuPushLogic.cs" Line="41" Column="42" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaAirCleanerPage.cs" Line="789" Column="42" /> - <File FileName="HDL_ON/DAL/DriverLayer/Control.cs" Line="209" Column="31" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/AC/AcControlPage.cs" Line="83" Column="1" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs" Line="9" Column="32" /> - <File FileName="HDL_ON/UI/UI1-Login/LoginPage.cs" Line="218" Column="58" /> - <File FileName="HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs" Line="47" Column="35" /> - </Files> - <Pads> - <Pad Id="ProjectPad"> - <State name="__root__"> - <Node name="HDL_APP_Project" expanded="True"> - <Node name="HDL_ON" expanded="True"> - <Node name="Common" expanded="True"> - <Node name="Utlis" expanded="True" /> - </Node> - <Node name="DAL" expanded="True"> - <Node name="DriverLayer" expanded="True" /> - </Node> - <Node name="Entity" expanded="True"> - <Node name="Function" expanded="True" /> - </Node> - <Node name="UI" expanded="True"> - <Node name="UI0-Public" expanded="True"> - <Node name="UpdataSidDataDialog.cs" selected="True" /> - </Node> - <Node name="UI0-Stan" expanded="True"> - <Node name="Logic" expanded="True" /> - </Node> - <Node name="UI1-Login" expanded="True" /> - <Node name="UI2" expanded="True"> - <Node name="1-HomePage" expanded="True" /> - <Node name="2-Classification" expanded="True" /> - <Node name="3-Intelligence" expanded="True"> - <Node name="Scene" expanded="True" /> - </Node> - <Node name="FuntionControlView" expanded="True"> - <Node name="AC" expanded="True" /> - <Node name="ArmSensor" expanded="True" /> - <Node name="Curtain" expanded="True" /> - <Node name="Electrical" expanded="True" /> - <Node name="Light" expanded="True" /> - </Node> - </Node> - </Node> - </Node> - <Node name="ys" expanded="True" /> - </Node> - </State> - </Pad> - </Pads> - </MonoDevelop.Ide.Workbench> - <MonoDevelop.Ide.DebuggingService.PinnedWatches /> - <DisabledProjects> - <String>Shared.IOS.TBL/Shared.IOS.TBL.csproj</String> - <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String> - <String>Shared.IOS/Shared.IOS.csproj</String> - </DisabledProjects> - <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" /> - <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" /> - <MonoDevelop.Ide.DebuggingService.Breakpoints> - <BreakpointStore> - <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/DriverLayer/Control.cs" relfile="HDL_ON/DAL/DriverLayer/Control.cs" line="458" column="1" /> - </BreakpointStore> - </MonoDevelop.Ide.DebuggingService.Breakpoints> - <MultiItemStartupConfigurations /> -</Properties> \ No newline at end of file diff --git a/DLL/Android/AndriodBluetoothLibrary.dll b/DLL/Android/AndriodBluetoothLibrary.dll new file mode 100644 index 0000000..606ade0 --- /dev/null +++ b/DLL/Android/AndriodBluetoothLibrary.dll Binary files differ diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index 1b59f7e..ddcf753 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -1141,6 +1141,33 @@ 1047=鏄惁閲嶇疆杈瑰埛 1048=鏄惁閲嶇疆婊氬埛 1049=鏄惁閲嶇疆婊ょ綉 +1050=娣诲姞璁惧 +1051=mini鏅鸿兘閬ユ帶鍣� +1052=娣诲姞绾㈠閬ユ帶 +1053=闀挎寜绾㈠閬ユ帶鍣ㄦ寜閽�10绉掞紝鎸囩ず鐏摑鑹插揩闂� +1054=璇风‘淇濇偍鐨勮摑鐗欏凡寮�鍚苟澶勪簬鍙互琚悳绱㈢姸鎬� +1055=涓嬩竴姝� +1056=璁惧鎼滅储涓�... +1057=娌℃湁鍙戠幇绾㈠閬ユ帶鍣� +1058=1銆佽妫�鏌ヨ澶囨槸鍚︽甯搁�氱數{0}2銆佽妫�鏌ヨ摑鐗欏姛鑳芥槸鍚︽甯稿紑鍚瘂0}3銆佽妫�鏌ユ寚绀虹伅鏄惁钃濊壊蹇棯鐘舵�� +1059=閲嶆柊鎼滅储 +1060=杩炴帴WiFi +1061=鐩墠鍙敮鎸�2.4G WiFi缃戠粶{0}鏆備笉鏀寔甯︽湁涓枃瀛楃鐨刉iFi鍚嶇О +1062=瀵嗙爜 +1063=姝e湪杩炴帴涓�... +1064=璇疯绾㈠閬ユ帶灏介噺鎺ヨ繎WIFI璺敱鍣� +1065=缃戠粶閾炬帴涓� +1066=涓婁紶鍒颁簯 +1067=杩炴帴鎴愬姛 +1068=1銆佽妫�鏌ヨ澶囨槸鍚︽甯搁�氱數{0}2銆佽寮�鍚摑鐗欏姛鑳絳0}3銆佸苟闀挎寜鎸夐挳10s锛屾寚绀虹伅甯镐寒 +1069=娣诲姞澶辫触 +1070=娣诲姞鎴愬姛 +1071=鍙互寮�濮嬩娇鐢ㄧ孩澶栭仴鎺у姛鑳斤紒 +1072=寮�濮嬩娇鐢� +1073=璇锋墦寮�钃濈墮 +1074=浣嶇疆淇℃伅(GBS)涓嶅彲鐢� +1075=缃戠粶涓嶅彲鐢� +1076=閫夋嫨绾㈠閬ユ帶鍣� 5000=闊充箰 5001=缁勫悎 diff --git a/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/ConnectSuccess.png b/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/ConnectSuccess.png new file mode 100644 index 0000000..8c6b86e --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/ConnectSuccess.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/ConnectSuccessSelect.png b/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/ConnectSuccessSelect.png new file mode 100644 index 0000000..224fd3f --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/ConnectSuccessSelect.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/MiniRemoteControlBigPictrue.png b/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/MiniRemoteControlBigPictrue.png new file mode 100644 index 0000000..a6ccf0a --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/MiniRemoteControlBigPictrue.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/MiniRemoteControlMenuIcon.png b/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/MiniRemoteControlMenuIcon.png new file mode 100644 index 0000000..be9906d --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/MiniRemoteControlMenuIcon.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/NetConnectSelect.png b/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/NetConnectSelect.png new file mode 100644 index 0000000..1c6cbfe --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/NetConnectSelect.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/UploadToClound.png b/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/UploadToClound.png new file mode 100644 index 0000000..ffef099 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/UploadToClound.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/UploadToCloundSelect.png b/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/UploadToCloundSelect.png new file mode 100644 index 0000000..fe57fe5 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/UploadToCloundSelect.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/WifiAndPhoneConnect.png b/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/WifiAndPhoneConnect.png new file mode 100644 index 0000000..4039574 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/PersonalCenter/AddDevice/WifiAndPhoneConnect.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/Public/ProgressMsg.png b/HDL-ON_Android/Assets/Phone/Public/ProgressMsg.png new file mode 100644 index 0000000..e0255b8 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/Public/ProgressMsg.png Binary files differ diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index 7bd22d5..91bb3b0 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -622,7 +622,115 @@ /// <summary> /// 鏄惁閲嶇疆婊ょ綉 /// </summary> - public const int ResetFilterScreenMsg = 1049; + public const int ResetFilterScreenMsg = 1049; + /// <summary> + /// 娣诲姞璁惧 + /// </summary> + public const int AddDevice = 1050; + /// <summary> + /// mini鏅鸿兘閬ユ帶鍣� + /// </summary> + public const int MiniIntelligentRemoteControl = 1051; + /// <summary> + /// 娣诲姞绾㈠閬ユ帶 + /// </summary> + public const int AddInfraredRemoteControl = 1052; + /// <summary> + /// 闀挎寜绾㈠閬ユ帶鍣ㄦ寜閽�10绉掞紝鎸囩ず鐏摑鑹插揩闂� + /// </summary> + public const int AddInfraredRemoteControlMsg1 = 1053; + /// <summary> + /// 璇风‘淇濇偍鐨勮摑鐗欏凡寮�鍚苟澶勪簬鍙互琚悳绱㈢姸鎬� + /// </summary> + public const int AddInfraredRemoteControlMsg2 = 1054; + /// <summary> + /// 涓嬩竴姝� + /// </summary> + public const int Next = 1055; + /// <summary> + /// 璁惧鎼滅储涓�... + /// </summary> + public const int SearchingDevice = 1056; + /// <summary> + /// 娌℃湁鍙戠幇绾㈠閬ユ帶鍣� + /// </summary> + public const int NoInfraredRemoteControlFound = 1057; + /// <summary> + /// 1銆佽妫�鏌ヨ澶囨槸鍚︽甯搁�氱數{0}2銆佽妫�鏌ヨ摑鐗欏姛鑳芥槸鍚︽甯稿紑鍚瘂0}3銆佽妫�鏌ユ寚绀虹伅鏄惁钃濊壊蹇棯鐘舵�� + /// </summary> + public const int AddInfraredRemoteControlMsg3 = 1058; + /// <summary> + /// 閲嶆柊鎼滅储 + /// </summary> + public const int ReSearch = 1059; + /// <summary> + /// 杩炴帴WiFi + /// </summary> + public const int ConnectWiFi = 1060; + /// <summary> + /// 鐩墠鍙敮鎸�2.4G WiFi缃戠粶{0}鏆備笉鏀寔甯︽湁涓枃瀛楃鐨刉iFi鍚嶇О + /// </summary> + public const int AddInfraredRemoteControlMsg4 = 1061; + /// <summary> + /// 瀵嗙爜 + /// </summary> + public const int Password = 1062; + /// <summary> + /// 姝e湪杩炴帴涓�... + /// </summary> + public const int NowConnectting = 1063; + /// <summary> + /// 璇疯绾㈠閬ユ帶灏介噺鎺ヨ繎WIFI璺敱鍣� + /// </summary> + public const int AddInfraredRemoteControlMsg5 = 1064; + /// <summary> + /// 缃戠粶閾炬帴涓� + /// </summary> + public const int InTheNetworkLink = 1065; + /// <summary> + /// 涓婁紶鍒颁簯 + /// </summary> + public const int UploadToCloud = 1066; + /// <summary> + /// 杩炴帴鎴愬姛 + /// </summary> + public const int ConnectSuccess = 1067; + /// <summary> + /// 1銆佽妫�鏌ヨ澶囨槸鍚︽甯搁�氱數{0}2銆佽寮�鍚摑鐗欏姛鑳絳0}3銆佸苟闀挎寜鎸夐挳10s锛屾寚绀虹伅甯镐寒 + /// </summary> + public const int AddInfraredRemoteControlMsg6 = 1068; + /// <summary> + /// 娣诲姞澶辫触 + /// </summary> + public const int AddFail = 1069; + /// <summary> + /// 娣诲姞鎴愬姛 + /// </summary> + public const int AddSuccess = 1070; + /// <summary> + /// 鍙互寮�濮嬩娇鐢ㄧ孩澶栭仴鎺у姛鑳斤紒 + /// </summary> + public const int AddInfraredRemoteControlMsg7 = 1071; + /// <summary> + /// 寮�濮嬩娇鐢� + /// </summary> + public const int StartUse = 1072; + /// <summary> + /// 璇锋墦寮�钃濈墮 + /// </summary> + public const int PleaseTurnOnBluetooth = 1073; + /// <summary> + /// 浣嶇疆淇℃伅(GBS)涓嶅彲鐢� + /// </summary> + public const int GbsIsNotAvailable = 1074; + /// <summary> + /// 缃戠粶涓嶅彲鐢� + /// </summary> + public const int NetworkIsNotAvailable = 1075; + /// <summary> + /// 閫夋嫨绾㈠閬ユ帶鍣� + /// </summary> + public const int ChooseInfraredRemoteControl = 1076; diff --git a/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs b/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs index be70231..035d430 100644 --- a/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs +++ b/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs @@ -115,5 +115,15 @@ return $"/user/{Control.Ins.GatewayId}/custom/scene/execute"; } } + /// <summary> + /// 娣诲姞璁惧涓婃姤 + /// </summary> + public string AddDevicePush + { + get + { + return $"/base/{Control.Ins.GatewayId}/thing/topo/found_reply"; + } + } } } \ No newline at end of file diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs index d6b5871..45dffe6 100644 --- a/HDL_ON/DAL/Mqtt/MqttClient.cs +++ b/HDL_ON/DAL/Mqtt/MqttClient.cs @@ -191,9 +191,15 @@ Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/property/send", QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce }; + //璁惧鍏ョ綉涓婃姤涓婚(鐩墠鍙湁绾㈠瀹�) + var topicFilterPush3 = new MqttTopicFilter() + { + Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found", + QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce + }; Utlis.WriteLine("寮�濮嬭闃咃紒"); - var result = await RemoteMqttClient.SubscribeAsync(new MqttTopicFilter[] { topicFilterPush2, topicAlinkStatus }); + var result = await RemoteMqttClient.SubscribeAsync(new MqttTopicFilter[] { topicFilterPush2, topicAlinkStatus, topicFilterPush3 }); if (result.Items[0].ResultCode == MQTTnet.Client.Subscribing.MqttClientSubscribeResultCode.GrantedQoS0) { isSubscribeSuccess = true; diff --git a/HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs b/HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs index 984a091..af475ed 100644 --- a/HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs +++ b/HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs @@ -44,7 +44,7 @@ //sidObj.bus.LoopId = Convert.ToByte(sidObj.sid.Substring(20, 4),16); sidObj.bus.loopId = sidObj.sid.Substring(20, 4); } - FunctionList.List.AddDeviceFunction(sidObj); + //FunctionList.List.AddDeviceFunction(sidObj); } //MainPage.GoUserPage(); } diff --git a/HDL_ON/UI/UI0-Stan/Controls/BaseControl/TextInputBase.cs b/HDL_ON/UI/UI0-Stan/Controls/BaseControl/TextInputBase.cs index 29d8059..b377db9 100644 --- a/HDL_ON/UI/UI0-Stan/Controls/BaseControl/TextInputBase.cs +++ b/HDL_ON/UI/UI0-Stan/Controls/BaseControl/TextInputBase.cs @@ -7,7 +7,7 @@ namespace HDL_ON.Stan { /// <summary> - /// 杈撳叆妗嗘帶浠剁殑鏈�鍒濆師鍨�(涓嶅缓璁慨鏀瑰拰鐩存帴浣跨敤):鏍囧噯瀛椾綋棰滆壊锛屾枃瀛楀悜宸﹂潬榻�,14鍙峰瓧 + /// 杈撳叆妗嗘帶浠剁殑鏈�鍒濆師鍨�(涓嶅缓璁慨鏀瑰拰鐩存帴浣跨敤):鏍囧噯瀛椾綋棰滆壊(0xFF798394)锛屾枃瀛楀悜宸﹂潬榻�,14鍙峰瓧 /// </summary> public class TextInputBase : EditText { diff --git a/HDL_ON/UI/UI0-Stan/Controls/BottomControls/BottomClickButton.cs b/HDL_ON/UI/UI0-Stan/Controls/BottomControls/BottomClickButton.cs index d1ec836..1476dd3 100644 --- a/HDL_ON/UI/UI0-Stan/Controls/BottomControls/BottomClickButton.cs +++ b/HDL_ON/UI/UI0-Stan/Controls/BottomControls/BottomClickButton.cs @@ -22,7 +22,7 @@ /// <param name="i_width">鏈変簺鐣岄潰寰堢壒娈�,涓嶇粺涓�鎸夐敭瀹藉害,鎵�浠ラ鐣欐鍙傛暟</param> public BottomClickButton(int i_width = 188) { - this.Yaxis = Application.GetRealHeight(539); + this.Yaxis = Application.GetRealHeight(543); //杩欎釜鏄竴鑸綅缃� this.Y = this.Yaxis; @@ -33,6 +33,7 @@ this.Gravity = Gravity.CenterHorizontal; this.Radius = (uint)Application.GetRealHeight(44) / 2; this.TextSize = CSS_FontSize.SubheadingFontSize; + this.BackgroundColor = CSS_Color.MainColor; this.IsBold = true; } } diff --git a/HDL_ON/UI/UI0-Stan/Controls/BottomControls/BottomItemSelectControl.cs b/HDL_ON/UI/UI0-Stan/Controls/BottomControls/BottomItemSelectControl.cs index aaff1c0..ec3f199 100644 --- a/HDL_ON/UI/UI0-Stan/Controls/BottomControls/BottomItemSelectControl.cs +++ b/HDL_ON/UI/UI0-Stan/Controls/BottomControls/BottomItemSelectControl.cs @@ -100,7 +100,7 @@ /// 娣诲姞鑿滃崟琛� /// </summary> /// <param name="i_listText">鏄剧ず鐨勫垪琛ㄦ枃瀛�</param> - /// <param name="i_listSelect">榛樿閫夋嫨</param> + /// <param name="i_listSelect">榛樿閫夋嫨(璇峰嬁璁剧疆涓簄ull)</param> public void AddRowMenu(List<string> i_listText, List<int> i_listSelect) { foreach (var index in i_listSelect) diff --git a/HDL_ON/UI/UI0-Stan/Controls/CompoundControls/ProgressRowBar.cs b/HDL_ON/UI/UI0-Stan/Controls/CompoundControls/ProgressRowBar.cs new file mode 100644 index 0000000..f110e78 --- /dev/null +++ b/HDL_ON/UI/UI0-Stan/Controls/CompoundControls/ProgressRowBar.cs @@ -0,0 +1,251 @@ +锘縰sing HDL_ON.Stan; +using Shared; +using System; +using System.Collections.Generic; +using System.Text; + +namespace HDL_ON.UI +{ + /// <summary> + /// 琛屾潯绫诲瀷鐨勮繘搴︽潯鎺т欢 + /// </summary> + public class ProgressRowBar : FrameLayout + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 杩涘害鏉¤兘鍚﹀線鍥炶蛋(榛樿涓嶅彲浠�) + /// </summary> + public bool ProgressBarGoback = false; + /// <summary> + /// 浼氱Щ鍔ㄧ殑杩涘害鏉� + /// </summary> + private FrameLayout btnProgressBar = null; + /// <summary> + /// 鏄剧ず鏁板�肩櫨鍒嗘瘮鐨勬帶浠� + /// </summary> + private NormalViewControl btnProgressTextView = null; + /// <summary> + /// 绾跨▼鏄惁杩愯 + /// </summary> + private bool isThreadAction = false; + /// <summary> + /// 妯″紡鍖哄垎 + /// </summary> + private int m_ModeDiv = -1; + + /// <summary> + /// 杩涘害鏉℃槸鍚﹀彲瑙� + /// </summary> + public new bool Visible + { + get { return base.Visible; } + set + { + if (this.btnProgressTextView != null) + { + this.btnProgressTextView.Visible = value; + } + base.Visible = value; + } + } + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 琛屾潯绫诲瀷鐨勮繘搴︽潯鎺т欢 + /// </summary> + /// <param name="width"> + /// <para>妯″紡1:浼氬姩鐨勯偅涓繘搴︽潯鐨勫搴�(闈炵湡瀹炲��)</para> + /// <para>妯″紡2:杩涘害鏉″湪鎸佺画鏃犻檺鐨勬潵鍥炵Щ鍔ㄧ殑鍖哄煙瀹藉害(闈炵湡瀹炲��)</para> + /// </param> + /// <param name="height"> + /// <para>妯″紡1:浼氬姩鐨勯偅涓繘搴︽潯鐨勯珮搴�(闈炵湡瀹炲��)</para> + /// <para>妯″紡2:杩涘害鏉″湪鎸佺画鏃犻檺鐨勬潵鍥炵Щ鍔ㄧ殑楂樺害(闈炵湡瀹炲��)</para> + /// </param> + public ProgressRowBar(int width, int height) + { + this.Height = Application.GetRealHeight(height); + this.Width = Application.GetRealWidth(width); + this.BackgroundColor = UI.CSS.CSS_Color.BackgroundColor; + this.Radius = (uint)Application.GetRealHeight(height) / 2; + } + + #endregion + + #region 鈻� 妯″紡1______________________________ + + /// <summary> + /// 妯″紡1 璇ユā寮忎负锛氭墜鍔ㄥ~鍐欒繘搴﹀�� + /// </summary> + /// <param name="showText"> + /// <para>鏄惁鍦ㄨ繘搴︽潯涓婃柟鏄剧ず鏁板�肩櫨鍒嗘瘮</para> + /// <para>璇风‘淇濇帶浠剁殑涓婃柟鏈夎冻澶熺殑鍖哄煙(娉�:璇蜂笉瑕佹墿澶ф鎺т欢鐨勯珮搴�)</para> + /// </param> + public void StartMode1(bool showText = false) + { + if (m_ModeDiv != -1) { return; } + this.m_ModeDiv = 1; + + //浼氱Щ鍔ㄧ殑杩涘害鏉� + this.btnProgressBar = new FrameLayout(); + btnProgressBar.Width = 0; + btnProgressBar.Height = this.Height; + btnProgressBar.BackgroundColor = UI.CSS.CSS_Color.MainColor; + btnProgressBar.Radius = (uint)this.Height / 2; + this.AddChidren(btnProgressBar); + + if (showText == true) + { + //杩涘害鍊兼枃鏈� + this.btnProgressTextView = new NormalViewControl(32, 22, true); + btnProgressTextView.Y = this.Y - Application.GetRealHeight(22 + 10);//10:瀹冧笌杩涘害鏉$殑闂磋窛 + btnProgressTextView.X = this.X - Application.GetRealWidth(32) / 2; + btnProgressTextView.UnSelectedImagePath = "Public/ProgressMsg.png"; + btnProgressTextView.TextSize = CSS.CSS_FontSize.PromptFontSize_SecondaryLevel; + btnProgressTextView.TextColor= CSS.CSS_Color.FirstLevelTitleColor; + btnProgressTextView.TextAlignment = TextAlignment.Center; + btnProgressTextView.Text = "0%"; + this.Parent.AddChidren(btnProgressTextView); + } + } + + /// <summary> + /// 閲嶇疆杩涘害鏉�(鍙妯″紡1鏈夋晥) + /// </summary> + public void ResetProgressBar() + { + if (this.m_ModeDiv == 1 && this.btnProgressBar != null) + { + this.btnProgressBar.Width = 0; + } + } + + /// <summary> + /// 璁剧疆杩涘害鍊� + /// </summary> + /// <param name="value">姝ゅ�间负鐧惧垎姣斿��(涔熷氨鏄皬浜庢垨鑰呯瓑浜�1鐨�)</param> + public void SetValue(decimal value) + { + this.SetValueEx(value); + } + + /// <summary> + /// 璁剧疆杩涘害鍊� + /// </summary> + /// <param name="value">杩涘害鍊�,鍐呴儴浼氶櫎浠axValue</param> + /// <param name="maxValue">鏈�澶у��</param> + public void SetValue(decimal value, decimal maxValue) + { + decimal result = value / maxValue; + this.SetValueEx(result); + } + + /// <summary> + /// 璁剧疆杩涘害鍊� + /// </summary> + /// <param name="value"></param> + private void SetValueEx(decimal value) + { + if (btnProgressBar == null || this.m_ModeDiv != 1) + { + return; + } + if (value > 1) { value = 1; } + + HdlThreadLogic.Current.RunMain(() => + { + int width = (int)(value * this.Width); + if (this.ProgressBarGoback == false && btnProgressBar.Width >= width) + { + //涓嶈兘璁╄繘搴︽潯寰�鍥炶蛋 + return; + } + btnProgressBar.Width = width; + if (this.btnProgressTextView != null) + { + //鏂囨湰鏄剧ず + btnProgressTextView.Text = ((int)(value * 100)) + "%"; + //鏂囨湰鏄剧ず鐨勯偅涓浘鐗囨绉诲姩 + this.btnProgressTextView.X = this.X + btnProgressBar.Right - btnProgressTextView.Width / 2; + } + }); + } + + #endregion + + #region 鈻� 妯″紡2______________________________ + + /// <summary> + /// 妯″紡2 璇ユā寮忎负锛氫笉鑳芥墜鍔ㄦ寚瀹氳繘搴﹀��,鐢卞唴閮ㄧ嚎绋嬪鐞�,杩涘害鏉″湪鎸佺画鏃犻檺鐨勬潵鍥炵Щ鍔� + /// </summary> + /// <param name="proWidth">鎸佺画鏃犻檺鐨勬潵鍥炵Щ鍔ㄧ殑杩涘害鏉$殑瀹藉害(闈炵湡瀹炲��)</param> + public void StartMode2(int proWidth = 100) + { + if (m_ModeDiv != -1) { return; } + this.m_ModeDiv = 2; + + //浼氱Щ鍔ㄧ殑杩涘害鏉� + this.btnProgressBar = new FrameLayout(); + btnProgressBar.Width = Application.GetRealWidth(proWidth); + btnProgressBar.Height = this.Height; + btnProgressBar.BackgroundColor = 0xfffb744a; + btnProgressBar.Radius = (uint)this.Height / 2; + this.AddChidren(btnProgressBar); + + //寮�鍚ā寮�2鐨勭嚎绋� + this.StartMode2Thread(); + } + + /// <summary> + /// 閲嶆柊寮�鍚ā寮�2 + /// </summary> + public void ReStartMode2() + { + //寮�鍚ā寮�2鐨勭嚎绋� + this.StartMode2Thread(); + } + + /// <summary> + /// 鏆傚仠妯″紡2 + /// </summary> + public void StopMode2() + { + this.isThreadAction = false; + } + + /// <summary> + /// 寮�鍚ā寮�2鐨勭嚎绋� + /// </summary> + private void StartMode2Thread() + { + if (this.isThreadAction == true) + { + return; + } + this.isThreadAction = true; + int moveLength = Application.GetRealWidth(30); + HdlThreadLogic.Current.RunThread(() => + { + while (this.Parent != null && isThreadAction == true) + { + HdlThreadLogic.Current.RunMain(() => + { + if (this.btnProgressBar.X >= this.Width) + { + //瓒呭嚭鍙宠竟涔嬪悗,鍐嶆浠庡乏杈瑰惊鐜� + this.btnProgressBar.X = -this.btnProgressBar.Width; + return; + } + this.btnProgressBar.X += moveLength; + }, ShowErrorMode.NO); + System.Threading.Thread.Sleep(150); + } + }); + } + + #endregion + } +} diff --git a/HDL_ON/UI/UI0-Stan/Controls/NormalControls/NormalViewControl.cs b/HDL_ON/UI/UI0-Stan/Controls/NormalControls/NormalViewControl.cs index 7ebb328..b16a121 100644 --- a/HDL_ON/UI/UI0-Stan/Controls/NormalControls/NormalViewControl.cs +++ b/HDL_ON/UI/UI0-Stan/Controls/NormalControls/NormalViewControl.cs @@ -11,7 +11,7 @@ public class NormalViewControl : ButtonCtrBase { /// <summary> - /// 骞冲嚒鏅�氱殑鎺т欢,鍩烘湰鍙槸鐢ㄦ潵鏄剧ず(姝e父鏂囨湰瀛椾綋棰滆壊,鏂囧瓧鍚戝乏闈犻綈) + /// 骞冲嚒鏅�氱殑鎺т欢,鍩烘湰鍙槸鐢ㄦ潵鏄剧ず(姝e父鏂囨湰瀛椾綋棰滆壊(0xFF798394),鏂囧瓧鍚戝乏闈犻綈) /// </summary> /// <param name="i_Width">瀹藉害</param> /// <param name="i_Height">楂樺害</param> diff --git a/HDL_ON/UI/UI0-Stan/Form/Base/CommonFormBase.cs b/HDL_ON/UI/UI0-Stan/Form/Base/CommonFormBase.cs index 86e2b4e..814f7d7 100644 --- a/HDL_ON/UI/UI0-Stan/Form/Base/CommonFormBase.cs +++ b/HDL_ON/UI/UI0-Stan/Form/Base/CommonFormBase.cs @@ -53,19 +53,6 @@ return; } - /// <summary> - /// 娣诲姞鎸囧畾鐢婚潰锛屽苟绉婚櫎褰撳墠鐢婚潰锛屽惎鍔ㄥ弬鏁扮敱鎸囧畾鐢婚潰鐨凷howForm鍑芥暟鎵�鎸囧畾 - /// </summary> - /// <param name="form">鐩爣鐣岄潰</param> - /// <param name="parameter">鍚姩鍙傛暟锛氬弬鏁扮敱鎸囧畾鐢婚潰鐨凷howForm鍑芥暟鎵�鎸囧畾</param> - public void AddFormAndCloseNowForm(CommonFormBase form, params object[] parameter) - { - //绉婚櫎褰撳墠鐢婚潰 - this.CloseForm(); - //娣诲姞鐢婚潰 - form.AddForm(parameter); - } - #endregion #region 鈻� 鍏抽棴鐣岄潰___________________________ diff --git a/HDL_ON/UI/UI0-Stan/Form/Base/EditorCommonForm.cs b/HDL_ON/UI/UI0-Stan/Form/Base/EditorCommonForm.cs index 0f0e916..31bdbe3 100644 --- a/HDL_ON/UI/UI0-Stan/Form/Base/EditorCommonForm.cs +++ b/HDL_ON/UI/UI0-Stan/Form/Base/EditorCommonForm.cs @@ -287,6 +287,117 @@ #endregion + #region 鈻� 娣诲姞鍒楄〃娑堟伅鏄剧ず鎺т欢_______________ + + /// <summary> + /// 娣诲姞鍒楄〃娑堟伅鏄剧ず鎺т欢,杩斿洖鐨勬槸鏈�鍚庝竴涓帶浠剁殑搴曢儴鍧愭爣 + /// </summary> + /// <param name="frameTable">妗屽竷瀹瑰櫒鎺т欢</param> + /// <param name="i_msg">鏄剧ず鐨勬秷鎭�(鎹㈣璇蜂娇鐢ㄣ�恵0}銆戣繘琛屽垎鍓�)</param> + /// <param name="i_fontSize">瀛椾綋澶у皬</param> + /// <param name="i_fontColor">瀛椾綋棰滆壊</param> + /// <param name="i_height">鎺т欢楂樺害(鐪熷疄鍊�)</param> + /// <param name="i_yy">Y杞村垵濮嬪潗鏍�(鐪熷疄鍊�)</param> + /// <param name="alignment">鏂囧瓧瀵归綈鏂瑰紡</param> + /// <param name="special"> + /// <para>娉細闄や簡鏂板缓杩欎釜鍑芥暟鐨勫紑鍙戣�呬互澶栵紝閮戒笉寤鸿鎶婅繖涓�间笉璁剧疆涓簍rue</para> + /// <para>璇存槑锛氫互鏈�闀跨殑鎺т欢鐨刋杞翠负鍩哄噯,鎵�鏈夋帶浠剁殑X杞撮兘鍙樻垚涓�鑷�</para> + /// </param> + /// <returns></returns> + public int AddListMsgControls(FrameLayout frameTable, string i_msg, int i_fontSize, uint i_fontColor, int i_height, + int i_yy, TextAlignment alignment = TextAlignment.Center, bool special = false) + { + var listMsg = i_msg.Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); + int defultWidth = this.bodyFrameLayout.Width - HdlControlResourse.XXLeft * 2; + + var listContr = new List<NormalViewControl>(); + int minXX = 10086;//鎺т欢闆嗗悎鏈�灏忕殑X杞� + foreach (var strMsg in listMsg) + { + //娑堟伅鏄剧ず鎺т欢 + var btnMsg = new NormalViewControl(defultWidth, i_height, false); + btnMsg.Y = i_yy; + btnMsg.Gravity = Gravity.CenterHorizontal; + btnMsg.TextAlignment = alignment; + btnMsg.TextColor = i_fontColor; + btnMsg.TextSize = i_fontSize; + btnMsg.Text = strMsg; + + //鐗规畩澶勭悊 + if (special == true && alignment == TextAlignment.Center) + { + //璁剧疆瀹冪殑鐪熷疄瀹藉害(瀵箂pecial鍙橀噺鏈夌敤) + int realWidth = btnMsg.GetRealWidthByText(); + btnMsg.Width = realWidth > defultWidth ? defultWidth : realWidth; + } + frameTable.AddChidren(btnMsg); + + //鏀堕泦鎺т欢 + listContr.Add(btnMsg); + + //璁板綍鎺т欢闆嗗悎X杞存渶灏忕殑鍊� + if (btnMsg.X < minXX) { minXX = btnMsg.X; } + + //涓よ涔嬮棿鐨勯棿璺濅负4 + i_yy = btnMsg.Bottom + Application.GetRealHeight(4); + } + //鐗规畩澶勭悊 + if (special == true && alignment == TextAlignment.Center) + { + foreach (var contr in listContr) + { + //浠ユ渶闀跨殑鎺т欢鐨刋杞翠负鍩哄噯,鎵�鏈夋帶浠剁殑X杞撮兘鍙樻垚涓�鑷� + contr.X = minXX; + } + } + + return i_yy - Application.GetRealHeight(4); + } + + #endregion + + #region 鈻� 娣诲姞搴曢儴鐐瑰嚮鎸夐挳鎺т欢_______________ + + /// <summary> + /// 娣诲姞搴曢儴鐐瑰嚮鎸夐挳鎺т欢 + /// </summary> + /// <param name="i_text">鏄剧ず鐨勬枃鏈�</param> + /// <returns></returns> + public BottomClickButton AddBottomClickButton(string i_text) + { + //瀹瑰櫒鎺т欢 + var frameBack = new FrameLayout(); + frameBack.Height = Application.GetRealHeight(76); + frameBack.Gravity = Gravity.BottomCenter; + bodyFrameLayout.AddChidren(frameBack); + //鐒跺悗鍦ㄩ《閮ㄦ坊鍔犱竴涓湁杈规鐨勪笢瑗� + var frameLine = new FrameLayout(); + frameLine.Height = Application.GetRealHeight(50); + frameLine.BorderWidth = 1; + frameLine.BackgroundColor = UI.CSS.CSS_Color.MainBackgroundColor; + frameLine.BorderColor = UI.CSS.CSS_Color.DividingLineColor; + frameLine.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); + frameBack.AddChidren(frameLine); + //鏈�鍚庡啀鏁翠釜鐧借壊鐨勪笢瑗块伄浣忓畠鐨勪笅閮� + var frameWite = new FrameLayout(); + frameWite.Height = frameBack.Height - Application.GetRealHeight(24 - 10);//闇�瑕佽秴杩囧畠 + frameWite.Width = frameBack.Width + Application.GetRealWidth(6); + frameWite.X = -Application.GetRealWidth(3); + frameWite.Y = Application.GetRealHeight(24); + frameWite.BackgroundColor = UI.CSS.CSS_Color.MainBackgroundColor; + frameBack.AddChidren(frameWite); + + //鎸夐挳 + var btnOk = new BottomClickButton(220); + btnOk.Gravity = Gravity.Center; + btnOk.Text = i_text; + frameBack.AddChidren(btnOk); + + return btnOk; + } + + #endregion + #region 鈻� 涓�鑸殑鏂规硶_________________________ /// <summary> diff --git a/HDL_ON/UI/UI0-Stan/Logic/HdlAndroidBluetoothLogic.cs b/HDL_ON/UI/UI0-Stan/Logic/HdlAndroidBluetoothLogic.cs new file mode 100644 index 0000000..8389e69 --- /dev/null +++ b/HDL_ON/UI/UI0-Stan/Logic/HdlAndroidBluetoothLogic.cs @@ -0,0 +1,567 @@ +锘縰sing Shared; +using System; +using System.Collections.Generic; +using System.Text; + +namespace HDL_ON.Stan +{ +#if __Android__ + public class HdlAndroidBluetoothLogic + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 瀹夊崜钃濈墮鐨勯�昏緫 + /// </summary> + private static HdlAndroidBluetoothLogic m_Current = null; + /// <summary> + /// 瀹夊崜钃濈墮鐨勯�昏緫 + /// </summary> + public static HdlAndroidBluetoothLogic Current + { + get + { + if (m_Current == null) + { + m_Current = new HdlAndroidBluetoothLogic(); + } + return m_Current; + } + } + + /// <summary> + /// 褰撳墠钃濈墮瀹㈡埛绔� + /// </summary> + private Blufi.Espressif.BlufiClient nowBlufiClient = null; + /// <summary> + /// 鎺ユ敹浜嬩欢 + /// </summary> + private Action<string> ReceiveEvent = null; + /// <summary> + /// 鍙戦�佺姸鎬�(0:鍙戦�佸け璐� 1:鍙戦�佹垚鍔�) + /// </summary> + private int sendStatuValue = -1; + + #endregion + + #region 鈻� 钃濈墮鎵�闇�鍔熻兘妫�娴媉__________________ + + /// <summary> + /// 妫�娴嬫槸鍚﹁兘澶熸悳绱㈣摑鐗�(鍐呴儴浼氬脊鍑篗sg妗�,鍥犱负鍐呴儴闇�瑕佹娴嬬郴缁熸潈闄�,鎵�浠ュ弬鏁伴噰鐢ㄥ洖璋冪殑鏂瑰紡) + /// </summary> + /// <param name="resultEvent">妫�娴嬬粨鏋滀簨浠�</param> + public void CheckCanScanBluetooth(Action<bool> resultEvent) + { + var adapter = Android.Bluetooth.BluetoothAdapter.DefaultAdapter; + var scanner = adapter.BluetoothLeScanner; + if (adapter.IsEnabled == false || scanner == null) + { + HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Language.StringByID(StringId.PleaseTurnOnBluetooth)); + resultEvent?.Invoke(false); + return; + } + //妫�娴嬫槸鍚︽墦寮�浜嗙郴缁熷姛鑳� + if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.M) + { + var locationManager = (Android.Locations.LocationManager)Application.Activity.GetSystemService(Android.Content.Context.LocationService); + if (locationManager == null) + { + //浣嶇疆淇℃伅(GBS)涓嶅彲鐢� + HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Language.StringByID(StringId.GbsIsNotAvailable)); + resultEvent?.Invoke(false); + return; + } + if (locationManager.IsProviderEnabled("network") == false) + { + HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Language.StringByID(StringId.NetworkIsNotAvailable)); + resultEvent?.Invoke(false); + return; + } + if (locationManager.IsProviderEnabled("gps") == false) + { + //浣嶇疆淇℃伅(GBS)涓嶅彲鐢� + HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Language.StringByID(StringId.GbsIsNotAvailable)); + resultEvent?.Invoke(false); + return; + } + } + //妫�娴嬭摑鐗欓渶瑕佺殑鏉冮檺 + ((BaseActivity)Application.Activity).SetPermission((result1) => + { + if (result1 == false) + { + resultEvent?.Invoke(false); + return; + } + ((BaseActivity)Application.Activity).SetPermission((result2) => + { + if (result2 == false) + { + resultEvent?.Invoke(false); + return; + } + //鍏ㄩ儴閫氳繃 + resultEvent?.Invoke(true); + + }, "android.permission.ACCESS_FINE_LOCATION"); + + }, "android.permission.ACCESS_COARSE_LOCATION"); + } + + #endregion + + #region 鈻� 钃濈墮鎵弿___________________________ + + /// <summary> + /// 鎼滅储钃濈墮 + /// </summary> + /// <param name="waitTime">鎼滅储鏃堕棿(绉�)</param> + /// <param name="FinishEvent">鎼滅储缁撴潫鐨勪簨浠�</param> + public void ScanBluetooth(int waitTime, Action<List<BluetoothInfo>> FinishEvent) + { + //鍐嶆妫�娴嬫槸鍚﹁兘澶熸悳绱㈣摑鐗� + this.CheckCanScanBluetooth((result) => + { + if (result == true) + { + HdlThreadLogic.Current.RunThread(() => + { + //寮�濮嬫悳绱㈣摑鐗� + this.DoScanBluetooth(waitTime, FinishEvent); + }); + } + }); + } + + /// <summary> + /// 寮�濮嬫悳绱㈣摑鐗� + /// </summary> + /// <param name="waitTime">鎼滅储鏃堕棿(绉�)</param> + /// <param name="FinishEvent">鎼滅储缁撴潫鐨勪簨浠�</param> + private void DoScanBluetooth(int waitTime, Action<List<BluetoothInfo>> FinishEvent) + { + var listBluetoothInfo = new List<BluetoothInfo>(); + + var adapter = Android.Bluetooth.BluetoothAdapter.DefaultAdapter; + var scanner = adapter.BluetoothLeScanner; + + var scanCallback = new BluetoothScanCallback(); + scanner.StartScan(null, new Android.Bluetooth.LE.ScanSettings.Builder().SetScanMode(Android.Bluetooth.LE.ScanMode.LowLatency).Build(), scanCallback); + + System.Threading.Thread.Sleep(waitTime * 1000); + + scanner.StopScan(scanCallback); + adapter.Dispose(); + + foreach (var data in scanCallback.listData) + { + listBluetoothInfo.Add(data); + } + scanCallback.listData.Clear(); + + FinishEvent?.Invoke(listBluetoothInfo); + } + + /// <summary> + /// 钃濈墮鐨勫洖璋冨璞� + /// </summary> + private class BluetoothScanCallback : Android.Bluetooth.LE.ScanCallback + { + /// <summary> + /// 钃濈墮鍒楄〃 + /// </summary> + public List<BluetoothInfo> listData = new List<BluetoothInfo>(); + /// <summary> + /// 閲嶅妫�娴� + /// </summary> + private List<string> listCheck = new List<string>(); + + /// <summary> + /// 钃濈墮缁撴灉鎺ユ敹 + /// </summary> + /// <param name="listResult"></param> + public override void OnBatchScanResults(IList<Android.Bluetooth.LE.ScanResult> listResult) + { + foreach (var result in listResult) + { + this.AddBluetoothResult(result); + } + } + + /// <summary> + /// 钃濈墮缁撴灉鎺ユ敹 + /// </summary> + /// <param name="callbackType"></param> + /// <param name="result"></param> + public override void OnScanResult(Android.Bluetooth.LE.ScanCallbackType callbackType, Android.Bluetooth.LE.ScanResult result) + { + this.AddBluetoothResult(result); + } + + /// <summary> + /// 娣诲姞钃濈墮缂撳瓨 + /// </summary> + /// <param name="result"></param> + private void AddBluetoothResult(Android.Bluetooth.LE.ScanResult result) + { + var device = result.Device; + if (device == null || listCheck.Contains(device.Address) == true) + { + return; + } + listCheck.Add(device.Address); + + var data = new BluetoothInfo(); + data.Name = device.Name; + if (data.Name == null) { data.Name = string.Empty; } + data.Address = device.Address; + data.Device = device; + listData.Add(data); + } + } + + #endregion + + #region 鈻� 钃濈墮閾炬帴___________________________ + + /// <summary> + /// 钃濈墮閾炬帴(false:杩炴帴澶辫触 true:杩炴帴鎴愬姛) + /// </summary> + /// <param name="bluetooth">闇�瑕侀摼鎺ョ殑钃濈墮瀵硅薄</param> + /// <param name="connectEvent">鍥犱负闇�瑕佸鏂瑰弽棣�,鎵�浠ヤ娇鐢ㄥ洖璋�(閾炬帴缁撴灉 false:杩炴帴澶辫触 true:杩炴帴鎴愬姛)</param> + public void ContectBluetooth(BluetoothInfo bluetooth, Action<bool> connectEvent) + { + try + { + this.nowBlufiClient = new Blufi.Espressif.BlufiClient(Application.Activity, bluetooth.Device); + + //涓�涓洖璋冧簨浠� + var callback = new InnerGattCallback(); + callback.ConnectionStateEvent += (div, newState) => + { + if (div == 1) + { + if (newState == Android.Bluetooth.ProfileState.Connected) + { + //閾炬帴寤虹珛鎴愬姛 + connectEvent?.Invoke(true); + //鍙�氱煡涓�娆� + connectEvent = null; + } + else if (newState == Android.Bluetooth.ProfileState.Disconnected) + { + //鍏抽棴閾炬帴 + this.DisContectBluetooth(); + connectEvent?.Invoke(false); + //鍙�氱煡涓�娆� + connectEvent = null; + } + } + else if (div == -1) + { + //鍏抽棴閾炬帴 + this.DisContectBluetooth(); + connectEvent?.Invoke(false); + //鍙�氱煡涓�娆� + connectEvent = null; + } + }; + nowBlufiClient.SetGattCallback(callback); + + //鍙﹀涓�涓洖璋冧簨浠� + var blufiCall = new BlufiCallbackMain(); + blufiCall.StateEvent += (div, data) => + { + //-1:寮傚父 1:姝e父 2:鍙戦�佹暟鎹垚鍔� 3:鍙戦�佹暟鎹け璐� + if (div == StatuEnum.A寮傚父) + { + //鍏抽棴閾炬帴 + this.DisContectBluetooth(); + connectEvent?.Invoke(false); + //鍙�氱煡涓�娆� + connectEvent = null; + } + else if (div == StatuEnum.A鍙戦�佹垚鍔� || div == StatuEnum.A鍙戦�佸け璐�) + { + sendStatuValue = div == StatuEnum.A鍙戦�佹垚鍔� ? 1 : 0; + } + else if (div == StatuEnum.A钃濈墮鍙嶉) + { + //钃濈墮杩斿洖鐨勭粨鏋� + this.ReceiveEvent?.Invoke(data); + } + }; + nowBlufiClient.SetBlufiCallback(blufiCall); + //鎵ц閾炬帴 + nowBlufiClient.Connect(); + } + catch + { + connectEvent?.Invoke(false); + connectEvent = null; + } + } + + /// <summary> + /// 鍏堣繖涔堝畾涔変竴涓┖鐨勭户鎵� + /// </summary> + private class InnerGattCallback : Android.Bluetooth.BluetoothGattCallback + { + /// <summary> + /// 鐘舵�佷簨浠跺洖璋�(-1:寮傚父 1:OnConnectionStateChange) + /// </summary> + public Action<int,Android.Bluetooth.ProfileState> ConnectionStateEvent = null; + /// <summary> + /// 閾炬帴鐘舵�佹敼鍙� + /// </summary> + /// <param name="gatt"></param> + /// <param name="status"></param> + /// <param name="newState"></param> + public override void OnConnectionStateChange(Android.Bluetooth.BluetoothGatt gatt, Android.Bluetooth.GattStatus status, Android.Bluetooth.ProfileState newState) + { + if (status == Android.Bluetooth.GattStatus.Success) + { + //鍥炶皟浜嬩欢 + this.ConnectionStateEvent?.Invoke(1, newState); + } + else + { + //鍥炶皟浜嬩欢 + this.ConnectionStateEvent?.Invoke(-1, 0); + } + } + + /// <summary> + /// 鎴愬姛鍙戠幇璁惧鐨剆ervices鏃讹紝璋冪敤姝ゆ柟娉� + /// </summary> + /// <param name="gatt"></param> + /// <param name="status"></param> + public override void OnServicesDiscovered(Android.Bluetooth.BluetoothGatt gatt, Android.Bluetooth.GattStatus status) + { + if (status != Android.Bluetooth.GattStatus.Success) + { + //鍥炶皟浜嬩欢 + this.ConnectionStateEvent?.Invoke(-1, 0); + } + } + + /// <summary> + /// 搴旇鏄啓鍏ヤ簨浠跺惂 + /// </summary> + /// <param name="gatt"></param> + /// <param name="characteristic"></param> + /// <param name="status"></param> + public override void OnCharacteristicWrite(Android.Bluetooth.BluetoothGatt gatt, Android.Bluetooth.BluetoothGattCharacteristic characteristic, Android.Bluetooth.GattStatus status) + { + if (status != Android.Bluetooth.GattStatus.Success) + { + //鍥炶皟浜嬩欢 + this.ConnectionStateEvent?.Invoke(-1, 0); + } + } + } + + /// <summary> + /// 鎶凷DK鐨勶紝鎴戜篃涓嶇煡閬撹繖涓槸浠�涔� + /// </summary> + private class BlufiCallbackMain : Blufi.Espressif.BlufiCallback + { + /// <summary> + /// 鐘舵�佷簨浠跺洖璋� 褰撶涓�涓弬鏁颁负"A钃濈墮鍙嶉"鏃�,绗簩涓弬鏁颁负钃濈墮杩斿洖鐨勪俊鎭� + /// </summary> + public Action<StatuEnum, string> StateEvent = null; + + /// <summary> + /// 鎶凷DK鐨勶紝鎴戜篃涓嶇煡閬撹繖涓槸浠�涔� + /// </summary> + /// <param name="client"></param> + /// <param name="gatt"></param> + /// <param name="service"></param> + /// <param name="writeChar"></param> + /// <param name="notifyChar"></param> + public override void OnGattPrepared(Blufi.Espressif.BlufiClient client, Android.Bluetooth.BluetoothGatt gatt, Android.Bluetooth.BluetoothGattService service, + Android.Bluetooth.BluetoothGattCharacteristic writeChar, Android.Bluetooth.BluetoothGattCharacteristic notifyChar) + { + if (service == null || writeChar == null || notifyChar == null) + { + StateEvent?.Invoke(StatuEnum.A寮傚父, null); + return; + } + + try + { + int mtu = 128; + if ((int)Android.OS.Build.VERSION.SdkInt == 29 + && Android.OS.Build.Manufacturer.ToLower().StartsWith("samsung") == true) + { + mtu = 23; + } + + var requestMtu = gatt.RequestMtu(mtu); + if (!requestMtu) + { + //Request mtu failed + client.SetPostPackageLengthLimit(20); + } + StateEvent?.Invoke(StatuEnum.A姝e父, null); ; + } + catch + { + StateEvent?.Invoke(StatuEnum.A寮傚父, null); + return; + } + } + + /// <summary> + /// 鎵嬫満绔彂閫佹暟鎹埌钃濈墮鐨勭粨鏋� + /// </summary> + /// <param name="client"></param> + /// <param name="status">0:鎴愬姛 鍏朵粬閮芥槸澶辫触</param> + /// <param name="data">鎵嬫満绔彂閫佺殑鏁版嵁</param> + public override void OnPostCustomDataResult(Blufi.Espressif.BlufiClient client, int status, byte[] data) + { + StateEvent?.Invoke(status == 0 ? StatuEnum.A鍙戦�佹垚鍔� : StatuEnum.A鍙戦�佸け璐�, null); + } + + /// <summary> + /// 钃濈墮鍥炲鐨勭粨鏋� + /// </summary> + /// <param name="client"></param> + /// <param name="status">0:鎴愬姛 鍏朵粬閮芥槸澶辫触</param> + /// <param name="data">钃濈墮鍥炲鐨勬暟鎹�</param> + public override void OnReceiveCustomData(Blufi.Espressif.BlufiClient client, int status, byte[] data) + { + if (status == 0) + { + var receiveData = System.Text.Encoding.UTF8.GetString(data); + StateEvent?.Invoke(StatuEnum.A钃濈墮鍙嶉, receiveData); + } + } + } + + #endregion + + #region 鈻� 钃濈墮鍏抽棴___________________________ + + /// <summary> + /// 鍏抽棴钃濈墮閾炬帴 + /// </summary> + public void DisContectBluetooth() + { + HdlThreadLogic.Current.RunMain(() => + { + this.nowBlufiClient?.RequestCloseConnection(); + this.nowBlufiClient = null; + + m_Current = null; + + }, ShowErrorMode.NO); + } + + /// <summary> + /// 鎽ф瘉 + /// </summary> + public void Dispone() + { + //鍏抽棴钃濈墮閾炬帴 + this.DisContectBluetooth(); + this.ReceiveEvent = null; + m_Current = null; + } + + #endregion + + #region 鈻� 鍙戦�佹暟鎹甠__________________________ + + /// <summary> + /// 鍙戦�佹暟鎹粰钃濈墮 + /// </summary> + /// <param name="i_data">鍙戦�佺殑鏁版嵁</param> + /// <param name="waiTime">绛夊緟鏃堕棿(绉�),濡傛灉璁剧疆涓�0,鍒欏彧瑕佸彂閫佷笉鍑虹幇寮傚父,鐩存帴鍒ゅ畾涓烘垚鍔�</param> + public bool SendData(string i_data, int waiTime = 0) + { + if (this.nowBlufiClient == null) + { + return false; + } + + try + { + this.sendStatuValue = -1; + //鍙戦�佹暟鎹� + var byteData = System.Text.Encoding.UTF8.GetBytes(i_data); + this.nowBlufiClient.PostCustomData(byteData); + if (waiTime == 0) { return true; } + + waiTime *= 5; + while (this.sendStatuValue == -1 && waiTime > 0) + { + System.Threading.Thread.Sleep(200); + waiTime--; + } + return this.sendStatuValue == 1; + } + catch { return false; } + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 娣诲姞钃濈墮鐨勬帴鏀朵簨浠� + /// </summary> + /// <param name="i_ReceiveEvent">钃濈墮鎺ユ敹浜嬩欢</param> + public void AddReceiveEvent(Action<string> i_ReceiveEvent) + { + this.ReceiveEvent = i_ReceiveEvent; + } + + /// <summary> + /// 绉婚櫎钃濈墮鐨勬帴鏀朵簨浠� + /// </summary> + public void RemoveReceiveEvent() + { + this.ReceiveEvent = null; + } + + #endregion + + #region 鈻� 缁撴瀯浣揰____________________________ + + /// <summary> + /// 钃濈墮杩斿洖鐨勪俊鎭� + /// </summary> + public class BluetoothInfo + { + /// <summary> + /// 鍚嶅瓧(姝ゅ悕瀛椾笉浼歯ull,濡傛灉瀹冩湰韬槸null,鍙細鏄痵tring.empty) + /// </summary> + public string Name = string.Empty; + /// <summary> + /// 鍦板潃 + /// </summary> + public string Address = string.Empty; + /// <summary> + /// 钃濈墮璁惧 + /// </summary> + public Android.Bluetooth.BluetoothDevice Device = null; + } + + /// <summary> + /// 鐘舵�佹灇涓� + /// </summary> + private enum StatuEnum + { + A寮傚父 = -1, + A姝e父 = 1, + A鍙戦�佹垚鍔� = 2, + A鍙戦�佸け璐� = 3, + A钃濈墮鍙嶉 = 4 + } + + #endregion + } +#endif +} + diff --git a/HDL_ON/UI/UI0-Stan/Logic/HdlCloudReceiveLogic.cs b/HDL_ON/UI/UI0-Stan/Logic/HdlCloudReceiveLogic.cs new file mode 100644 index 0000000..7a3f147 --- /dev/null +++ b/HDL_ON/UI/UI0-Stan/Logic/HdlCloudReceiveLogic.cs @@ -0,0 +1,138 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace HDL_ON.Stan +{ + //搴旇涔熶笉澶�,灏卞啓鍦ㄨ繖閲屼簡 + + /// <summary> + /// 浜戠鎺ㄩ�佹灇涓� + /// </summary> + public enum CloudPushEnum + { + A鏂拌澶囦笂鎶� = 1, + } + + /// <summary> + /// 鍏ㄥ眬鎺ユ敹浜戠鎺ㄩ�佺殑鐨勯�昏緫(涓轰簡鎵ц閫熷害,灏藉彲鑳界殑鍒姞鑰楁椂鐨勬搷浣�) + /// </summary> + public class HdlCloudReceiveLogic + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 鍏ㄥ眬鎺ユ敹浜戠鎺ㄩ�佺殑鐨勯�昏緫 + /// </summary> + private static HdlCloudReceiveLogic m_Current = null; + /// <summary> + /// 鍏ㄥ眬鎺ユ敹浜戠鎺ㄩ�佺殑鐨勯�昏緫 + /// </summary> + public static HdlCloudReceiveLogic Current + { + get + { + if (m_Current == null) + { + m_Current = new HdlCloudReceiveLogic(); + } + return m_Current; + } + } + + /// <summary> + /// 浜戠鎺ユ敹浜嬩欢闆嗗悎 + /// </summary> + private List<CloudReceiveEventClass> ListCloudEvent = new List<CloudReceiveEventClass>(); + + #endregion + + #region 鈻� 鍏ㄥ眬鎺ユ敹___________________________ + + /// <summary> + /// 鍏ㄥ眬鎺ユ敹浜戠鎺ㄩ�佺殑鐨勯�昏緫(涓轰簡鎵ц閫熷害,灏藉彲鑳界殑鍒姞鑰楁椂鐨勬搷浣�) + /// </summary> + /// <param name="topic">鏁翠釜涓婚</param> + /// <param name="msgData">鎺ユ敹鐨勬暟鎹�</param> + public void CloudOverallMsgReceive(string topic, string msgData) + { + //娌℃湁浠讳綍鐩戝惉 + if (ListCloudEvent.Count == 0) { return; } + + //璁惧鍏ョ綉涓婃姤涓婚(鐩墠鍙湁绾㈠瀹�) + if (topic == DriverLayer.CommunicationTopic.ct.AddDevicePush) + { + for (int i = 0; i < this.ListCloudEvent.Count; i++) + { + //鍥炶皟浜嬩欢 + this.ListCloudEvent[i].CloudReceiveEvent(CloudPushEnum.A鏂拌澶囦笂鎶�, msgData); + } + } + } + + #endregion + + #region 鈻� 娣诲姞浜戠鐩戝惉_______________________ + + /// <summary> + /// 娣诲姞浜戠鎺ユ敹浜嬩欢 + /// </summary> + /// <param name="i_mainKey">鏍囪瘑浜嬩欢鐨勪富閿�(鍙互闅忎究濉�,涓昏鏄拡瀵瑰涓晫闈竴璧蜂娇鐢ㄧ殑鎯呭喌)</param> + /// <param name="action">(鍙傛暟1:鏋氫妇 鍙傛暟2:鎺ㄩ�佹秷鎭�)</param> + public void AddCloudReceiveEvent(string i_mainKey, Action<CloudPushEnum, string> action) + { + try + { + var eventClass = new CloudReceiveEventClass(); + eventClass.MainKey = i_mainKey; + eventClass.CloudReceiveEvent = action; + this.ListCloudEvent.Add(eventClass); + } + catch { } + } + #endregion + + #region 鈻� 绉婚櫎浜戠鐩戝惉_______________________ + + /// <summary> + /// 绉婚櫎浜戠鎺ユ敹浜嬩欢 + /// </summary> + /// <param name="i_mainKey">鏍囪瘑浜嬩欢鐨勪富閿�(鍙互闅忎究濉�,涓昏鏄拡瀵瑰涓晫闈竴璧蜂娇鐢ㄧ殑鎯呭喌)</param> + public void RemoveCloudReceiveEvent(string i_mainKey) + { + try + { + for (int i = 0; i < this.ListCloudEvent.Count; i++) + { + if (this.ListCloudEvent[i].MainKey == i_mainKey) + { + this.ListCloudEvent.RemoveAt(i); + i--; + } + } + } + catch { } + } + + #endregion + + #region 鈻� 缁撴瀯浣揰____________________________ + + /// <summary> + /// 浜戠鎺ユ敹浜嬩欢绫� + /// </summary> + private class CloudReceiveEventClass + { + /// <summary> + /// 鏍囪瘑浜嬩欢鐨勪富閿�(鍙互闅忎究濉�,涓昏鏄拡瀵瑰涓晫闈竴璧蜂娇鐢ㄧ殑鎯呭喌) + /// </summary> + public string MainKey = string.Empty; + /// <summary> + /// 浜戠鎺ユ敹浜嬩欢(鍙傛暟1:鏋氫妇 鍙傛暟2:鎺ㄩ�佹秷鎭�) + /// </summary> + public Action<CloudPushEnum, string> CloudReceiveEvent = null; + } + + #endregion + } +} diff --git a/HDL_ON/UI/UI0-Stan/Logic/HdlWifiLogic.cs b/HDL_ON/UI/UI0-Stan/Logic/HdlWifiLogic.cs new file mode 100644 index 0000000..b4af0db --- /dev/null +++ b/HDL_ON/UI/UI0-Stan/Logic/HdlWifiLogic.cs @@ -0,0 +1,99 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace HDL_ON.Stan +{ + /// <summary> + /// WiFi鐨勯�昏緫 + /// </summary> + public class HdlWifiLogic + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// WiFi鐨勯�昏緫 + /// </summary> + private static HdlWifiLogic m_Current = null; + /// <summary> + /// WiFi鐨勯�昏緫 + /// </summary> + public static HdlWifiLogic Current + { + get + { + if (m_Current == null) + { + m_Current = new HdlWifiLogic(); + } + return m_Current; + } + } + + /// <summary> + /// 褰撳墠wifi鐨凷SID,涔熷彨Wifi鐨勫悕瀛�(鍙栦笉鍒版椂,浼氳繑鍥瀗ull) + /// </summary> + public string SSID + { + get + { +#if __IOS__ + string ssiD = Shared.WiimuUPnP.SSID; + if (string.IsNullOrEmpty(ssiD) == false && ssiD.StartsWith("\"") && ssiD.EndsWith("\"")) + { + ssiD = ssiD.Substring(1, ssiD.Length - 2); + } + return ssiD; +#endif +#if __Android__ + string ssiD = null; + HdlThreadLogic.Current.RunThread(() => + { + Shared.Net.NetWiFi.GetWIFISSID((strId) => + { + ssiD = strId; + }); + }, ShowErrorMode.NO); + int count = 0; + while (ssiD == null) + { + System.Threading.Thread.Sleep(50); + count++; + if (count == 20) + { + //1绉掕秴鏃� + return null; + } + } + if (string.IsNullOrEmpty(ssiD) == false && ssiD.StartsWith("\"") && ssiD.EndsWith("\"")) + { + ssiD = ssiD.Substring(1, ssiD.Length - 2); + } + return ssiD; +#endif + } + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 鎵撳紑鎵嬫満wifi璁剧疆鐣岄潰 + /// </summary> + public void OpenAppWifiSettion() + { + if (Shared.Application.DeviceType == Shared.Device.Android) + { + ///鎵撳紑WI-IF鐣岄潰 + Shared.CommonClass.OpenAction("android.settings.WIFI_SETTINGS"); + } + else + { + Shared.CommonClass.OpenAction("App-Prefs:root=WIFI"); + } + } + + #endregion + } +} diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection1Page.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection1Page.cs new file mode 100644 index 0000000..3f32913 --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection1Page.cs @@ -0,0 +1,80 @@ +锘縰sing HDL_ON.Stan; +using Shared; +using System; +using System.Collections.Generic; +using System.Text; + +namespace HDL_ON.UI +{ + /// <summary> + /// 娣诲姞Evoyo鐨凪ini鏅鸿兘閬ユ帶鍣ㄦ楠�1鐣岄潰 + /// </summary> + public class AddMiniRemoteControlDirection1Page : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(StringId.AddInfraredRemoteControl)); + //杩欎釜鐣岄潰鐨勮儗鏅渶瑕佺櫧鑹� + bodyFrameLayout.BackgroundColor = UI.CSS.CSS_Color.MainBackgroundColor; + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //鍥剧墖 + var btnPic = new PicViewControl(149, 95); + btnPic.Y = Application.GetRealHeight(99); + btnPic.Gravity = Gravity.CenterHorizontal; + btnPic.UnSelectedImagePath = "PersonalCenter/AddDevice/MiniRemoteControlBigPictrue.png"; + bodyFrameLayout.AddChidren(btnPic); + + //闀挎寜绾㈠閬ユ帶鍣ㄦ寜閽�10绉掞紝鎸囩ず鐏摑鑹插揩闂� + var strMsg = Language.StringByID(StringId.AddInfraredRemoteControlMsg1); + var intYY = this.AddListMsgControls(bodyFrameLayout, strMsg, CSS.CSS_FontSize.TextFontSize, + CSS.CSS_Color.FirstLevelTitleColor, Application.GetRealHeight(20), Application.GetRealHeight(408)); + + //璇风‘淇濇偍鐨勮摑鐗欏凡寮�鍚苟澶勪簬鍙互琚悳绱㈢姸鎬� + strMsg = Language.StringByID(StringId.AddInfraredRemoteControlMsg2); + this.AddListMsgControls(bodyFrameLayout, strMsg, CSS.CSS_FontSize.PromptFontSize_FirstLevel, + CSS.CSS_Color.PromptingColor1, Application.GetRealHeight(18), intYY + Application.GetRealHeight(4)); + + //涓嬩竴姝� + var btnNext = this.AddBottomClickButton(Language.StringByID(StringId.Next)); + btnNext.ButtonClickEvent += (sender, e) => + { +#if __IOS__ +#endif +#if __Android__ + //妫�娴嬭摑鐗欓渶瑕佺殑涓滆タ + HdlAndroidBluetoothLogic.Current.CheckCanScanBluetooth((result) => + { + if (result == true) + { + this.CloseForm(); + var form = new AddMiniRemoteControlDirection2Page(); + //wifi鍜屽瘑鐮侀兘涓虹┖ + form.AddForm(); + } + }); +#endif + }; + } + + #endregion + } +} diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection2Page.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection2Page.cs new file mode 100644 index 0000000..68bb03f --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection2Page.cs @@ -0,0 +1,242 @@ +锘縰sing HDL_ON.Stan; +using Shared; +using System; +using System.Collections.Generic; +using System.Text; + +namespace HDL_ON.UI +{ + /// <summary> + /// 娣诲姞Evoyo鐨凪ini鏅鸿兘閬ユ帶鍣ㄦ楠�2鐣岄潰 + /// </summary> + public class AddMiniRemoteControlDirection2Page : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(StringId.AddInfraredRemoteControl)); + //杩欎釜鐣岄潰鐨勮儗鏅渶瑕佺櫧鑹� + bodyFrameLayout.BackgroundColor = UI.CSS.CSS_Color.MainBackgroundColor; + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖body + this.ClearBodyFrame(); + + //杩涘害鏉� + var btnProgress = new ProgressRowBar(180, 6); + btnProgress.Y = Application.GetRealHeight(218); + btnProgress.Gravity = Gravity.CenterHorizontal; + bodyFrameLayout.AddChidren(btnProgress); + btnProgress.StartMode1(true); + + //璁惧鎼滅储涓�... + var btnSearch = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(20), false); + btnSearch.Y = btnProgress.Bottom + Application.GetRealHeight(40); + btnSearch.TextColor = CSS.CSS_Color.FirstLevelTitleColor; + btnSearch.TextID = StringId.SearchingDevice; + btnSearch.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(btnSearch); + + //璇风‘淇濇偍鐨勮摑鐗欏凡寮�鍚苟澶勪簬鍙互琚悳绱㈢姸鎬� + var strMsg = Language.StringByID(StringId.AddInfraredRemoteControlMsg2); + this.AddListMsgControls(bodyFrameLayout, strMsg, CSS.CSS_FontSize.TextFontSize, + CSS.CSS_Color.FirstLevelTitleColor, Application.GetRealHeight(20), btnSearch.Bottom + Application.GetRealHeight(4)); + + //鎼滅储鏃堕棿(绉�) + int searchTime = 5; + +#if __IOS__ +#endif +#if __Android__ + //瀹夊崜鎼滅储钃濈墮(鐗规晥闂,鍔�1绉�) + this.StartSearchBluetoothOnAndriod(searchTime + 1); +#endif + HdlThreadLogic.Current.RunThread(() => + { + //杩涘害鏉$壒鏁� + for (int i = 0; i <= searchTime; i++) + { + HdlThreadLogic.Current.RunMain(() => + { + btnProgress.SetValue(i + 1, searchTime); + }); + System.Threading.Thread.Sleep(1000); + } + }); + } + + #endregion + + #region 鈻� 瀹夊崜鎼滅储钃濈墮_______________________ + +#if __Android__ + /// <summary> + /// 瀹夊崜鎼滅储钃濈墮 + /// </summary> + /// <param name="i_searchTime">鎼滅储鏃堕棿(绉�)</param> + private void StartSearchBluetoothOnAndriod(int i_searchTime) + { + //寮�濮嬫悳绱㈣摑鐗� + HdlAndroidBluetoothLogic.Current.ScanBluetooth(i_searchTime, (listBluetooth) => + { + var listDevice = new List<HdlAndroidBluetoothLogic.BluetoothInfo>(); + foreach (var device in listBluetooth) + { + //鍙湁杩欎釜鏍囪瘑,鎵嶆槸绾㈠瀹� + if (device.Name.StartsWith("MIR01R-LK.10") == true) + { + //鏄寚瀹氱殑绾㈠瀹濊澶� + listDevice.Add(device); + } + } + if (listDevice.Count == 0) + { + //鎽ф瘉钃濈墮缂撳瓨 + HdlAndroidBluetoothLogic.Current.Dispone(); + //鏄剧ず澶辫触鐣岄潰 + HdlThreadLogic.Current.RunMain(() => + { + this.ShowFailView(); + }); + } + else if (listDevice.Count == 1) + { + //濡傛灉鍙娴嬪埌涓�涓�,鍒欑洿鎺ヨ繛鎺� + HdlAndroidBluetoothLogic.Current.ContectBluetooth(listDevice[0], (result) => + { + if (result == true) + { + //杩炴帴鎴愬姛,鍒欒烦杞埌涓嬩竴涓晫闈� + HdlThreadLogic.Current.RunMain(() => + { + this.CloseForm(); + var form = new AddMiniRemoteControlDirection3Page(); + form.AddForm(); + }); + } + }); + } + else + { + var listName = new List<string>(); + foreach (var device in listDevice) + { + listName.Add(device.Name); + } + //鏄剧ず閫夋嫨钃濈墮鍒楄〃鐨勭晫闈�(褰撳尮閰嶅埌澶氫釜钃濈墮鐨勬椂鍊欎娇鐢�) + this.ShowBluetoothListView(listName, (index) => + { + //濡傛灉鍙娴嬪埌涓�涓�,鍒欑洿鎺ヨ繛鎺� + HdlAndroidBluetoothLogic.Current.ContectBluetooth(listDevice[index], (result) => + { + if (result == true) + { + //杩炴帴鎴愬姛,鍒欒烦杞埌涓嬩竴涓晫闈� + HdlThreadLogic.Current.RunMain(() => + { + this.CloseForm(); + var form = new AddMiniRemoteControlDirection3Page(); + form.AddForm(); + }); + } + }); + }); + } + }); + } +#endif + + #endregion + + #region 鈻� 鏄剧ず閫夋嫨钃濈墮鍒楄〃鐨勭晫闈____________ + + /// <summary> + /// 鏄剧ず閫夋嫨钃濈墮鍒楄〃鐨勭晫闈�(褰撳尮閰嶅埌澶氫釜钃濈墮鐨勬椂鍊欎娇鐢�) + /// </summary> + /// <param name="listName">钃濈墮鍚嶅瓧鍒楄〃</param> + /// <param name="selectEvent">閫夋嫨浜嬩欢(鑰冭檻鍒癐os鍜屽畨鍗�,鎵�浠ヨ繖鏍峰畾鍙傛暟)</param> + private void ShowBluetoothListView(List<string> listName, Action<int> selectEvent) + { + HdlThreadLogic.Current.RunMain(() => + { + var contr = new BottomItemSelectControl(listName.Count, Language.StringByID(StringId.ChooseInfraredRemoteControl), false); + //鍒濆鍖� + contr.AddRowMenu(listName, new List<int>()); + contr.FinishOnlyEvent += (div, value) => + { + if (div == 0) + { + //濡傛灉鐐瑰嚮浜嗗彇娑�,鍒欏叧闂繖涓晫闈�,涓嶇浜� + this.CloseForm(); + } + else + { + //璋冪敤鍥炶皟鍑芥暟 + selectEvent?.Invoke(value); + } + }; + }); + } + + #endregion + + #region 鈻� 鏄剧ず澶辫触鐣岄潰_______________________ + + /// <summary> + /// 鏄剧ず澶辫触鐣岄潰 + /// </summary> + private void ShowFailView() + { + //娓呯┖body + this.ClearBodyFrame(); + //鍥剧墖 + var btnPic = new PicViewControl(180, 180); + btnPic.Y = Application.GetRealHeight(48); + btnPic.Gravity = Gravity.CenterHorizontal; + btnPic.UnSelectedImagePath = "Public/TipIcon_Failed.png"; + bodyFrameLayout.AddChidren(btnPic); + //娌℃湁鍙戠幇绾㈠閬ユ帶鍣� + var btnMsgNot = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(22), false); + btnMsgNot.Y = btnPic.Bottom + Application.GetRealHeight(16); + btnMsgNot.TextAlignment = TextAlignment.Center; + btnMsgNot.TextColor = CSS.CSS_Color.AuxiliaryColor2; + btnMsgNot.TextSize = CSS.CSS_FontSize.SubheadingFontSize; + btnMsgNot.TextID = StringId.NoInfraredRemoteControlFound; + bodyFrameLayout.AddChidren(btnMsgNot); + //1銆佽妫�鏌ヨ澶囨槸鍚︽甯搁�氱數 + //2銆佽妫�鏌ヨ摑鐗欏姛鑳芥槸鍚︽甯稿紑鍚� + //3銆佽妫�鏌ユ寚绀虹伅鏄惁钃濊壊蹇棯鐘舵�� + var strMsg = Language.StringByID(StringId.AddInfraredRemoteControlMsg3); + this.AddListMsgControls(bodyFrameLayout, strMsg, CSS.CSS_FontSize.TextFontSize, + CSS.CSS_Color.TextualColor, Application.GetRealHeight(20), btnMsgNot.Bottom + Application.GetRealHeight(8), + TextAlignment.Center, true); + + //閲嶆柊鎼滅储 + var btnReSearch = this.AddBottomClickButton(Language.StringByID(StringId.ReSearch)); + btnReSearch.ButtonClickEvent += (sender, e) => + { + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + }; + } + + #endregion + } +} diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection3Page.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection3Page.cs new file mode 100644 index 0000000..5fd6f0e --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection3Page.cs @@ -0,0 +1,173 @@ +锘縰sing HDL_ON.Stan; +using Shared; +using System; +using System.Collections.Generic; +using System.Text; + +namespace HDL_ON.UI +{ + /// <summary> + /// 娣诲姞Evoyo鐨凪ini鏅鸿兘閬ユ帶鍣ㄦ楠�3鐣岄潰 + /// </summary> + public class AddMiniRemoteControlDirection3Page : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 褰撳墠wifi鐨勫悕瀛� + /// </summary> + private string NowWifiName = string.Empty; + /// <summary> + /// wifi鐨勭嚎绋嬫槸鍚﹀惎鍔� + /// </summary> + private bool WifiThreadAction = false; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(StringId.AddInfraredRemoteControl)); + //杩欎釜鐣岄潰鐨勮儗鏅渶瑕佺櫧鑹� + bodyFrameLayout.BackgroundColor = UI.CSS.CSS_Color.MainBackgroundColor; + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //杩炴帴WiFi + var btnWifi = new NormalViewControl(200, 28, true); + btnWifi.X = HdlControlResourse.XXLeft; + btnWifi.Y = Application.GetRealHeight(16); + btnWifi.IsBold = true; + btnWifi.TextColor = CSS.CSS_Color.FirstLevelTitleColor; + btnWifi.TextSize = CSS.CSS_FontSize.EmphasisFontSize_Secondary; + btnWifi.TextID = StringId.ConnectWiFi; + bodyFrameLayout.AddChidren(btnWifi); + //鐩墠鍙敮鎸�2.4G WiFi缃戠粶 + //鏆備笉鏀寔甯︽湁涓枃瀛楃鐨刉iFi鍚嶇О + var strMsg = Language.StringByID(StringId.AddInfraredRemoteControlMsg4); + int yy = this.AddListMsgControls(bodyFrameLayout, strMsg, CSS.CSS_FontSize.TextFontSize, CSS.CSS_Color.TextualColor, + Application.GetRealHeight(20), btnWifi.Bottom + Application.GetRealHeight(16), TextAlignment.CenterLeft); + + //wifi琛� + var rowWifi = new RowLayoutControl(); + rowWifi.Y = yy + Application.GetRealHeight(32); + bodyFrameLayout.AddChidren(rowWifi); + //wifi鍚嶅瓧 + var txtWifi = rowWifi.frameTable.AddLeftInput("", 200); + txtWifi.TextColor = CSS.CSS_Color.FirstLevelTitleColor; + //搴曠嚎 + rowWifi.frameTable.AddBottomLine(); + //鍚戝彸鍥炬爣 + var btnRight = rowWifi.frameTable.AddMostRightEmptyIcon(24, 24); + btnRight.UnSelectedImagePath = "Public/Right.png"; + btnRight.ButtonClickEvent += (sender, e) => + { + //鎵撳紑鎵嬫満wifi璁剧疆鐣岄潰 + HdlWifiLogic.Current.OpenAppWifiSettion(); + //鍒锋柊wifi鍚嶅瓧 + this.RefreshWifiName(txtWifi); + }; + + //瀵嗙爜琛� + var rowPsw = new RowLayoutControl(); + rowPsw.Y = rowWifi.Bottom; + bodyFrameLayout.AddChidren(rowPsw); + //瀵嗙爜 + var txtPsw = rowPsw.frameTable.AddLeftInput("551775569", 200); + txtPsw.TextColor = CSS.CSS_Color.FirstLevelTitleColor; + txtPsw.PlaceholderText = Language.StringByID(StringId.Password); + txtPsw.SecureTextEntry = true; + //搴曠嚎 + rowPsw.frameTable.AddBottomLine(); + //鐪肩潧鍥炬爣 + var btnView = rowPsw.frameTable.AddMostRightEmptyIcon(24, 24); + btnView.UnSelectedImagePath = "LoginIcon/HidePasswordIcon.png"; + btnView.SelectedImagePath = "LoginIcon/ShowPasswordIcon.png"; + btnView.ButtonClickEvent += (sender, e) => + { + btnView.IsSelected = !btnView.IsSelected; + txtPsw.SecureTextEntry = !btnView.IsSelected; + }; + + //涓嬩竴姝� + var btnNext = this.AddBottomClickButton(Language.StringByID(StringId.Next)); + btnNext.ButtonClickEvent += (sender, e) => + { + if (txtWifi.Text.Trim() == string.Empty || txtPsw.Text.Trim() == string.Empty) + { + return; + } + + //杩涘叆涓嬩竴涓晫闈� + this.CloseForm(); + var form = new AddMiniRemoteControlDirection4Page(); + form.AddForm(txtWifi.Text.Trim(), txtPsw.Text); + }; + + HdlThreadLogic.Current.RunThread(() => + { + //鎵撳紑杩涘害鏉�,鍗″畠涓�涓� + this.ShowProgressBar(); + //鑾峰彇褰撳墠wifi鍚嶅瓧(閲岄潰鍙兘浼氬崱) + this.NowWifiName = HdlWifiLogic.Current.SSID; + HdlThreadLogic.Current.RunMain(() => + { + txtWifi.Text = NowWifiName; + }); + + this.CloseProgressBar(); + }); + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 鍒锋柊wifi鍚嶅瓧 + /// </summary> + private void RefreshWifiName(TextInputControl textInput) + { + if (this.WifiThreadAction == true) { return; } + this.WifiThreadAction = true; + + HdlThreadLogic.Current.RunThread(() => + { + //杩欎釜绾跨▼涓嶄細琚腑鏂� + while (this.Parent != null) + { + System.Threading.Thread.Sleep(1500); + string wifiName = string.Empty; + try + { + //鑾峰彇褰撳墠wifi鍚嶅瓧(閲岄潰鍙兘浼氬崱) + wifiName = HdlWifiLogic.Current.SSID; + } + catch { continue; } + if (wifiName != this.NowWifiName) + { + this.NowWifiName = wifiName; + HdlThreadLogic.Current.RunMain(() => + { + textInput.Text = this.NowWifiName; + }); + } + } + }); + } + + #endregion + } +} diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs new file mode 100644 index 0000000..6caf40d --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs @@ -0,0 +1,424 @@ +锘縰sing HDL_ON.Stan; +using Shared; +using System; +using System.Collections.Generic; +using System.Text; + +namespace HDL_ON.UI +{ + /// <summary> + /// 娣诲姞Evoyo鐨凪ini鏅鸿兘閬ユ帶鍣ㄦ楠�4鐣岄潰 + /// </summary> + public class AddMiniRemoteControlDirection4Page : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// wifi鍚嶅瓧 + /// </summary> + private string wifiName = string.Empty; + /// <summary> + /// wifi瀵嗙爜 + /// </summary> + private string wifiPsw = string.Empty; + /// <summary> + /// 瓒呮椂绾跨▼鏄惁杩愯 + /// </summary> + private bool timeoutThreadActivity = false; + /// <summary> + /// 涓婁紶鍒颁簯鐨勫浘鏍� + /// </summary> + private IconViewControl btnClound = null; + /// <summary> + /// 涓婁紶鍒颁簯 + /// </summary> + private NormalViewControl btnCloundView = null; + /// <summary> + /// 杩炴帴鎴愬姛鐨勫浘鏍� + /// </summary> + private IconViewControl btnConnect = null; + /// <summary> + /// 杩炴帴鎴愬姛 + /// </summary> + private NormalViewControl btnConnetView = null; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + /// <param name="i_wifiName">wifi鍚嶅瓧</param> + /// <param name="i_wifiPsw">wifi瀵嗙爜</param> + public void ShowForm(string i_wifiName, string i_wifiPsw) + { + this.wifiName = i_wifiName; + this.wifiPsw = i_wifiPsw; + + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(StringId.AddInfraredRemoteControl)); + //杩欎釜鐣岄潰鐨勮儗鏅渶瑕佺櫧鑹� + bodyFrameLayout.BackgroundColor = UI.CSS.CSS_Color.MainBackgroundColor; + + //娣诲姞鎺ユ敹钃濈墮鍙嶉鐨勪簨浠� + HdlAndroidBluetoothLogic.Current.AddReceiveEvent(this.BluetoothReceiveEvent); + //娣诲姞浜戠鍙嶉浜嬩欢 + HdlCloudReceiveLogic.Current.AddCloudReceiveEvent("AddMiniRemoteControlDirection4Page", this.CloudReceiveEvent); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖body + this.ClearBodyFrame(); + //鍥剧墖 + var btnPic = new PicViewControl(282, 121); + btnPic.Y = Application.GetRealHeight(122); + btnPic.Gravity = Gravity.CenterHorizontal; + btnPic.UnSelectedImagePath = "PersonalCenter/AddDevice/WifiAndPhoneConnect.png"; + bodyFrameLayout.AddChidren(btnPic); + //姝e湪杩炴帴涓�... + var btnSearch = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(20), false); + btnSearch.Y = btnPic.Bottom + Application.GetRealHeight(40); + btnSearch.TextColor = CSS.CSS_Color.FirstLevelTitleColor; + btnSearch.TextID = StringId.NowConnectting; + btnSearch.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(btnSearch); + //璇疯绾㈠閬ユ帶灏介噺鎺ヨ繎WIFI璺敱鍣� + var strMsg = Language.StringByID(StringId.AddInfraredRemoteControlMsg5); + this.AddListMsgControls(bodyFrameLayout, strMsg, CSS.CSS_FontSize.TextFontSize, + CSS.CSS_Color.PromptingColor1, Application.GetRealHeight(20), btnSearch.Bottom + Application.GetRealHeight(4)); + + //缃戠粶杩炴帴涓� + var btnNetIcon = new IconViewControl(20); + btnNetIcon.X = Application.GetRealWidth(60); + btnNetIcon.Y = btnPic.Bottom + Application.GetRealHeight(265); + btnNetIcon.UnSelectedImagePath = "PersonalCenter/AddDevice/NetConnectSelect.png"; + bodyFrameLayout.AddChidren(btnNetIcon); + var btnNetView = new NormalViewControl(140, 18, true);//宸﹀彸闂磋窛40鍐嶅姞鏂囨湰60 + btnNetView.Y = btnNetIcon.Bottom + Application.GetRealHeight(16); + btnNetView.TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel; + btnNetView.TextColor = CSS.CSS_Color.FirstLevelTitleColor; + btnNetView.TextAlignment = TextAlignment.Center; + btnNetView.TextID = StringId.InTheNetworkLink; + bodyFrameLayout.AddChidren(btnNetView); + + //涓�鏉℃í绾� + var btnLine1 = new NormalViewControl(Application.GetRealWidth(92), 2, false); + btnLine1.X = btnNetIcon.Right + Application.GetRealWidth(3); + btnLine1.Y = btnNetIcon.Y + (btnNetIcon.Height + 2) / 2; + btnLine1.BackgroundColor = CSS.CSS_Color.PromptingColor1; + bodyFrameLayout.AddChidren(btnLine1); + + //涓婁紶鍒颁簯 + this.btnClound = new IconViewControl(20); + btnClound.Gravity = Gravity.CenterHorizontal; + btnClound.Y = btnNetIcon.Y; + btnClound.UnSelectedImagePath = "PersonalCenter/AddDevice/UploadToClound.png"; + btnClound.SelectedImagePath = "PersonalCenter/AddDevice/UploadToCloundSelect.png"; + bodyFrameLayout.AddChidren(btnClound); + this.btnCloundView = new NormalViewControl(btnNetView.Width, btnNetView.Height, false); + btnCloundView.Y = btnNetView.Y; + btnCloundView.Gravity = Gravity.CenterHorizontal; + btnCloundView.TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel; + btnCloundView.TextColor = CSS.CSS_Color.PromptingColor1; + btnCloundView.TextAlignment = TextAlignment.Center; + btnCloundView.TextID = StringId.UploadToCloud; + bodyFrameLayout.AddChidren(btnCloundView); + + //涓�鏉℃í绾� + var btnLine2 = new NormalViewControl(btnLine1.Width, btnLine1.Height, false); + btnLine2.X = btnClound.Right + Application.GetRealWidth(3); + btnLine2.Y = btnLine1.Y; + btnLine2.BackgroundColor = CSS.CSS_Color.PromptingColor1; + bodyFrameLayout.AddChidren(btnLine2); + + //杩炴帴鎴愬姛 + this.btnConnect = new IconViewControl(20); + btnConnect.X = bodyFrameLayout.Width - btnNetIcon.X - btnConnect.IconSize; + btnConnect.Y = btnNetIcon.Y; + btnConnect.UnSelectedImagePath = "PersonalCenter/AddDevice/ConnectSuccess.png"; + btnConnect.SelectedImagePath = "PersonalCenter/AddDevice/ConnectSuccessSelect.png"; + bodyFrameLayout.AddChidren(btnConnect); + this.btnConnetView = new NormalViewControl(btnNetView.Width, btnNetView.Height, false); + btnConnetView.X = bodyFrameLayout.Width - btnNetView.Width - btnNetView.X; + btnConnetView.Y = btnNetView.Y; + btnConnetView.TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel; + btnConnetView.TextColor = CSS.CSS_Color.PromptingColor1; + btnConnetView.TextAlignment = TextAlignment.Center; + btnConnetView.TextID = StringId.ConnectSuccess; + bodyFrameLayout.AddChidren(btnConnetView); + + HdlThreadLogic.Current.RunThread(() => + { + System.Threading.Thread.Sleep(2000); + HdlThreadLogic.Current.RunMain(() => + { + //鍙戦�佽处鍙峰拰瀵嗙爜缁欒摑鐗� + this.SendAccountAndPswToBluetooth(); + }); + //鍚姩瓒呮椂绾跨▼ + this.StartTimeoutThread(); + }); + } + + #endregion + + #region 鈻� 鏄剧ず鎴愬姛鐣岄潰_______________________ + + /// <summary> + /// 鏄剧ず鎴愬姛鐣岄潰 + /// </summary> + private void ShowSuccessView() + { + //娓呯┖body + this.ClearBodyFrame(); + + //鍥剧墖 + var btnPic = new PicViewControl(180, 180); + btnPic.Y = Application.GetRealHeight(48); + btnPic.Gravity = Gravity.CenterHorizontal; + btnPic.UnSelectedImagePath = "Public/TipIcon_Successfully.png"; + bodyFrameLayout.AddChidren(btnPic); + + //娣诲姞鎴愬姛 + var btnFail = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(22), false); + btnFail.Y = btnPic.Bottom + Application.GetRealHeight(16); + btnFail.TextSize = CSS.CSS_FontSize.SubheadingFontSize; + btnFail.TextColor = CSS.CSS_Color.MainColor; + btnFail.TextAlignment = TextAlignment.Center; + btnFail.TextID = StringId.AddSuccess; + bodyFrameLayout.AddChidren(btnFail); + + //鍙互寮�濮嬩娇鐢ㄧ孩澶栭仴鎺у姛鑳斤紒 + var strMsg = Language.StringByID(StringId.AddInfraredRemoteControlMsg7); + int yy = this.AddListMsgControls(bodyFrameLayout, strMsg, CSS.CSS_FontSize.TextFontSize, CSS.CSS_Color.TextualColor, + Application.GetRealHeight(20), btnFail.Bottom + Application.GetRealHeight(8)); + + //寮�濮嬩娇鐢� + var btnUse = new BottomClickButton(220); + btnUse.Y = yy + Application.GetRealHeight(60); + btnUse.TextID = StringId.StartUse; + bodyFrameLayout.AddChidren(btnUse); + btnUse.ButtonClickEvent += (sender, e) => + { + }; + } + + #endregion + + #region 鈻� 鏄剧ず澶辫触鐣岄潰_______________________ + + /// <summary> + /// 鏄剧ず澶辫触鐣岄潰 + /// </summary> + private void ShowFailView() + { + //娓呯┖body + this.ClearBodyFrame(); + + //鍥剧墖 + var btnPic = new PicViewControl(180, 180); + btnPic.Y = Application.GetRealHeight(48); + btnPic.Gravity = Gravity.CenterHorizontal; + btnPic.UnSelectedImagePath = "Public/TipIcon_Failed.png"; + bodyFrameLayout.AddChidren(btnPic); + + //娣诲姞澶辫触 + var btnFail = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(22), false); + btnFail.Y = btnPic.Bottom + Application.GetRealHeight(16); + btnFail.TextSize = CSS.CSS_FontSize.SubheadingFontSize; + btnFail.TextColor = CSS.CSS_Color.AuxiliaryColor2; + btnFail.TextAlignment = TextAlignment.Center; + btnFail.TextID = StringId.AddFail; + bodyFrameLayout.AddChidren(btnFail); + //1銆佽妫�鏌ヨ澶囨槸鍚︽甯搁�氱數 + //2銆佽寮�鍚摑鐗欏姛鑳� + //3銆佸苟闀挎寜鎸夐挳10s锛屾寚绀虹伅甯镐寒 + var strMsg = Language.StringByID(StringId.AddInfraredRemoteControlMsg6); + this.AddListMsgControls(bodyFrameLayout, strMsg, CSS.CSS_FontSize.TextFontSize, CSS.CSS_Color.TextualColor, + Application.GetRealHeight(20), btnFail.Bottom + Application.GetRealHeight(8), + TextAlignment.Center, true); + + //閲嶈瘯 + var btnReDo = this.AddBottomClickButton(Language.StringByID(StringId.Retry)); + btnReDo.ButtonClickEvent += (sender, e) => + { + //閲嶆柊鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + }; + } + + #endregion + + #region 鈻� 鍙戦�佽处鍙峰拰瀵嗙爜缁欒摑鐗檁______________ +#if __IOS__ +#endif +#if __Android__ + /// <summary> + /// 鍙戦�佽处鍙峰拰瀵嗙爜缁欒摑鐗� + /// </summary> + private void SendAccountAndPswToBluetooth() + { + //鑾峰彇鍙戦�佸埌钃濈墮鐨勬暟鎹� + var sendData = this.GetSendToBluetoothData(); + //涓嶇瓑寰� + HdlAndroidBluetoothLogic.Current.SendData(sendData); + } +#endif + + #endregion + + #region 鈻� 浜戠鍙嶉___________________________ + + /// <summary> + /// 浜戠鍙嶉 + /// </summary> + /// <param name="pushEnum">鏋氫妇</param> + /// <param name="i_data">鎺ㄩ�佺殑鍐呭</param> + private void CloudReceiveEvent(CloudPushEnum pushEnum, string i_data) + { + if (pushEnum != CloudPushEnum.A鏂拌澶囦笂鎶�) { return; } + + //鎺ユ敹鍒板氨绉婚櫎杩欎釜浜嬩欢 + HdlCloudReceiveLogic.Current.RemoveCloudReceiveEvent("AddMiniRemoteControlDirection4Page"); + //鍋滄绾跨▼ + this.timeoutThreadActivity = false; + + //娣诲姞璁惧鎴愬姛涔嬪悗,澶勭悊涓�浜涗笢瑗� + this.DoSomethingAfterAddDeviceSuccess(); + } + + /// <summary> + /// 娣诲姞璁惧鎴愬姛涔嬪悗,澶勭悊涓�浜涗笢瑗� + /// </summary> + private void DoSomethingAfterAddDeviceSuccess() + { + HdlThreadLogic.Current.RunThread(() => + { + //鏁寸偣鐗规晥鑰屽凡 + for (int i = 1; i <= 6; i++) + { + System.Threading.Thread.Sleep(1000); + if (i == 1) + { + HdlThreadLogic.Current.RunMain(() => + { + //鏁寸偣鐗规晥鑰屽凡 + this.btnClound.IsSelected = true; + this.btnCloundView.TextColor = CSS.CSS_Color.FirstLevelTitleColor; + }); + } + else if (i == 4) + { + HdlThreadLogic.Current.RunMain(() => + { + //鏁寸偣鐗规晥鑰屽凡 + this.btnConnect.IsSelected = true; + this.btnConnetView.TextColor = CSS.CSS_Color.FirstLevelTitleColor; + }); + } + else if (i == 6) + { + HdlThreadLogic.Current.RunMain(() => + { + //鏄剧ず鎴愬姛鐣岄潰 + this.ShowSuccessView(); + }); + } + } + }); + } + + #endregion + + #region 鈻� 钃濈墮鍙嶉___________________________ + + /// <summary> + /// 钃濈墮鍙嶉 + /// </summary> + /// <param name="i_receviceData">钃濈墮鍙嶉鐨勬暟鎹�</param> + private void BluetoothReceiveEvent(string i_receviceData) + { +#if DEBUG + System.Console.WriteLine("钃濈墮杩斿洖锛�" + i_receviceData); +#endif + } + + #endregion + + #region 鈻� 瓒呮椂绾跨▼___________________________ + + /// <summary> + /// 鍚姩瓒呮椂绾跨▼ + /// </summary> + private void StartTimeoutThread() + { + HdlThreadLogic.Current.RunThread(() => + { + //300绉掕秴鏃� + int timeout = 300; + while (this.timeoutThreadActivity == false && this.Parent != null) + { + System.Threading.Thread.Sleep(1000); + timeout--; + if (timeout == 0) + { + break; + } + } + if (timeout <= 0) + { + //鏄剧ず澶辫触鐣岄潰 + HdlThreadLogic.Current.RunMain(() => + { + this.ShowFailView(); + }); + } + }); + } + + #endregion + + #region 鈻� 鐣岄潰鍏抽棴___________________________ + + /// <summary> + /// 鐣岄潰鍏抽棴 + /// </summary> + public override void CloseFormBefore() + { + //鎽ф瘉钃濈墮 + HdlAndroidBluetoothLogic.Current.Dispone(); + HdlCloudReceiveLogic.Current.RemoveCloudReceiveEvent("AddMiniRemoteControlDirection4Page"); + + base.CloseFormBefore(); + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 鑾峰彇鍙戦�佸埌钃濈墮鐨勬暟鎹� + /// </summary> + /// <returns></returns> + private string GetSendToBluetoothData() + { + var pra = new { id = "id010203", ssid = this.wifiName, password = this.wifiPsw }; + var praData = Newtonsoft.Json.JsonConvert.SerializeObject(pra); + + var sendData = "Topic:/user/id/custom/wifi/set\r\n"; + sendData += "Length:" + praData.Length + "\r\n\r\n"; + sendData += praData; + return sendData; + } + + #endregion + } +} diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddThirdPartyDeviceMenuListPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddThirdPartyDeviceMenuListPage.cs new file mode 100644 index 0000000..38eb89b --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddThirdPartyDeviceMenuListPage.cs @@ -0,0 +1,92 @@ +锘縰sing HDL_ON.Stan; +using Shared; +using System; +using System.Collections.Generic; +using System.Text; + +namespace HDL_ON.UI +{ + /// <summary> + /// 娣诲姞绗笁鏂硅澶囩殑鑿滃崟鍒楄〃鐣岄潰 + /// </summary> + public class AddThirdPartyDeviceMenuListPage : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + /// <param name="i_div"> + /// <para>Evoyo:Evoyo鐨勮澶�</para> + /// <para>Yingshi:钀ょ煶璁惧</para> + /// <para>Tuya:娑傞甫璁惧</para></param> + public void ShowForm(string i_div) + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(StringId.AddDevice)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(i_div); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame(string i_div) + { + //鍒楄〃瀹瑰櫒 + var listView = new VerticalListControl(); + listView.BackgroundColor = CSS.CSS_Color.MainBackgroundColor; + listView.Height = bodyFrameLayout.Height; + bodyFrameLayout.AddChidren(listView); + + //Evoyo鐨勮澶� + if (i_div == "Evoyo") + { + //鍒濆鍖朎voyo璁惧鑿滃崟 + this.InitEvoyoDeviceListMenu(listView); + } + //钀ょ煶璁惧 + else if (i_div == "Yingshi") + { + } + //娑傞甫璁惧 + else if (i_div == "Tuya") + { + } + } + + #endregion + + #region 鈻� 鍒濆鍖朎voyo璁惧鑿滃崟________________ + + /// <summary> + /// 鍒濆鍖朎voyo璁惧鑿滃崟 + /// </summary> + /// <param name="listView"></param> + private void InitEvoyoDeviceListMenu(VerticalListControl listView) + { + //mini鏅鸿兘閬ユ帶鍣� + var rowMini = new RowLayoutControl(); + listView.AddChidren(rowMini); + rowMini.frameTable.AddLeftIcon(32, "PersonalCenter/AddDevice/MiniRemoteControlMenuIcon.png"); + var btnMiniView = rowMini.frameTable.AddLeftCaption(Language.StringByID(StringId.MiniIntelligentRemoteControl), 200); + btnMiniView.TextColor = CSS.CSS_Color.FirstLevelTitleColor; + rowMini.frameTable.AddRightArrow(); + rowMini.frameTable.ButtonClickEvent += (sender, e) => + { + var form = new AddMiniRemoteControlDirection1Page(); + form.AddForm(); + }; + + //璋冩暣妗屽竷鐪熷疄楂樺害 + listView.AdjustRealHeight(0); + } + + #endregion + } +} diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaAirCleanerPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaAirCleanerPage.cs index 68cc16b..d0199bb 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaAirCleanerPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaAirCleanerPage.cs @@ -328,7 +328,7 @@ rowReset.Height = Application.GetRealHeight(50); rowReset.Width = FrameWhiteCentet2.Width; rowReset.Y = rowAnion.Bottom; - FrameWhiteCentet2.AddChidren(rowReset); + //FrameWhiteCentet2.AddChidren(rowReset); rowReset.AddLeftCaption(Language.StringByID(StringId.FilterElementReset), 200); rowReset.AddBottomLine(); rowReset.AddRightArrow(); -- Gitblit v1.8.0