From 4c40f503acf2bcf90d294cc439ef46ba259b9c60 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 02 十二月 2019 09:27:46 +0800 Subject: [PATCH] 新版本,如果 IOS 编译报错,先注释掉 --- ZigbeeApp/Shared/Phone/Device/Logic/DelayTime.cs | 16 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayAddSuccessForm.cs | 12 ZigbeeApp/GateWay.Droid/Assets/Language.ini | 6 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs | 3 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs | 24 ZigbeeApp/Shared/DLL/IOS/Shared.IOS.dll | 0 ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj | 1 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs | 43 + ZigbeeApp/Shared/Common/CommonPage.cs | 4 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs | 2 ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs | 83 ++- ZigbeeApp/Shared/DLL/Android/Shared.Droid.HDLWidget.dll | 0 ZigbeeApp/Shared/Phone/UserCenter/Suggestion/FeedbackForm.cs | 7 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomRightClickButton.cs | 4 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs | 69 --- ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml | 2 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindInfo.cs | 72 ++ ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorlockDialog.cs | 90 +++ ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs | 18 ZigbeeApp/Shared/Phone/Device/Account/AccountLoginByCode.cs | 4 ZigbeeApp/Shared/Phone/ZigBee/Common/Config.cs | 154 ------- ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessUdpSelectNetworkForm.cs | 14 ZigbeeApp/Shared/Phone/UserView/HomePage.cs | 6 ZigbeeApp/Shared/Phone/UserCenter/Residence/AddNewRoomForm.cs | 21 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs | 12 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessApDirection2Form.cs | 41 + ZigbeeApp/Shared/Phone/UserCenter/Member/AddMemberSuccessForm.cs | 14 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MemberFrozenPage.cs | 3 ZigbeeApp/Home.Ios/Home.IOS.csproj | 0 ZigbeeApp/Shared/R.cs | 24 + ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomLeftClickButton.cs | 4 ZigbeeApp/Shared/DLL/Android/Shared.Droid.dll | 0 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessApSelectNetworkForm.cs | 27 + ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs | 203 +++++++++ ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SafeguardLogControl.cs | 4 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs | 24 ZigbeeApp/Shared/Phone/UserCenter/UserMain/MessageManagementForm.cs | 32 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserManagement.cs | 1 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs | 110 ++-- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs | 12 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs | 48 ++ ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlFirmwareUpdateLogic.cs | 5 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessApSearchForm.cs | 2 ZigbeeApp/Shared/Phone/Device/Account/AccountLogin.cs | 17 /dev/null | 0 ZigbeeApp/Shared/Phone/UserCenter/Residence/EditorRoomInforForm.cs | 37 + ZigbeeApp/Shared/Phone/UserCenter/Safety/SafetyManagementMainForm.cs | 3 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs | 4 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/TopRightMenuControl.cs | 7 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessApDirection3Form.cs | 14 51 files changed, 785 insertions(+), 520 deletions(-) diff --git a/ZigbeeApp/GateWay.Droid/Assets/Language.ini b/ZigbeeApp/GateWay.Droid/Assets/Language.ini index 8724e0e..086da77 100755 --- a/ZigbeeApp/GateWay.Droid/Assets/Language.ini +++ b/ZigbeeApp/GateWay.Droid/Assets/Language.ini @@ -1666,6 +1666,12 @@ 15975=姝e湪涓婁紶澶囦唤鏂囦欢 15976=纭鍒犻櫎鍏ㄩ儴娑堟伅? 15977=纭鏍囪鍏ㄩ儴娑堟伅涓哄凡璇�? +15978=閫氫俊閾炬帴澶辫触 +15979=鑾峰彇缃戠粶SSID澶辫触 +15980=瀵嗙爜鍙戦�佸け璐� +15981=閫夋嫨hdlZigbeeGW-xxxx缃戠粶 +15982=璇疯繛鎺ュ搴璚iFi +15983=姝e湪鑾峰彇鍒嗕韩鏁版嵁 ;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄帴鍙g殑杩斿洖淇℃伅缈昏瘧,浠�18000寮�濮嬧槄鈽呪槄鈽� 18004=鎸囧畾缃戝叧宸茬粡琚粦瀹� diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/BottomShadow.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/BottomShadow.png deleted file mode 100755 index 17ea24b..0000000 --- a/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/BottomShadow.png +++ /dev/null Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj b/ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj index 9eacf47..0bbf23c 100644 --- a/ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj +++ b/ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj @@ -435,7 +435,6 @@ <AndroidAsset Include="Assets\Phone\Item\Add_Category.png" /> <AndroidAsset Include="Assets\Phone\Item\Add_GW.png" /> <AndroidAsset Include="Assets\Phone\Item\Back.png" /> - <AndroidAsset Include="Assets\Phone\Item\BottomShadow.png" /> <AndroidAsset Include="Assets\Phone\Item\CancelIcon.png" /> <AndroidAsset Include="Assets\Phone\Item\Category_FunctionBG.png" /> <AndroidAsset Include="Assets\Phone\Item\Category_FunctionBGSelected.png" /> diff --git a/ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml b/ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml index af355b2..1bf5fc4 100644 --- a/ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml +++ b/ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@ 锘�<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.home" android:versionCode="2019112601" android:installLocation="auto" android:versionName="1.0.19112601"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.home" android:versionCode="2019112901" android:installLocation="auto" android:versionName="1.0.19112901"> <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="26" /> <permission android:name="com.hdl.home.permission.JPUSH_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> diff --git a/ZigbeeApp/Home.Ios/Home.IOS.csproj b/ZigbeeApp/Home.Ios/Home.IOS.csproj old mode 100755 new mode 100644 diff --git a/ZigbeeApp/Shared/Common/CommonPage.cs b/ZigbeeApp/Shared/Common/CommonPage.cs index 7a587d5..e64b370 100755 --- a/ZigbeeApp/Shared/Common/CommonPage.cs +++ b/ZigbeeApp/Shared/Common/CommonPage.cs @@ -62,7 +62,7 @@ /// <summary> /// 鐗堟湰鍙� /// </summary> - public static string CodeIDString = "1.0.19112601"; + public static string CodeIDString = "1.0.19112901"; /// <summary> /// 娉ㄥ唽鏉ユ簮(0:HDL On 1:Zigbee) /// </summary> @@ -330,8 +330,6 @@ #if DEBUG System.Console.WriteLine(e.Message); #endif - //Log鍑哄姏 - Phone.UserCenter.HdlLogLogic.Current.WriteLog(e); return null; } } diff --git a/ZigbeeApp/Shared/DLL/Android/Shared.Droid.HDLWidget.dll b/ZigbeeApp/Shared/DLL/Android/Shared.Droid.HDLWidget.dll index 8c539f3..354eaa7 100755 --- a/ZigbeeApp/Shared/DLL/Android/Shared.Droid.HDLWidget.dll +++ b/ZigbeeApp/Shared/DLL/Android/Shared.Droid.HDLWidget.dll Binary files differ diff --git a/ZigbeeApp/Shared/DLL/Android/Shared.Droid.dll b/ZigbeeApp/Shared/DLL/Android/Shared.Droid.dll index 6199639..e7138c2 100755 --- a/ZigbeeApp/Shared/DLL/Android/Shared.Droid.dll +++ b/ZigbeeApp/Shared/DLL/Android/Shared.Droid.dll Binary files differ diff --git a/ZigbeeApp/Shared/DLL/IOS/Shared.IOS.dll b/ZigbeeApp/Shared/DLL/IOS/Shared.IOS.dll index e646f69..89a2645 100755 --- a/ZigbeeApp/Shared/DLL/IOS/Shared.IOS.dll +++ b/ZigbeeApp/Shared/DLL/IOS/Shared.IOS.dll Binary files differ diff --git a/ZigbeeApp/Shared/Phone/Device/Account/AccountLogin.cs b/ZigbeeApp/Shared/Phone/Device/Account/AccountLogin.cs old mode 100644 new mode 100755 index 76f8dad..a79dba4 --- a/ZigbeeApp/Shared/Phone/Device/Account/AccountLogin.cs +++ b/ZigbeeApp/Shared/Phone/Device/Account/AccountLogin.cs @@ -377,14 +377,10 @@ var revertData = responseDataObj; Config.ReFresh(); Config.Instance.Account = revertData.Account; - Config.Instance.MqttKey = revertData.MqttKey; Config.Instance.Password = passwordStr; Config.Instance.MD5PWD = revertData.MD5PWD; Config.Instance.Guid = revertData.Guid; Config.Instance.LoginDateTime = DateTime.Now; - Config.Instance.ConnectZigbeeMqttBrokerPwd = revertData.ConnectZigbeeMqttBrokerPwd; - Config.Instance.ConnectZigbeeMqttClientId = revertData.ConnectZigbeeMqttClientId; - Config.Instance.ZigbeeMqttBrokerLoadSubDomain = revertData.ZigbeeMqttBrokerLoadSubDomain; if (Config.Instance.AccountList.Find((obj) => obj == revertData.Account) == null) { Config.Instance.AccountList.Add(revertData.Account); @@ -509,8 +505,11 @@ var re = await isBindAuthAsync(authStr); if (re) { - //鐩存帴鐧诲綍 - HomePage.Instance.ShowLoginLoadView(); + Application.RunOnMainThread(() => + { + //鐩存帴鐧诲綍 + HomePage.Instance.ShowLoginLoadView(); + }); var resultRegID = await Shared.Common.CommonPage.Instance.PushRegID(); var homes = await House.GetHomeLists(); //鍚姩ZigBee @@ -545,7 +544,7 @@ #endif #if iOS - Home.IOS.AppDelegate.WXLogin(); + Home.IOS.AppDelegate.WXLogin(); Home.IOS.AppDelegate.RespAction = (authStr) => { if (authStr == null) @@ -636,11 +635,7 @@ Config.Instance.Account = revertData.Account; Config.Instance.MD5PWD = revertData.MD5PWD; Config.Instance.Guid = revertData.Guid; - Config.Instance.MqttKey = revertData.MqttKey; Config.Instance.LoginDateTime = DateTime.Now; - Config.Instance.ConnectZigbeeMqttBrokerPwd = revertData.ConnectZigbeeMqttBrokerPwd; - Config.Instance.ConnectZigbeeMqttClientId = revertData.ConnectZigbeeMqttClientId; - Config.Instance.ZigbeeMqttBrokerLoadSubDomain = revertData.ZigbeeMqttBrokerLoadSubDomain; if (Config.Instance.AccountList.Find((obj) => obj == revertData.Account) == null) { Config.Instance.AccountList.Add(revertData.Account); diff --git a/ZigbeeApp/Shared/Phone/Device/Account/AccountLoginByCode.cs b/ZigbeeApp/Shared/Phone/Device/Account/AccountLoginByCode.cs index 78a13f4..bfdbd0d 100755 --- a/ZigbeeApp/Shared/Phone/Device/Account/AccountLoginByCode.cs +++ b/ZigbeeApp/Shared/Phone/Device/Account/AccountLoginByCode.cs @@ -306,13 +306,9 @@ var revertData = responseDataObj; Config.ReFresh(); Config.Instance.Account = revertData.Account; - Config.Instance.MqttKey = revertData.MqttKey; Config.Instance.Guid = revertData.Guid; Config.Instance.MD5PWD = revertData.MD5PWD; Config.Instance.LoginDateTime = DateTime.Now; - Config.Instance.ConnectZigbeeMqttBrokerPwd = revertData.ConnectZigbeeMqttBrokerPwd; - Config.Instance.ConnectZigbeeMqttClientId = revertData.ConnectZigbeeMqttClientId; - Config.Instance.ZigbeeMqttBrokerLoadSubDomain = revertData.ZigbeeMqttBrokerLoadSubDomain; if (Config.Instance.AccountList.Find((obj) => obj == revertData.Account) == null) { Config.Instance.AccountList.Add(revertData.Account); diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DelayTime.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DelayTime.cs index 4144117..09560c1 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/DelayTime.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DelayTime.cs @@ -165,10 +165,18 @@ { timevalue = int.Parse(Common.Logic.CurrentLogic.Actions[isInt]["DelayTime"].ToString()); - var minutevalue1 = timevalue / 60; - var secondvalue1 = timevalue % 60; - //鏇存柊鏈�鏂扮姸鎬� - mUIPickerView.setCurrentItems(minutevalue1, secondvalue1, 0); + if (timevalue > 3600) + { + //鏇存柊鏈�鏂扮姸鎬� + mUIPickerView.setCurrentItems(60, timevalue - 3600, 0); + } + else + { + var minutevalue1 = timevalue / 60; + var secondvalue1 = timevalue % 60; + //鏇存柊鏈�鏂扮姸鎬� + mUIPickerView.setCurrentItems(minutevalue1, secondvalue1, 0); + } value = timevalue; } string selectde = ""; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs index 22fb634..7a5fef0 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs @@ -1057,6 +1057,10 @@ /// <summary> /// 涓婚敭 /// </summary> + public string Id = string.Empty; + /// <summary> + /// 鎴戜篃涓嶇煡閬撹繖涓槸浠�涔堥 + /// </summary> public string RegId = string.Empty; /// <summary> /// 娑堟伅鍐呭 diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs index 6c3fb2b..36c8452 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs @@ -241,75 +241,6 @@ return Application.GetRealWidth(realWidth + 20); } - /// <summary> - /// 娣诲姞搴曢儴闃村奖鐗规晥(纭繚鎷ユ湁鐖舵帶浠跺悗鎵嶈皟鐢�) - /// </summary> - /// <param name="view">涓哄摢涓帶浠舵坊鍔犻槾褰辩壒鏁�,鐪佺暐鏃�,涓哄綋鍓嶆帶浠舵坊鍔�</param> - /// <param name="average">娣诲姞鐨勯槾褰辩壒鏁堟槸鍚︽寜骞冲潎鍊艰缃珮瀹藉害</param> - public void AddBottomShadow(View view = null, bool average = false) - { - //闇�瑕佹墿澶х殑楂樺害 - int heightValue = 21; - //闇�瑕佹墿澶х殑瀹藉害 - int widthValue = 15; - //鏈�澶ч珮搴� - int maxHeight = 0; - if (average == false) - { - heightValue = Application.GetRealHeight(heightValue); - widthValue = Application.GetRealWidth(widthValue); - maxHeight = Application.GetRealHeight(460); - } - else - { - heightValue = Application.GetMinRealAverage(heightValue); - widthValue = Application.GetMinRealAverage(widthValue); - maxHeight = Application.GetMinRealAverage(460); - } - if (view == null) - { - //鐪佺暐鏃�,鎸囧畾涓哄綋鍓嶆帶浠� - view = this; - } - //鍏堢Щ闄� - this.btnBottomShadowView1?.RemoveFromParent(); - this.btnBottomShadowView2?.RemoveFromParent(); - - int realHeight = view.Height + heightValue * 2; - if (realHeight <= maxHeight) - { - //闃村奖鎺т欢 - this.btnBottomShadowView1 = new Button(); - btnBottomShadowView1.UnSelectedImagePath = "Item/BottomShadow.png"; - btnBottomShadowView1.Height = realHeight; - btnBottomShadowView1.Width = view.Width + widthValue * 2; - btnBottomShadowView1.X = view.X - widthValue; - btnBottomShadowView1.Y = view.Y; - view.Parent.AddChidren(btnBottomShadowView1); - view.BringToFront(); - } - else - { - //瓒呰繃鏈�澶ф椂,鐗规畩澶勭悊 - this.btnBottomShadowView1 = new Button(); - btnBottomShadowView1.UnSelectedImagePath = "Item/BottomShadow.png"; - btnBottomShadowView1.Height = view.Height - heightValue * 2; - btnBottomShadowView1.Width = view.Width + widthValue * 2; - btnBottomShadowView1.X = view.X - widthValue; - btnBottomShadowView1.Y = view.Y + heightValue * 2; - view.Parent.AddChidren(btnBottomShadowView1); - - this.btnBottomShadowView2 = new Button(); - btnBottomShadowView2.UnSelectedImagePath = "Item/BottomShadow.png"; - btnBottomShadowView2.Height = maxHeight; - btnBottomShadowView2.Width = view.Width + widthValue * 2; - btnBottomShadowView2.X = view.X - widthValue; - btnBottomShadowView2.Y = view.Bottom - maxHeight + heightValue * 2; - view.Parent.AddChidren(btnBottomShadowView2); - view.BringToFront(); - } - } - #endregion #region 鈻� Log鍑哄姏____________________________ diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomLeftClickButton.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomLeftClickButton.cs index 211dcdc..c9f3365 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomLeftClickButton.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomLeftClickButton.cs @@ -42,14 +42,14 @@ /// <param name="i_width">瀹藉害,鐪熷疄鍊�</param> /// <param name="i_height">楂樺害,鐪熷疄鍊�</param> /// <param name="i_radius">鍦嗚搴�(鍙瀹夊崜鏈夋晥)</param> - public BottomLeftClickButton(int i_width, int i_height, int i_radius = 8) + public BottomLeftClickButton(int i_width, int i_height, uint i_radius = 8) { this.Height = i_height; this.Width = i_width; this.Gravity = Gravity.BottomLeft; #if Android - this.Radius = 8; + this.Radius = i_radius; #endif } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomRightClickButton.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomRightClickButton.cs index 3dddb62..5bc2d3d 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomRightClickButton.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomRightClickButton.cs @@ -42,14 +42,14 @@ /// <param name="i_width">瀹藉害,鐪熷疄鍊�</param> /// <param name="i_height">楂樺害,鐪熷疄鍊�</param> /// <param name="i_radius">鍦嗚搴�(鍙瀹夊崜鏈夋晥)</param> - public BottomRightClickButton(int i_width, int i_height, int i_radius = 8) + public BottomRightClickButton(int i_width, int i_height, uint i_radius = 8) { this.Height = i_height; this.Width = i_width; this.Gravity = Gravity.BottomRight; #if Android - this.Radius = 8; + this.Radius = i_radius; #endif } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SafeguardLogControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SafeguardLogControl.cs index 475f0e6..8bf882e 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SafeguardLogControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SafeguardLogControl.cs @@ -136,7 +136,7 @@ this.frameTable.AddChidren(btnMsg); } //娣诲姞搴曢儴闃村奖鐗规晥 - this.btnTime.AddBottomShadow(this.frameTable); + this.frameTable.SetViewShadow(true); } #endregion @@ -272,7 +272,7 @@ this.Height = realHeight + Application.GetRealHeight(44); } //娣诲姞搴曢儴闃村奖鐗规晥 - this.btnTime.AddBottomShadow(this.frameTable); + this.frameTable.SetViewShadow(true); return value; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/TopRightMenuControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/TopRightMenuControl.cs index 9c87f0d..20b11a9 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/TopRightMenuControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/TopRightMenuControl.cs @@ -39,7 +39,7 @@ /// <summary> /// 鍋氭垚涓�涓瓨鍦ㄤ簬鍙充笂瑙掔殑鑿滃崟鎺т欢 /// </summary> - /// <param name="i_RowCount">涓�鍏辨湁鍑犺</param> + /// <param name="i_RowCount">涓�鍏辨湁鍑犺(涓嶅惈鏍囬)</param> /// <param name="i_width">杩欎釜鑿滃崟鏈夊瀹�</param> /// <param name="titleText">鏍囬鏂囨湰(濡傛灉涓嶄负绌�,鑿滃崟妯″紡鍙樻洿涓烘嫢鏈夋爣棰樼殑妯″紡)</param> public TopRightMenuControl(int i_RowCount, int i_width = 395, string titleText = null) @@ -66,6 +66,11 @@ //鏈�澶ф樉绀�5涓� int rowCount = this.RowCount > 5 ? 5 : this.RowCount; + if (rowCount < 5 && titleText != null) + { + //鑿滃崟+1 + rowCount++; + } //妗屽竷 var frameTable = new FrameLayout(); frameTable.X = Application.GetRealWidth(662 - (RowWidth - 395)); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs index f1d9bc5..fb1b67c 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs @@ -127,7 +127,7 @@ } //娑堟伅 - var btnMsg = new NormalViewControl(frameBack.Width - Application.GetRealWidth(60 * 2), Application.GetRealHeight(180), false); + var btnMsg = new NormalViewControl(frameBack.Width - Application.GetRealWidth(55 * 2), Application.GetRealHeight(180), false); btnMsg.Y = Application.GetRealHeight(141); btnMsg.IsMoreLines = true; btnMsg.TextAlignment = TextAlignment.Center; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs index 9b0a56a..d8c8cb4 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs @@ -396,6 +396,9 @@ var file2 = System.IO.File.Create(checkFile); file2.Close(); + //閲嶆柊鍒锋柊浣忓畢瀵硅薄 + UserCenterLogic.RefreshHomeObject(); + return 1; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlFirmwareUpdateLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlFirmwareUpdateLogic.cs index 12fe130..a1c6fb9 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlFirmwareUpdateLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlFirmwareUpdateLogic.cs @@ -138,8 +138,9 @@ /// <returns></returns> private async static Task<bool> GetFirmwareVersionAndSetToMemmory(FirmwareLevelType levelType, GetFirmwareVersionPra pra) { - string resultValue = await UserCenterLogic.GetResponseDataByRequestHttps("FirmwareMana/DetectionPlatformUploadFirmware", false, pra); - if (resultValue == null) + var listNotShow = new List<string>() { "NotSetAgain" }; + string resultValue = await UserCenterLogic.GetResponseDataByRequestHttps("FirmwareMana/DetectionPlatformUploadFirmware", false, pra, listNotShow); + if (string.IsNullOrEmpty(resultValue) == true) { return false; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs index 660ebbc..ea5c735 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs @@ -117,10 +117,20 @@ { return; } + + List<string> listBackupGwId = new List<string>(); + var fileData = Global.ReadFileByDirectory(DirNameResourse.LocalMemoryDirectory, DirNameResourse.BackupGatewayIdFile); + if (fileData != null) + { + //鏂板锛氳櫧鐒舵鐜囦綆锛屼絾鏄‘瀹炲彂鐢熶簡銆傚鏋滄湁缃戠粶鏃讹紝App閲嶆柊缁戝畾璁板綍鐨勭綉鍏冲け璐ョ殑璇� + //涓嶅簲璇ュ垹闄ゅ畠 + listBackupGwId = JsonConvert.DeserializeObject<List<string>>(System.Text.Encoding.UTF8.GetString(fileData)); + } + List<string> listDelete = new List<string>(); foreach (var gatewayId in this.dicGateway.Keys) { - if (result.ContainsKey(gatewayId) == false) + if (result.ContainsKey(gatewayId) == false && listBackupGwId.Contains(gatewayId) == false) { //鏈湴瀛樺湪浜戠涓嶅瓨鍦ㄧ殑缃戝叧锛屽垯鍒犻櫎 listDelete.Add(gatewayId); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs index b9e473b..766493a 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs @@ -478,7 +478,6 @@ /// <summary> /// 鑾峰彇鎴愬憳鍏变韩鍒楄〃鐒跺悗淇濆瓨鍒版湰鍦�(鐢ㄥ畬涔嬪悗鏈�濂借皟鐢ㄦ竻绌� ClearShardDirectory鍑芥暟娓呯┖) /// </summary> - /// <param name="SubAccountDistributedMark">鎴愬憳鍒楄〃鎺ュ彛杩斿洖鐨凷ubAccountDistributedMark</param> /// <param name="memberShardInfo"> /// <para>鎴愬憳鐨勫垎浜暟鎹�</para> /// <para>濡傛灉涓嶇煡閬撹繖鏄粈涔堜笢瑗�,灏盢ew涓�涓�,鐒跺悗缂撳瓨璧锋潵,璋冪敤鍏朵粬鍑芥暟閮介渶瑕佽繖涓笢瑗�</para> @@ -495,8 +494,9 @@ } memberShardInfo.Refresh = false; - //鎵撳紑杩涘害鏉� - ProgressBar.Show(); + //姝e湪鑾峰彇鍒嗕韩鏁版嵁 + ProgressFormBar.Current.Start(); + ProgressFormBar.Current.SetMsg(Language.StringByID(R.MyInternationalizationString.uShardContentGetting)); var infoPra = new { @@ -508,7 +508,7 @@ if (result == null) { //鍏抽棴杩涘害鏉� - ProgressBar.Close(); + ProgressFormBar.Current.Close(); return false; } var listData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ReceiveShardInfoResult>>(result); @@ -543,7 +543,7 @@ if (listFile == null) { //鍏抽棴杩涘害鏉� - ProgressBar.Close(); + ProgressFormBar.Current.Close(); return false; } @@ -551,7 +551,7 @@ this.GetMemberShardContentListFromLocal(memberShardInfo); //鍏抽棴杩涘害鏉� - ProgressBar.Close(); + ProgressFormBar.Current.Close(); return true; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs index d78f64a..b73cdc7 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs @@ -1,5 +1,6 @@ 锘縰sing System; using System.Collections.Generic; +using System.Security.Cryptography; using System.Text; namespace Shared.Phone.UserCenter @@ -31,6 +32,35 @@ } /// <summary> + /// 褰撳墠Wifi鐨処p鍦板潃 + /// </summary> + public string IpAddress + { + get + { + var temp = new Shared.Net.NetWiFi(); + return temp.GetIPAddress(); + } + } + + /// <summary> + /// 褰撳墠鏄惁鏄綉鍏崇儹鐐� + /// </summary> + public bool IsGatewayHotspot + { + get + { + string myId = this.SSID; + + if (myId.StartsWith("hdlZigbeeGW") == true) + { + return true; + } + return false; + } + } + + /// <summary> /// 褰撳墠wifi鐨凷SID,涔熷彨Wifi鐨勫悕瀛�(鍙栦笉鍒版椂,浼氳繑鍥瀗ull) /// </summary> public string SSID @@ -54,9 +84,9 @@ { System.Threading.Thread.Sleep(50); count++; - if (count == 60) + if (count == 20) { - //3绉掕秴鏃� + //1绉掕秴鏃� return null; } } @@ -75,6 +105,175 @@ private Com.Mediatek.Elian.ElianNative hdlWiFi = null; #endif + /// <summary> + /// TCP鍗忚 + /// </summary> + private System.Net.Sockets.TcpClient tcpClient = null; + /// <summary> + /// 閾炬帴娴佸璞� + /// </summary> + private System.Net.Sockets.NetworkStream networkStream = null; + /// <summary> + /// Ap妯″紡缃戝叧杩斿洖鐨勭閽� + /// </summary> + private string randDesKey = null; + + #endregion + + #region 鈻� Ap妯″紡鐨凾CP閾炬帴____________________ + + /// <summary> + /// 鎵撳紑Ap妯″紡鐨凾CP閾炬帴(鏈夐敊璇椂锛岀洿鎺ヨ繑鍥為敊璇秷鎭�傛病鏈夐敊璇椂锛岃繑鍥瀗ull) + /// </summary> + /// <returns></returns> + public string StartApTcpConnection() + { + try + { + //TCP杩炴帴 + tcpClient = new System.Net.Sockets.TcpClient(); + tcpClient.Connect("192.168.8.1", 5000); + networkStream = tcpClient.GetStream(); + //鍔犲瘑鏁版嵁 + string sendDataMsg = "hdl1985."; + string DefaultdesKey = "hdl1985."; + //44bytes 鍔犲瘑鏁版嵁 DES鍔犲瘑 base64瀵嗘枃 + var sendData = Encoding.UTF8.GetBytes(DesEncrypt(sendDataMsg, DefaultdesKey)); + //灏嗘暟鎹啓鍏ョ綉缁滄祦 + networkStream.Write(sendData, 0, sendData.Length); + + System.Threading.Thread.Sleep(500); + //2.鎺ユ敹鐘舵��,闀垮害<1024瀛楄妭 + byte[] bytes = new Byte[1024]; + int length = networkStream.Read(bytes, 0, bytes.Length); + if (length == 0) + { + //閫氫俊閾炬帴澶辫触 + return Language.StringByID(R.MyInternationalizationString.uCommunicationLinkFail); + } + string data = Encoding.UTF8.GetString(bytes, 0, length); + //缃戝叧杩斿洖鐨勭閽� + this.randDesKey = DESDecrypt(data, DefaultdesKey); + + return null; + } + catch (Exception ex) + { + HdlLogLogic.Current.WriteLog(ex); + this.CloseApTcpConnection(); + //閫氫俊閾炬帴澶辫触 + return Language.StringByID(R.MyInternationalizationString.uCommunicationLinkFail); + } + } + + /// <summary> + /// Ap妯″紡 鍙戦�佸瘑鐮佸埌瀹跺涵鐨勮矾鐢卞櫒 + /// </summary> + /// <param name="ssid"></param> + /// <param name="password"></param> + /// <returns></returns> + public bool SendApHomeWifiPassword(string ssid, string password) + { + try + { + //鍔犲瘑鏁版嵁 + string data2 = "ssid:" + ssid + "," + "pwd:" + password; + var sendData2 = Encoding.UTF8.GetBytes(DesEncrypt(data2, randDesKey)); + //灏嗘暟鎹啓鍏ョ綉缁滄祦 + networkStream.Write(sendData2, 0, sendData2.Length); + return true; + } + catch (Exception ex) + { + HdlLogLogic.Current.WriteLog(ex); + return false; + } + } + + /// <summary> + /// 鍏抽棴Ap妯″紡鐨則cp閾炬帴 + /// </summary> + public void CloseApTcpConnection() + { + try + { + //鍏抽棴瀹㈡埛绔� + tcpClient?.Close(); + tcpClient = null; + networkStream = null; + randDesKey = null; + } + catch (Exception ex) + { + HdlLogLogic.Current.WriteLog(ex); + } + } + + #endregion + + #region 鈻� 鍔犲瘑瑙e瘑___________________________ + + /// <summary> + /// //鍔犲瘑鏁版嵁 + /// </summary> + /// <param name="pToDesEncrypt"></param> + /// <param name="sKey">DES绉橀挜</param> + /// <returns></returns> + private string DesEncrypt(string pToDesEncrypt, string sKey) + { + // 鍒涘缓des鍔犲瘑娌� + using (DESCryptoServiceProvider des = new DESCryptoServiceProvider()) + { + // 寰楀埌UTF-8鐨勬暟鎹簮 + byte[] inputByteArray = Encoding.UTF8.GetBytes(pToDesEncrypt); + // 璁剧疆key鍜宨v瀵嗛挜 + des.Key = ASCIIEncoding.ASCII.GetBytes(sKey); + des.IV = ASCIIEncoding.ASCII.GetBytes(sKey); + //鐢变簬java鏄娇鐢ㄩ粯璁ゅ姞瀵嗘ā寮忥紝C#榛樿鏄疌BC锛岄渶瑕佷慨鏀逛负ECB + des.Mode = CipherMode.CBC; + des.Padding = PaddingMode.PKCS7; + // 鍒涘缓鏁版嵁娴佸苟杩涜鍔犲瘑 + var ms = new System.IO.MemoryStream(); + using (CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(), CryptoStreamMode.Write)) + { + cs.Write(inputByteArray, 0, inputByteArray.Length); + cs.FlushFinalBlock(); + cs.Close(); + } + // 鍏抽棴鏁版嵁娴� + ms.Close(); + return Convert.ToBase64String(ms.ToArray());//base64瀵嗘枃 + } + } + + /// <summary> + /// 瑙e瘑 + /// </summary> + /// <param name="pToDecrypt"></param> + /// <param name="key">瑙e瘑瀵嗗寵</param> + /// <returns></returns> + private string DESDecrypt(string pToDecrypt, string key = null) + { + byte[] inputByteArray = Convert.FromBase64String(pToDecrypt); + using (DESCryptoServiceProvider des = new DESCryptoServiceProvider()) + { + + des.Key = ASCIIEncoding.ASCII.GetBytes(key); + des.IV = ASCIIEncoding.ASCII.GetBytes(key); + + var ms = new System.IO.MemoryStream(); + using (CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(), CryptoStreamMode.Write)) + { + cs.Write(inputByteArray, 0, inputByteArray.Length); + cs.FlushFinalBlock(); + cs.Close(); + } + string str = Encoding.UTF8.GetString(ms.ToArray()); + ms.Close(); + return str; + } + } + #endregion #region 鈻� 涓�鑸柟娉昣__________________________ diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs index 7baafdd..319918d 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs @@ -510,18 +510,8 @@ /// </summary> public static void RefreshAllMemory() { - //澶囦唤鐨勬暟鎹紝鏈夊彲鑳芥槸涓讳汉鑷繁涓婁紶鐨勶紝濡傛灉绠$悊鍛樼櫥闄嗘椂锛屼粬鑾峰彇鐨勫浠芥暟鎹湁鐐圭壒娈� - //姣斿涓嬮潰杩欎笁涓笢瑗垮湪涓昏处鍙烽偅閲屾槸涓嶉渶瑕佺殑 - bool isOthreShare = Config.Instance.Home.IsOthreShare; - int accountType = Config.Instance.Home.AccountType; - string mainMark = Config.Instance.Home.MainUserDistributedMark; - //杩樺師浣忓畢瀵硅薄 - Config.Instance.Home = House.GetHouseByHouseId(Config.Instance.Home.Id); - Config.Instance.Home.IsOthreShare = isOthreShare; - Config.Instance.Home.AccountType = accountType; - Config.Instance.Home.MainUserDistributedMark = mainMark; - Config.Instance.Home.Save(false); - + //鍒锋柊浣忓畢瀵硅薄 + RefreshHomeObject(); //鍒锋柊鏈湴缃戝叧鏂囦欢 HdlGatewayLogic.Current.ReFreshByLocal(); //鍒锋柊鏈湴璁惧 @@ -530,6 +520,28 @@ HdlGatewayLogic.Current.SynchronizeDbGateway(); //浠庢湰鍦伴噸鏂板姞杞藉叏閮ㄧ殑鎴块棿 Common.Room.RefreshAllRoomByLocation(); + } + + /// <summary> + /// 鍒锋柊浣忓畢瀵硅薄 + /// </summary> + public static void RefreshHomeObject() + { + //澶囦唤鐨勬暟鎹紝鏈夊彲鑳芥槸涓讳汉鑷繁涓婁紶鐨勶紝濡傛灉绠$悊鍛樼櫥闄嗘椂锛屼粬鑾峰彇鐨勫浠芥暟鎹湁鐐圭壒娈� + //姣斿涓嬮潰杩欎笁涓笢瑗垮湪涓昏处鍙烽偅閲屾槸涓嶉渶瑕佺殑 + bool isOthreShare = Config.Instance.Home.IsOthreShare; + int accountType = Config.Instance.Home.AccountType; + string mainMark = Config.Instance.Home.MainUserDistributedMark; + double Longitude = Config.Instance.Home.Longitude; + double Latitude = Config.Instance.Home.Latitude; + //杩樺師浣忓畢瀵硅薄 + Config.Instance.Home = House.GetHouseByHouseId(Config.Instance.Home.Id); + Config.Instance.Home.IsOthreShare = isOthreShare; + Config.Instance.Home.AccountType = accountType; + Config.Instance.Home.MainUserDistributedMark = mainMark; + Config.Instance.Home.Longitude = Longitude; + Config.Instance.Home.Latitude = Latitude; + Config.Instance.Home.Save(false); } #endregion @@ -648,18 +660,24 @@ /// <summary> /// 鍏抽棴鎵�鏈夋墦寮�浜嗙殑鐣岄潰 /// </summary> - public static void CloseAllOpenForm() + /// <param name="tagetFrom">鐩爣鐣岄潰,濡傛灉鎸囧畾浜嗙殑璇�,鍒欏叧闂洰鏍囩晫闈笂灞傜殑鍏ㄩ儴鐣岄潰(瀹冭嚜韬笉鍏抽棴)</param> + public static void CloseAllOpenForm(string tagetFrom = "") { while (UserView.HomePage.Instance.ChildrenCount > 0) { var view = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1); if (view is CommonFormBase) { + if (((CommonFormBase)view).FormID == tagetFrom) + { + //鍙叧闂埌鎸囧畾鐩爣鐣岄潰 + return; + } ((CommonFormBase)view).CloseForm(); } else if (view is UserView.UserPage) { - break; + return; } else { @@ -807,15 +825,16 @@ UserCenterResourse.Option.UserPictruePath = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Config.Instance.Guid, DirNameResourse.UserPictrueDirectory); //鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅 - await InitUserAccoutInfo(); - //鍒濆鍖栫鐞嗗憳鏉冮檺淇℃伅 - await InitAdminConnectMqttInfo(true); + var hadNet = await InitUserAccoutInfo(); + //濡傛灉鏈夌綉缁滅殑璇� + if (hadNet == true) + { + //閲嶆柊鍙戦�佸懡浠ゅ幓缁戝畾鏂綉鎯呭喌涓嬪浠界殑缃戝叧 + HdlGatewayLogic.Current.ResetComandToBindBackupGateway(); + } //鍒濆鍖栫紦瀛樻垚鍛樼殑淇℃伅 InitLocalMemberListInfo(); - - //閲嶆柊鍙戦�佸懡浠ゅ幓缁戝畾鏂綉鎯呭喌涓嬪浠界殑缃戝叧 - HdlGatewayLogic.Current.ResetComandToBindBackupGateway(); //棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶� CreatAllUserCenterDirectory(); @@ -832,15 +851,22 @@ UserCenterResourse.Option.OldAccountId = Common.Config.Instance.Account; //鍚屾鏁版嵁(浜屾璋冪敤娌″叧绯�) - var result = await HdlAutoBackupLogic.SynchronizeDbAutoBackupData(); + int result = -1; + if (hadNet == true) + { + result = await HdlAutoBackupLogic.SynchronizeDbAutoBackupData(); + } //鍒濆鍖栨湰鍦扮殑缃戝叧淇℃伅 HdlGatewayLogic.Current.ReFreshByLocal(); //鍒濆鍖栨湰鍦扮殑璁惧淇℃伅 Common.LocalDevice.Current.ReFreshByLocal(); - //鍚屾浜戠鐨勭綉鍏砳d锛屽鏋滄湰鍦版嫢鏈変簯绔笉瀛樺湪鐨刬d锛屽垯琛ㄧず搴旇琚崲缁戜簡锛岀洿鎺ュ垹闄� - HdlGatewayLogic.Current.SynchronizeDbGateway(); + if (hadNet == true) + { + //鍚屾浜戠鐨勭綉鍏砳d锛屽鏋滄湰鍦版嫢鏈変簯绔笉瀛樺湪鐨刬d锛屽垯琛ㄧず搴旇琚崲缁戜簡锛岀洿鎺ュ垹闄� + HdlGatewayLogic.Current.SynchronizeDbGateway(); + } //鍒濆鍖栦綇瀹呭璞� Common.Config.Instance.Home = House.GetHouseByHouseId(Common.Config.Instance.HomeId); @@ -1046,44 +1072,6 @@ var info = JsonConvert.DeserializeObject<MemberAdministratorResult>(result); Config.Instance.AdminRequestBaseUrl = info.RequestBaseUrl; Config.Instance.AdminRequestToken = info.RequestToken; - - return true; - } - - /// <summary> - /// 鍒濆鍖栫鐞嗗憳鏉冮檺鐨勮繙绋嬭繛鎺ヤ俊鎭� - /// </summary> - /// <param name="stopRemote">鏄惁涓柇杩滅▼</param> - /// <returns></returns> - public static async Task<bool> InitAdminConnectMqttInfo(bool stopRemote = false) - { - if (UserCenterResourse.UserInfo.AuthorityNo != 2 && UserCenterResourse.UserInfo.AuthorityNo != 3) - { - //鍙湁鎴愬憳鍒嗚韩鎵嶈兘璋冪敤杩欎釜鍑芥暟 - return true; - } - var praMqtt = new - { - CommonPage.RequestVersion, - LoginAccessToken = Config.Instance.Token, - Config.Instance.Home.MainUserDistributedMark, - HomeId = Config.Instance.Home.Id - }; - - var listNotShow = new List<string>() { "NotSetAgain" }; - var result2 = await GetResponseDataByRequestHttps("App/GetConnectMainUserMqttInfo", false, praMqtt, listNotShow); - if (string.IsNullOrEmpty(result2) == true) - { - return false; - } - - //杩滅▼Mqtt - var info2 = JsonConvert.DeserializeObject<MemberAdministratorMqttResult>(result2); - Config.Instance.AdminConnectZigbeeMqttBrokerPwd = info2.ConnectZigbeeMqttBrokerPwd; - Config.Instance.AdminConnectZigbeeMqttClientId = info2.ConnectZigbeeMqttClientId; - Config.Instance.AdminMqttKey = info2.MqttKey; - Config.Instance.AdminZigbeeMqttBrokerLoadSubDomain = info2.ZigbeeMqttBrokerLoadSubDomain; - Config.Instance.AdminConnectZigbeeMqttBrokerName = info2.ConnectZigbeeMqttBrokerName; return true; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindInfo.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindInfo.cs index c2a79dc..a804ced 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindInfo.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindInfo.cs @@ -20,6 +20,52 @@ /// </summary> public static List<CommonDevice> oldTargetList = new List<CommonDevice>(); + //public static async System.Threading.Tasks.Task<int> RemoveTargets(BindObj.BindListResponseObj bindDevice, Panel currentKey) + //{ + // var delDevice = new BindObj.DelDeviceBindData(); + // delDevice.DeviceAddr = currentKey.DeviceAddr; + // delDevice.Epoint = currentKey.DeviceEpoint; + + // if (bindDevice.BindType == 0 || bindDevice.BindType == 1) + // { + // var removeDevice = new BindObj.RemoveBindListObj(); + // removeDevice.BindCluster = bindDevice.BindCluster; + // removeDevice.BindType = 0; + // removeDevice.BindMacAddr = bindDevice.BindMacAddr; + // removeDevice.BindEpoint = bindDevice.BindEpoint; + // delDevice.RemoveBindList.Add(removeDevice); + // } + // else if (bindDevice.BindType == 2) + // { + // var removeDevice = new BindObj.RemoveBindListObj(); + // removeDevice.BindCluster = bindDevice.BindCluster; + // removeDevice.BindType = 1; + // removeDevice.BindScenesId = bindDevice.BindScenesId; + // delDevice.RemoveBindList.Add(removeDevice); + // } + // var delResult = await currentKey.DelDeviceBindAsync(delDevice); + // foreach (var re in delResult.delDeviceBindResponseData.RemoveBindList) + // { + // switch (re.Result) + // { + // case 0: + // return 0; + // break; + // case 4: + + // if (delResult.removeBindResultResponseData != null) + // { + // if (delResult.removeBindResultResponseData.Result == 0) + // { + // return 0; + // } + // } + // break; + // } + // } + // return -1; + //} + public static async System.Threading.Tasks.Task<int> RemoveTargets(BindObj.BindListResponseObj bindDevice, Panel currentKey) { var delDevice = new BindObj.DelDeviceBindData(); @@ -44,24 +90,20 @@ delDevice.RemoveBindList.Add(removeDevice); } var delResult = await currentKey.DelDeviceBindAsync(delDevice); - foreach (var re in delResult.delDeviceBindResponseData.RemoveBindList) + if (delResult != null && delResult.removeBindResultResponseData != null) { - switch (re.Result) + if (delResult.removeBindResultResponseData.Result == 0) { - case 0: - return 0; - break; - case 4: - - if (delResult.removeBindResultResponseData != null) - { - if (delResult.removeBindResultResponseData.Result == 0) - { - return 0; - } - } - break; + return 0; } + else + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(CommonPage.Instance); + } + } + else + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(CommonPage.Instance); } return -1; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs index 9b61629..cfb5f36 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs @@ -601,7 +601,7 @@ { CommonPage.Loading.Start(""); var bindResult = await currentKey.ClearBindInfoAsync(); - if (bindResult.clearBindInfoResponseData != null) + if (bindResult != null && bindResult.clearBindInfoResponseData != null) { if (bindResult.clearBindInfoResponseData.Result != 0) { @@ -629,6 +629,10 @@ isDelSuccess = true; } } + } + else + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel); } } catch { } @@ -1068,6 +1072,46 @@ CommonPage.Loading.Start(""); var delResult = new DelDeviceBindResponseAllData(); delResult = await currentKey.DelDeviceBindAsync(delDevice); + //if (delResult != null) + //{ + // if (delResult.removeBindResultResponseData != null) + // { + // if (delResult.removeBindResultResponseData.Result == 0) + // { + // currentKey.bindList.Remove(bindDevice); + // RefreshList(); + // return 0; + // } + // else + // { + // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(CommonPage.Instance); + // } + // } + // else if (delResult.delDeviceBindResponseData != null) + // { + // foreach (var remTarget in delResult.delDeviceBindResponseData.RemoveBindList) + // { + // if (remTarget.Result == 0) + // { + // currentKey.bindList.Remove(bindDevice); + // RefreshList(); + // //濡傛灉鏄満鏅紝鐢ㄦ埛鍒犻櫎娓呯┖褰撳墠鍒版埧闂村垪琛� + // currentKey.RoomId = ""; + // currentKey.ReSave(); + // return 0; + // } + // else + // { + // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(CommonPage.Instance); + // } + // } + // } + //} + //else + //{ + // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(CommonPage.Instance); + //} + if (delResult.delDeviceBindResponseData?.RemoveBindList != null) { foreach (var re in delResult.delDeviceBindResponseData.RemoveBindList) @@ -1135,7 +1179,7 @@ CommonPage.Loading.Hide(); } break; - case 4: + case 2: if (delResult.removeBindResultResponseData != null) { if (delResult.removeBindResultResponseData.Result == 0) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs index 80c02c8..5759c49 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs @@ -257,21 +257,19 @@ if (UserCenterResourse.UserInfo.AuthorityNo == 1) { Action action = null; - if (!UserCenterResourse.Option.DoorUnLockByRemote) + Action actionNone = null; + action = () => + { + var userManagement = new Shared.Phone.UserCenter.DoorLock.UserManagement(doorLock); + Shared.Phone.UserView.HomePage.Instance.AddChidren(userManagement); + Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; + userManagement.Show(); + }; + actionNone = () => { Shared.Phone.UserCenter.DoorLock.DoorLockCommonLayout.SecurityRequest(doorLock, action); - } - else - { - action = async () => - { - var userManagement = new Shared.Phone.UserCenter.DoorLock.UserManagement(doorLock); - Shared.Phone.UserView.HomePage.Instance.AddChidren(userManagement); - Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - userManagement.Show(); - }; - HdlCheckLogic.Current.CheckSecondarySecurity(action); - } + }; + HdlCheckLogic.Current.CheckSecondarySecurity(action, actionNone); } else { @@ -279,10 +277,21 @@ var result = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockOperateAccess(doorLock, Shared.Common.Config.Instance.Guid); if (result == false) { - var userManagement = new Shared.Phone.UserCenter.DoorLock.UserManagement(doorLock); - Shared.Phone.UserView.HomePage.Instance.AddChidren(userManagement); - Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - userManagement.Show(); + Action action = null; + Action actionNone = null; + action = () => + { + var userManagement = new Shared.Phone.UserCenter.DoorLock.UserManagement(doorLock); + Shared.Phone.UserView.HomePage.Instance.AddChidren(userManagement); + Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; + userManagement.Show(); + }; + actionNone = () => + { + Shared.Phone.UserCenter.DoorLock.DoorLockCommonLayout.SecurityRequest(doorLock, action); + }; + HdlCheckLogic.Current.CheckSecondarySecurity(action, actionNone); + } else { diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs index 98bb400..8b5ba3c 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs @@ -98,13 +98,10 @@ //涓荤嚎绋嬬殑寮傛浼氶樆濉炰富绾跨▼,瀵艰嚧鐣岄潰鏈夋鏃堕棿浼氱櫧灞�,鎵�浠ヨ繖鏍峰瓙璁╃晫闈㈠厛鍑烘潵 //鐒跺悗鍐嶅埛鏂版暟鎹� - HdlThreadLogic.Current.RunThread(() => + HdlThreadLogic.Current.RunMainInThread(() => { - Application.RunOnMainThread(() => - { - //鍒濆鍖栬褰曞垪琛� - this.InitLogListInfo(); - }); + //鍒濆鍖栬褰曞垪琛� + this.InitLogListInfo(); }); } @@ -167,6 +164,11 @@ btnScreeningIcon.Gravity = Gravity.CenterVertical; btnScreeningIcon.UnSelectedImagePath = "Item/ScreeningType.png"; frameTitle.AddChidren(btnScreeningIcon, ChidrenBindMode.NotBind); + btnScreeningIcon.ButtonClickEvent += (sender, e) => + { + //鏄剧ず绫诲瀷绛涢�夌晫闈� + this.ShowDoorLockScreeningTypeForm(); + }; //搴曠嚎 frameTitle.AddBottomLine(); @@ -313,7 +315,7 @@ } else { - btnIcon.UnSelectedImagePath = "Item/UnLockSuccess.png"; + btnIcon.UnSelectedImagePath = "Item/UnLockFail.png"; } //淇℃伅 @@ -510,6 +512,7 @@ List<string> listUser = null; if (listSearchUserId.Contains("-1") == false) { + listUser = new List<string>(); listUser.AddRange(listSearchUserId); //绉婚櫎鍏朵粬,鍥犱负浜戠鍥哄畾浼氱粰 listUser.Remove(""); @@ -519,6 +522,7 @@ List<int> listLock = null; if (listSearchLockId.Contains(-1) == false) { + listLock = new List<int>(); listLock.AddRange(listSearchLockId); } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs index e2bcbed..9ea0ffd 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs @@ -207,22 +207,28 @@ doorDialog.dialogMidFraFrameLayout.Height = Application.GetRealHeight(69); doorDialog.dialogMidFraFrameLayout.X = Application.GetRealWidth(58); doorDialog.dialogMidFraFrameLayout.Y = Application.GetRealHeight(213); - doorDialog.dialogMidFraFrameLayout.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBorder; + doorDialog.dialogMidFraFrameLayout.BackgroundColor = BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBorder; + + var editInputPasswordFrameLayout = new FrameLayout() + { + Width = Application.GetRealWidth(677) - 2, + Height = Application.GetRealHeight(69) - 2, + X = 1, + Y = 1, + BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite, + }; + doorDialog.dialogMidFraFrameLayout.AddChidren(editInputPasswordFrameLayout); var editInputPassword = new EditText() { - Width = Application.GetRealWidth(672), - Height = Application.GetRealHeight(63), - X = Application.GetRealWidth(3), - Y = Application.GetRealHeight(3), - TextSize = 14, + X = Application.GetRealHeight(25), + TextSize = 13, PlaceholderTextColor = Shared.Common.ZigbeeColor.Current.XMGray3, PlaceholderText = Language.StringByID(R.MyInternationalizationString.InputUnlockPasswrd), TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, - TextAlignment = TextAlignment.CenterLeft, - BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite, + TextAlignment = TextAlignment.BottomLeft, }; - doorDialog.dialogMidFraFrameLayout.AddChidren(editInputPassword); + editInputPasswordFrameLayout.AddChidren(editInputPassword); doorDialog.dialogBtnCancel.MouseUpEventHandler += (sender1, e1) => { diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorlockDialog.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorlockDialog.cs index 696a6b1..0c6c44e 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorlockDialog.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorlockDialog.cs @@ -16,14 +16,21 @@ /// <summary> /// 寮圭獥鍙栨秷鎸夐敭 /// </summary> + public Button dialogLine = new Button + { + Height = 1, + Y = Application.GetRealHeight(380), + BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine, + }; + + /// <summary> + /// 寮圭獥鍙栨秷鎸夐敭 + /// </summary> public Button dialogBtnCancel = new Button { - Width = Application.GetRealWidth(397), - Height = Application.GetRealHeight(127), - Y = Application.GetRealHeight(380), TextID = R.MyInternationalizationString.Cancel, TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, - BackgroundColor = Shared.Common.ZigbeeColor.Current.XMMidFrameLayout, + TextSize = 14, }; /// <summary> @@ -31,13 +38,9 @@ /// </summary> public Button dialogBtnConfirm = new Button { - Width = Application.GetRealWidth(398), - Height = Application.GetRealHeight(128), - X = Application.GetRealWidth(397), - Y = Application.GetRealHeight(380), TextID = R.MyInternationalizationString.confrim, TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, - BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack, + TextSize = 14, }; /// <summary> @@ -83,6 +86,7 @@ Y = Application.GetRealHeight(691 - 184), X = Application.GetRealWidth(144), BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite, + Radius = 6, }; flMain.AddChidren(dialogFrameLayout); @@ -94,12 +98,74 @@ Y = Application.GetRealHeight(69), Text = title, TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, + TextSize = 16, }; - dialogFrameLayout.AddChidren(dialogTitle); + #region 搴曢儴鍦嗚UI + var rFrameLayout0 = new FrameLayout + { + Width = Application.GetRealWidth(397), + Height = Application.GetRealHeight(50), + Y = Application.GetRealHeight(380) + 1, + BackgroundColor = Shared.Common.ZigbeeColor.Current.XMMidFrameLayout, + }; + var rFrameLayout1 = new FrameLayout + { + Width = Application.GetRealWidth(398), + Height = Application.GetRealHeight(50), + X = Application.GetRealWidth(397), + Y = Application.GetRealHeight(380) + 1, + BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack, + }; + + var rFrameLayout2 = new FrameLayout + { + Width = Application.GetRealWidth(50), + Height = Application.GetRealHeight(128) - 1, + X = Application.GetRealWidth(397 - 50), + Y = Application.GetRealHeight(380) + 1, + BackgroundColor = Shared.Common.ZigbeeColor.Current.XMMidFrameLayout, + }; + + var rFrameLayout3 = new FrameLayout + { + Width = Application.GetRealWidth(50), + Height = Application.GetRealHeight(128) - 1, + X = Application.GetRealWidth(397), + Y = Application.GetRealHeight(380) + 1, + BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack, + }; + + var r1FrameLayout = new FrameLayout + { + Width = Application.GetRealWidth(397), + Height = Application.GetRealHeight(128) - 1, + Y = Application.GetRealHeight(380) + 1, + BackgroundColor = Shared.Common.ZigbeeColor.Current.XMMidFrameLayout, + Radius = 6, + }; + + var r2FrameLayout = new FrameLayout + { + Width = Application.GetRealWidth(398), + Height = Application.GetRealHeight(128) - 1, + X = Application.GetRealWidth(397), + Y = Application.GetRealHeight(380) + 1, + BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack, + Radius = 6, + }; + dialogFrameLayout.AddChidren(rFrameLayout0); + dialogFrameLayout.AddChidren(rFrameLayout1); + dialogFrameLayout.AddChidren(rFrameLayout2); + dialogFrameLayout.AddChidren(rFrameLayout3); + dialogFrameLayout.AddChidren(r1FrameLayout); + dialogFrameLayout.AddChidren(r2FrameLayout); + #endregion + dialogFrameLayout.AddChidren(dialogTitle); dialogFrameLayout.AddChidren(dialogMidFraFrameLayout); - dialogFrameLayout.AddChidren(dialogBtnConfirm); - dialogFrameLayout.AddChidren(dialogBtnCancel); + dialogFrameLayout.AddChidren(dialogLine); + r2FrameLayout.AddChidren(dialogBtnConfirm); + r1FrameLayout.AddChidren(dialogBtnCancel); } } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs index a25457b..0fbe09b 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs @@ -37,6 +37,7 @@ /// </summary> private CommonDevice deviceObj = null; Action action; + Action actionNone; string modifyDeviceName = ""; bool IsModifyName = true; public Action<string> devicNameAction; @@ -293,21 +294,18 @@ { if (currentIndex == 3) { - if (!UserCenterResourse.Option.DoorUnLockByRemote) + action = async () => { - SecurityRequest(doorLock, action); - } - else + var temporaryPassword = new Shared.Phone.UserCenter.DoorLock.TemporaryPassword(doorLock); + Shared.Phone.UserView.HomePage.Instance.AddChidren(temporaryPassword); + Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; + temporaryPassword.Show(); + }; + actionNone = async () => { - action = async () => - { - var temporaryPassword = new Shared.Phone.UserCenter.DoorLock.TemporaryPassword(doorLock); - Shared.Phone.UserView.HomePage.Instance.AddChidren(temporaryPassword); - Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - temporaryPassword.Show(); - }; - HdlCheckLogic.Current.CheckSecondarySecurity(action); - } + Shared.Phone.UserCenter.DoorLock.DoorLockCommonLayout.SecurityRequest(doorLock, action); + }; + HdlCheckLogic.Current.CheckSecondarySecurity(action, actionNone); } else if (currentIndex == 4) { diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MemberFrozenPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MemberFrozenPage.cs index 3d801e6..0676dc9 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MemberFrozenPage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MemberFrozenPage.cs @@ -73,13 +73,14 @@ { }; this.midFrameLayout.AddChidren(bodyView); + MidRefresh(); + bodyView.BeginHeaderRefreshingAction += () => { bodyView.BeginHeaderRefreshing(); ReadDoorLockUserInfo(); bodyView.EndHeaderRefreshing(); }; - MidRefresh(); } public async void MidRefresh() diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs index b5c8250..74cbb04 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs @@ -144,6 +144,7 @@ btnAddFrameLayout.Width = Application.GetRealWidth(72); } + MidFrameLayoutContent(); if (doorLock.IsFailedToGetDoorLockInfo[curAccountObj.SubAccountDistributedMark] == true) { CommonPage.Loading.Start("Loading..."); @@ -151,7 +152,6 @@ } else { - MidFrameLayoutContent(); RefreshList(); } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserManagement.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserManagement.cs index 0e978d9..e019808 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserManagement.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserManagement.cs @@ -41,7 +41,6 @@ { System.Threading.Tasks.Task.Run(async () => { - //Application.RunOnMainThread(() => {; }); try { var localAccountListTemp = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.LocalAccountList(); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessApDirection2Form.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessApDirection2Form.cs index 7e10cf7..74d326b 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessApDirection2Form.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessApDirection2Form.cs @@ -31,6 +31,35 @@ //娓呯┖bodyFrame this.ClearBodyFrame(); + //涓嬩竴姝� + var btnNext = new BottomClickButton(); + btnNext.TextID = R.MyInternationalizationString.uNextway; + bodyFrameLayout.AddChidren(btnNext); + btnNext.ButtonClickEvent += (sender, e) => + { + //濡傛灉涓嶆槸鐑偣妯″紡 + if (HdlWifiLogic.Current.IsGatewayHotspot == false) + { + //閫夋嫨hdlZigbeeGW-xxxx缃戠粶 + this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uPleaseSelectGatewayXXNet)); + return; + } + var errorMsg = HdlWifiLogic.Current.StartApTcpConnection(); + if (errorMsg != null) + { + //鎷ユ湁閿欒 + this.ShowMassage(ShowMsgType.Error, errorMsg); + return; + } + var form = new WirelessApSelectNetworkForm(); + this.AddFromAndRemoveNowForm(form); + }; + //濡傛灉涓嶆槸缃戝叧鐑偣 + if (HdlWifiLogic.Current.IsGatewayHotspot == false) + { + btnNext.Visible = false; + } + //鍥剧墖 var framePic = new FrameLayout(); framePic.Width = Application.GetMinRealAverage(852); @@ -64,6 +93,8 @@ btnSettion.Text = Language.StringByID(R.MyInternationalizationString.uGotoSettion); btnSettion.ButtonClickEvent += (sender, e) => { + HdlWifiLogic.Current.OpenAppWifiSettion(); + btnNext.Visible = true; }; bodyFrameLayout.AddChidren(btnSettion); //搴曠嚎 @@ -80,16 +111,6 @@ { var form = new DeviceDirection.DeviceDirectionHelpForm(); form.AddForm("WirelessUdp"); - }; - - //涓嬩竴姝� - var btnNext = new BottomClickButton(); - btnNext.TextID = R.MyInternationalizationString.uNextway; - bodyFrameLayout.AddChidren(btnNext); - btnNext.ButtonClickEvent += (sender, e) => - { - var form = new WirelessApSelectNetworkForm(); - this.AddFromAndRemoveNowForm(form); }; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessApDirection3Form.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessApDirection3Form.cs index 881549b..b211421 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessApDirection3Form.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessApDirection3Form.cs @@ -9,6 +9,10 @@ /// </summary> public class WirelessApDirection3Form : EditorCommonForm { + #region 鈻� 鍙橀噺澹版槑___________________________ + + #endregion + #region 鈻� 鍒濆鍖朹____________________________ /// <summary> @@ -45,9 +49,17 @@ bodyFrameLayout.AddChidren(btnNext); btnNext.ButtonClickEvent += (sender, e) => { + //濡傛灉杩樻槸鐑偣妯″紡 + if (HdlWifiLogic.Current.IsGatewayHotspot == true) + { + //璇烽摼鎺ュ搴璚ifi + this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uPleaseLinkHomeWifi)); + return; + } var form = new WirelessApSearchForm(); this.AddFromAndRemoveNowForm(form); }; + btnNext.Visible = false; //鍥剧墖 var framePic = new FrameLayout(); @@ -82,6 +94,8 @@ btnSettion.Text = Language.StringByID(R.MyInternationalizationString.uGotoSettion); btnSettion.ButtonClickEvent += (sender, e) => { + HdlWifiLogic.Current.OpenAppWifiSettion(); + btnNext.Visible = true; }; bodyFrameLayout.AddChidren(btnSettion); //搴曠嚎 diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessApSearchForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessApSearchForm.cs index c75ddc2..ea4e0a0 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessApSearchForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessApSearchForm.cs @@ -244,7 +244,7 @@ //璁℃椂鏃堕棿 int timeCount = 0; //瓒呮椂鏃堕棿 - int timeOut = 120; + int timeOut = 240; while (btnGwImage.Parent != null) { timeCount++; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessApSelectNetworkForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessApSelectNetworkForm.cs index 286daf5..35953ee 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessApSelectNetworkForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessApSelectNetworkForm.cs @@ -1,5 +1,6 @@ 锘縰sing System; using System.Collections.Generic; +using System.Security.Cryptography; using System.Text; namespace Shared.Phone.UserCenter.GatewayAdd @@ -45,7 +46,7 @@ frameBack.AddChidren(btnTitle); //WIFI - var rowWifi = new FrameCaptionInputControl("WiFi", HdlWifiLogic.Current.SSID); + var rowWifi = new FrameCaptionInputControl("WiFi", ""); rowWifi.Y = Application.GetRealHeight(124); frameBack.AddChidren(rowWifi); rowWifi.InitControl(); @@ -105,11 +106,35 @@ btnMsg.Text = Language.StringByID(R.MyInternationalizationString.uPleaseInputWifiPassword); return; } + //鍙戦�佸瘑鐮� + var result = HdlWifiLogic.Current.SendApHomeWifiPassword(rowWifi.Text, btnPsw.Text); + if (result == false) + { + //瀵嗙爜鍙戦�佸け璐� + this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uSendPasswordFail)); + return; + } + var form = new WirelessApDirection3Form(); this.AddFromAndRemoveNowForm(form); }; } #endregion + + #region 鈻� 鐣岄潰鍏抽棴___________________________ + + /// <summary> + /// 鐣岄潰鍏抽棴 + /// </summary> + public override void CloseFormBefore() + { + //鍏抽棴Tcp閾炬帴 + HdlWifiLogic.Current.CloseApTcpConnection(); + + base.CloseFormBefore(); + } + + #endregion } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessUdpSelectNetworkForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessUdpSelectNetworkForm.cs index 913df51..9ec7cc9 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessUdpSelectNetworkForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WirelessUdpSelectNetworkForm.cs @@ -28,14 +28,16 @@ //鎵撳紑杩涘害鏉� this.ShowProgressBar(); var ssid = HdlWifiLogic.Current.SSID; - if (ssid == null) - { - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(ShowReLoadMode.YES); - return; - } //鍏抽棴杩涘害鏉� this.CloseProgressBar(); + if (ssid == null) + { + //鑾峰彇缃戠粶SSID澶辫触 + string msg = Language.StringByID(R.MyInternationalizationString.uGetSsidFail); + this.ShowMassage(ShowMsgType.Error, msg); + return; + } + HdlThreadLogic.Current.RunMain(() => { //鍒濆鍖栦腑閮ㄤ俊鎭� diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayAddSuccessForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayAddSuccessForm.cs index 0b3a7d8..bdb8c08 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayAddSuccessForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayAddSuccessForm.cs @@ -76,11 +76,8 @@ frameAdd.AddChidren(btnAdd, ChidrenBindMode.BindEventOnly); frameAdd.ButtonClickEvent += (sender, e) => { - //鍏抽棴鑷韩 - this.CloseForm(); - //鍏抽棴鍒楄〃鐣岄潰 - this.CloseFormByFormName("WiredGatewayListForm"); //璁╁畠閫�鍒拌彍鍗曢�夋嫨鐣岄潰 + UserCenterLogic.CloseAllOpenForm("NewGateWayMenuSelectForm"); }; //杩斿洖涓婚〉 @@ -90,13 +87,8 @@ bodyFrameLayout.AddChidren(btnGoback); btnGoback.ButtonClickEvent += (sender, e) => { - //鍏抽棴鑷韩 - this.CloseForm(); - //鍏抽棴鍒楄〃鐣岄潰 - this.CloseFormByFormName("WiredGatewayListForm"); - //鍏抽棴鑿滃崟閫夋嫨鐣岄潰 - this.CloseFormByFormName("NewGateWayMenuSelectForm"); //璁╁畠閫�鍒颁富椤� + UserCenterLogic.CloseAllOpenForm(); }; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Member/AddMemberSuccessForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Member/AddMemberSuccessForm.cs index 99afecb..aee74d5 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Member/AddMemberSuccessForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Member/AddMemberSuccessForm.cs @@ -56,10 +56,20 @@ bodyFrameLayout.AddChidren(frame); //鐢ㄦ埛鍥炬爣 - var btnUserIcon = new PicViewControl(207, 207); + string iconPath = System.IO.Path.Combine(UserCenterResourse.Option.UserPictruePath, memberResult.DistributedMark + ".png"); + var btnUserIcon = new ImageView(); + btnUserIcon.Height = Application.GetMinRealAverage(207); + btnUserIcon.Width = Application.GetMinRealAverage(207); btnUserIcon.Y = Application.GetRealHeight(104); btnUserIcon.Gravity = Gravity.CenterHorizontal; - btnUserIcon.UnSelectedImagePath = "Center/Admin.png"; + if (System.IO.File.Exists(iconPath) == true) + { + btnUserIcon.ImageBytes = Shared.IO.FileUtils.ReadFile(iconPath); + } + else + { + btnUserIcon.ImagePath = "Center/Admin.png"; + } frame.AddChidren(btnUserIcon); //鏄电О diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/AddNewRoomForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/AddNewRoomForm.cs index e06b16b..63086d9 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/AddNewRoomForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/AddNewRoomForm.cs @@ -54,23 +54,26 @@ //娓呯┖bodyFrame this.ClearBodyFrame(); + //鎴块棿鍥剧墖 + var framePic = new FrameLayout(); + framePic.Y = Application.GetRealHeight(60); + framePic.Width = Application.GetMinRealAverage(887); + framePic.Height = Application.GetMinRealAverage(444); + framePic.Gravity = Gravity.CenterHorizontal; + framePic.Radius = 8; + framePic.BackgroundColor = UserCenterColor.Current.BodyFrameLayout; + bodyFrameLayout.AddChidren(framePic); var btnPic = new ImageView(); - btnPic.Y = Application.GetRealHeight(60); - btnPic.Width = Application.GetMinRealAverage(887); - btnPic.Height = Application.GetMinRealAverage(444); - btnPic.Gravity = Gravity.CenterHorizontal; btnPic.Radius = 8; btnPic.ImagePath = "RoomIcon/0.JPG"; - bodyFrameLayout.AddChidren(btnPic); + framePic.AddChidren(btnPic); btnPic.MouseUpEventHandler += (sender, e) => { //鎴块棿鍥剧墖閫夋嫨 this.RoomPictrueSelect(btnPic); }; //娣诲姞闃村奖鐗规晥 - var btnTemp = new ButtonBase(); - btnTemp.AddBottomShadow(btnPic, true); - btnTemp = null; + framePic.SetViewShadow(true); this.newRoom = new Common.Room(); newRoom.FloorId = this.floorKeys; @@ -170,7 +173,7 @@ string picName = $"RoomIcon_{DateTime.Now.ToString("yyyyMMddHHmmss")}.png"; string picFullName = System.IO.Path.Combine(Common.Config.Instance.FullPath, picName); Shared.IO.FileUtils.WriteFileByBytes(picFullName, btnPic.ImageBytes); - newRoom.BackgroundImage = picFullName; + newRoom.BackgroundImage = picName; //澶囦唤 Phone.UserCenter.HdlAutoBackupLogic.AddOrEditorFile(picName); } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/EditorRoomInforForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/EditorRoomInforForm.cs index 6f68a33..d1e2ed5 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/EditorRoomInforForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/EditorRoomInforForm.cs @@ -59,23 +59,33 @@ //娓呯┖bodyFrame this.ClearBodyFrame(); + //鎴块棿鍥剧墖 + var framePic = new FrameLayout(); + framePic.Y = Application.GetRealHeight(60); + framePic.Width = Application.GetMinRealAverage(887); + framePic.Height = Application.GetMinRealAverage(444); + framePic.Gravity = Gravity.CenterHorizontal; + framePic.Radius = 8; + framePic.BackgroundColor = UserCenterColor.Current.BodyFrameLayout; + bodyFrameLayout.AddChidren(framePic); var btnPic = new ImageView(); - btnPic.Y = Application.GetRealHeight(60); - btnPic.Width = Application.GetMinRealAverage(887); - btnPic.Height = Application.GetMinRealAverage(444); - btnPic.Gravity = Gravity.CenterHorizontal; btnPic.Radius = 8; - btnPic.ImagePath = this.editorRoom.BackgroundImage; - bodyFrameLayout.AddChidren(btnPic); + framePic.AddChidren(btnPic); + if (this.editorRoom.BackgroundImageType == 0) + { + btnPic.ImagePath = this.editorRoom.BackgroundImage; + } + else + { + btnPic.ImageBytes = Common.Global.ReadFileByHomeId(this.editorRoom.BackgroundImage); + } btnPic.MouseUpEventHandler += (sender, e) => { //鎴块棿鍥剧墖閫夋嫨 this.RoomPictrueSelect(btnPic); }; //娣诲姞闃村奖鐗规晥 - var btnTemp = new ButtonBase(); - btnTemp.AddBottomShadow(btnPic, true); - btnTemp = null; + framePic.SetViewShadow(true); //鍒濆鍖栨甯� var tableContr = new InformationEditorControl(); @@ -181,13 +191,12 @@ if (editorRoom.BackgroundImageType == 1 || editorRoom.BackgroundImageType == 2) { //鍒犻櫎鎺夊師鏉ョ殑鑷畾涔夊浘鐗� - if (System.IO.File.Exists(editorRoom.BackgroundImage) == true) + if (Common.Global.IsExistsByHomeId(editorRoom.BackgroundImage) == true) { - System.IO.File.Delete(editorRoom.BackgroundImage); + Common.Global.DeleteFilebyHomeId(editorRoom.BackgroundImage); } //澶囦唤 - string[] MyArry = editorRoom.BackgroundImage.Split(new string[] { "/", @"\" }, StringSplitOptions.RemoveEmptyEntries); - HdlAutoBackupLogic.DeleteFile(MyArry[MyArry.Length - 1]); + HdlAutoBackupLogic.DeleteFile(editorRoom.BackgroundImage); } //鑷畾涔夊浘鐗� if (cloneRoom.BackgroundImageType == 1 || cloneRoom.BackgroundImageType == 2) @@ -196,7 +205,7 @@ string picName = $"RoomIcon_{DateTime.Now.ToString("yyyyMMddHHmmss")}.png"; string picFullName = System.IO.Path.Combine(Common.Config.Instance.FullPath, picName); Shared.IO.FileUtils.WriteFileByBytes(picFullName, btnPic.ImageBytes); - cloneRoom.BackgroundImage = picFullName; + cloneRoom.BackgroundImage = picName; //澶囦唤 HdlAutoBackupLogic.AddOrEditorFile(picName); } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Safety/SafetyManagementMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Safety/SafetyManagementMainForm.cs index 43a4379..ebac787 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Safety/SafetyManagementMainForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Safety/SafetyManagementMainForm.cs @@ -448,8 +448,7 @@ listView.AddChidrenFrame(frameDevice); frameDevice.InitControl(device); //娣诲姞闃村奖鐗规晥 - var btnTemp = new ButtonBase(); - btnTemp.AddBottomShadow(frameDevice); + frameDevice.SetViewShadow(true); string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device); this.dicSensorStatuView[mainkeys] = frameDevice; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Suggestion/FeedbackForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Suggestion/FeedbackForm.cs index 39e8883..a1337aa 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Suggestion/FeedbackForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Suggestion/FeedbackForm.cs @@ -63,10 +63,15 @@ frameInput.AddChidren(btnFild); //鎮ㄧ殑鍙嶉鍜屾剰瑙佷細璁╂垜浠彉寰楁洿濂� - var txtInput = new TextInputControl(bodyFrameLayout.Width - ControlCommonResourse.XXLeft * 2, Application.GetRealHeight(470), false); + //var txtInput = new TextInputControl(bodyFrameLayout.Width - ControlCommonResourse.XXLeft * 2, Application.GetRealHeight(470), false); + var txtInput = new EditTextView(); + txtInput.Width = bodyFrameLayout.Width - ControlCommonResourse.XXLeft * 2; + txtInput.Height = Application.GetRealHeight(470); txtInput.Y = Application.GetRealHeight(32); txtInput.TextAlignment = TextAlignment.TopLeft; txtInput.Gravity = Gravity.CenterHorizontal; + txtInput.TextColor = UserCenterColor.Current.TextColor1; + txtInput.PlaceholderTextColor = UserCenterColor.Current.TextGrayColor1; txtInput.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uYouSuggestionMsg); frameInput.AddChidren(txtInput); txtInput.TextChangeEventHandler += (sender, txtvalue) => diff --git a/ZigbeeApp/Shared/Phone/UserCenter/UserMain/MessageManagementForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/UserMain/MessageManagementForm.cs index bd4329d..7197147 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/UserMain/MessageManagementForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/UserMain/MessageManagementForm.cs @@ -66,7 +66,7 @@ var dicData = await this.GetMessageData(); //鍏抽棴杩涘害鏉� this.CloseProgressBar(dicData == null && showReload == true ? ShowReLoadMode.YES : ShowReLoadMode.NO); - + HdlThreadLogic.Current.RunMain(() => { //鍏抽棴鍒锋柊鐗规晥 @@ -188,7 +188,7 @@ var rowControl = new RowLayoutControl(frameList.rowSpace / 2); frameList.AddChidren(rowControl); rowControl.Name = frameList.ChildrenCount.ToString(); - rowControl.MainKeys = recordInfo.RegId; + rowControl.MainKeys = recordInfo.Id; this.dicAllRow[frameList.Name + "-" + rowControl.Name] = rowControl; //鍥炬爣(鐜板湪娴嬭瘯) @@ -240,7 +240,7 @@ string msg = Language.StringByID(R.MyInternationalizationString.uDeleteMessageMsg); this.ShowMassage(ShowMsgType.Confirm, msg, async () => { - await this.DeleteMsg(recordInfo.RegId, frameList, rowControl); + await this.DeleteMsg(recordInfo.Id, frameList, rowControl); }); }; @@ -261,7 +261,7 @@ if (sender != null) { //鏍囪宸茶(涓嶇瀹冩垚鍔熶笉鎴愬姛) - await this.SetTickIsRead(recordInfo.RegId); + await this.SetTickIsRead(recordInfo.Id); } }; } @@ -277,11 +277,14 @@ private async System.Threading.Tasks.Task<bool> SetTickIsRead(string strId) { string strUrl = "ZigbeeUsers/TickIsRead?Id=" + strId; - var result = await Common.CommonPage.Instance.DoRequestZigbeeHttpsInterface(strUrl, null, Common.Config.Instance.Token, "GET"); - var revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.ResponsePack>(Encoding.UTF8.GetString(result)); - //妫�娴嬫槸鍚﹀瓨鍦ㄩ敊璇俊鎭� - var falge = UserCenterLogic.CheckNotEorrorMsg(revertObj, "ZigbeeUsers/TickIsRead", null, null); - return falge; + + var result = await Common.CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync(strUrl, null, "GET"); + if (result == null) + { + return UserCenterLogic.CheckNotEorrorMsg(null, "ZigbeeUsers/TickIsRead", null, null); + } + //浜戠鏄笉浼氳繑鍥炰笢瑗跨殑 + return true; } /// <summary> @@ -340,16 +343,13 @@ { string strUrl = "ZigbeeUsers/DeletePushMessage?Id=" + strId; - var result = await Common.CommonPage.Instance.DoRequestZigbeeHttpsInterface(strUrl, null, Common.Config.Instance.Token, "GET"); + var result = await Common.CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync(strUrl, null, "GET"); if (result == null) { return UserCenterLogic.CheckNotEorrorMsg(null, "ZigbeeUsers/DeletePushMessage", null, null); } - var revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.ResponsePack>(Encoding.UTF8.GetString(result)); - //妫�娴嬫槸鍚﹀瓨鍦ㄩ敊璇俊鎭� - var falge = UserCenterLogic.CheckNotEorrorMsg(revertObj, "ZigbeeUsers/DeletePushMessage", null, null); - - if (falge == true && frameList != null) + //浜戠鏄笉浼氳繑鍥炰笢瑗跨殑 + if (frameList != null) { HdlThreadLogic.Current.RunMain(() => { @@ -359,7 +359,7 @@ this.AdjustControlLocation(frameList, rowContr); }); } - return falge; + return true; } /// <summary> diff --git a/ZigbeeApp/Shared/Phone/UserView/HomePage.cs b/ZigbeeApp/Shared/Phone/UserView/HomePage.cs index be5e2ba..1be601f 100755 --- a/ZigbeeApp/Shared/Phone/UserView/HomePage.cs +++ b/ZigbeeApp/Shared/Phone/UserView/HomePage.cs @@ -167,8 +167,6 @@ { return -1; } - //鍒濆鍖栫鐞嗗憳鏉冮檺淇℃伅(閲岄潰鏈夌壒娈婂垽鏂簡,鍙互鐩存帴璋冪敤) - await UserCenter.UserCenterLogic.InitAdminConnectMqttInfo(); var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginRes>(revertObj.ResponseData.ToString()); var revertData = responseDataObj; @@ -176,11 +174,7 @@ Config.Instance.Password = password; Config.Instance.MD5PWD = revertData.MD5PWD; Config.Instance.Guid = revertData.Guid; - Config.Instance.MqttKey = revertData.MqttKey; Config.Instance.LoginDateTime = DateTime.Now; - Config.Instance.ConnectZigbeeMqttBrokerPwd = revertData.ConnectZigbeeMqttBrokerPwd; - Config.Instance.ConnectZigbeeMqttClientId = revertData.ConnectZigbeeMqttClientId; - Config.Instance.ZigbeeMqttBrokerLoadSubDomain = revertData.ZigbeeMqttBrokerLoadSubDomain; if (Config.Instance.AccountList.Find((obj) => obj == revertData.Account) == null) { Config.Instance.AccountList.Add(revertData.Account); diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Common/Config.cs b/ZigbeeApp/Shared/Phone/ZigBee/Common/Config.cs index 8a041b9..2216ec9 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Common/Config.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Common/Config.cs @@ -19,139 +19,6 @@ return config; } } - /// <summary> - /// 璐︽埛鐧诲綍鎴愬姛鐨凪qttKey - /// </summary> - public string MqttKey - { - get - { - if (Phone.UserCenter.UserCenterResourse.UserInfo.AuthorityNo == 2 - || Phone.UserCenter.UserCenterResourse.UserInfo.AuthorityNo == 3) - { - return AdminMqttKey; - } - return MeMqttKey; - } - set { MeMqttKey = value; } - } - /// <summary> - /// 褰撳墠闇�瑕佽繛鎺ヤ簯绔痁igbeeMqttBroker鐨勮繛鎺ュ湴鍧� - /// </summary> - public string ZigbeeMqttBrokerLoadSubDomain - { - get - { - if (Phone.UserCenter.UserCenterResourse.UserInfo.AuthorityNo == 2 - || Phone.UserCenter.UserCenterResourse.UserInfo.AuthorityNo == 3) - { - return AdminZigbeeMqttBrokerLoadSubDomain; - } - return MeZigbeeMqttBrokerLoadSubDomain; - } - set { MeZigbeeMqttBrokerLoadSubDomain = value; } - } - /// <summary> - /// 褰撳墠闇�瑕佽繛鎺ヤ簯绔痁igbeeMqttBroker鐨勮繛鎺ョ殑ClientId - /// </summary> - public string ConnectZigbeeMqttClientId - { - get - { - if (Phone.UserCenter.UserCenterResourse.UserInfo.AuthorityNo == 2 - || Phone.UserCenter.UserCenterResourse.UserInfo.AuthorityNo == 3) - { - return AdminConnectZigbeeMqttClientId; - } - return MeConnectZigbeeMqttClientId; - } - set { MeConnectZigbeeMqttClientId = value; } - } - /// <summary> - /// 褰撳墠闇�瑕佽繛鎺ヤ簯绔痁igbeeMqttBroker鐨勮繛鎺ョ殑瀵嗙爜 - /// </summary> - public string ConnectZigbeeMqttBrokerPwd - { - get - { - if (Phone.UserCenter.UserCenterResourse.UserInfo.AuthorityNo == 2 - || Phone.UserCenter.UserCenterResourse.UserInfo.AuthorityNo == 3) - { - return AdminConnectZigbeeMqttBrokerPwd; - } - return MeConnectZigbeeMqttBrokerPwd; - } - set { MeConnectZigbeeMqttBrokerPwd = value; } - } - /// <summary> - /// 褰撳墠闇�瑕佽繛鎺ヤ簯绔痁igbeeMqttBroker鐨勮繛鎺ョ殑瀵嗙爜 - /// </summary> - public string ConnectZigbeeMqttBrokerName - { - get - { - if (Phone.UserCenter.UserCenterResourse.UserInfo.AuthorityNo == 2 - || Phone.UserCenter.UserCenterResourse.UserInfo.AuthorityNo == 3) - { - return AdminConnectZigbeeMqttBrokerName; - } - return Config.Instance.Account; - } - } - /// <summary> - /// 褰撳墠闇�瑕佽繛鎺ヤ簯绔痁igbeeMqttBroker鐨勮繛鎺ョ殑瀵嗙爜 - /// </summary> - public string ConnectGuid - { - get - { - if (Phone.UserCenter.UserCenterResourse.UserInfo.AuthorityNo == 2 - || Phone.UserCenter.UserCenterResourse.UserInfo.AuthorityNo == 3) - { - return AdminConnectZigbeeMqttBrokerName; - } - return Config.Instance.Guid; - } - } - - /// <summary> - /// 璐︽埛鐧诲綍鎴愬姛鐨凪qttKey - /// </summary> - private string MeMqttKey = string.Empty; - /// <summary> - /// 褰撳墠闇�瑕佽繛鎺ヤ簯绔痁igbeeMqttBroker鐨勮繛鎺ュ湴鍧� - /// </summary> - private string MeZigbeeMqttBrokerLoadSubDomain = string.Empty; - /// <summary> - /// 褰撳墠闇�瑕佽繛鎺ヤ簯绔痁igbeeMqttBroker鐨勮繛鎺ョ殑ClientId - /// </summary> - private string MeConnectZigbeeMqttClientId = string.Empty; - /// <summary> - /// 褰撳墠闇�瑕佽繛鎺ヤ簯绔痁igbeeMqttBroker鐨勮繛鎺ョ殑瀵嗙爜 - /// </summary> - [Newtonsoft.Json.JsonIgnore] - private string MeConnectZigbeeMqttBrokerPwd = string.Empty; - /// <summary> - /// 璐︽埛鐧诲綍鎴愬姛鐨凪qttKey(绠$悊鍛樿韩浠界敤) - /// </summary> - public string AdminMqttKey = string.Empty; - /// <summary> - /// 褰撳墠闇�瑕佽繛鎺ヤ簯绔痁igbeeMqttBroker鐨勮繛鎺ュ湴鍧�(绠$悊鍛樿韩浠界敤) - /// </summary> - public string AdminZigbeeMqttBrokerLoadSubDomain = string.Empty; - /// <summary> - /// 褰撳墠闇�瑕佽繛鎺ヤ簯绔痁igbeeMqttBroker鐨勮繛鎺ョ殑ClientId(绠$悊鍛樿韩浠界敤) - /// </summary> - public string AdminConnectZigbeeMqttClientId = string.Empty; - /// <summary> - /// 搴旇鏄彨杩滅▼杩炴帴鐨勫悕瀛楀惂 - /// </summary> - public string AdminConnectZigbeeMqttBrokerName = string.Empty; - /// <summary> - /// 褰撳墠闇�瑕佽繛鎺ヤ簯绔痁igbeeMqttBroker鐨勮繛鎺ョ殑瀵嗙爜(绠$悊鍛樿韩浠界敤) - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public string AdminConnectZigbeeMqttBrokerPwd = string.Empty; /// <summary> /// 鏈嶅姟鍣ㄦ敞鍐孖D @@ -223,32 +90,11 @@ /// 鎴愬憳璇锋眰鎺у埗涓诲笎鍙锋浣忓畢鏃惰姹傚熀鍦板潃鐨凩oginAccessToken鐨勫�� /// </summary> public string AdminRequestToken = string.Empty; - /// <summary> - /// 鍥轰欢鍚嶇О - /// </summary> - //public string Name = string.Empty; - ///// <summary> - ///// 鍥轰欢鍞竴鏍囪瘑 - ///// </summary> - //public string DistributedMark = string.Empty; - ///// <summary> - ///// 鍥轰欢鐗堟湰 - ///// </summary> - //public string FirmwareVersion = string.Empty; - ///// <summary> - ///// 鍥轰欢澶囨敞 - ///// </summary> - //public string Remarks = string.Empty; - ///// <summary> - ///// 鍥轰欢ID - ///// </summary> - //public string Id; [Newtonsoft.Json.JsonIgnore] /// <summary> /// 褰撳墠甯愬彿鐨凾oken /// </summary> - private string Token1 = ""; public string Token { get diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs index 8c1ef41..695486f 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs @@ -3177,7 +3177,7 @@ .WithTcpServer(brokerName, 1883) .WithKeepAlivePeriod(TimeSpan.FromSeconds(20)) .WithCleanSession() - .WithCommunicationTimeout(TimeSpan.FromSeconds(4)) + //.WithCommunicationTimeout(TimeSpan.FromSeconds(10)) .WithCredentials("", "") .Build(); await localMqttClient.ConnectAsync(options, CancellationToken.None); @@ -3358,7 +3358,7 @@ { DebugPrintLog($"杩滅▼杩炴帴鏂紑"); await DisConnectRemoteMqttClient("StartRemoteMqtt.DisconnectedHandler"); - await StartRemoteMqtt(); + //await StartRemoteMqtt(); }); } if (RemoteMqttClient.ConnectedHandler == null) @@ -3411,21 +3411,35 @@ try { - var jsonData = new Dictionary<string, object> { ["RequestVersion"] = "RequestVersion", ["RequestSource"] = 0, ["LoginAccessToken"] = Config.Instance.Token, ["RequestProtocolType"] = 0 }; - var bytes = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(jsonData)); - - var result = await CommonPage.Instance.DoRequestZigbeeHttpsInterface("https://global.hdlcontrol.com/HangZhouHdlCloudApi/EmqMqtt/GetConnMqttInfo", bytes, Config.Instance.Token); - //{ - //"ResponseVersion": "RequestVersion1", - //"StateCode": "Success", - //"ErrorInfo": null, - //"ResponseData": { < !--濡備笅淇℃伅鍙兘浣跨敤涓�娆★紝鍗充究浣犺繛鎺ュけ璐�!-- > - // "ConnEmqDomainPort": "tcp://developer.hdlcontrol.com:1883", - // "ConnEmqClientId": "ZigbeeClientTcp_33094de8-34ba-4e38-93c2-ac8da16d0e68_Zigbee", - // "ConnEmqUserName": "33094de8-34ba-4e38-93c2-ac8da16d0e68", - // "ConnEmqPwd": "4a265b65-d6cc-4a" - //} - //} + byte[] result = null; + if (Config.Instance.Home.IsOthreShare == false) + { + //涓讳汉 + var jsonData = new Dictionary<string, object> + { + ["RequestVersion"] = CommonPage.RequestVersion, + ["RequestSource"] = 0, + ["LoginAccessToken"] = Config.Instance.Token, + ["RequestProtocolType"] = 0 + }; + var bytes = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(jsonData)); + result = await CommonPage.Instance.DoRequestZigbeeHttpsInterface("https://global.hdlcontrol.com/HangZhouHdlCloudApi/EmqMqtt/GetConnMqttInfo", bytes, Config.Instance.Token); + } + else + { + //鍒嗕韩鐨� + var jsonData = new Dictionary<string, object> + { + ["RequestVersion"] = CommonPage.RequestVersion, + ["RequestSource"] = 0, + ["LoginAccessToken"] = Config.Instance.Token, + ["RequestProtocolType"] = 0, + ["MainUserDistributedMark"] = Config.Instance.Home.MainUserDistributedMark, + ["HomeId"] = Config.Instance.Home.Id + }; + var bytes = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(jsonData)); + result = await CommonPage.Instance.DoRequestZigbeeHttpsInterface("https://global.hdlcontrol.com/HangZhouHdlCloudApi/EmqMqtt/ShareMemberConnMqttInfo", bytes, Config.Instance.Token); + } if (result != null) { var jobject = Newtonsoft.Json.Linq.JObject.Parse(Encoding.UTF8.GetString(result)); @@ -3447,7 +3461,7 @@ .WithCredentials(connEmqUserName, connEmqPwd) .WithKeepAlivePeriod(TimeSpan.FromSeconds(20)) .WithCleanSession() - .WithCommunicationTimeout(TimeSpan.FromSeconds(6)) + //.WithCommunicationTimeout(TimeSpan.FromSeconds(10)) .Build(); await DisConnectRemoteMqttClient("StartRemoteMqtt"); await RemoteMqttClient.ConnectAsync(options, CancellationToken.None); @@ -3601,9 +3615,7 @@ //鏂囦欢娴佷笉鐢ㄥ姞瀵� if (topic != "FileTransfer/SendFile") { - topic = ZigBee.Common.SecuritySet.AesEncrypt(System.Text.Encoding.UTF8.GetBytes(topic), Password); - topic = topic.Replace("/", "[[$-MQTT_TILT_SYMBOL_REPLACE-$]]").Replace("+", "[[$-MQTT_PLUS_SYMBOL_REPLACE-$]]"); - message = System.Text.Encoding.UTF8.GetBytes(SecuritySet.AesEncrypt(message, password)); + message = SecuritySet.AesEncryptBytes(message, password); } } if (localIsConnected) @@ -3614,6 +3626,7 @@ } catch(Exception e) { + DebugPrintLog($"Local涓诲姩鏂紑_{e.Message}"); await DisConnectLocalMqttClient(e.Message); await StartLocalMqtt("ReConnect"); if (localIsConnected) @@ -3664,8 +3677,7 @@ { try { - var topic = e.ApplicationMessage.Topic.TrimStart('/'); - topic = topic.Replace("[[$-MQTT_TILT_SYMBOL_REPLACE-$]]", "/").Replace("[[$-MQTT_PLUS_SYMBOL_REPLACE-$]]", "+"); + var topic = e.ApplicationMessage.Topic.TrimStart('/'); var payload = e.ApplicationMessage.Payload; var message = string.Empty; @@ -3680,7 +3692,7 @@ { return; } - if (topics[2]== "NotifyGateWayInfoChagne") { + if (topics[2]== "NotifyGateWayInfoChange") { initGateWayBaseInfomation(); return; } @@ -3727,39 +3739,36 @@ { try { - var topic = e.ApplicationMessage.Topic; - topic = topic.Replace("[[$-MQTT_TILT_SYMBOL_REPLACE-$]]", "/").Replace("[[$-MQTT_PLUS_SYMBOL_REPLACE-$]]", "+"); - var message = System.Text.Encoding.UTF8.GetString(e.ApplicationMessage.Payload); + var topic = e.ApplicationMessage.Topic; + string payloadString = ""; if (IsEncry) { //涓婚 - topic = Common.SecuritySet.AesDecrypt(System.Text.Encoding.UTF8.GetBytes(topic), Password); //涓嬭浇鐨勫瓧鑺傛祦涓嶉渶瑕佽В瀵� if (topic.Split('/')[0] + "/" + topic.Split('/')[1] == topic.Split('/')[0] + "/" + "FileTransfer") { if (topic.Split('/')[2] != "DownloadFile") { - message = Common.SecuritySet.AesDecrypt(e.ApplicationMessage.Payload, Password); + payloadString = System.Text.Encoding.UTF8.GetString(Common.SecuritySet.AesDecryptBytes(e.ApplicationMessage.Payload, Password)); } } else if (topic == topic.Split('/')[0] + "/" + "SendAESKey_Respon") { }//鍥炲涓婚鏄鏂囷紝鏁版嵁鏄槑鏂� else { - message = Common.SecuritySet.AesDecrypt(e.ApplicationMessage.Payload, Password); + payloadString = System.Text.Encoding.UTF8.GetString(Common.SecuritySet.AesDecryptBytes(e.ApplicationMessage.Payload, Password)); } } - -#if DEBUG - DebugPrintLog($"缃戝叧杩斿洖鐨勪富棰�:{topic}_缃戝叧杩斿洖鐨勮礋杞�:{message}_{System.DateTime.Now.ToString()}"); -#endif - ReceiveMessage(topic, message, e.ApplicationMessage.Payload); + else + { + payloadString = System.Text.Encoding.UTF8.GetString(e.ApplicationMessage.Payload); + } + DebugPrintLog($"缃戝叧杩斿洖鐨勪富棰�:{topic}_缃戝叧杩斿洖鐨勮礋杞�:{payloadString}"); + ReceiveMessage(topic, payloadString, e.ApplicationMessage.Payload); } catch (Exception ex) { -#if DEBUG DebugPrintLog($"鎺ユ敹缃戝叧鏁版嵁寮傚父:{ex.Message}"); -#endif } } diff --git a/ZigbeeApp/Shared/R.cs b/ZigbeeApp/Shared/R.cs index 826ff6b..5658982 100755 --- a/ZigbeeApp/Shared/R.cs +++ b/ZigbeeApp/Shared/R.cs @@ -5021,6 +5021,30 @@ /// 纭鏍囪鍏ㄩ儴娑堟伅涓哄凡璇�? /// </summary> public const int uUnTipAllMessageMsg = 15977; + /// <summary> + /// 閫氫俊閾炬帴澶辫触 + /// </summary> + public const int uCommunicationLinkFail = 15978; + /// <summary> + /// 鑾峰彇缃戠粶SSID澶辫触 + /// </summary> + public const int uGetSsidFail = 15979; + /// <summary> + /// 瀵嗙爜鍙戦�佸け璐� + /// </summary> + public const int uSendPasswordFail = 15980; + /// <summary> + /// 閫夋嫨hdlZigbeeGW-xxxx缃戠粶 + /// </summary> + public const int uPleaseSelectGatewayXXNet = 15981; + /// <summary> + /// 璇疯繛鎺ュ搴璚iFi + /// </summary> + public const int uPleaseLinkHomeWifi = 15982; + /// <summary> + /// 姝e湪鑾峰彇鍒嗕韩鏁版嵁 + /// </summary> + public const int uShardContentGetting = 15983; //鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄帴鍙g殑杩斿洖淇℃伅缈昏瘧,浠�18000寮�濮嬧槄鈽呪槄鈽� /// <summary> -- Gitblit v1.8.0