From 5428935270159bfc42c2934ed7fb1091554fc9a4 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 09 七月 2020 17:12:42 +0800 Subject: [PATCH] 修改了 sokect --- ZigbeeApp/GateWay.Droid/Assets/Language.ini | 4 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs | 172 -- ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionDirectoryListForm.cs | 9 ZigbeeApp/Shared/Phone/Category/SelectFloorForm.cs | 46 ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs | 8 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlBackupLogic.cs | 104 + ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/AccountOption.cs | 9 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs | 15 ZigbeeApp/Shared/Common/CommonPage.cs | 6 ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs | 65 ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionMainForm.cs | 75 ZigbeeApp/Shared/Phone/Category/CategoryMainForm.cs | 4 ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs | 2 ZigbeeApp/Shared/Phone/CommonForm/EditorCommonForm.cs | 3 ZigbeeApp/GateWay.Droid/Application.cs | 16 ZigbeeApp/Shared/Phone/MainPage/HomeMainPageForm.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/Suggestion/FeedbackForm.cs | 12 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayProductInfoForm.cs | 6 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Resourse/DirectoryFileNameResourse.cs | 162 +- ZigbeeApp/Shared/Phone/UserView/UserPage.cs | 1 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressFormBar.cs | 10 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlResidenceLogic.cs | 8 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs | 17 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAlarmsLogic.cs | 72 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/ResidenceOption.cs | 18 ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml | 2 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlFileLogic.cs | 37 ZigbeeApp/Shared/Phone/UserCenter/Residence/FloorListRoomForm.cs | 12 ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGatewayData.cs | 4 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceDryContactSettionForm.cs | 4 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/TextInputBase.cs | 15 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs | 356 +++-- ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs | 37 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressRowBar.cs | 22 ZigbeeApp/Shared/Phone/UserCenter/Guide/GuideForm2.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionFileListForm.cs | 22 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs | 6 ZigbeeApp/Shared/Phone/CommonForm/CommonFormBase.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs | 113 - ZigbeeApp/Shared/Phone/ZigBee/Common/Global.cs | 112 -- ZigbeeApp/Shared/Phone/MainPage/LeftListRoomViewFrom.cs | 38 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/Guide/GuideCommonForm.cs | 2 ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs | 53 ZigbeeApp/Home.Ios/Resources/Language.ini | 4 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs | 23 ZigbeeApp/Shared/R.cs | 9 ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlBackupListForm.cs | 22 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/BelongAreaControl.cs | 171 -- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlExperienceAccountLogic.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs | 13 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs | 14 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBrightnessAdjustForm.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs | 40 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/NormalSelectControl.cs | 33 ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedListRoomForm.cs | 1 ZigbeeApp/Shared/Common/Device.cs | 71 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAirConditionerLogic.cs | 4 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs | 135 + ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorWorkModeMenuForm.cs | 4 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs | 311 ----- ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs | 2 ZigbeeApp/Shared/Phone/Login/Logic/AccountLogic.cs | 12 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs | 75 ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs | 41 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs | 18 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameRowControl.cs | 7 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlFirmwareUpdateLogic.cs | 3 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterEnumCommon.cs | 142 -- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameRefreshControl.cs | 22 ZigbeeApp/Shared/Shared.projitems | 3 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/SiphonateDirectionAndLimitSettionForm.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs | 4 /dev/null | 73 - ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewaySearchListForm.cs | 32 ZigbeeApp/Shared/Phone/MainPage/UnallocatedRoomForm.cs | 20 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlControlLogic.cs | 180 ++ ZigbeeApp/Shared/Phone/UserCenter/Residence/EditorRoomInforForm.cs | 4 ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs | 16 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameControl.cs | 22 ZigbeeApp/Shared/Common/House.cs | 43 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceGeneralInformationForm.cs | 8 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs | 5 88 files changed, 1,488 insertions(+), 1,802 deletions(-) diff --git a/ZigbeeApp/GateWay.Droid/Application.cs b/ZigbeeApp/GateWay.Droid/Application.cs index 32c6c9d..d149de0 100755 --- a/ZigbeeApp/GateWay.Droid/Application.cs +++ b/ZigbeeApp/GateWay.Droid/Application.cs @@ -98,11 +98,10 @@ api.SendReq(req); } /// <summary>鈥� /// 鎵�鏈夊垵濮嬪寲鍏ㄩ儴鍦ㄨ繖涓柟娉曞疄鐜扳�� /// </summary>鈥� void initAll()鈥� { - string checkFile = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Shared.Phone.UserCenter.DirNameResourse.OpenGbsFile); - Shared.Application.IsGpsEnable = System.IO.File.Exists(checkFile); - - //璁剧疆鏋佸厜璋冭瘯妯″紡锛屼负false鏃跺彧鎵撳嵃璀﹀憡淇℃伅 - // System.Console.WriteLine($"AAA : {System.DateTime.Now.ToString()}"); + Shared.Application.IsGpsEnable = false; + + //璁剧疆鏋佸厜璋冭瘯妯″紡锛屼负false鏃跺彧鎵撳嵃璀﹀憡淇℃伅 + // System.Console.WriteLine($"AAA : {System.DateTime.Now.ToString()}"); #if Release鈥� JPushInterface.SetDebugMode(false); //淇濆瓨鎵嬫満鍚嶇О鍒版湰鍦版枃浠� //System.Console.WriteLine($"BBB : {System .DateTime .Now .ToString ()}"); @@ -110,6 +109,8 @@ JPushInterface.Init(this); //System.Console.WriteLine($"CCC : {System.DateTime.Now.ToString()}"); #endif + + BaseActivity.BackKeyAction = () => { try { @@ -158,8 +159,9 @@ Shared.Application.FontSize = 12; AppCenter.Start("4802834a-e7e9-4dd8-93f1-c2f88f0bd464", typeof(Analytics), typeof(Crashes));鈥�#if Release鈥� //淇濆瓨鑾峰彇鐨勬瀬鍏夋湇鍔″櫒涓婄殑娉ㄥ唽ID鍒版湰鍦版枃浠垛�� var registrationId = JPushInterface.GetRegistrationID(activity); System.Console.WriteLine("registrationId-鏋佸厜id=" + registrationId); - if (!string.IsNullOrEmpty(registrationId))鈥� {鈥� Shared.Common.Config.Instance.RegistrationID = registrationId;鈥� Shared.Common.Config.Instance.Save();鈥� }鈥�#endif鈥� };鈥� BaseActivity.RefreshUIAction += (activity) => {鈥� Shared.Language.CurrentLanguage = "Chinese";鈥� Shared.Common.CommonPage.Instance.Show();鈥� };鈥� BaseActivity.OnResumeAction += (activity) => {鈥� };鈥� BaseActivity.NetworkStateChanged += (v) =>鈥� {鈥� //缃戠粶鐘舵�佸彉鍖栧鐞嗕簨浠� - Shared.Common.CommonPage.nowNetworkMode = v;鈥� };鈥� BaseActivity.OnDestroyAction += (activity) => {鈥� //socket鍋滄杩炴帴鈥� //ZigBee.Device.ZbGateway.FindGateWaySocket.Stop();鈥� };鈥ㄢ�� HDLUtils.SetAuthoritiesName("com.hdl.home.fileProvider");鈥� }鈥ㄢ�� public static bool IsShowTip = true;鈥� JpushNotificationReceiver myReceiver = new JpushNotificationReceiver { };鈥ㄢ�� /// <summary>鈥� /// 椤圭洰鍚姩鏃剁綉缁滄煡璇⑩�� /// </summary>鈥� void checkSomeInfo()鈥� {鈥� var status = isNetworkAvailable(this);鈥� string internetStatus = "Available";鈥� if (!status)鈥� {鈥� internetStatus = "UnaVailable";鈥� }鈥� else鈥� {鈥� var isWifi = isWifiConnected(this);鈥� if (isWifi)鈥� {鈥� internetStatus = "WiFiConnect";鈥� }鈥� else鈥� {鈥� internetStatus = "MobileConnect";鈥� }鈥� }鈥ㄢ�� int connectState = 0;鈥� if (internetStatus == "UnaVailable")鈥� {鈥� connectState = 0;鈥� }鈥� else if (internetStatus == "WiFiConnect")鈥� {鈥� connectState = 2;鈥� }鈥� else鈥� {鈥� connectState = 1;鈥� }鈥� //ZigBee.Device.ZbGateway.CheckConnection(connectState);鈥� }鈥ㄢ�� /// <summary>鈥� /// 缃戠粶鏄惁鍙敤鈥� /// </summary>鈥� /// <returns><c>true</c>, if network available was ised, <c>false</c> otherwise.</returns>鈥� /// <param name="context">Context.</param>鈥� bool isNetworkAvailable(Context context)鈥� {鈥� var cm = (ConnectivityManager)context.GetSystemService(ConnectivityService);鈥ㄢ�� if (cm == null || cm.ActiveNetworkInfo == null)鈥� {鈥� //褰撳墠缃戠粶涓嶅彲鐢ㄢ�� return false;鈥� }鈥� else鈥� {鈥� return cm.ActiveNetworkInfo.IsAvailable;鈥� }鈥� }鈥ㄢ�� /// <summary>鈥� /// 缃戠粶鏄惁杩炴帴鈥� /// </summary>鈥� /// <returns><c>true</c>, if wifi connected was ised, <c>false</c> otherwise.</returns>鈥� /// <param name="context">Context.</param>鈥� bool isWifiConnected(Context context)鈥� {鈥� if (context != null)鈥� {鈥� var cm = (ConnectivityManager)context.GetSystemService(ConnectivityService);鈥ㄢ�� var mWiFiNetworkInfo = cm.GetNetworkInfo(ConnectivityType.Wifi);鈥� if (Android.Net.NetworkInfo.State.Connected == mWiFiNetworkInfo.GetState())鈥� {鈥� //褰撳墠缃戠粶鏄疻i-Fi杩炴帴鈥� return true;鈥� }鈥ㄢ�� var moWiFiNetworkInfo = cm.GetNetworkInfo(ConnectivityType.Mobile);鈥� if (Android.Net.NetworkInfo.State.Connected == moWiFiNetworkInfo.GetState())鈥� {鈥� //褰撳墠缃戠粶鏄疢obile杩炴帴鈥� return false;鈥� }鈥� }鈥� return false;鈥� } + if (!string.IsNullOrEmpty(registrationId))鈥� {鈥� Shared.Common.Config.Instance.RegistrationID = registrationId;鈥� Shared.Common.Config.Instance.Save();鈥� }鈥�#endif鈥� };鈥ㄢ�� 鈥� BaseActivity.RefreshUIAction += (activity) => {鈥� Shared.Language.CurrentLanguage = "Chinese";鈥� Shared.Common.CommonPage.Instance.Show();鈥� };鈥ㄢ�� BaseActivity.NetworkStateChanged += (v) =>鈥� {鈥� };鈥� BaseActivity.OnDestroyAction += (activity) => {鈥� //socket鍋滄杩炴帴鈥� //ZigBee.Device.ZbGateway.FindGateWaySocket.Stop();鈥� };鈥ㄢ�� HDLUtils.SetAuthoritiesName("com.hdl.home.fileProvider");鈥� }鈥ㄢ�� public static bool IsShowTip = true;鈥� JpushNotificationReceiver myReceiver = new JpushNotificationReceiver { };鈥ㄢ�� /// <summary>鈥� /// 椤圭洰鍚姩鏃剁綉缁滄煡璇⑩�� /// </summary>鈥� void checkSomeInfo()鈥� {鈥� var status = isNetworkAvailable(this);鈥� string internetStatus = "Available";鈥� if (!status)鈥� {鈥� internetStatus = "UnaVailable";鈥� }鈥� else鈥� {鈥� var isWifi = isWifiConnected(this);鈥� if (isWifi)鈥� {鈥� internetStatus = "WiFiConnect";鈥� }鈥� else鈥� {鈥� internetStatus = "MobileConnect";鈥� }鈥� }鈥ㄢ�� int connectState = 0;鈥� if (internetStatus == "UnaVailable")鈥� {鈥� connectState = 0;鈥� }鈥� else if (internetStatus == "WiFiConnect")鈥� {鈥� connectState = 2;鈥� }鈥� else鈥� {鈥� connectState = 1;鈥� }鈥� //ZigBee.Device.ZbGateway.CheckConnection(connectState);鈥� }鈥ㄢ�� /// <summary>鈥� /// 缃戠粶鏄惁鍙敤鈥� /// </summary>鈥� /// <returns><c>true</c>, if network available was ised, <c>false</c> otherwise.</returns>鈥� /// <param name="context">Context.</param>鈥� bool isNetworkAvailable(Context context)鈥� {鈥� var cm = (ConnectivityManager)context.GetSystemService(ConnectivityService);鈥ㄢ�� if (cm == null || cm.ActiveNetworkInfo == null)鈥� {鈥� //褰撳墠缃戠粶涓嶅彲鐢ㄢ�� return false;鈥� }鈥� else鈥� {鈥� return cm.ActiveNetworkInfo.IsAvailable;鈥� }鈥� }鈥ㄢ�� /// <summary>鈥� /// 缃戠粶鏄惁杩炴帴鈥� /// </summary>鈥� /// <returns><c>true</c>, if wifi connected was ised, <c>false</c> otherwise.</returns>鈥� /// <param name="context">Context.</param>鈥� bool isWifiConnected(Context context)鈥� {鈥� if (context != null)鈥� {鈥� var cm = (ConnectivityManager)context.GetSystemService(ConnectivityService);鈥ㄢ�� var mWiFiNetworkInfo = cm.GetNetworkInfo(ConnectivityType.Wifi);鈥� if (Android.Net.NetworkInfo.State.Connected == mWiFiNetworkInfo.GetState())鈥� {鈥� //褰撳墠缃戠粶鏄疻i-Fi杩炴帴鈥� return true;鈥� }鈥ㄢ�� var moWiFiNetworkInfo = cm.GetNetworkInfo(ConnectivityType.Mobile);鈥� if (Android.Net.NetworkInfo.State.Connected == moWiFiNetworkInfo.GetState())鈥� {鈥� //褰撳墠缃戠粶鏄疢obile杩炴帴鈥� return false;鈥� }鈥� }鈥� return false;鈥� } + + } public class JpushNotificationReceiver : BroadcastReceiver diff --git a/ZigbeeApp/GateWay.Droid/Assets/Language.ini b/ZigbeeApp/GateWay.Droid/Assets/Language.ini index 71eef6b..bb3d578 100755 --- a/ZigbeeApp/GateWay.Droid/Assets/Language.ini +++ b/ZigbeeApp/GateWay.Droid/Assets/Language.ini @@ -1610,7 +1610,7 @@ 15873=鎷嶇収 15874=浠庣浉鍐屼腑閫夋嫨 15875=鎶辨瓑锛岀▼搴忓嚭鐜伴敊璇� -15876=璇疯緭鍏ユ墜鍔縜 +15876=璇疯緭鍏ユ墜鍔� 15877=璇峰啀娆¤緭鍏ユ墜鍔� 15878=鏇存敼鎵嬪娍锛岃杈撳叆鎵嬪娍 15879=纭鎵嬪娍閿欒锛岃閲嶆柊璁剧疆 @@ -1865,6 +1865,8 @@ 16132=铚傞福鍣ㄥ紑鍏� 16133=灏忓鐏紑鍏� 16134=璁剧疆璁惧鍔熻兘绫诲瀷澶辫触 +16135=鑾峰彇鍦烘櫙鍒楄〃澶辫触,缃戝叧鍥炲瓒呮椂 +16136=闇�閲嶆柊缁戝畾 ;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄帴鍙g殑杩斿洖淇℃伅缈昏瘧,浠�18000寮�濮嬧槄鈽呪槄鈽� 18004=鎸囧畾缃戝叧宸茬粡琚粦瀹� diff --git a/ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml b/ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml index fcfd53e..f26006a 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="0120070302" android:installLocation="auto" android:versionName="1.1.0120070302"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.home" android:versionCode="0120070901" android:installLocation="auto" android:versionName="1.1.0120070901"> <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/Resources/Language.ini b/ZigbeeApp/Home.Ios/Resources/Language.ini index 71eef6b..bb3d578 100755 --- a/ZigbeeApp/Home.Ios/Resources/Language.ini +++ b/ZigbeeApp/Home.Ios/Resources/Language.ini @@ -1610,7 +1610,7 @@ 15873=鎷嶇収 15874=浠庣浉鍐屼腑閫夋嫨 15875=鎶辨瓑锛岀▼搴忓嚭鐜伴敊璇� -15876=璇疯緭鍏ユ墜鍔縜 +15876=璇疯緭鍏ユ墜鍔� 15877=璇峰啀娆¤緭鍏ユ墜鍔� 15878=鏇存敼鎵嬪娍锛岃杈撳叆鎵嬪娍 15879=纭鎵嬪娍閿欒锛岃閲嶆柊璁剧疆 @@ -1865,6 +1865,8 @@ 16132=铚傞福鍣ㄥ紑鍏� 16133=灏忓鐏紑鍏� 16134=璁剧疆璁惧鍔熻兘绫诲瀷澶辫触 +16135=鑾峰彇鍦烘櫙鍒楄〃澶辫触,缃戝叧鍥炲瓒呮椂 +16136=闇�閲嶆柊缁戝畾 ;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄帴鍙g殑杩斿洖淇℃伅缈昏瘧,浠�18000寮�濮嬧槄鈽呪槄鈽� 18004=鎸囧畾缃戝叧宸茬粡琚粦瀹� diff --git a/ZigbeeApp/Shared/Common/CommonPage.cs b/ZigbeeApp/Shared/Common/CommonPage.cs index 9a8e327..814ad33 100755 --- a/ZigbeeApp/Shared/Common/CommonPage.cs +++ b/ZigbeeApp/Shared/Common/CommonPage.cs @@ -42,7 +42,7 @@ /// <summary> /// 鐗堟湰鍙� /// </summary> - public static string CodeIDString = "1.1.0120070302"; + public static string CodeIDString = "1.1.0120070901"; /// <summary> /// 娉ㄥ唽鏉ユ簮(0:HDL On 1:Zigbee) /// </summary> @@ -95,10 +95,6 @@ /// 鐢ㄤ簬楠岃瘉閭姝e垯琛ㄨ揪寮� /// </summary> public static string EmailRegexStr = "^\\s*([A-Za-z0-9_-]+(\\.\\w+)*@(\\w+\\.)+\\w{2,5})\\s*$"; - /// <summary> - /// 褰撳墠缃戠粶杩炴帴鐨勬ā寮� 0:娌℃湁缃戠粶 1锛氳繙绋嬭繛鎺ワ紝涔熷彨3G,4G 2锛歐IFI - /// </summary> - public static int nowNetworkMode = 0; /// <summary> /// 瀹夊崜鐨勭郴缁熻繑鍥炴寜閿兘鍚︽寜涓�(姣斿鍦ㄥ浠借繕鍘熸椂,涓嶈兘鎸変笅杩斿洖閿�) /// </summary> diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs index a436fb3..9ba510c 100755 --- a/ZigbeeApp/Shared/Common/Device.cs +++ b/ZigbeeApp/Shared/Common/Device.cs @@ -2179,12 +2179,21 @@ private void InitRealDeviceRoomId() { this.dicDeviceRoomId = new Dictionary<string, string>(); - string fullName = UserCenterLogic.CombinePath(DirNameResourse.DeviceRoomIdFile); - var strData = UserCenterLogic.LoadFileContent(fullName); + string fullName = DirNameResourse.DeviceRoomIdFile; + var strData = HdlFileLogic.Current.ReadFileTextContent(fullName); if (strData != null) { this.dicDeviceRoomId = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(strData); } + } + + /// <summary> + /// 鑾峰彇鍏ㄩ儴鐗╃悊璁惧鎵�灞炴埧闂寸殑璁板綍 + /// </summary> + /// <returns></returns> + public Dictionary<string, string> GetAllRealDeviceRoomData() + { + return this.dicDeviceRoomId; } /// <summary> @@ -2238,8 +2247,7 @@ if (save == true) { //淇濆瓨璁板綍 - string fullName = UserCenterLogic.CombinePath(DirNameResourse.DeviceRoomIdFile); - UserCenterLogic.SaveFileContent(fullName, this.dicDeviceRoomId); + HdlFileLogic.Current.SaveFileContent(DirNameResourse.DeviceRoomIdFile, this.dicDeviceRoomId); //娣诲姞鑷姩澶囦唤 HdlAutoBackupLogic.AddOrEditorFile(DirNameResourse.DeviceRoomIdFile); @@ -2259,7 +2267,7 @@ return Language.StringByID(R.MyInternationalizationString.uDeviceNotAssignedRoom); } var room = HdlRoomLogic.Current.GetRoomById(this.dicDeviceRoomId[device.DeviceAddr]); - return HdlRoomLogic.Current.GetFloorRoomName(room); + return HdlRoomLogic.Current.GetRoomName(room); } /// <summary> @@ -2307,8 +2315,7 @@ return; } //淇濆瓨璁板綍 - string fullName = UserCenterLogic.CombinePath(DirNameResourse.DeviceRoomIdFile); - UserCenterLogic.SaveFileContent(fullName, this.dicDeviceRoomId); + HdlFileLogic.Current.SaveFileContent(DirNameResourse.DeviceRoomIdFile, this.dicDeviceRoomId); //娣诲姞鑷姩澶囦唤 HdlAutoBackupLogic.AddOrEditorFile(DirNameResourse.DeviceRoomIdFile); @@ -2891,23 +2898,17 @@ else if (mainDevice.Type == DeviceType.OnOffOutput) { //2020.05.13鍙樻洿:缁х數鍣ㄩ兘榛樿涓虹伅鍏� - //var myType = this.GetHdlMyDeviceEnumInfo(mainDevice); - //if (myType != null && myType.ConcreteType == DeviceConcreteType.Relay_ThreeLoad) + if (mainDevice.DfunctionType == DeviceFunctionType.A鏈畾涔�) { - if (mainDevice.DfunctionType == DeviceFunctionType.A鏈畾涔�) + mainDevice.DfunctionType = DeviceFunctionType.A鐏厜; + if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A鐏厜) { - mainDevice.DfunctionType = DeviceFunctionType.A鐏厜; - if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A鐏厜) - { - //缁х數鍣ㄩ粯璁や负鐏厜 - this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A鐏厜); - } - } - if (mainDevice.IsCustomizeImage == false) - { - mainDevice.IconPath = "Device/Light.png"; + //缁х數鍣ㄩ粯璁や负鐏厜 + this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A鐏厜); } } + //鏍规嵁鍔熻兘绫诲瀷,閲嶆柊璁剧疆璁惧鍥炶矾鍥炬爣 + this.ResetIconPathByDeviceFunctionType(mainDevice); } //濡傛灉鏄┖姘斿紑鍏崇殑璇� else if (mainDevice.Type == DeviceType.AirSwitch) @@ -2922,10 +2923,8 @@ this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A寮�鍏�); } } - if (mainDevice.IsCustomizeImage == false) - { - mainDevice.IconPath = "Device/Switch.png"; - } + //鏍规嵁鍔熻兘绫诲瀷,閲嶆柊璁剧疆璁惧鍥炶矾鍥炬爣 + this.ResetIconPathByDeviceFunctionType(mainDevice); } //濡傛灉鏄僵鐏殑璇� else if (mainDevice.Type == DeviceType.ColorDimmableLight) @@ -2944,6 +2943,30 @@ } /// <summary> + /// 鏍规嵁鍔熻兘绫诲瀷,閲嶆柊璁剧疆璁惧鍥炶矾鍥炬爣 + /// </summary> + /// <param name="device"></param> + private void ResetIconPathByDeviceFunctionType(CommonDevice device) + { + if (device.IsCustomizeImage == true) + { + return; + } + if (device.DfunctionType == DeviceFunctionType.A寮�鍏�) + { + device.IconPath = "Device/Switch.png"; + } + else if (device.DfunctionType == DeviceFunctionType.A鎻掑骇) + { + device.IconPath = "Device/Socket1.png"; + } + else + { + device.IconPath = "Device/Light.png"; + } + } + + /// <summary> /// 鏍规嵁璁惧Type鍒涘缓瀵瑰簲鐨勮澶囧璞� /// </summary> /// <param name="deviceType">璁惧Type</param> diff --git a/ZigbeeApp/Shared/Common/House.cs b/ZigbeeApp/Shared/Common/House.cs index d368109..dc7e878 100755 --- a/ZigbeeApp/Shared/Common/House.cs +++ b/ZigbeeApp/Shared/Common/House.cs @@ -60,10 +60,6 @@ /// </summary> public string ResidenceAddressName = string.Empty; /// <summary> - /// 鎴块棿鍒楄〃(鎴块棿鐨処D) - /// </summary> - public List<string> ListRooms = new List<string>(); - /// <summary> /// 妤煎眰瀛楀吀 /// key:FloorId /// value:FloorName @@ -109,42 +105,6 @@ #endregion - #region 鈼� 娣诲姞鎴块棿璺緞_________________________ - - /// <summary> - /// 娣诲姞鎴块棿ID - /// </summary> - /// <returns><c>true</c>, if room list file path was added, <c>false</c> otherwise.</returns> - /// <param name="roomFilePath">Room file path.</param> - public void AddRoomId(string roomId) - { - if (ListRooms.Contains(roomId) == false) - { - ListRooms.Add(roomId); - this.Save(); - } - } - - #endregion - - #region 鈼� 鍒犻櫎鎴块棿璺緞_________________________ - - /// <summary> - /// 绉婚櫎鎴块棿Id - /// </summary> - /// <returns><c>true</c>, if room list file path was added, <c>false</c> otherwise.</returns> - /// <param name="roomFilePath">Room file path.</param> - public void RemoveRoomId(string roomId) - { - if (ListRooms.Contains(roomId)==true) - { - ListRooms.Remove(roomId); - Save(); - } - } - - #endregion - #region 鈼� 淇濆瓨____________________________ /// <summary> @@ -160,7 +120,8 @@ System.IO.Directory.CreateDirectory(path); } path = System.IO.Path.Combine(path, FileName); - Shared.IO.FileUtils.WriteFileByBytes(path, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this))); + HdlFileLogic.Current.SaveFileContent(path, this); + if (autoBackup == true && Id == Config.Instance.HomeId) { HdlAutoBackupLogic.AddOrEditorFile(FileName); diff --git a/ZigbeeApp/Shared/Phone/Category/CategoryMainForm.cs b/ZigbeeApp/Shared/Phone/Category/CategoryMainForm.cs index d4ab25f..78a495d 100755 --- a/ZigbeeApp/Shared/Phone/Category/CategoryMainForm.cs +++ b/ZigbeeApp/Shared/Phone/Category/CategoryMainForm.cs @@ -188,6 +188,7 @@ //鍦烘櫙,鍔熻兘,鑷姩鍖栫殑鍒囨崲鎺т欢 var switchContr = new SceneFunctionSwitchControl(); + switchContr.Y = Application.GetRealHeight(40); switchContr.Width = Application.GetRealWidth(650); switchContr.Gravity = Gravity.CenterVertical; frameSwitchBack.AddChidren(switchContr); @@ -636,6 +637,9 @@ { //鍦ㄥ闈㈡竻绌�(鐗规晥鐨勯棶棰�) this.functionSceneBodyView.RemoveAll(); + //鍒锋柊鍦烘櫙鐨勬椂鍊�,鍏抽棴宸﹀垝鑿滃崟鐨勬湭鍒嗛厤鐣岄潰 + MainPage.LeftListRoomViewFrom.Instance?.CloseUnallocatedRoomForm(); + HdlThreadLogic.Current.RunMainInThread(() => { //鍒锋柊鍦烘櫙鍒嗘敮鎺т欢 diff --git a/ZigbeeApp/Shared/Phone/Category/SelectFloorForm.cs b/ZigbeeApp/Shared/Phone/Category/SelectFloorForm.cs index 29e69c7..e07f70b 100755 --- a/ZigbeeApp/Shared/Phone/Category/SelectFloorForm.cs +++ b/ZigbeeApp/Shared/Phone/Category/SelectFloorForm.cs @@ -80,7 +80,8 @@ }; backgroundFL.AddChidren(floorLayout); - var floorCount = Config.Instance.Home.FloorDics.Count; + var dicFloor = UserCenter.HdlRoomLogic.Current.GetFloorSortList(); + int floorCount = dicFloor.Count; if (floorCount > 0) { @@ -109,9 +110,9 @@ floorLayout.Height = this.GetPictrueRealSize(150 * floorCount); } - foreach (var floor in Config.Instance.Home.FloorDics) + foreach (var floor in dicFloor.Keys) { - AddFloor(floorLayout, floor); + AddFloor(floorLayout, floor, dicFloor[floor]); } } } @@ -120,50 +121,41 @@ /// AddFloor /// </summary> /// <param name="verticalScrolView"></param> - private void AddFloor(VerticalScrolViewLayout verticalScrolView, KeyValuePair<string, string> floor,bool isLast=false) + private void AddFloor(VerticalScrolViewLayout verticalScrolView, string floorId, string floorName) { var frow = new Device.CommonForm.LeftIconButtonRow(449, 150); frow.Width = this.GetPictrueRealSize(449); frow.Height = this.GetPictrueRealSize(150); - frow.Tag = floor.Key; - frow.Init("Floor/Floor.png", "Floor/FloorSelected.png", floor.Value); + frow.Init("Floor/Floor.png", "Floor/FloorSelected.png", floorName); verticalScrolView.AddChidren(frow); if (string.IsNullOrEmpty(CurFloorId)) { - if (Config.Instance.Home.CurrentFloorId == floor.Key) + if (Config.Instance.Home.CurrentFloorId == floorId) { frow.IsSelected = true; } } else { - if (CurFloorId == floor.Key) + if (CurFloorId == floorId) { frow.IsSelected = true; } } - frow.ButtonClickEvent += SelectFloor_MouseUpEvent; - } - - /// <summary> - /// SelectFloor_MouseUpEvent - /// </summary> - /// <param name="sender"></param> - /// <param name="mouseEventArgs"></param> - private void SelectFloor_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs) - { - (sender as Device.CommonForm.LeftIconButtonRow).IsSelected = true; - if (changeFloor) + frow.ButtonClickEvent += (sender, e) => { - Config.Instance.Home.CurrentFloorId = (sender as Device.CommonForm.LeftIconButtonRow).Tag.ToString(); - Config.Instance.Home.Save(false); - UserCenter.HdlRoomLogic.Current.RefreshRoomListView(); - } - RemoveView(); - FloorAction?.Invoke((sender as Device.CommonForm.LeftIconButtonRow).Tag.ToString()); - + frow.IsSelected = true; + if (changeFloor) + { + Config.Instance.Home.CurrentFloorId = floorId; + Config.Instance.Home.Save(false); + UserCenter.HdlRoomLogic.Current.RefreshRoomListView(); + } + RemoveView(); + FloorAction?.Invoke(floorId); + }; } /// <summary> diff --git a/ZigbeeApp/Shared/Phone/CommonForm/CommonFormBase.cs b/ZigbeeApp/Shared/Phone/CommonForm/CommonFormBase.cs index c24d305..346da1c 100755 --- a/ZigbeeApp/Shared/Phone/CommonForm/CommonFormBase.cs +++ b/ZigbeeApp/Shared/Phone/CommonForm/CommonFormBase.cs @@ -306,7 +306,7 @@ /// 妫�娴嬬晫闈㈢殑閿欒 /// </summary> /// <returns></returns> - public bool CheckForm() + public virtual bool CheckForm() { //妫�娴嬫帶浠� return this.CheckControl(this); diff --git a/ZigbeeApp/Shared/Phone/CommonForm/EditorCommonForm.cs b/ZigbeeApp/Shared/Phone/CommonForm/EditorCommonForm.cs index ff1b7c6..b384af6 100755 --- a/ZigbeeApp/Shared/Phone/CommonForm/EditorCommonForm.cs +++ b/ZigbeeApp/Shared/Phone/CommonForm/EditorCommonForm.cs @@ -292,6 +292,9 @@ frame.AddChidren(btnReLoad); btnReLoad.ButtonClickEvent += (sender, e) => { + //鐐瑰嚮閲嶆柊鍔犺浇鏃�,鍏佽鍐嶆鑱旂綉 + HdlWifiLogic.Current.CanAccessHttp = true; + //娓呴櫎鍏ㄩ儴鎺т欢 this.ClearBodyFrame(); diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectZone.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectZone.cs deleted file mode 100755 index f83aec4..0000000 --- a/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectZone.cs +++ /dev/null @@ -1,73 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using Shared.Common; - -namespace Shared.Phone.Device.CommonForm -{ - public class SelectZone - { - public Action<Common.Room> ZoneAction; - /// <summary> - /// curRoom - /// </summary> - private Common.Room curRoom; - /// <summary> - /// 鏍囬 - /// </summary> - public string title = Language.StringByID(R.MyInternationalizationString.BelongZone); - /// <summary> - /// Init - /// </summary> - public void Init() - { - List<string> floorIds = new List<string> { }; - List<string> floorNames = new List<string> { }; - List<List<string>> roomNames = new List<List<string>> { }; - List<List<Common.Room>> rooms = new List<List<Common.Room>> { }; - List<Common.Room> rs = new List<Common.Room> { }; - List<string> rNames = new List<string> { }; - if (Config.Instance.Home.FloorDics.Count > 0) - { - foreach (var floor in Config.Instance.Home.FloorDics) - { - if (UserCenter.HdlRoomLogic.Current.GetRoomsByFloorId(floor.Key).Count > 0) - { - floorIds.Add(floor.Key); - floorNames.Add(floor.Value); - - roomNames.Add(UserCenter.HdlRoomLogic.Current.GetRoomNamesByFloorId(floor.Key)); - rooms.Add(UserCenter.HdlRoomLogic.Current.GetRoomsByFloorId(floor.Key)); - } - } - PickerView.ShowSecondary(floorNames, roomNames, (index1, index2) => - { - curRoom = rooms[index1][index2]; - ZoneAction?.Invoke(curRoom); - }, 0, 0, title, - Language.StringByID(R.MyInternationalizationString.Confrim), - Language.StringByID(R.MyInternationalizationString.Cancel)); - } - else - { - var listAllRoom = UserCenter.HdlRoomLogic.Current.GetAllListRooms(); - for (int i = 0; i < listAllRoom.Count; i++) - { - var r = listAllRoom[i]; - if (r.IsLove) - { - continue; - } - rs.Add(r); - rNames.Add(r.Name); - } - PickerView.Show(rNames, (index1) => - { - curRoom = rs[index1]; - ZoneAction?.Invoke(curRoom); - }, 0, title, - Language.StringByID(R.MyInternationalizationString.Confrim), - Language.StringByID(R.MyInternationalizationString.Cancel)); - } - } - } -} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs b/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs index 1c7f1b2..793d7c0 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs @@ -64,6 +64,8 @@ } #region 鈼� 鑷姩鍖朹_________________________ + + static bool If_once = true; /// <summary> /// 鑷姩鍖栧姛鑳戒唬鐮佸叆鍙� /// </summary> @@ -241,6 +243,7 @@ if (!Config.Instance.Home.IsVirtually) {//铏氭嫙鐨勪笉鑾峰彇缃戝叧閫昏緫鍒楄〃 //閲嶆柊鍒锋柊logic鍒楄〃 + If_once = true; Common.Logic.LogicList.Clear(); Read(logicScrolView, no); } @@ -271,35 +274,39 @@ { if (!Config.Instance.Home.IsVirtually)//铏氭嫙鐨勪笉鑾峰彇缃戝叧閫昏緫鍒楄〃 { - if (Common.Logic.LogicList.Count == 0) - { - var Idlist1 = await Send.GetLogicId(0);// - var Idlist2 = await Send.GetLogicId(2);//闂ㄩ攣甯稿紑妯″紡 - if (Idlist1.Count != 0) - { - var listlogic1 = await Send.ReadList(Idlist1.Count, 0); - for (int j = 0; j < listlogic1.Count; j++) - { - var logic = listlogic1[j]; - if (logic.LogicType != 0) - { - continue; - } - Common.Logic.LogicList.Add(logic); - } - } - if (Idlist2.Count != 0) - { - var listlogic2 = await Send.ReadList(Idlist2.Count, 2); - for (int j = 0; j < listlogic2.Count; j++) - { - var logic = listlogic2[j]; - if (logic.LogicType != 2) - { - continue; - } - Common.Logic.LogicList.Add(logic); - } + if (If_once) + { + If_once = false; + if (Common.Logic.LogicList.Count == 0) + { + var Idlist1 = await Send.GetLogicId(0);// + var Idlist2 = await Send.GetLogicId(2);//闂ㄩ攣甯稿紑妯″紡 + if (Idlist1.Count != 0) + { + var listlogic1 = await Send.ReadList(Idlist1.Count, 0); + for (int j = 0; j < listlogic1.Count; j++) + { + var logic = listlogic1[j]; + if (logic.LogicType != 0) + { + continue; + } + Common.Logic.LogicList.Add(logic); + } + } + if (Idlist2.Count != 0) + { + var listlogic2 = await Send.ReadList(Idlist2.Count, 2); + for (int j = 0; j < listlogic2.Count; j++) + { + var logic = listlogic2[j]; + if (logic.LogicType != 2) + { + continue; + } + Common.Logic.LogicList.Add(logic); + } + } } } } diff --git a/ZigbeeApp/Shared/Phone/Login/Logic/AccountLogic.cs b/ZigbeeApp/Shared/Phone/Login/Logic/AccountLogic.cs index 639c0a4..b87c37b 100755 --- a/ZigbeeApp/Shared/Phone/Login/Logic/AccountLogic.cs +++ b/ZigbeeApp/Shared/Phone/Login/Logic/AccountLogic.cs @@ -115,7 +115,7 @@ Latitude = lat }; var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj); - var revertObj = await RequestHttpsZigbeeAsync("ProcessRange/ReceiveAppLatAndLon", System.Text.Encoding.UTF8.GetBytes(requestJson)); + var revertObj = RequestHttpsZigbeeAsync("ProcessRange/ReceiveAppLatAndLon", System.Text.Encoding.UTF8.GetBytes(requestJson)); } catch { } } @@ -127,9 +127,9 @@ /// <param name="requestUrl">璇锋眰Url</param> /// <param name="byteData">璇锋眰鐨勭殑鏁版嵁</param> /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns> - private async System.Threading.Tasks.Task<Shared.Common.ResponseEntity.ResponsePack> RequestHttpsZigbeeAsync(string requestUrl, byte[] byteData) + public Shared.Common.ResponseEntity.ResponsePack RequestHttpsZigbeeAsync(string requestUrl, byte[] byteData) { - string result = await RequestHttpsZigbeeResultAsync(requestUrl, byteData); + string result = RequestHttpsZigbeeResultAsync(requestUrl, byteData); if (result != null) { try @@ -152,9 +152,9 @@ /// <param name="requestUrl">璇锋眰Url</param> /// <param name="byteData">璇锋眰鐨勭殑鏁版嵁</param> /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns> - private async System.Threading.Tasks.Task<string> RequestHttpsZigbeeResultAsync(string requestUrl, byte[] byteData) + public string RequestHttpsZigbeeResultAsync(string requestUrl, byte[] byteData) { - var result = await RequestHttpsZigbeeBytesResultAsync(requestUrl, byteData); + var result = RequestHttpsZigbeeBytesResultAsync(requestUrl, byteData); if (result != null) { return Encoding.UTF8.GetString(result); @@ -170,7 +170,7 @@ /// <param name="byteData">璇锋眰鐨勭殑鏁版嵁</param> /// <param name="requestMethod">POST 鎴栬�� GET 绛夌瓑</param> /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns> - private async System.Threading.Tasks.Task<byte[]> RequestHttpsZigbeeBytesResultAsync(string requestUrl, byte[] byteData, string requestMethod = "POST") + public byte[] RequestHttpsZigbeeBytesResultAsync(string requestUrl, byte[] byteData, string requestMethod = "POST") { //璇锋眰Url鐨勫畬鎴愯矾寰� var requestHost = "https://global.hdlcontrol.com/GeofenceService"; diff --git a/ZigbeeApp/Shared/Phone/MainPage/HomeMainPageForm.cs b/ZigbeeApp/Shared/Phone/MainPage/HomeMainPageForm.cs index c461c90..8f84fd0 100755 --- a/ZigbeeApp/Shared/Phone/MainPage/HomeMainPageForm.cs +++ b/ZigbeeApp/Shared/Phone/MainPage/HomeMainPageForm.cs @@ -57,7 +57,7 @@ Instance = this; //鍏堝垵濮嬪寲宸︽粦鎴块棿鍒楄〃鐣岄潰(鍦ㄥ弽灏勯噷闈㈠垵濮嬪寲) - if (ListRoomViewFrom.Instance == null) { } + if (LeftListRoomViewFrom.Instance == null) { } //鏁翠釜鑳屾櫙鐨勪笂涓嬫粦鍔ㄦ帶浠� if (this.listBodyContr == null) diff --git a/ZigbeeApp/Shared/Phone/MainPage/ListRoomViewFrom.cs b/ZigbeeApp/Shared/Phone/MainPage/LeftListRoomViewFrom.cs similarity index 90% rename from ZigbeeApp/Shared/Phone/MainPage/ListRoomViewFrom.cs rename to ZigbeeApp/Shared/Phone/MainPage/LeftListRoomViewFrom.cs index 3b2d07d..c64ef01 100755 --- a/ZigbeeApp/Shared/Phone/MainPage/ListRoomViewFrom.cs +++ b/ZigbeeApp/Shared/Phone/MainPage/LeftListRoomViewFrom.cs @@ -10,22 +10,22 @@ /// <summary> /// 宸︽粦鑿滃崟鐨勭殑鎴块棿鍒楄〃鐣岄潰 /// </summary> - public class ListRoomViewFrom : EditorCommonForm + public class LeftListRoomViewFrom : EditorCommonForm { #region 鈻� 鍙橀噺澹版槑___________________________ - private static ListRoomViewFrom roomManagement = null; + private static LeftListRoomViewFrom roomManagement = null; /// <summary> /// 宸︽粦鑿滃崟鐨勭殑鎴块棿瀵硅薄 /// </summary> - public static ListRoomViewFrom Instance + public static LeftListRoomViewFrom Instance { get { if (roomManagement == null) { //鍒濆鍖栧乏婊戣彍鍗� - roomManagement = new ListRoomViewFrom(); + roomManagement = new LeftListRoomViewFrom(); CommonPage.Instance.AddLeftView(roomManagement); } return roomManagement; @@ -52,6 +52,10 @@ /// 鍗$墖鎺т欢闆嗗悎 /// </summary> private Dictionary<string, Controls.ListRoomCardControl> dicCardControl = new Dictionary<string, Controls.ListRoomCardControl>(); + /// <summary> + /// 鏈垎閰嶇晫闈�(鐢ㄤ簬瀵瑰簲鍒汉涔辨悶,鍦ㄦ墦寮�鏈垎閰嶇晫闈笉鍏虫椂,鍘诲埛鏂板満鏅�,鐒跺悗鎻恇ug璇存病鏈夊満鏅�) + /// </summary> + private UnallocatedRoomForm unalloctedRoom = null; #endregion @@ -60,7 +64,7 @@ /// <summary> /// 鐢婚潰鏄剧ず /// </summary> - public void ShowForm() + private void ShowForm() { //鍒濆鍖栧ご閮ㄤ俊鎭� this.InitTopFrame(); @@ -152,6 +156,9 @@ /// </summary> public void RefreshListRoom() { + //淇濋櫓璧疯,杩欓噷瑕佸叧闂湭鍒嗛厤鐣岄潰 + this.CloseUnallocatedRoomForm(); + //濡傛灉杩樻病鏈夊垵濮嬪寲瀹屾垚鐣岄潰鐨勮瘽 if (this.isInitFinish == false) { @@ -295,14 +302,33 @@ return; } //鏈垎閰� - var unalloctedRoom = new UnallocatedRoomForm(); + this.unalloctedRoom = new UnallocatedRoomForm(); this.AddChidren(unalloctedRoom); unalloctedRoom.ShowForm(); + unalloctedRoom.FormCloseEvent += () => + { + //鎵嬪姩鐐瑰嚮鍏抽棴鐨勮瘽,鐩存帴缃┖ + this.unalloctedRoom = null; + }; }; } #endregion + #region 鈻� 鍏抽棴鏈垎閰嶇晫闈____________________ + + /// <summary> + /// 鍏抽棴鏈垎閰嶇晫闈� + /// </summary> + public void CloseUnallocatedRoomForm() + { + //鍏抽棴鐣岄潰 + this.unalloctedRoom?.CloseForm(); + this.unalloctedRoom = null; + } + + #endregion + #region 鈻� 鍒锋柊鎸囧畾鎴块棿_______________________ /// <summary> diff --git a/ZigbeeApp/Shared/Phone/MainPage/UnallocatedRoomForm.cs b/ZigbeeApp/Shared/Phone/MainPage/UnallocatedRoomForm.cs index af70771..fe4fce7 100755 --- a/ZigbeeApp/Shared/Phone/MainPage/UnallocatedRoomForm.cs +++ b/ZigbeeApp/Shared/Phone/MainPage/UnallocatedRoomForm.cs @@ -16,6 +16,10 @@ #region 鈻� 鍙橀噺澹版槑___________________________ /// <summary> + /// 鐣岄潰鍏抽棴浜嬩欢 + /// </summary> + public Action FormCloseEvent = null; + /// <summary> /// 娣诲姞鍒� 鐨勮儗鏅浘鎺т欢 /// </summary> private FrameLayoutStatuControl frameAddBackGroud = null; @@ -530,19 +534,17 @@ frameAddBackGroud.AddChidren(btnAdd, ChidrenBindMode.BindEvent); frameAddBackGroud.ButtonClickEvent += (sender, e) => { - var selectZone = new SelectZone(); - selectZone.title = Language.StringByID(R.MyInternationalizationString.AddTo); - selectZone.Init(); - selectZone.ZoneAction += (selectRoom) => + HdlControlLogic.Current.ShowBottomListRoomView(string.Empty, Language.StringByID(R.MyInternationalizationString.AddTo), (selectId, selectName) => { //鍙樻洿浜嗗綋鍓嶆埧闂寸殑涓滆タ,涓婚〉闇�瑕佸埛鏂� - if (HdlRoomLogic.Current.NowMainPageRoom.Id == selectRoom.Id) + if (HdlRoomLogic.Current.NowMainPageRoom.Id == selectId) { this.dataHadChanged = true; } //淇濆瓨閫夋嫨鐨勮澶囧拰鍦烘櫙 - this.SaveSelectDeviceAndScene(selectRoom); - }; + var room = HdlRoomLogic.Current.GetRoomById(selectId); + this.SaveSelectDeviceAndScene(room); + }); }; } @@ -654,6 +656,10 @@ /// </summary> public override void CloseFormBefore() { + //璋冪敤鍥炶皟浜嬩欢 + this.FormCloseEvent?.Invoke(); + this.FormCloseEvent = null; + if (this.dataHadChanged == true) { HdlThreadLogic.Current.RunMainInThread(() => diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/AccountOption.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/AccountOption.cs index 4ea33c1..76b0fa8 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/AccountOption.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/AccountOption.cs @@ -77,11 +77,8 @@ string oldGestureAuthentication = GestureAuthentication; GestureAuthentication = UserCenterLogic.EncryptPassword(hdlKey, oldGestureAuthentication); - var data = Newtonsoft.Json.JsonConvert.SerializeObject(this); - var byteData = System.Text.Encoding.UTF8.GetBytes(data); - string fullName = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Common.Config.Instance.Guid, DirNameResourse.AccountOptionFile); //鍐欏叆鍐呭 - Shared.IO.FileUtils.WriteFileByBytes(fullName, byteData); + HdlFileLogic.Current.SaveFileContent(DirNameResourse.AccountOptionFile, this); //杩樺師鏄庣爜 PswAuthentication = oldPswAuthentication; GestureAuthentication = oldGestureAuthentication; @@ -98,14 +95,14 @@ /// <returns></returns> public AccountOptionClass Load() { - string fileName = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Common.Config.Instance.Guid, DirNameResourse.AccountOptionFile); + string fileName = DirNameResourse.AccountOptionFile; if (System.IO.File.Exists(fileName) == false) { return new AccountOptionClass(); } try { - var varByte = Shared.IO.FileUtils.ReadFile(fileName); + var varByte = HdlFileLogic.Current.ReadFileByteContent(fileName); string strValue = System.Text.Encoding.UTF8.GetString(varByte); var info = Newtonsoft.Json.JsonConvert.DeserializeObject<AccountOptionClass>(strValue); //瑙e瘑瀵嗙爜 diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/ResidenceOption.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/ResidenceOption.cs index 18d80cf..c4dfa2e 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/ResidenceOption.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/ResidenceOption.cs @@ -55,18 +55,8 @@ /// </summary> public void Save() { - try - { - var data = Newtonsoft.Json.JsonConvert.SerializeObject(this); - var byteData = System.Text.Encoding.UTF8.GetBytes(data); - string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.ResidenceOptionFile); - //鍐欏叆鍐呭 - Shared.IO.FileUtils.WriteFileByBytes(fullName, byteData); - } - catch (Exception ex) - { - HdlLogLogic.Current.WriteLog(ex); - } + //鍐欏叆鍐呭 + HdlFileLogic.Current.SaveFileContent(DirNameResourse.ResidenceOptionFile, this); } /// <summary> @@ -75,14 +65,14 @@ /// <returns></returns> public ResidenceOptionClass Load() { - string fileName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.ResidenceOptionFile); + string fileName = DirNameResourse.ResidenceOptionFile; if (System.IO.File.Exists(fileName) == false) { return new ResidenceOptionClass(); } try { - var varByte = Shared.IO.FileUtils.ReadFile(fileName); + var varByte = HdlFileLogic.Current.ReadFileByteContent(fileName); string strValue = System.Text.Encoding.UTF8.GetString(varByte); var info = Newtonsoft.Json.JsonConvert.DeserializeObject<ResidenceOptionClass>(strValue); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs index 936bcae..e35c611 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs @@ -62,7 +62,6 @@ /// <summary> /// 鐧婚檰鏉冮檺缂栧彿鐨勭炕璇戝悕锛�1:涓昏处鍙疯嚜宸�(鏈汉) 2:璧嬩簣绠$悊鍛樻潈闄愮殑鎴愬憳 3:鎴愬憳 /// </summary> - [Newtonsoft.Json.JsonIgnore] public string AuthorityText = string.Empty; /// <summary> /// 鐢ㄦ埛澶村儚鏁版嵁(涓存椂鐢�,浼氱疆绌�) @@ -1308,6 +1307,10 @@ /// 鏄惁灏嗗彂閫佸強鎺ユ敹鍒扮殑鏁版嵁鍐欏叆鍒癓og涓� 1->鍐欏叆 /// </summary> public int WriteSendAndReceveDataToFile = 0; + /// <summary> + /// 鏄惁灏哠ocketReceive鐨勬暟鎹啓鍏ュ埌Log涓� 1->鍐欏叆 + /// </summary> + public int WriteSocketReceiveDataToFile = 0; } #endregion diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterEnumCommon.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterEnumCommon.cs index 08bd6c6..70432a9 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterEnumCommon.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterEnumCommon.cs @@ -3,25 +3,6 @@ namespace Shared.Phone.UserCenter { /// <summary> - /// 琛屾帶浠堕噷闈㈠瓙鎺т欢鐨勪綅缃榻愭柟寮� - /// </summary> - public enum UViewAlignment - { - /// <summary> - /// 浣嶄簬涓婇儴(绛夐棿璺濈灞呬腑:浣嶄簬涓婇儴锛屼互涓棿妯嚎涓哄熀鍑嗭紝浣嗘槸涓婁笅绌虹櫧涓�鑷�) - /// </summary> - Top = 1, - /// <summary> - /// 浣嶄簬姝d腑闂� - /// </summary> - Center = 2, - /// <summary> - /// 浣嶄簬搴曢儴(绛夐棿璺濈灞呬腑:浣嶄簬涓婇儴锛屼互涓棿妯嚎涓哄熀鍑嗭紝涓婁笅绌虹櫧涓�鑷�) - /// </summary> - Bottom = 3 - } - - /// <summary> /// 鐘舵�佹帶浠舵坊鍔犲瓙鎺т欢浜嬩欢鐨勭粦瀹氭ā寮� /// </summary> public enum ChidrenBindMode @@ -34,75 +15,6 @@ /// 涓嶇粦瀹氫簨浠讹紝涔熶笉鏄剧ず閫夋嫨鐘舵�� /// </summary> NotBind = 2 - } - - /// <summary> - /// 鎺т欢鑷姩璋冩暣楂樺害澶у皬妯″紡 - /// </summary> - public enum HeightAutoMode - { - /// <summary> - /// 浠�涔堜簨閮戒笉鍋� - /// </summary> - None = 1, - /// <summary> - /// 鑷姩澧炲姞楂樺害,鍙褰撳墠瀹瑰櫒杩涜鍒ゅ畾(鐢辨帶浠剁殑bottomSpace鐨勫�艰繘琛屽垽瀹�) - /// </summary> - IncreaseOnly = 2, - /// <summary> - /// 鑷姩璋冩暣楂樺害,鍙褰撳墠瀹瑰櫒杩涜鍒ゅ畾锛岃鎱庣敤姝ゆā寮�(澧炲姞鎴栬�呭噺灏戯紝鐢辨帶浠剁殑bottomSpace鐨勫�艰繘琛屽垽瀹�) - /// </summary> - AutoOnly = 3, - /// <summary> - /// 鑷姩澧炲姞楂樺害,鍖呭惈鍏ㄩ儴鐖跺鍣ㄨ繘琛屽垽瀹�(鐢辨帶浠剁殑bottomSpace鐨勫�艰繘琛屽垽瀹�) - /// </summary> - IncreaseAll = 4, - /// <summary> - /// 鑷姩璋冩暣楂樺害,鍖呭惈鍏ㄩ儴鐖跺鍣ㄨ繘琛屽垽瀹氾紝璇锋厧鐢ㄦ妯″紡(澧炲姞鎴栬�呭噺灏戯紝鐢辨帶浠剁殑bottomSpace鐨勫�艰繘琛屽垽瀹�) - /// </summary> - AutoAll = 5 - } - - /// <summary> - /// 杩涘害鏉$殑娣诲姞妯″紡 - /// </summary> - public enum ProBarAddMode - { - /// <summary> - /// 瀹屽叏閬綇鐢婚潰,涓嶈兘杩涜浠讳綍鎿嶄綔 - /// </summary> - FullForm = 1, - /// <summary> - /// 杩涘害鏉″彧鐩栦綇Body锛屼絾鑳芥搷浣滃ご閮ㄨ彍鍗曪紝鍏佽鐢ㄦ埛鍙栨秷 - /// </summary> - BodyFrame = 2 - } - - /// <summary> - /// 寮圭獥鐢婚潰鐨勬ā寮� - /// </summary> - public enum DialogFrameMode - { - /// <summary> - /// <para>涓嶅仛浠讳綍澶勭悊,瀛愭帶浠剁敱鑷畾涔夋坊鍔�,瀛愭帶浠舵坊鍔犲畬鎴愬悗</para> - /// <para>璇疯皟鐢ㄣ�怓inishInitControl銆戝嚱鏁板畬鎴愭渶鍚庣殑鍒濆鍖�</para> - /// </summary> - None = 1, - /// <summary> - /// <para>鍙湁涓�涓緭鍏ユ,鐢盜nputText灞炴�ц幏鍙栬緭鍏ュ��</para> - /// <para>鐢盨etTipText鍑芥暟璁剧疆杈撳叆妗嗙伆鑹插瓧浣撹鏄�(濡傛灉鏈夐渶瑕�)</para> - /// </summary> - OnlyInput = 2, - /// <summary> - /// <para>鍙湁涓�涓緭鍏ユ(瀵嗙爜妯″紡)</para> - /// <para>鐢盜nputText灞炴�ц幏鍙栬緭鍏ュ��,鐢盨etTipText鍑芥暟璁剧疆杈撳叆妗嗙伆鑹插瓧浣撹鏄�</para> - /// </summary> - OnlyPassword = 3, - /// <summary> - /// <para>鍙湁涓�涓緭鍏ユ(瀵嗙爜妯″紡),鍙宠竟鏈変竴涓彲浠ョ湅瑙佸瘑鐮佺殑鍥炬爣</para> - /// <para>鐢盜nputText灞炴�ц幏鍙栬緭鍏ュ��,鐢盨etTipText鍑芥暟璁剧疆杈撳叆妗嗙伆鑹插瓧浣撹鏄�</para> - /// </summary> - PasswordView = 4 } /// <summary> @@ -291,21 +203,6 @@ } /// <summary> - /// 楠岃瘉妯″紡 - /// </summary> - public enum ValidatedMode - { - /// <summary> - /// 涓嶉獙璇� - /// </summary> - NO = 0, - /// <summary> - /// 楠岃瘉 - /// </summary> - YES = 1 - } - - /// <summary> /// 鍥轰欢闃剁骇鍒嗙被 /// </summary> public enum FirmwareLevelType @@ -350,45 +247,6 @@ /// WIFI /// </summary> WIFI = 2 - } - - /// <summary> - /// 鑾峰彇鍚嶅瓧妯″紡 - /// </summary> - public enum GetNameMode - { - /// <summary> - /// 浠�涔堢壒鏁堥兘涓嶅姞锛岀洿鎺ヨ幏鍙� - /// </summary> - None = 0, - /// <summary> - /// <para>璁惧鍚嶅瓧鍔犵壒鏁�</para> - /// <para>澶氬洖璺椂锛歑XXX(NN鍥炶矾)</para> - /// </summary> - SpecialDevice = 1, - /// <summary> - /// 缃戝叧鍚嶇О鍔犵壒鏁� - /// </summary> - SpecialGateway = 2 - } - - /// <summary> - /// 姘村钩婊戝姩婊氬姩鏉$殑绫诲瀷妯″紡 - /// </summary> - public enum SeekBarTypeMode - { - /// <summary> - /// 鍗曠函鍙湪鍙宠竟鏈変竴涓櫨鍒嗘瘮鐨勬枃鏈�(鏈夋晥鎺т欢锛歴eekBar锛宐tnRight) - /// </summary> - OnlyPersent = 1, - /// <summary> - /// 宸﹁竟鏈変竴涓枃鏈�,鍙宠竟鏈変竴涓櫨鍒嗘瘮鐨勬枃鏈�(鏈夋晥鎺т欢锛歴eekBar锛宐tnLeft锛宐tnRight) - /// </summary> - LeftAndPersent = 2, - /// <summary> - /// 宸﹁竟鍜屽彸杈归兘鏈変竴涓枃鏈�,浣嗘槸鏃犺繘搴︽潯(鏈夋晥鎺т欢锛歴eekBar锛宐tnLeft锛宐tnRight) - /// </summary> - LeftAndRight = 3 } /// <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 3a2334a..1cad842 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs @@ -23,6 +23,8 @@ get { return m_CanClick; } set { + if (m_CanClick == value) { return; } + m_CanClick = value; //鑳藉鐐瑰嚮,鍒欐樉绀烘病鏈夌偣鍑昏繃鐨勭姸鎬� if (m_CanClick == true) { this.SetNotClickStatu(); } @@ -307,21 +309,6 @@ { base.RemoveFromParent(); } - } - - /// <summary> - /// Y杞撮噸缃�(鐪熷疄鏁板��,娌℃湁鐖跺鍣ㄦ棤鏁�) - /// </summary> - /// <param name="alignment">涓婁笅瀵归綈鏂瑰紡</param> - /// <param name="Space">涓婁笅涓ら儴鍒嗙殑闂磋窛</param> - public void ReSetYaxis(UViewAlignment alignment, int Space = 0) - { - if (this.Parent == null) - { - return; - } - //Y杞撮噸缃� - this.Y = HdlControlLogic.Current.GetControlChidrenYaxis(this.Parent.Height, this.Height, alignment, Space); } /// <summary> diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/TextInputBase.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/TextInputBase.cs index dbf1a01..6d11849 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/TextInputBase.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/TextInputBase.cs @@ -284,21 +284,6 @@ #region 鈻� 涓�鑸柟娉昣__________________________ /// <summary> - /// Y杞撮噸缃�(鐪熷疄鏁板��,娌℃湁鐖跺鍣ㄦ棤鏁�) - /// </summary> - /// <param name="alignment">涓婁笅瀵归綈鏂瑰紡</param> - /// <param name="Space">涓婁笅涓ら儴鍒嗙殑闂磋窛</param> - public void ReSetYaxis(UViewAlignment alignment, int Space = 0) - { - if (this.Parent == null) - { - return; - } - //Y杞撮噸缃� - this.Y = HdlControlLogic.Current.GetControlChidrenYaxis(this.Parent.Height, this.Height, alignment, Space); - } - - /// <summary> /// 璁$畻鍥剧墖鐨勭湡瀹為珮瀹藉害 /// </summary> /// <param name="i_size"></param> diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/BelongAreaControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/BelongAreaControl.cs index f667767..8bbe274 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/BelongAreaControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/BelongAreaControl.cs @@ -20,25 +20,9 @@ /// </summary> public string RoomKey = string.Empty; /// <summary> - /// 褰撳墠閫夋嫨鐨勬ゼ灞備富閿�(娌″繀瑕佸叕寮�鍑哄幓) + /// 鏄剧ず鏂囨湰 /// </summary> - private string FloorKey = string.Empty; - /// <summary> - /// 妤煎眰鍒楄〃鍚嶅瓧 - /// </summary> - private List<string> listFloorName = new List<string>(); - /// <summary> - /// 妤煎眰鍒楄〃涓婚敭 - /// </summary> - private List<string> listFloorKeys = new List<string>(); - /// <summary> - /// 鎴块棿鍚嶅瓧 - /// </summary> - private List<List<string>> listRoomName = new List<List<string>>(); - /// <summary> - /// 鎴块棿涓婚敭 - /// </summary> - private List<List<string>> listRoomKeys = new List<List<string>>(); + private NormalViewControl btnTextView = null; #endregion @@ -50,8 +34,6 @@ /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(銆愬垪琛ㄦ帶浠剁殑rowSpace/2銆戝嵆鍙�,涓嶆噦榛樿涓�0鍗冲彲)</param> public BelongAreaControl(int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { - //鍒濆鍖栨暟鎹� - this.InitData(); } /// <summary> @@ -114,7 +96,6 @@ { string roomName = i_Room.Name; this.RoomKey = i_Room.Id; - this.FloorKey = i_Room.FloorId; if (Common.Config.Instance.Home.FloorDics.ContainsKey(i_Room.FloorId) == true) { //妤煎眰+鎴块棿 @@ -140,17 +121,17 @@ this.AddChidren(btnCaption, ChidrenBindMode.BindEvent); //鏄剧ず妗� - var txtView = new NormalViewControl(700, true); - txtView.X = Application.GetRealWidth(294); - txtView.Gravity = Gravity.CenterVertical; - txtView.TextColor = UserCenterColor.Current.TextGrayColor1; - txtView.Text = i_RoomName; - this.AddChidren(txtView, ChidrenBindMode.BindEvent); + this.btnTextView = new NormalViewControl(700, true); + btnTextView.X = Application.GetRealWidth(294); + btnTextView.Gravity = Gravity.CenterVertical; + btnTextView.TextColor = UserCenterColor.Current.TextGrayColor1; + btnTextView.Text = i_RoomName; + this.AddChidren(btnTextView, ChidrenBindMode.BindEvent); if (chidrenYaxis != 0) { btnCaption.Y += chidrenYaxis; - txtView.Y += chidrenYaxis; + btnTextView.Y += chidrenYaxis; } if (IsSharedRoom == true) @@ -159,74 +140,15 @@ this.UseClickStatu = false; return; } - if (this.listFloorKeys.Count == 0 && listRoomKeys.Count == 0) - { - //鎴栬�呮牴鏈氨娌℃湁鍒涘缓鎴块棿锛屽垯涓嶅厑璁告洿鏀� - this.UseClickStatu = false; - return; - } + //鍙崇澶� this.AddRightArrow(); this.ButtonClickEvent += (sender, e) => { //鍖哄煙閫夋嫨 - this.ShowSelectRoom(txtView, i_caption); + this.ShowSelectRoom(btnTextView, i_caption); }; - } - - /// <summary> - /// 鍒濆鍖栨暟鎹� - /// </summary> - private void InitData() - { - var dicFloor = HdlRoomLogic.Current.GetFloorSortList(); - if (dicFloor.Count == 0) - { - //绗竴浣嶉粯璁ゆ坊鍔犳湭鍒嗛厤 - var listKeys = new List<string>() { "" }; - var listName = new List<string>() { Language.StringByID(R.MyInternationalizationString.uUndistributed) }; - //鎴块棿鍚嶅瓧鍜屼富閿敹闆� - var listRoom = HdlRoomLogic.Current.GetFloorSortRoom(string.Empty, false); - foreach (var myRoom in listRoom) - { - listName.Add(myRoom.Name); - listKeys.Add(myRoom.Id); - } - listRoomName.Add(listName); - listRoomKeys.Add(listKeys); - } - else - { - //绗竴浣嶉粯璁ゆ坊鍔犳湭鍒嗛厤(鏈垎閰嶆斁鍦ㄦゼ灞傞偅涓彍鍗�) - var listKeys = new List<string>() { "" }; - var listName = new List<string>() { "" }; - listRoomName.Add(listName); - listRoomKeys.Add(listKeys); - this.listFloorKeys.Add(""); - this.listFloorName.Add(Language.StringByID(R.MyInternationalizationString.uUndistributed)); - - foreach (string fKeys in dicFloor.Keys) - { - var listRoom = HdlRoomLogic.Current.GetFloorSortRoom(fKeys, false); - if (listRoom.Count > 0) - { - //妤煎眰鍚嶅瓧鍜屼富閿敹闆� - this.listFloorKeys.Add(fKeys); - this.listFloorName.Add(dicFloor[fKeys]); - //鎴块棿鍚嶅瓧鍜屼富閿敹闆� - listName = new List<string>(); - listKeys = new List<string>(); - foreach (var myRoom in listRoom) - { - listName.Add(myRoom.Name); - listKeys.Add(myRoom.Id); - } - listRoomName.Add(listName); - listRoomKeys.Add(listKeys); - } - } - } } #endregion @@ -240,58 +162,39 @@ /// <param name="i_caption"></param> private void ShowSelectRoom(NormalViewControl txtView, string i_caption) { - int index1 = this.listFloorKeys.IndexOf(FloorKey); - if (index1 == -1) { index1 = 0; } - int index2 = this.listRoomKeys[index1].IndexOf(RoomKey); - if (index2 == -1) { index2 = 0; } - - if (this.listFloorKeys.Count == 0) + //鏄剧ず搴曢儴寮圭獥鐨勬埧闂村垪琛� + var result = HdlControlLogic.Current.ShowBottomListRoomView(this.RoomKey, i_caption, (selectId, selectName) => { - //鏃犳ゼ灞傛ā寮� - PickerView.Show(this.listRoomName[0], (value) => - { - RoomKey = this.listRoomKeys[0][value]; - if (RoomKey != string.Empty) - { - //鎴块棿 - txtView.Text = this.listRoomName[0][value]; - } - else - { - txtView.Text = Language.StringByID(R.MyInternationalizationString.uDeviceNotAssignedRoom); - } - this.SelectRoomEvent?.Invoke(RoomKey); - - }, index2, i_caption, - Language.StringByID(R.MyInternationalizationString.uFinish), - Language.StringByID(R.MyInternationalizationString.uCancel)); - } - else + this.RoomKey = selectId; + txtView.Text = selectName; + //璋冪敤鍥炶皟鍑芥暟 + this.SelectRoomEvent?.Invoke(RoomKey); + }); + if (result == false) { - //鏈夋ゼ灞傛ā寮� - PickerView.ShowSecondary(this.listFloorName, this.listRoomName, (value1, value2) => - { - FloorKey = this.listFloorKeys[value1]; - RoomKey = this.listRoomKeys[value1][value2]; - if (RoomKey != string.Empty) - { - //妤煎眰+鎴块棿 - txtView.Text = this.listFloorName[value1] + " " + this.listRoomName[value1][value2]; - } - else - { - txtView.Text = Language.StringByID(R.MyInternationalizationString.uDeviceNotAssignedRoom); - } - this.SelectRoomEvent?.Invoke(RoomKey); - - }, index1, index2, i_caption, - Language.StringByID(R.MyInternationalizationString.uFinish), - Language.StringByID(R.MyInternationalizationString.uCancel)); + //鎴栬�呮牴鏈氨娌℃湁鍒涘缓鎴块棿锛屽垯涓嶅厑璁告洿鏀� + this.UseClickStatu = false; } } #endregion + #region 鈻� 鍒锋柊鎺т欢___________________________ + + /// <summary> + /// 閲嶆柊鍒锋柊鎺т欢 + /// </summary> + /// <param name="i_RoomId">鎸囧畾浠ュ摢涓埧闂碔D鍒锋柊鎺т欢</param> + public void RefreshControl(string i_RoomId) + { + this.RoomKey = i_RoomId; + + var room = HdlRoomLogic.Current.GetRoomById(i_RoomId); + this.btnTextView.Text = HdlRoomLogic.Current.GetRoomName(room); + } + + #endregion + #region 鈻� 鎺т欢鎽ф瘉___________________________ /// <summary> diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/NormalSelectControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/NormalSelectControl.cs index 63d9ce0..850ab6d 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/NormalSelectControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/NormalSelectControl.cs @@ -16,6 +16,10 @@ /// </summary> private string textValue = string.Empty; /// <summary> + /// 涓嬮儴鏄剧ず鏂囨湰 + /// </summary> + private string textBottomValue = null; + /// <summary> /// 鏂囨湰鎺т欢 /// </summary> private NormalViewControl btnText = null; @@ -46,7 +50,7 @@ } } /// <summary> - /// 澶勪簬闈為�変腑鐘舵�佹椂锛屾槸鍚︽妸瀛椾綋鍙樻垚鐏拌壊(榛樿鍙樻垚鐏拌壊) + /// 澶勪簬閫変腑鎴栬�呴潪閫変腑鐘舵�佹椂锛屾槸鍚﹀彉鏇村瓧浣撻鑹� /// </summary> public bool ChangedTextColor = true; @@ -65,6 +69,18 @@ } /// <summary> + /// 鍋氭垚涓�涓畝鍗曠殑閫夋嫨鎺т欢 + /// </summary> + /// <param name="i_topText">涓婇儴鏄剧ず鏂囨湰</param> + /// <param name="i_bottomText">涓嬮儴鏄剧ず鏂囨湰</param> + /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(銆愬垪琛ㄦ帶浠剁殑rowSpace/2銆戝嵆鍙�,涓嶆噦榛樿涓�0鍗冲彲)</param> + public NormalSelectControl(string i_topText, string i_bottomText, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) + { + this.textValue = i_topText; + this.textBottomValue = i_bottomText; + } + + /// <summary> /// 鍒濆鍖栧唴閮ㄦ帶浠� /// </summary> /// <param name="iconParh">宸︿晶鍥炬爣</param> @@ -76,9 +92,18 @@ var btnIcon = this.AddLeftIcon(); btnIcon.UnSelectedImagePath = iconParh; } - //鏄剧ず鏂囨湰 - btnText = this.AddLeftCaption(this.textValue, 600); - btnText.TextColor = UserCenterColor.Current.TextGrayColor3; + if (this.textBottomValue == null) + { + //鏄剧ず鏂囨湰 + btnText = this.AddLeftCaption(this.textValue, 600); + btnText.TextColor = UserCenterColor.Current.TextGrayColor3; + } + else + { + //鏄剧ず鏂囨湰 + btnText = this.AddTopView(this.textValue, 600); + this.AddBottomView(this.textBottomValue, 600); + } //閫夋嫨鎺т欢 btnSelect = this.AddMostRightEmptyIcon(58, 58); btnSelect.Visible = false; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressFormBar.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressFormBar.cs index 3349ea3..0f048dc 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressFormBar.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressFormBar.cs @@ -124,7 +124,7 @@ HdlThreadLogic.Current.RunMain(() => { btnText.Text = msg; - }); + }, ShowErrorMode.NO); } #endregion @@ -137,7 +137,7 @@ /// <param name="value">姝ゅ�间负鐧惧垎姣斿��(涔熷氨鏄皬浜庢垨鑰呯瓑浜�1鐨�)</param> public void SetValue(decimal value) { - this.btnProgressBar.SetValue(value); + this.btnProgressBar?.SetValue(value); } /// <summary> @@ -147,7 +147,7 @@ /// <param name="maxValue">鏈�澶у��</param> public void SetValue(decimal value, decimal maxValue) { - this.btnProgressBar.SetValue(value, maxValue); + this.btnProgressBar?.SetValue(value, maxValue); } #endregion @@ -165,7 +165,7 @@ { //鍒濆鍖栬繘搴︽潯 this.InitProgressFormBar(); - }); + }, ShowErrorMode.NO); } } @@ -200,7 +200,7 @@ //鍏抽棴浜嬩欢 this.CloseEvent?.Invoke(); this.CloseEvent = null; - }); + }, ShowErrorMode.NO); } #endregion diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressRowBar.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressRowBar.cs index 91b3ada..d3be37f 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressRowBar.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressRowBar.cs @@ -12,7 +12,7 @@ #region 鈻� 鍙橀噺澹版槑___________________________ /// <summary> - /// 杩涘浘鏉¤兘鍚﹀線鍥炶蛋(榛樿鍙互) + /// 杩涘害鏉¤兘鍚﹀線鍥炶蛋(榛樿鍙互) /// </summary> public bool ProgressBarGoback = true; /// <summary> @@ -35,6 +35,22 @@ /// 妯″紡鍖哄垎 /// </summary> private int m_ModeDiv = -1; + + /// <summary> + /// 杩涘害鏉℃槸鍚﹀彲瑙� + /// </summary> + public new bool Visible + { + get { return base.Visible; } + set + { + if (this.frameProgressBack != null) + { + this.frameProgressBack.Visible = value; + } + base.Visible = value; + } + } #endregion @@ -143,10 +159,12 @@ /// <param name="value"></param> private void SetValueEx(decimal value) { - if (btnProgressBar == null || this.m_ModeDiv != 1 || value > 1) + if (btnProgressBar == null || this.m_ModeDiv != 1) { return; } + if (value > 1) { value = 1; } + HdlThreadLogic.Current.RunMain(() => { int width = (int)(value * this.Width); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs index d02b8e4..b081b6c 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs @@ -181,8 +181,21 @@ public override void RemoveFromParent() { this.SelectTabEvent = null; + if (this.Parent != null) + { + base.RemoveFromParent(); + } + } - base.RemoveFromParent(); + /// <summary> + /// 鈽嗏槅绉婚櫎鍏ㄩ儴鎺т欢鈽嗏槅 + /// </summary> + public override void RemoveAll() + { + if (this.Parent != null) + { + base.RemoveAll(); + } } #endregion diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameRowControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameRowControl.cs index 037155f..86cc665 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameRowControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameRowControl.cs @@ -173,12 +173,17 @@ /// 娣诲姞宸﹁竟鍥炬爣 /// </summary> /// <param name="i_Iconsize">鍥炬爣澶у皬</param> + /// <param name="i_IconPath">鍥炬爣鍦板潃</param> /// <returns></returns> - public IconViewControl AddLeftIcon(int i_Iconsize = 81) + public IconViewControl AddLeftIcon(int i_Iconsize = 81, string i_IconPath = null) { var btnIcon = new IconViewControl(i_Iconsize); btnIcon.X = ControlCommonResourse.XXLeft + LeftOffset; btnIcon.Gravity = Gravity.CenterVertical; + if (i_IconPath != null) + { + btnIcon.UnSelectedImagePath = i_IconPath; + } this.AddChidren(btnIcon, ChidrenBindMode.BindEvent); if (chidrenYaxis != 0) { diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameControl.cs index fd43d18..cea4fbb 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameControl.cs @@ -85,16 +85,16 @@ this.InitFrameTable(); //鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣 - int value = this.GetLocationMostLastViewBottom(this.m_frameTable); + int value = this.GetLocationMostLastViewBottom(this.frameTable); if (value != -1) { view.Y = value + rowSpace; } - this.m_frameTable.AddChidren(view); + this.frameTable.AddChidren(view); //璋冩暣妗屽竷楂樺害 - if (this.m_frameTable.Height < view.Bottom) + if (this.frameTable.Height < view.Bottom) { - this.m_frameTable.Height = view.Bottom; + this.frameTable.Height = view.Bottom; } } @@ -125,10 +125,16 @@ /// 璋冩暣瀛怓rameLayout鐨勭湡瀹為珮搴� /// </summary> /// <param name="frame"></param> - public void AdjustChidrenFrameRealHeight(FrameLayout frame) + /// <param name="minHeight">鏈�灏忛珮搴�</param> + public void AdjustChidrenFrameRealHeight(FrameLayout frame, int minHeight = -1) { //鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣 int value = this.GetLocationMostLastViewBottom(frame); + if (minHeight != -1 && value < minHeight) + { + //娌℃湁瓒呰繃鏈�灏忛珮搴� + return; + } if (value != -1) { //璋冩暣妗屽竷楂樺害 @@ -148,11 +154,11 @@ } //鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣 - int value = this.GetLocationMostLastViewBottom(this.m_frameTable); + int value = this.GetLocationMostLastViewBottom(this.frameTable); if (value != -1) { //璋冩暣妗屽竷楂樺害 - this.m_frameTable.Height = value; + this.frameTable.Height = value; } else { @@ -174,7 +180,7 @@ this.AdjustTableHeight(); var btnTemp = new BottomClickButton(); - if (btnTemp.Yaxis >= this.m_frameTable.Height + correctionsValue) + if (btnTemp.Yaxis >= this.frameTable.Height + correctionsValue) { //娌℃湁瓒呰繃 return; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameRefreshControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameRefreshControl.cs index 7f5b774..e10b04e 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameRefreshControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameRefreshControl.cs @@ -85,16 +85,16 @@ //鍒濆鍖栨甯冩帶浠� this.InitFrameTable(); - int value = this.GetLocationMostLastViewBottom(this.m_frameTable); + int value = this.GetLocationMostLastViewBottom(this.frameTable); if (value != -1) { view.Y = value + rowSpace; } - this.m_frameTable.AddChidren(view); + this.frameTable.AddChidren(view); //璋冩暣妗屽竷楂樺害 - if (this.m_frameTable.Height < view.Bottom) + if (this.frameTable.Height < view.Bottom) { - this.m_frameTable.Height = view.Bottom; + this.frameTable.Height = view.Bottom; } } @@ -108,20 +108,20 @@ this.InitFrameTable(); //鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣 - int value = this.GetLocationMostLastViewBottom(this.m_frameTable); + int value = this.GetLocationMostLastViewBottom(this.frameTable); if (value != -1) { view.Y = value; } - this.m_frameTable.AddChidren(view); + this.frameTable.AddChidren(view); if (rowSpace > 0) { view.Height += rowSpace; } //璋冩暣妗屽竷楂樺害 - if (this.m_frameTable.Height < view.Bottom) + if (this.frameTable.Height < view.Bottom) { - this.m_frameTable.Height = view.Bottom; + this.frameTable.Height = view.Bottom; } } @@ -158,11 +158,11 @@ } //鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣 - int value = this.GetLocationMostLastViewBottom(this.m_frameTable); + int value = this.GetLocationMostLastViewBottom(this.frameTable); if (value != -1) { //璋冩暣妗屽竷楂樺害 - this.m_frameTable.Height = value + buttomSpace; + this.frameTable.Height = value + buttomSpace; } else { @@ -181,7 +181,7 @@ this.AdjustTableHeight(); var btnTemp = new BottomClickButton(); - if (btnTemp.Yaxis >= this.m_frameTable.Height + correctionsValue) + if (btnTemp.Yaxis >= this.frameTable.Height + correctionsValue) { //娌℃湁瓒呰繃 return; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs index c4d31b4..f2a9145 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs @@ -19,6 +19,10 @@ /// </summary> public Action CancelClickEvent = null; /// <summary> + /// 鐐瑰嚮鑳屾櫙鏄惁鍏抽棴寮圭獥 + /// </summary> + public bool CloseByClickBack = true; + /// <summary> /// 淇℃伅绫诲瀷 /// </summary> private ShowMsgType msgType = ShowMsgType.Confirm; @@ -105,9 +109,12 @@ Common.CommonPage.Instance.AddChidren(frameMain); frameMain.MouseUpEventHandler += (sender, e) => { - //绉婚櫎鐣岄潰 - frameMain.RemoveFromParent(); - this.ConfirmClickEvent = null; + if (this.CloseByClickBack == true) + { + //绉婚櫎鐣岄潰 + frameMain.RemoveFromParent(); + this.ConfirmClickEvent = null; + } }; //鐧借壊鑳屾櫙妗� diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs index b0bca1d..6ff45d2 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs @@ -111,7 +111,7 @@ var form = new BottomItemSelectForm(); form.CancelCallEvent = true;//鍏佽鍙栨秷 - form.AddForm(title, listText, nowSelectNo - 1); + form.AddForm(title, listText, null, nowSelectNo - 1); form.FinishSelectEvent += (selectNo) => { if (selectNo == nowSelectNo - 1) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs index 00c5eb4..e149453 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs @@ -5,14 +5,15 @@ namespace Shared.Phone.UserCenter { /// <summary> - /// 搴曢儴寮圭獥椤圭洰閫夋嫨鐣岄潰(鍒楄〃鏁板敖鍙兘鍒紕閭d箞澶�) + /// 搴曢儴寮圭獥椤圭洰閫夋嫨鐣岄潰 /// </summary> public class BottomItemSelectForm : DialogCommonForm { #region 鈻� 鍙橀噺澹版槑___________________________ /// <summary> - /// 瀹屾垚閫夋嫨鐨勪簨浠�(鍙傛暟涓洪�夋嫨鐨勬槸鍒楄〃鐨勭鍑犺,浠�0寮�濮�) + /// <para>瀹屾垚閫夋嫨鐨勪簨浠�(鍙傛暟涓洪�夋嫨鐨勬槸鍒楄〃鐨勭鍑犺,浠�0寮�濮�)</para> + /// <para>褰揅ancelCallEvent=true鏃�,鐐瑰嚮纭鎸夐挳鏃�,鍙傛暟涓�:-1</para> /// </summary> public Action<int> FinishSelectEvent = null; /// <summary> @@ -24,7 +25,7 @@ /// </summary> public bool CancelCallEvent = false; /// <summary> - /// 閫夋嫨鐨勮鑳藉惁鍙栨秷 + /// 閫夋嫨鐨勮鑳藉惁鍙栨秷(榛樿鍙互鍙栨秷) /// </summary> public bool SelectRowCanCancel = true; @@ -36,12 +37,13 @@ /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) /// </summary> /// <param name="i_topText">澶撮儴鏍囬</param> - /// <param name="i_listText">闇�瑕佹樉绀虹殑鍒楄〃淇℃伅(鍒楄〃鏁板敖鍙兘鍒紕閭d箞澶�)</param> + /// <param name="i_listText">闇�瑕佹樉绀虹殑鍒楄〃淇℃伅</param> + /// <param name="i_listBottomText">闇�瑕佹樉绀虹殑鍒楄〃淇℃伅(搴曢儴),濡傛灉鍙槸鍗曡鏄剧ず,鍒欐鍊艰缃负null(濡傛灉涓嶄负null,浣嗘槸绱㈠紩鎵�鎸囧悜鐨勫�间负null,鍒欒琛屽己鍒跺崟琛屾樉绀�)</param> /// <param name="i_selectNo">璁剧疆鍝釜鏂囨湰涓洪粯璁ら�夋嫨(涓嶈缃~-1)</param> - public void ShowForm(string i_topText, List<string> i_listText, int i_selectNo) + public void ShowForm(string i_topText, List<string> i_listText, List<string> i_listBottomText, int i_selectNo) { //鍒濆鍖栦腑閮ㄤ俊鎭� - this.InitMiddleFrame(i_topText, i_listText, i_selectNo); + this.InitMiddleFrame(i_topText, i_listText, i_listBottomText, i_selectNo); } /// <summary> @@ -49,48 +51,62 @@ /// </summary> /// <param name="i_topText">澶撮儴鏍囬</param> /// <param name="i_listText">闇�瑕佹樉绀虹殑鍒楄〃淇℃伅</param> + /// <param name="i_listBottomtext">闇�瑕佹樉绀虹殑鍒楄〃淇℃伅(搴曢儴)</param> /// <param name="i_selectNo">榛樿閫夋嫨</param> - private void InitMiddleFrame(string i_topText, List<string> i_listText, int i_selectNo) + private void InitMiddleFrame(string i_topText, List<string> i_listText, List<string> i_listBottomtext, int i_selectNo) { - //寮у害鐨勫渾鐨勪竴鍗婄殑楂樺害(鍥哄畾) - int halfRoundHeigth = Application.GetRealHeight(116) / 2; - //澶撮儴楂樺害 - int topHeight = Application.GetRealHeight(195); - //搴曢儴楂樺害 - int bottomHeight = Application.GetRealHeight(57); - //鏄庣粏楂樺害 - int detailHeight = (ControlCommonResourse.ListViewRowHeight + Application.GetRealHeight(12)) * i_listText.Count; + //涓嶈兘澶熸粦鍔ㄧ殑涓滆タ + FrameListControl listDetailView1 = null; + //鑳藉婊戝姩鐨勪笢瑗� + VerticalListControl listDetailView2 = null; - //鎼炰竴涓�忔槑鐨勬 - var frameTransparent = new FrameLayout(); - frameTransparent.Y = bodyFrameLayout.Height - topHeight - bottomHeight - detailHeight; - frameTransparent.Height = topHeight + bottomHeight + detailHeight + halfRoundHeigth * 2;//楂樺害灏辨槸瑕佸畠瓒呰繃锛岄殢渚挎悶鐨� - frameTransparent.BackgroundColor = UserCenterColor.Current.Transparent; - bodyFrameLayout.AddChidren(frameTransparent); + //鈽呪槄浠庝笅寰�涓婃坊鍔犳帶浠垛槄鈽� - //鏄庣粏鍒楄〃鐨勬甯冿紝鐧借壊鑳屾櫙(瀹冧笌瀹為檯楂樺害灏忎簡鍗婁釜寮у害鐨勫渾) - var detailBackFrame = new FrameLayout(); - detailBackFrame.Y = halfRoundHeigth; - detailBackFrame.Height = frameTransparent.Height; - detailBackFrame.BackgroundColor = UserCenterColor.Current.White; - frameTransparent.AddChidren(detailBackFrame); + //鏄庣粏楂樺害(鍒濆鏈�澶氬彧鏄剧ず9琛�) + int detailHeight = ControlCommonResourse.ListViewRowHeight + Application.GetRealHeight(12); + if (i_listText.Count > 9) + { + //63:涓婇儴闂磋窛 58:涓嬮儴闂磋窛 + detailHeight = detailHeight * 9 + Application.GetRealHeight(63 + 58); + listDetailView2 = new VerticalListControl(12); + listDetailView2.Height = detailHeight; + listDetailView2.Gravity = Gravity.BottomCenter; + listDetailView2.BackgroundColor = UserCenterColor.Current.White; + bodyFrameLayout.AddChidren(listDetailView2); + } + else + { + //63:涓婇儴闂磋窛 58:涓嬮儴闂磋窛 + detailHeight = detailHeight * i_listText.Count + Application.GetRealHeight(63 + 58); + listDetailView1 = new FrameListControl(12); + listDetailView1.Height = detailHeight; + listDetailView1.Gravity = Gravity.BottomCenter; + listDetailView1.BackgroundColor = UserCenterColor.Current.White; + bodyFrameLayout.AddChidren(listDetailView1); + } + //绾� + int lineYY = listDetailView1 != null ? listDetailView1.Y : listDetailView2.Y; + var btnLine = new NormalViewControl(bodyFrameLayout.Width, ControlCommonResourse.BottomLineHeight, false); + btnLine.Y = lineYY - ControlCommonResourse.BottomLineHeight; + btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine; + bodyFrameLayout.AddChidren(btnLine); - //寮у害鐨勫渾 - var rowRound = new FrameLayout(); - rowRound.Width = bodyFrameLayout.Width; - rowRound.Height = halfRoundHeigth * 2; - rowRound.BackgroundColor = UserCenterColor.Current.White; - rowRound.Radius = (uint)halfRoundHeigth; - frameTransparent.AddChidren(rowRound); + //澶撮儴鐧借壊鑳屾櫙 + var topBackFame = new FrameLayout(); + topBackFame.Y = btnLine.Y - Application.GetRealHeight(138); + topBackFame.BackgroundColor = UserCenterColor.Current.White; + topBackFame.Height = Application.GetRealHeight(138); + topBackFame.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); + bodyFrameLayout.AddChidren(topBackFame); //澶撮儴淇℃伅 - var btnTitle = new NormalViewControl(detailBackFrame.Width, Application.GetRealHeight(63), false); - btnTitle.Y = Application.GetRealHeight(35); + var btnTitle = new NormalViewControl(topBackFame.Width, Application.GetRealHeight(65), false); + btnTitle.Y = Application.GetRealHeight(34); btnTitle.Text = i_topText; btnTitle.TextColor = UserCenterColor.Current.TextColor4; btnTitle.TextSize = 16; btnTitle.TextAlignment = TextAlignment.Center; - rowRound.AddChidren(btnTitle); + topBackFame.AddChidren(btnTitle); //鍙栨秷 var btnCancel = new NormalViewControl(200, 58, true); @@ -98,7 +114,7 @@ btnCancel.Y = Application.GetRealHeight(40); btnCancel.TextColor = UserCenterColor.Current.TextGrayColor1; btnCancel.TextID = R.MyInternationalizationString.uCancel; - rowRound.AddChidren(btnCancel); + topBackFame.AddChidren(btnCancel); btnCancel.ButtonClickEvent += (sender, e) => { this.CloseForm(); @@ -111,7 +127,7 @@ btnFinish.TextAlignment = TextAlignment.CenterRight; btnFinish.TextColor = 0xfffb744a; btnFinish.TextID = R.MyInternationalizationString.uFinish; - rowRound.AddChidren(btnFinish); + topBackFame.AddChidren(btnFinish); btnFinish.ButtonClickEvent += (sender, e) => { if (FinishSelectEvent != null && oldSelectContr != null) @@ -127,23 +143,32 @@ this.CloseForm(); }; - //绾� - var btnLine = new NormalViewControl(detailBackFrame.Width, ControlCommonResourse.BottomLineHeight, false); - btnLine.Y = Application.GetRealHeight(138) - ControlCommonResourse.BottomLineHeight - halfRoundHeigth; - btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine; - detailBackFrame.AddChidren(btnLine); + //娣诲姞涓�涓櫧鑹茬殑闂磋窛 + var frameSpace = new FrameLayout(); + frameSpace.Height = Application.GetRealHeight(63); + listDetailView1?.AddChidren(frameSpace); + listDetailView2?.AddChidren(frameSpace); - //鍒楄〃鎺т欢 - var listView = new FrameListControl(12); - listView.Height = detailHeight + bottomHeight; - listView.Y = topHeight - halfRoundHeigth; - detailBackFrame.AddChidren(listView); + //鏄庣粏鍒楄〃鎺т欢 + int rowSpace = listDetailView1 != null ? listDetailView1.rowSpace : listDetailView2.rowSpace; for (int i = 0; i < i_listText.Count; i++) { - var btnRow = new NormalSelectControl(i_listText[i], listView.rowSpace / 2); + NormalSelectControl btnRow = null; + if (i_listBottomtext == null || i_listBottomtext[i] == null) + { + //鍙樉绀轰竴琛� + btnRow = new NormalSelectControl(i_listText[i], rowSpace / 2); + } + else + { + //鏄剧ず涓婁笅涓よ + btnRow = new NormalSelectControl(i_listText[i], i_listBottomtext[i], rowSpace / 2); + } btnRow.LeftOffset = Application.GetRealWidth(81) - ControlCommonResourse.XXLeft;//鍚戝彸鍋忕Щ btnRow.RightOffset = ControlCommonResourse.XXLeft - Application.GetRealWidth(81);//鍚戝乏鍋忕Щ - listView.AddChidren(btnRow); + listDetailView1?.AddChidren(btnRow); + listDetailView2?.AddChidren(btnRow); + btnRow.InitControl(); btnRow.MainKeys = i.ToString(); btnRow.ButtonClickEvent += (sender, e) => @@ -178,6 +203,14 @@ btnRow.AddBottomLine(); } } + + //濡傛灉鏄粦鍔ㄦ帶浠�,鍒欐坊鍔犲簳閮ㄩ棿璺� + if (listDetailView2 != null) + { + var frameSpace2 = new FrameLayout(); + frameSpace2.Height = Application.GetRealHeight(58); + listDetailView2?.AddChidren(frameSpace2); + } } #endregion diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAlarmsLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAlarmsLogic.cs index b892c60..5eeab9e 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAlarmsLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAlarmsLogic.cs @@ -58,34 +58,27 @@ this.listDoorLockAlarmInfo.Clear(); string fileName = DateTime.Now.ToString("yyyyMMdd"); - //鍒ゆ柇鏈夋病鏈夎繖涓枃浠� - string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardAlarmDirectory, fileName); - if (System.IO.File.Exists(fullName) == true) + //瀹夐槻鎶ヨ + string fullName = System.IO.Path.Combine(DirNameResourse.SafeguardAlarmDirectory, fileName); + var data1 = HdlFileLogic.Current.ReadFileByteContent(fullName); + if (data1 != null) { - lock (listSafetyAlarmInfo) + this.listSafetyAlarmInfo = JsonConvert.DeserializeObject<List<SafeguardAlarmInfo>>(System.Text.Encoding.UTF8.GetString(data1)); + if (this.listSafetyAlarmInfo == null) { - string dir = System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardAlarmDirectory); - var data = Global.ReadFileByDirectory(dir, fileName); - this.listSafetyAlarmInfo = JsonConvert.DeserializeObject<List<SafeguardAlarmInfo>>(System.Text.Encoding.UTF8.GetString(data)); - if (this.listSafetyAlarmInfo == null) - { - this.listSafetyAlarmInfo = new List<SafeguardAlarmInfo>(); - } + this.listSafetyAlarmInfo = new List<SafeguardAlarmInfo>(); } } + //闂ㄩ攣璁板綍 - fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DoorLockAlarmDirectory, fileName); - if (System.IO.File.Exists(fullName) == true) + fullName = System.IO.Path.Combine(DirNameResourse.DoorLockAlarmDirectory, fileName); + var data2 = HdlFileLogic.Current.ReadFileByteContent(fullName); + if (data2 != null) { - lock (listDoorLockAlarmInfo) + this.listDoorLockAlarmInfo = JsonConvert.DeserializeObject<List<DeviceAlarmInfo>>(System.Text.Encoding.UTF8.GetString(data2)); + if (this.listDoorLockAlarmInfo == null) { - string dir = System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DoorLockAlarmDirectory); - var data = Global.ReadFileByDirectory(dir, fileName); - this.listDoorLockAlarmInfo = JsonConvert.DeserializeObject<List<DeviceAlarmInfo>>(System.Text.Encoding.UTF8.GetString(data)); - if (this.listDoorLockAlarmInfo == null) - { - this.listDoorLockAlarmInfo = new List<DeviceAlarmInfo>(); - } + this.listDoorLockAlarmInfo = new List<DeviceAlarmInfo>(); } } } @@ -141,10 +134,8 @@ } //淇濆瓨鍒版湰鍦� - var saveData = JsonConvert.SerializeObject(this.listSafetyAlarmInfo); - var byteData = System.Text.Encoding.UTF8.GetBytes(saveData); - string dir = System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardAlarmDirectory); - Global.WriteFileToDirectoryByBytes(dir, fileName, byteData); + string fullName = System.IO.Path.Combine(DirNameResourse.SafeguardAlarmDirectory, fileName); + HdlFileLogic.Current.SaveFileContent(fullName, this.listSafetyAlarmInfo); if (UserCenterResourse.DicActionForm.ContainsKey("SafetyManagementMainForm") == true) { @@ -217,10 +208,8 @@ } //淇濆瓨鍒版湰鍦� - var saveData = JsonConvert.SerializeObject(this.listSafetyAlarmInfo); - var byteData = System.Text.Encoding.UTF8.GetBytes(saveData); - string dir = System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardAlarmDirectory); - Global.WriteFileToDirectoryByBytes(dir, fileName, byteData); + string fullName = System.IO.Path.Combine(DirNameResourse.SafeguardAlarmDirectory, fileName); + HdlFileLogic.Current.SaveFileContent(fullName, this.listSafetyAlarmInfo); } } @@ -248,16 +237,15 @@ { lock (listSafetyAlarmInfo) { - string fullPath = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardAlarmDirectory); - //鍊熺敤涓�涓嬭嚜鍔ㄥ浠借幏鍙栨寚瀹氱洰褰曚笅闈㈢殑鏂囦欢鐨勫嚱鏁� - List<string> listFile = HdlAutoBackupLogic.GetFileFromDirectory(fullPath); + string fullPath = DirNameResourse.SafeguardAlarmDirectory; + //鑾峰彇鎸囧畾鐩綍涓嬮潰鐨勬枃浠� + List<string> listFile = HdlFileLogic.Current.GetFileFromDirectory(fullPath); //鍗囧簭 listFile.Sort(); var dic = new Dictionary<string, List<SafeguardAlarmInfo>>(); - string dir = System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardAlarmDirectory); for (int i = listFile.Count - 1; i >= 0; i--) { - var data = Global.ReadFileByDirectory(dir, listFile[i]); + var data = HdlFileLogic.Current.ReadFileByteContent(System.IO.Path.Combine(fullPath, listFile[i])); var info = JsonConvert.DeserializeObject<List<SafeguardAlarmInfo>>(System.Text.Encoding.UTF8.GetString(data)); if (info == null) { @@ -479,10 +467,9 @@ } //淇濆瓨鍒版湰鍦� - var saveData = JsonConvert.SerializeObject(this.listDoorLockAlarmInfo); - var byteData = System.Text.Encoding.UTF8.GetBytes(saveData); - string dir = System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DoorLockAlarmDirectory); - Global.WriteFileToDirectoryByBytes(dir, fileName, byteData); + string fullName = System.IO.Path.Combine(DirNameResourse.DoorLockAlarmDirectory, fileName); + HdlFileLogic.Current.SaveFileContent(fullName, this.listDoorLockAlarmInfo); + return true; } } @@ -495,16 +482,15 @@ { lock (listDoorLockAlarmInfo) { - string fullPath = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DoorLockAlarmDirectory); - //鍊熺敤涓�涓嬭嚜鍔ㄥ浠借幏鍙栨寚瀹氱洰褰曚笅闈㈢殑鏂囦欢鐨勫嚱鏁� - List<string> listFile = HdlAutoBackupLogic.GetFileFromDirectory(fullPath); + string fullPath = DirNameResourse.DoorLockAlarmDirectory; + //鑾峰彇鎸囧畾鐩綍涓嬮潰鐨勬枃浠� + List<string> listFile = HdlFileLogic.Current.GetFileFromDirectory(fullPath); //鍗囧簭 listFile.Sort(); var dic = new Dictionary<string, List<DeviceAlarmInfo>>(); - string dir = System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DoorLockAlarmDirectory); for (int i = listFile.Count - 1; i >= 0; i--) { - var data = Global.ReadFileByDirectory(dir, listFile[i]); + var data = HdlFileLogic.Current.ReadFileByteContent(System.IO.Path.Combine(fullPath, listFile[i])); var info = JsonConvert.DeserializeObject<List<DeviceAlarmInfo>>(System.Text.Encoding.UTF8.GetString(data)); if (info == null) { diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs index 9215637..797741b 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs @@ -36,15 +36,15 @@ //鍒犻櫎鍏ㄩ儴鐨勮嚜鍔ㄥ浠界殑鏈湴鏂囦欢 DeleteAllAutoBackupFile(); //濡傛灉娌℃湁鑷姩澶囦唤鏁版嵁,鍒欐妸鏈湴鍏ㄩ儴涓滆タ涓婁紶 - var pathTemp = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupDirectory); + var pathTemp = DirNameResourse.AutoBackupDirectory; //澶嶅埗鏈湴鎵�鏈夋枃浠惰繃鍘� List<string> listAllFile = Global.FileListByHomeId(); foreach (string fileName in listAllFile) { - string oldFile = UserCenterLogic.CombinePath(fileName); + string oldFile = System.IO.Path.Combine(Config.Instance.FullPath, fileName); string newFile = System.IO.Path.Combine(pathTemp, fileName); //澶嶅埗鏂囦欢 - System.IO.File.Copy(oldFile, newFile, true); + HdlFileLogic.Current.CopyFile(oldFile, newFile); } } @@ -91,13 +91,13 @@ private static bool UpLoadBackupFileToDB(List<string> listFile) { int listFileCount = listFile.Count; - string backUpDir = System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupDirectory); + string backUpDir = DirNameResourse.AutoBackupDirectory; for (int i = 0; i < listFile.Count; i++) { string file = listFile[i]; var datainfo = new FileInfoData(); datainfo.BackupFileName = file; - datainfo.BackupFileContent = ReadDirctoryFileByName(backUpDir, file); + datainfo.BackupFileContent = HdlFileLogic.Current.ReadFileByteContent(System.IO.Path.Combine(backUpDir, file)); if (datainfo.BackupFileContent == null) { continue; @@ -153,12 +153,11 @@ } //鍒犻櫎鏂囦欢 - string strroot = Common.Config.Instance.FullPath; - var backPath = System.IO.Path.Combine(strroot, DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupdeleteDirectory); + var backPath = DirNameResourse.AutoBackupdeleteDirectory; foreach (var file in listData) { string fullName = System.IO.Path.Combine(backPath, file); - System.IO.File.Delete(fullName); + HdlFileLogic.Current.DeleteFile(fullName); } return true; } @@ -185,12 +184,11 @@ } //鍒犻櫎鏂囦欢 - string strroot = Common.Config.Instance.FullPath; - var backPath = System.IO.Path.Combine(strroot, DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupDirectory); + var backPath = DirNameResourse.AutoBackupDirectory; foreach (var file in listData) { string fullName = System.IO.Path.Combine(backPath, file.BackupFileName); - System.IO.File.Delete(fullName); + HdlFileLogic.Current.DeleteFile(fullName); } return true; @@ -200,31 +198,13 @@ #region 鈻� 鑾峰彇鏂囦欢___________________________ - /// <summary> - /// 鑾峰彇鎸囧畾鏂囦欢澶逛笅闈㈢殑鏂囦欢鍐呭 - /// </summary> - /// <param name="dirctory">鎸囧畾鏂囦欢澶圭殑鍚嶅瓧(涓嶆槸鍏ㄨ矾寰�)</param> - /// <param name="fileName">File name.</param> - private static byte[] ReadDirctoryFileByName(string dirctory, string fileName) - { - var path = UserCenterLogic.CombinePath(dirctory, fileName); - if (System.IO.File.Exists(path) == false) - { - return null; - } - return Shared.IO.FileUtils.ReadFile(path); - } - /// <summary> /// 鑾峰彇鑷姩澶囦唤鐩綍涓嬬殑娣诲姞鎴栬�呯紪杈戠殑鏂囦欢 /// </summary> /// <returns></returns> public static List<string> GetAutoBackupEditorFile() { - string strroot = Common.Config.Instance.FullPath; - var path = System.IO.Path.Combine(strroot, DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupDirectory); - - return GetFileFromDirectory(path); + return HdlFileLogic.Current.GetFileFromDirectory(DirNameResourse.AutoBackupDirectory); } /// <summary> @@ -233,32 +213,7 @@ /// <returns></returns> public static List<string> GetAutoBackupDeleteFile() { - string strroot = Common.Config.Instance.FullPath; - var path = System.IO.Path.Combine(strroot, DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupdeleteDirectory); - - return GetFileFromDirectory(path); - } - - /// <summary> - /// 鑾峰彇鎸囧畾鏂囦欢澶归噷闈㈢殑鍏ㄩ儴鏂囦欢 - /// </summary> - /// <param name="directory">鏂囦欢璺緞锛堝叏鍚嶏級</param> - /// <returns></returns> - public static List<string> GetFileFromDirectory(string directory) - { - if (System.IO.Directory.Exists(directory) == false) - { - return new List<string>(); - } - - List<string> list = new List<string>(); - var files = System.IO.Directory.GetFiles(directory); - foreach (var file in files) - { - var f = file.Substring(directory.Length + 1); - list.Add(f); - } - return list; + return HdlFileLogic.Current.GetFileFromDirectory(DirNameResourse.AutoBackupdeleteDirectory); } #endregion @@ -271,35 +226,26 @@ /// <param name="fileName">鏂囦欢鐨勫悕瀛�,涓嶅惈璺緞</param> public static void AddOrEditorFile(string fileName) { - //鏍圭洰褰� - string strroot = Common.Config.Instance.FullPath; - if (strroot == string.Empty) - { - return; - } + fileName = System.IO.Path.GetFileName(fileName); //鑷姩澶囦唤鐩綍 - string strBackPath = System.IO.Path.Combine(strroot, DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupDirectory); - - - //鑷姩鍒犻櫎澶囦唤鐩綍 - string strdelBackPath = System.IO.Path.Combine(strroot, DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupdeleteDirectory); - //濡傛灉鍒犻櫎鍒楄〃閲岄潰鏈夎繖涓笢瑗跨殑璇濓紝绉婚櫎鎺� - string delFile = System.IO.Path.Combine(strdelBackPath, fileName); - if (System.IO.File.Exists(delFile) == true) - { - System.IO.File.Delete(delFile); - } - - string soureFile = System.IO.Path.Combine(strroot, fileName); - string newFile = System.IO.Path.Combine(strBackPath, fileName); + string strBackPath = DirNameResourse.AutoBackupDirectory; if (System.IO.Directory.Exists(strBackPath) == false) { //棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶� - UserCenterLogic.CreatAllUserCenterDirectory(); + HdlFileLogic.Current.CreatAllUserCenterDirectory(); } + //鑷姩鍒犻櫎澶囦唤鐩綍 + string strdelBackPath = DirNameResourse.AutoBackupdeleteDirectory; + //濡傛灉鍒犻櫎鍒楄〃閲岄潰鏈夎繖涓笢瑗跨殑璇濓紝绉婚櫎鎺� + string delFile = System.IO.Path.Combine(strdelBackPath, fileName); + HdlFileLogic.Current.DeleteFile(delFile); + + string soureFile = System.IO.Path.Combine(Common.Config.Instance.FullPath, fileName); + string newFile = System.IO.Path.Combine(strBackPath, fileName); + //鍘熷師鏈湰鐨勫鍒舵枃浠跺埌鎸囧畾鏂囦欢澶� - CopyFile(soureFile, newFile); + HdlFileLogic.Current.CopyFile(soureFile, newFile); } /// <summary> @@ -308,15 +254,9 @@ /// <param name="fileName">鏂囦欢鐨勫悕瀛�,涓嶅惈璺緞</param> public static void DeleteFile(string fileName) { - //鏍圭洰褰� - string strroot = Common.Config.Instance.FullPath; - if (strroot == string.Empty) - { - return; - } + fileName = System.IO.Path.GetFileName(fileName); //鑷姩鍒犻櫎澶囦唤鐩綍 - string strBackPath = System.IO.Path.Combine(strroot, DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupdeleteDirectory); - + string strBackPath = DirNameResourse.AutoBackupdeleteDirectory; string newFile = System.IO.Path.Combine(strBackPath, fileName); //鍒涘缓涓�涓┖鏂囦欢 @@ -324,13 +264,11 @@ file.Close(); //鑷姩澶囦唤鐩綍 - strBackPath = System.IO.Path.Combine(strroot, DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupDirectory); + strBackPath = DirNameResourse.AutoBackupDirectory; //濡傛灉澶囦唤鍒楄〃閲岄潰鏈夎繖涓笢瑗跨殑璇濓紝绉婚櫎鎺� string delFile = System.IO.Path.Combine(strBackPath, fileName); - if (System.IO.File.Exists(delFile) == true) - { - System.IO.File.Delete(delFile); - } + + HdlFileLogic.Current.DeleteFile(delFile); } #endregion @@ -344,7 +282,7 @@ public static int SynchronizeDbAutoBackupData() { //鍒ゆ柇鏄惁鑳藉鍚屾鏁版嵁 - string checkFile = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoDownLoadBackupCheckFile); + string checkFile = DirNameResourse.AutoDownLoadBackupCheckFile; //濡傛灉鏈湴宸茬粡鎷ユ湁浜嗚繖涓枃浠讹紝鍒欒鏄庝笉鏄柊鎵嬫満锛屼笉鍐嶈嚜鍔ㄨ繕鍘� if (System.IO.File.Exists(checkFile) == true) { @@ -396,10 +334,10 @@ return -1; } //濡傛灉璇诲彇鍒扮殑鏂囦欢瀹屽叏娌℃湁闂锛屽垯娓呯悊鏈湴鐨勬枃浠� - UserCenterLogic.DeleteAllLocationFile(false); + HdlFileLogic.Current.DeleteAllLocationFile(false); //娌℃湁閿欒鐨勮瘽锛屽垯绉诲姩鍒板綋鍓嶄綇瀹呮枃浠跺す涓嬮潰 - Global.MoveDirectoryFileToHomeDirectory(tempDir, true); + HdlFileLogic.Current.MoveDirectoryFileToHomeDirectory(tempDir, true); //鍒涘缓涓�涓┖鏂囦欢(鏍囪瘑宸茬粡瀹屾垚鍚屾) var file2 = System.IO.File.Create(checkFile); @@ -416,37 +354,19 @@ #region 鈻� 涓�鑸柟娉昣__________________________ /// <summary> - /// 澶嶅埗鏂囦欢 - /// </summary> - /// <param name="sourseFile">鎸囧畾鏂囦欢锛堝叏鍚嶏級</param> - /// <param name="newFile">鏂版枃浠讹紙鍏ㄥ悕锛�</param> - private static void CopyFile(string sourseFile, string newFile) - { - try - { - if (System.IO.File.Exists(sourseFile) == false) - { - return; - } - System.IO.File.Copy(sourseFile, newFile, true); - } - catch { } - } - - /// <summary> /// 鍒犻櫎鍏ㄩ儴鐨勮嚜鍔ㄥ浠界殑鏈湴鏂囦欢(姝ゅ嚱鏁扮敤浜庤鍙栬嚜鍔ㄥ浠界殑鏃跺�欎娇鐢�) /// </summary> public static void DeleteAllAutoBackupFile() { //娓呯┖鑷姩澶囦唤銆愭枃浠跺す銆�(缂栬緫,杩藉姞) - string dirPath = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupDirectory); - System.IO.Directory.Delete(dirPath, true); - System.IO.Directory.CreateDirectory(dirPath); + string dirPath = DirNameResourse.AutoBackupDirectory; + HdlFileLogic.Current.DeleteDirectory(dirPath); + HdlFileLogic.Current.CreateDirectory(dirPath, true); //娓呯┖鑷姩澶囦唤銆愭枃浠跺す銆�(鍒犻櫎) - dirPath = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupdeleteDirectory); - System.IO.Directory.Delete(dirPath, true); - System.IO.Directory.CreateDirectory(dirPath); + dirPath = DirNameResourse.AutoBackupdeleteDirectory; + HdlFileLogic.Current.DeleteDirectory(dirPath); + HdlFileLogic.Current.CreateDirectory(dirPath, true); } #endregion @@ -461,11 +381,11 @@ public static void SaveBackupNotPrompted(bool notPrompted, int day = -1) { //鏂囦欢鍏ㄨ矾寰� - string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupNotPromptedFile); + string fullName = DirNameResourse.AutoBackupNotPromptedFile; BackupNotPrompted info = null; if (System.IO.File.Exists(fullName) == true) { - var data = Global.ReadFileByDirectory(DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupNotPromptedFile); + var data = HdlFileLogic.Current.ReadFileByteContent(fullName); info = JsonConvert.DeserializeObject<BackupNotPrompted>(System.Text.Encoding.UTF8.GetString(data)); } if (info == null) @@ -480,9 +400,7 @@ info.Day = day; } //淇濆瓨 - var saveData = JsonConvert.SerializeObject(info); - var byteData = System.Text.Encoding.UTF8.GetBytes(saveData); - Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupNotPromptedFile, byteData); + HdlFileLogic.Current.SaveFileContent(fullName, info); } /// <summary> @@ -495,10 +413,8 @@ //鏆備笉鏀寔鎴愬憳 return; } - string strroot = Common.Config.Instance.FullPath; - var path = System.IO.Path.Combine(strroot, DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupDirectory); - List<string> listFile1 = GetFileFromDirectory(path); + List<string> listFile1 = HdlFileLogic.Current.GetFileFromDirectory(DirNameResourse.AutoBackupDirectory); List<string> listFile2 = GetAutoBackupDeleteFile(); if (listFile1.Count == 0 && listFile2.Count == 0) @@ -512,7 +428,7 @@ } //鏂囦欢鍏ㄨ矾寰� - string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupNotPromptedFile); + string fullName = DirNameResourse.AutoBackupNotPromptedFile; if (System.IO.File.Exists(fullName) == false) { HdlThreadLogic.Current.RunMain(() => @@ -523,7 +439,7 @@ return; } BackupNotPrompted info = null; - var data = Global.ReadFileByDirectory(DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupNotPromptedFile); + var data = HdlFileLogic.Current.ReadFileByteContent(fullName); info = JsonConvert.DeserializeObject<BackupNotPrompted>(System.Text.Encoding.UTF8.GetString(data)); if (info.NotPrompted == true) { diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlBackupLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlBackupLogic.cs index b966e9a..5dc54a3 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlBackupLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlBackupLogic.cs @@ -96,8 +96,8 @@ UserCenterResourse.AccountOption.AppCanSignout = false; //棣栧厛鍏堝垱寤轰竴涓复鏃舵枃浠跺す,瀛樺湪鏂囦欢鍒欐竻绌� - string newDir = System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadBackupTempDirectory); - Global.CreateEmptyDirectory(newDir, true); + string newDir = DirNameResourse.DownLoadBackupTempDirectory; + HdlFileLogic.Current.CreateDirectory(newDir, true); //鑾峰彇杩欎釜澶囦唤涓嬮潰鏈夊灏戜釜鏂囦欢 List<string> listFile = GetBackFileIDFromDB(BackupClassId, IsGatewayAutoBackup, ZigbeeUniqueId); @@ -147,7 +147,7 @@ return null; } //灏嗚緭鍏ュ啓鍏ユ湰鍦扮殑涓存椂鏂囦欢澶� - Global.WriteFileToDirectoryByBytes(newDir, fileName, result); + HdlFileLogic.Current.SaveTextToFile(System.IO.Path.Combine(newDir, fileName), System.Text.Encoding.UTF8.GetString(result)); //璁剧疆杩涘害鍊� ProgressFormBar.Current.SetValue(i + 1, listFileCount); } @@ -246,11 +246,11 @@ { //鑾峰彇鏈湴鏂囦欢 listAllFile = Global.FileListByHomeId(); - fullDir = UserCenterLogic.CombinePath(); + fullDir = Common.Config.Instance.FullPath; } else { - listAllFile = HdlAutoBackupLogic.GetFileFromDirectory(upPath); + listAllFile = HdlFileLogic.Current.GetFileFromDirectory(upPath); fullDir = upPath; } if (listAllFile.Count == 0) @@ -265,7 +265,8 @@ foreach (string fileName in listAllFile) { - if (fileName.EndsWith(".png") == true) + if (fileName.EndsWith(".png") == true + || fileName.EndsWith(".bin") == true) { //鍥剧墖鏂囦欢 listPicFile.Add(fileName); @@ -311,7 +312,7 @@ var datainfo = new FileInfoData(); datainfo.BackupFileName = file; string fullFileName = System.IO.Path.Combine(fullDir, file); - datainfo.BackupFileContent = Shared.IO.FileUtils.ReadFile(fullFileName); + datainfo.BackupFileContent = HdlFileLogic.Current.ReadFileByteContent(fullFileName); var list = new List<FileInfoData>(); list.Add(datainfo); @@ -529,8 +530,8 @@ /// <returns></returns> public bool UpLoadLogBackup() { - string upPath = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.LogDirectory); - if (HdlAutoBackupLogic.GetFileFromDirectory(upPath).Count == 0) + string upPath = DirNameResourse.LogDirectory; + if (HdlFileLogic.Current.GetFileFromDirectory(upPath).Count == 0) { //娌℃湁Log鏂囦欢 return true; @@ -572,7 +573,7 @@ { try { - var listAllFile = HdlAutoBackupLogic.GetFileFromDirectory(upPath); + var listAllFile = HdlFileLogic.Current.GetFileFromDirectory(upPath); if (listAllFile.Count > 10) { listAllFile.Sort(); @@ -594,6 +595,85 @@ }); return result; + } + + /// <summary> + /// 涓婁紶涓滆タ鍒伴殣鍖垮姛鑳藉浠� + /// </summary> + /// <param name="fileName"></param> + /// <param name="byteData"></param> + /// <returns></returns> + public bool UpLoadByteDataToOptionBackup(string fileName, byte[] byteData) + { + ProgressFormBar.Current.Start(); + ProgressFormBar.Current.SetMsg("姝e湪涓婁紶鏂囦欢"); + + //浠庝簯绔幏鍙栨暟鎹� + var pageData = HdlBackupLogic.Current.GetBackupListNameFromDB(0, null, true); + if (pageData == null) + { + ProgressFormBar.Current.Close(); + HdlThreadLogic.Current.RunMain(() => + { + var contr = new ShowMsgControl(ShowMsgType.Tip, "鑾峰彇鍔熻兘澶囦唤澶辫触"); + contr.Show(); + }); + return false; + } + string backId = string.Empty; + for (int i = 0; i < pageData.Count; i++) + { + if (pageData[i].BackupName == DirNameResourse.OptionBackupName) + { + //鑾峰彇鍔熻兘澶囦唤鐨処D + backId = pageData[i].Id; + break; + } + } + if (backId == string.Empty) + { + //鍒涘缓鏂扮殑澶囦唤 + backId = this.CreatNewBackupNameToDB(DirNameResourse.OptionBackupName); + if (backId == null) + { + ProgressFormBar.Current.Close(); + HdlThreadLogic.Current.RunMain(() => + { + var contr = new ShowMsgControl(ShowMsgType.Tip, "鍒涘缓鍔熻兘澶囦唤澶辫触"); + contr.Show(); + }); + return false; + } + } + //涓婁紶Log鏂囦欢 + var datainfo = new FileInfoData(); + datainfo.BackupFileName = fileName; + datainfo.BackupFileContent = byteData; + + var list = new List<FileInfoData>(); + list.Add(datainfo); + + //鎵ц涓婁紶 + bool falge = DoUpLoadInfoToDB(backId, list, 0); + //鍏抽棴杩涘害鏉� + ProgressFormBar.Current.Close(); + + if (falge == false) + { + HdlThreadLogic.Current.RunMain(() => + { + var contr = new ShowMsgControl(ShowMsgType.Tip, "鏂囦欢涓婁紶鎴愬姛"); + contr.Show(); + }); + return false; + } + HdlThreadLogic.Current.RunMain(() => + { + var contr = new ShowMsgControl(ShowMsgType.Tip, "鏂囦欢涓婁紶鎴愬姛"); + contr.Show(); + }); + + return true; } #endregion @@ -705,10 +785,10 @@ ProgressFormBar.Current.Close(); //濡傛灉璇诲彇鍒扮殑鏂囦欢瀹屽叏娌℃湁闂锛屽垯娓呯悊鏈湴鐨勬枃浠� - UserCenterLogic.DeleteAllLocationFile(false); + HdlFileLogic.Current.DeleteAllLocationFile(false); //娌℃湁閿欒鐨勮瘽锛屽垯绉诲姩鍒板綋鍓嶄綇瀹呮枃浠跺す涓嬮潰 - Global.MoveDirectoryFileToHomeDirectory(tempDirectory, true); + HdlFileLogic.Current.MoveDirectoryFileToHomeDirectory(tempDirectory, true); //鍒犻櫎鍏ㄩ儴鐨勮嚜鍔ㄥ浠界殑鏈湴鏂囦欢(姝ゅ嚱鏁扮敤浜庤鍙栬嚜鍔ㄥ浠界殑鏃跺�欎娇鐢�) HdlAutoBackupLogic.DeleteAllAutoBackupFile(); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlControlLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlControlLogic.cs index dff6a77..5a30994 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlControlLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlControlLogic.cs @@ -32,41 +32,6 @@ #endregion - #region 鈻� 瀛愭帶浠剁殑Y杞村潗鏍嘷___________________ - - /// <summary> - /// 鎸囧畾浣嶇疆绫诲瀷鑾峰彇Rowlayout鐨勫瓙鎺т欢鐨刌杞村潗鏍�(璇风‘淇濆瓙鎺т欢涓嶅ぇ浜庣埗瀹瑰櫒) - /// </summary> - /// <param name="fatherCtrHeight">鐖舵帶浠剁殑鐪熷疄楂樺害</param> - /// <param name="ctrHeight">瀛愭帶浠剁殑鐪熷疄楂樺害</param> - /// <param name="alignment">浣嶇疆瀵归綈鏂瑰紡</param> - /// <param name="Space">涓婁笅闂寸殑绌虹櫧闂磋窛,鐪佺暐鏃讹紝鍙栬鎺т欢鍏遍�氬彉閲忕殑鍊笺�傝缃负-1鏃讹紝涓嶈绠楃┖鐧介棿璺�</param> - /// <returns></returns> - public int GetControlChidrenYaxis(int fatherCtrHeight, int ctrHeight, UViewAlignment alignment, int Space = 0) - { - if (Space < 0) - { - //涓嶈绠楅棿璺濆�� - Space = 0; - } - - if (alignment == UViewAlignment.Center) - { - return fatherCtrHeight / 2 - ctrHeight / 2; - } - else if (alignment == UViewAlignment.Top) - { - return (fatherCtrHeight / 2 - Space / 2) / 2 - ctrHeight / 2; - } - else - { - int top = fatherCtrHeight / 2 + Space / 2; - return top + (fatherCtrHeight - top) / 2 - ctrHeight / 2; - } - } - - #endregion - #region 鈻� 璁$畻鍥剧墖鐪熷疄澶у皬___________________ /// <summary> @@ -80,5 +45,150 @@ } #endregion + + #region 鈻� 鏄剧ず搴曢儴寮圭獥鐨勬埧闂村垪琛╛____________ + + /// <summary> + /// 鏄剧ず搴曢儴寮圭獥鐨勬埧闂村垪琛�(褰撹繕娌℃湁鎴块棿鏃�,浼氳繑鍥瀎alse) + /// </summary> + /// <param name="RoomKey">榛樿閫夋嫨鐨勬埧闂翠富閿�</param> + /// <param name="titleText">鏍囬淇℃伅</param> + /// <param name="SelectRoomEvent">纭閫夋嫨鎴块棿鐨勫洖璋冨嚱鏁�(鎴块棿ID,鎴块棿鍚�(浼氭嫾涓婃ゼ灞�))</param> + public bool ShowBottomListRoomView(string RoomKey, string titleText, Action<string, string> SelectRoomEvent) + { + //妤煎眰鍒楄〃鍚嶅瓧 + var listFloorName = new List<string>(); + //妤煎眰鍒楄〃涓婚敭 + var listFloorKeys = new List<string>(); + //鎴块棿鍚嶅瓧 + var listRoomName = new List<List<string>>(); + //鎴块棿涓婚敭 + var listRoomKeys = new List<List<string>>(); + + //鍒濆鍖栨埧闂村垪琛ㄦ暟鎹� + bool result = this.InitRoomListData(ref listFloorName, ref listFloorKeys, ref listRoomName, ref listRoomKeys); + if (result == false) + { + return false; + } + + var room = HdlRoomLogic.Current.GetRoomById(RoomKey); + int index1 = room != null ? listFloorKeys.IndexOf(room.FloorId) : 0; + if (index1 == -1) { index1 = 0; } + int index2 = listRoomKeys[index1].IndexOf(RoomKey); + if (index2 == -1) { index2 = 0; } + + if (listFloorKeys.Count == 0) + { + //鏃犳ゼ灞傛ā寮� + PickerView.Show(listRoomName[0], (value) => + { + RoomKey = listRoomKeys[0][value]; + string roomName = string.Empty; + if (RoomKey != string.Empty) + { + //鎴块棿 + roomName = listRoomName[0][value]; + } + else + { + roomName = Language.StringByID(R.MyInternationalizationString.uDeviceNotAssignedRoom); + } + SelectRoomEvent?.Invoke(RoomKey, roomName); + + }, index2, titleText, + Language.StringByID(R.MyInternationalizationString.uFinish), + Language.StringByID(R.MyInternationalizationString.uCancel)); + } + else + { + //鏈夋ゼ灞傛ā寮� + PickerView.ShowSecondary(listFloorName, listRoomName, (value1, value2) => + { + RoomKey = listRoomKeys[value1][value2]; + string roomName = string.Empty; + if (RoomKey != string.Empty) + { + //妤煎眰+鎴块棿 + roomName = listFloorName[value1] + " " + listRoomName[value1][value2]; + } + else + { + roomName = Language.StringByID(R.MyInternationalizationString.uDeviceNotAssignedRoom); + } + SelectRoomEvent?.Invoke(RoomKey, roomName); + + }, index1, index2, titleText, + Language.StringByID(R.MyInternationalizationString.uFinish), + Language.StringByID(R.MyInternationalizationString.uCancel)); + } + return true; + } + + /// <summary> + /// 鍒濆鍖栨埧闂村垪琛ㄦ暟鎹� + /// </summary> + /// <param name="listFloorName">妤煎眰鍒楄〃鍚嶅瓧</param> + /// <param name="listFloorKeys">妤煎眰鍒楄〃涓婚敭</param> + /// <param name="listRoomName">鎴块棿鍚嶅瓧</param> + /// <param name="listRoomKeys">鎴块棿涓婚敭</param> + private bool InitRoomListData(ref List<string> listFloorName, ref List<string> listFloorKeys, ref List<List<string>> listRoomName, ref List<List<string>> listRoomKeys) + { + var dicFloor = HdlRoomLogic.Current.GetFloorSortList(); + if (dicFloor.Count == 0) + { + //绗竴浣嶉粯璁ゆ坊鍔犳湭鍒嗛厤 + var listKeys = new List<string>() { "" }; + var listName = new List<string>() { Language.StringByID(R.MyInternationalizationString.uUndistributed) }; + //鎴块棿鍚嶅瓧鍜屼富閿敹闆� + var listRoom = HdlRoomLogic.Current.GetFloorSortRoom(string.Empty, false); + foreach (var myRoom in listRoom) + { + listName.Add(myRoom.Name); + listKeys.Add(myRoom.Id); + } + listRoomName.Add(listName); + listRoomKeys.Add(listKeys); + } + else + { + //绗竴浣嶉粯璁ゆ坊鍔犳湭鍒嗛厤(鏈垎閰嶆斁鍦ㄦゼ灞傞偅涓彍鍗�) + var listKeys = new List<string>() { "" }; + var listName = new List<string>() { "" }; + listRoomName.Add(listName); + listRoomKeys.Add(listKeys); + listFloorKeys.Add(""); + listFloorName.Add(Language.StringByID(R.MyInternationalizationString.uUndistributed)); + + foreach (string fKeys in dicFloor.Keys) + { + var listRoom = HdlRoomLogic.Current.GetFloorSortRoom(fKeys, false); + if (listRoom.Count > 0) + { + //妤煎眰鍚嶅瓧鍜屼富閿敹闆� + listFloorKeys.Add(fKeys); + listFloorName.Add(dicFloor[fKeys]); + //鎴块棿鍚嶅瓧鍜屼富閿敹闆� + listName = new List<string>(); + listKeys = new List<string>(); + foreach (var myRoom in listRoom) + { + listName.Add(myRoom.Name); + listKeys.Add(myRoom.Id); + } + listRoomName.Add(listName); + listRoomKeys.Add(listKeys); + } + } + } + //娌℃湁寤虹珛鎴块棿 + if (listFloorKeys.Count == 0 && listRoomKeys.Count == 0) + { + return false; + } + return true; + } + + #endregion } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAirConditionerLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAirConditionerLogic.cs index 8ff084f..27d0ccd 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAirConditionerLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAirConditionerLogic.cs @@ -599,7 +599,7 @@ ///璇诲彇IRACC妯″潡鍥轰欢鐗堟湰 /// <para>reserve:0-ff</para> /// </summary> - public async void UpgradeAsync(CommonDevice device, SendUpgradeData upgradeData) + public void UpgradeAsync(CommonDevice device, SendUpgradeData upgradeData) { var Gateway = device.Gateway; if (Gateway == null) @@ -752,7 +752,7 @@ ///璇诲彇IRACC妯″潡鍥轰欢鐗堟湰 /// <para>status:0--鎴愬姛;1--澶辫触;ff--鏃犳晥 .</para> /// </summary> - public async void SendFinishAsync(CommonDevice device, int status) + public void SendFinishAsync(CommonDevice device, int status) { var Gateway = device.Gateway; if (Gateway == null) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs index 2ea4709..d1eddb8 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs @@ -810,16 +810,9 @@ /// </summary> /// <param name="panel">骞叉帴鐐瑰璞�</param> /// <returns></returns> - public async Task<List<CommonDevice.AttributeDataObj>> GetDryContactConfigureInfo(CommonDevice device) + public List<CommonDevice.AttributeDataObj> GetDryContactConfigureInfo(CommonDevice device) { - //鍊熺敤瀹冪殑鍑芥暟 - var panel = new Panel(); - panel.DeviceAddr = device.DeviceAddr; - panel.DeviceEpoint = device.DeviceEpoint; - panel.CurrentGateWayId = device.CurrentGateWayId; - - var result = HdlDeviceBindLogic.Current.ReadPanelConfigureInfoAsync(panel); - panel = null; + var result = HdlDeviceBindLogic.Current.ReadPanelConfigureInfoAsync(device); //鍏遍�氶敊璇娴� string error = HdlCheckLogic.Current.CheckCommonErrorCode(result); @@ -1256,10 +1249,7 @@ /// </summary> private void SaveDryContactFunctionToLocaltion() { - var file = Newtonsoft.Json.JsonConvert.SerializeObject(dicDryContactFunction); - - var bytes = System.Text.Encoding.UTF8.GetBytes(file); - Common.Global.WriteFileByBytesByHomeId(DirNameResourse.DryContactFunctionFile, bytes); + HdlFileLogic.Current.SaveFileContent(DirNameResourse.DryContactFunctionFile, dicDryContactFunction); } /// <summary> @@ -1267,12 +1257,13 @@ /// </summary> private void LoadDryContactFunctionFromLocaltion() { - if (Common.Global.IsExistsByHomeId(DirNameResourse.DryContactFunctionFile) == false) + this.dicDryContactFunction = new Dictionary<string, DryContactFunctionInfo>(); + + byte[] filebyte = HdlFileLogic.Current.ReadFileByteContent(DirNameResourse.DryContactFunctionFile); + if (filebyte == null) { return; } - - byte[] filebyte = Common.Global.ReadFileByHomeId(DirNameResourse.DryContactFunctionFile); string strvalue = System.Text.Encoding.UTF8.GetString(filebyte); this.dicDryContactFunction = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, DryContactFunctionInfo>>(strvalue); } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlExperienceAccountLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlExperienceAccountLogic.cs index 198b656..dcd359c 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlExperienceAccountLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlExperienceAccountLogic.cs @@ -109,7 +109,7 @@ Config.Instance.Home = HdlResidenceLogic.Current.GetHouseByHouseId(house.Id); //棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶� - UserCenterLogic.CreatAllUserCenterDirectory(); + HdlFileLogic.Current.CreatAllUserCenterDirectory(); } #endregion diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlFileLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlFileLogic.cs index d79b5e2..544d769 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlFileLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlFileLogic.cs @@ -32,6 +32,43 @@ } #endregion + #region 鈻� 棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶筥________ + + /// <summary> + /// 棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶� + /// </summary> + public void CreatAllUserCenterDirectory() + { + //鏈湴缂撳瓨鐨勬牴鐩綍 + this.CreateDirectory(DirNameResourse.LocalMemoryDirectory); + + //鑷姩澶囦唤銆愭枃浠跺す銆�(缂栬緫,杩藉姞) + this.CreateDirectory(DirNameResourse.AutoBackupDirectory); + + //鑷姩澶囦唤銆愭枃浠跺す銆�(鍒犻櫎) + this.CreateDirectory(DirNameResourse.AutoBackupdeleteDirectory); + + //涓嬭浇澶囦唤鐨勬椂鍊欐墍浣跨敤鐨勪复鏃躲�愭枃浠跺す銆� + this.CreateDirectory(DirNameResourse.DownLoadBackupTempDirectory); + + //淇濆瓨瀹夐槻璁板綍鐨勩�愭枃浠跺す銆� + this.CreateDirectory(DirNameResourse.SafeguardAlarmDirectory); + + //涓嬭浇鍒嗕韩鏂囦欢鐨勪复鏃躲�愭枃浠跺す銆� + this.CreateDirectory(DirNameResourse.DownLoadShardDirectory); + + //LOG鍑哄姏銆愭枃浠跺す銆� + this.CreateDirectory(DirNameResourse.LogDirectory); + + //鐢ㄦ埛鍥剧墖鐩綍璺緞銆愭枃浠跺す銆� + if (UserCenterResourse.AccountOption.UserPictruePath != string.Empty) + { + this.CreateDirectory(UserCenterResourse.AccountOption.UserPictruePath); + } + } + + #endregion + #region 鈻� 鏂囦欢淇濆瓨鍜岃鍙朹____________________ /// <summary> diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlFirmwareUpdateLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlFirmwareUpdateLogic.cs index 0bade2f..0f70087 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlFirmwareUpdateLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlFirmwareUpdateLogic.cs @@ -132,7 +132,8 @@ /// <returns></returns> private static int GetFirmwareVersionAndSetToMemmory(FirmwareLevelType levelType, GetFirmwareVersionPra pra) { - string resultValue = UserCenterLogic.GetResponseDataByRequestHttps("FirmwareMana/DetectionPlatformUploadFirmware", false, pra); + var listCheck = new List<string> { "NotCheck" }; + string resultValue = UserCenterLogic.GetResponseDataByRequestHttps("FirmwareMana/DetectionPlatformUploadFirmware", false, pra, listCheck); if (string.IsNullOrEmpty(resultValue) == true) { return -1; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs index e9a6550..275a2cc 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs @@ -82,7 +82,7 @@ GatewayResourse.AppOldSelectGatewayId = string.Empty; //浠庢枃浠朵腑鑾峰彇涓婁竴娆¢�夋嫨鐨勭綉鍏砳d - byte[] data = Global.ReadFileByDirectory(DirNameResourse.LocalMemoryDirectory, DirNameResourse.AppOldSelectGatewayFile); + byte[] data = HdlFileLogic.Current.ReadFileByteContent(DirNameResourse.AppOldSelectGatewayFile); if (data != null) { string strvalue = System.Text.Encoding.UTF8.GetString(data); @@ -118,7 +118,7 @@ } List<string> listBackupGwId = new List<string>(); - var fileData = Global.ReadFileByDirectory(DirNameResourse.LocalMemoryDirectory, DirNameResourse.BackupGatewayIdFile); + var fileData = HdlFileLogic.Current.ReadFileByteContent(DirNameResourse.BackupGatewayIdFile); if (fileData != null) { //鏂板锛氳櫧鐒舵鐜囦綆锛屼絾鏄‘瀹炲彂鐢熶簡銆傚鏋滄湁缃戠粶鏃讹紝App閲嶆柊缁戝畾璁板綍鐨勭綉鍏冲け璐ョ殑璇� @@ -149,26 +149,10 @@ //鍒犻櫎缃戝叧鏂囦欢 this.DeleteGatewayFile(gatewayId); } - //LOG杈撳嚭 - if (listDelete.Count > 0) + //濡傛灉缃戝叧閮芥病浜嗙殑璇�,鎶婂満鏅叏閮ㄥ垹浜� + if (listDelete.Count > 0 && this.GetAllLocalGateway().Count == 0) { - string msg = "鏈湴鎷ユ湁鐨勭綉鍏筹細"; - foreach (var gatewayId in this.dicGateway.Keys) - { - msg += gatewayId + ","; - } - msg += "\r\n琚垹闄ょ殑缃戝叧锛�"; - foreach (var gatewayId in listDelete) - { - msg += gatewayId + ","; - } - msg += "\r\n姝ゆ椂浜戠杩斿洖褰撳墠璐﹀彿鎵�缁戝畾鏈夌殑缃戝叧锛�"; - foreach (var gatewayId in result.Keys) - { - msg += gatewayId + ","; - } - var bytes = System.Text.Encoding.UTF8.GetBytes(msg); - Common.Global.WriteFileByBytesByHomeId("GatewayDeleteLog.txt", bytes); + HdlSceneLogic.Current.DeleteAllLocalScene(); } } @@ -407,7 +391,7 @@ //鑾峰彇鎺у埗涓讳汉璐﹀彿鐨凾oken bindGateway.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); - var result = UserCenterLogic.GetResultCodeByRequestHttps("App/BindGatewayToHome", true, bindGateway); + var result = UserCenterLogic.GetResultCodeByRequestHttps("App/BindGatewayToHome", true, bindGateway, new List<string> { "NotCheck" }); if (result == "Error") { return -1; @@ -576,42 +560,30 @@ /// </summary> /// <param name="zbGateway">缃戝叧瀵硅薄</param> /// <param name="gatewayName">缃戝叧鍚�</param> - public async Task<bool> ReName(ZbGateway zbGateway, string gatewayName) + public bool ReName(ZbGateway zbGateway, string gatewayName) { - ZbGateway realWay = null; - if (this.GetRealGateway(ref realWay, zbGateway) == false) + //鍙彇32涓猙yte + var bytes = new byte[32]; + var reamarkGwBytes = System.Text.Encoding.UTF8.GetBytes(gatewayName); + System.Array.Copy(reamarkGwBytes, 0, bytes, 0, 32 < reamarkGwBytes.Length ? 32 : reamarkGwBytes.Length); + gatewayName = System.Text.Encoding.UTF8.GetString(bytes); + + var jObject = new Newtonsoft.Json.Linq.JObject { { "Cluster_ID", 0 }, { "Command", 91 } }; + var data = new Newtonsoft.Json.Linq.JObject { { "GwName", gatewayName } }; + jObject.Add("Data", data); + var result = this.SendJobjectDataToGateway(zbGateway, "GwReName", jObject.ToString(), "GwReName_Respon"); + if (result.ErrorMsg != null) { - //鑾峰彇缃戝叧瀵硅薄澶辫触 - string msg = Language.StringByID(R.MyInternationalizationString.uGetGatewayTagartFail); - this.ShowErrorMsg(msg); + this.ShowTipMsg(result.ErrorMsg); return false; } - - var result = await realWay.GwReNameAsync(gatewayName); - //妫�娴嬬綉鍏宠繑鍥炵殑鍏遍�氶敊璇姸鎬佺爜 - string error = HdlCheckLogic.Current.CheckCommonErrorCode(result); - if (error != null) - { - this.ShowErrorMsg(error); - return false; - } - - if (result == null) + if (result.ErrorMsgDiv == 0) { //缃戝叧鍚嶇О淇敼澶辫触 string msg = Language.StringByID(R.MyInternationalizationString.uGatewayReNameFail); - - this.ShowErrorMsg(msg); - return false; - } - - //缃戝叧淇敼澶辫触 - if (result.gwReNameData == null) - { - //缃戝叧鍚嶇О淇敼澶辫触 - string msg = Language.StringByID(R.MyInternationalizationString.uGatewayReNameFail); - - this.ShowErrorMsg(msg); + //缃戝叧鍥炲瓒呮椂 + msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, null, "鍥炲瓒呮椂"); + this.ShowTipMsg(msg); return false; } @@ -721,8 +693,7 @@ public void SaveGatewayIdToLocation(string gatewayId) { GatewayResourse.AppOldSelectGatewayId = gatewayId; - byte[] data = System.Text.Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(GatewayResourse.AppOldSelectGatewayId)); - Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.AppOldSelectGatewayFile, data); + HdlFileLogic.Current.SaveFileContent(DirNameResourse.AppOldSelectGatewayFile, GatewayResourse.AppOldSelectGatewayId); } #endregion @@ -1334,9 +1305,8 @@ /// 鑾峰彇缃戝叧鍔犵壒鏁堢殑鍚嶇О /// </summary> /// <param name="zbGateway"></param> - /// <param name="mode"></param> /// <returns></returns> - public string GetGatewayName(ZbGateway zbGateway, GetNameMode mode = GetNameMode.SpecialGateway) + public string GetGatewayName(ZbGateway zbGateway) { string gwId = zbGateway.GwId; if (this.dicGateway.ContainsKey(gwId) == false) @@ -1351,14 +1321,11 @@ return name; } - if (mode == GetNameMode.SpecialGateway) + string keyName = Common.LocalDevice.deviceModelIdName + localWay.LinuxImageType; + if (LocalDevice.Current.dicDeviceAllNameID.ContainsKey(keyName) == true) { - string keyName = Common.LocalDevice.deviceModelIdName + localWay.LinuxImageType; - if (LocalDevice.Current.dicDeviceAllNameID.ContainsKey(keyName) == true) - { - //娌℃湁鍚嶇О鏃讹紝鍒欎娇鐢≧鏂囦欢閲岄潰璁剧疆鐨勯粯璁よ澶囧悕绉� - return Language.StringByID(LocalDevice.Current.dicDeviceAllNameID[keyName] + 20000); - } + //娌℃湁鍚嶇О鏃讹紝鍒欎娇鐢≧鏂囦欢閲岄潰璁剧疆鐨勯粯璁よ澶囧悕绉� + return Language.StringByID(LocalDevice.Current.dicDeviceAllNameID[keyName] + 20000); } return string.Empty; @@ -1538,11 +1505,11 @@ /// <summary> /// 鍙樻洿缃戝叧鎴块棿 /// </summary> - /// <param name="zbGateway">缃戝叧瀵硅薄</param> + /// <param name="gwId">缃戝叧Id</param> /// <param name="roomId">鎴块棿ID</param> - public void ChangedGatewayRoom(ZbGateway zbGateway, string roomId) + public void ChangedGatewayRoom(string gwId, string roomId) { - var localGateway = this.GetLocalGateway(zbGateway.GwId); + var localGateway = this.GetLocalGateway(gwId); if (localGateway != null) { localGateway.RoomId = roomId; @@ -2008,7 +1975,7 @@ //鑾峰彇鎺у埗涓讳汉璐﹀彿鐨凾oken Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); - List<string> listNotShowError = new List<string>() { "NoExist", "NoBind", "NoRecord" }; + List<string> listNotShowError = new List<string>() { "NoExist", "NoBind", "NoRecord", "NotCheck" }; bool result = UserCenterLogic.GetResultStatuByRequestHttps("App/ReleaseGatewayToHome", true, Pra, listNotShowError); if (result == false) @@ -2034,9 +2001,7 @@ listBackupGwId.Add(strId); //澶囦唤 - var strData = Newtonsoft.Json.JsonConvert.SerializeObject(listBackupGwId); - var byteData = System.Text.Encoding.UTF8.GetBytes(strData); - Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.BackupGatewayIdFile, byteData); + HdlFileLogic.Current.SaveFileContent(DirNameResourse.BackupGatewayIdFile, listBackupGwId); } } @@ -2047,7 +2012,7 @@ { HdlThreadLogic.Current.RunThread(() => { - var fileData = Global.ReadFileByDirectory(DirNameResourse.LocalMemoryDirectory, DirNameResourse.BackupGatewayIdFile); + var fileData = HdlFileLogic.Current.ReadFileByteContent(DirNameResourse.BackupGatewayIdFile); if (fileData == null) { return; @@ -2065,7 +2030,7 @@ { bindGateway.BindGateways.Clear(); bindGateway.BindGateways.Add(gwId); - var result = UserCenterLogic.GetResultCodeByRequestHttps("App/BindGatewayToHome", true, bindGateway); + var result = UserCenterLogic.GetResultCodeByRequestHttps("App/BindGatewayToHome", true, bindGateway, new List<string> { "NotCheck" }); if (result == "Success") { this.listBackupGwId.Remove(gwId); @@ -2079,7 +2044,7 @@ if (this.listBackupGwId.Count == 0) { //濡傛灉娌℃湁浜嗗唴瀹�,鍒欏垹闄ゆ枃浠� - string file = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.BackupGatewayIdFile); + string file = DirNameResourse.BackupGatewayIdFile; if (System.IO.File.Exists(file) == true) { System.IO.File.Delete(file); @@ -2088,9 +2053,7 @@ else { //澶囦唤 - var strData = Newtonsoft.Json.JsonConvert.SerializeObject(listBackupGwId); - var byteData = System.Text.Encoding.UTF8.GetBytes(strData); - Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.BackupGatewayIdFile, byteData); + HdlFileLogic.Current.SaveFileContent(DirNameResourse.BackupGatewayIdFile, listBackupGwId); } }); } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs index 3c3e6b6..21fed47 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs @@ -56,13 +56,13 @@ /// <summary> /// Log鍑哄姏 /// </summary> - /// <param name="div">1:鏅�歀og,-1:鑷村懡閿欒Log,2:鐗规畩Log</param> + /// <param name="div">1:鏅�歀og,-1:鑷村懡閿欒Log,2,3:鐗规畩Log</param> /// <param name="strLog">Log鍐呭</param> public void WriteLog(int div, string strLog) { lock (objLock) { - if (div != -1 && div != 2 && UserCenterResourse.HideOption.DetailedLog == 0) + if (div == 1 && UserCenterResourse.HideOption.DetailedLog == 0) { //鏆傛椂鍙褰曞紓甯镐俊鎭� return; @@ -72,15 +72,19 @@ try { string fullName = string.Empty; - if (div != 2) + if (div == 1 || div == -1) { string fileName = this.GetLogFile(div); - fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.LogDirectory, fileName); + fullName = System.IO.Path.Combine(DirNameResourse.LogDirectory, fileName); } - else + else if (div == 2) { fullName = DirNameResourse.SendAndReceveDataLog; } + else if (div == 3) + { + fullName = DirNameResourse.SocketReceiveDataLog; + } strLog = "\r\n[" + DateTime.Now.ToString("yyyyMMdd HH:mm:ss") + "] " + strLog + "\r\n"; sw = new System.IO.StreamWriter(fullName, true, Encoding.UTF8); sw.WriteLine(strLog); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlResidenceLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlResidenceLogic.cs index cc3c9ca..2e85454 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlResidenceLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlResidenceLogic.cs @@ -131,7 +131,7 @@ Pra.LoginAccessToken = Config.Instance.Token; //缂栬緫浣忓畢 - bool flage = UserCenterLogic.GetResultStatuByRequestHttps("App/EditHome", false, Pra); + bool flage = UserCenterLogic.GetResultStatuByRequestHttps("App/EditHome", false, Pra, new List<string> { "NotCheck" }); if (flage == true) { //鍒锋柊鍐呭瓨鐨勪綇瀹呭悕 @@ -176,7 +176,7 @@ public House GetHouseByHouseId(string houseId) { var path = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Config.Instance.Guid, houseId, $"House_{houseId}.json"); - var file = Shared.IO.FileUtils.ReadFile(path); + var file = HdlFileLogic.Current.ReadFileByteContent(path); if (file == null) { return null; @@ -192,7 +192,7 @@ public House GetHouseByFilePath(string filePath) { var path = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Config.Instance.Guid, GetHouseIdByFilePath(filePath), filePath); - var file = Shared.IO.FileUtils.ReadFile(path); + var file = HdlFileLogic.Current.ReadFileByteContent(path); if (file == null) { return null; @@ -350,7 +350,7 @@ if (arryHouse.Length > 0) { //璇诲彇鏂囦欢鍐呭 - var textValue = UserCenterLogic.LoadFileContent(System.IO.Path.Combine(nowPath, arryHouse[0])); + var textValue = HdlFileLogic.Current.ReadFileTextContent(System.IO.Path.Combine(nowPath, arryHouse[0])); if (textValue == null) { continue; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs index 75af7bc..a777b63 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs @@ -61,14 +61,18 @@ this.dicRooms.Clear(); //妫�娴嬫垜鐨勫枩鐖辫繖涓埧闂村璞� this.CheckLoveRoom(); - - foreach (var roomId in Config.Instance.Home.ListRooms) + + var listFile = Global.FileListByHomeId(); + foreach (var fileName in listFile) { - //浠庢枃浠堕噷闈㈣幏鍙栨埧闂村璞� - var room = this.GetRoomByFilePath($"Room_{roomId}.json"); - if (room != null) + if (fileName.StartsWith("Room_") == true) { - this.dicRooms[room.Id] = (room); + //浠庢枃浠堕噷闈㈣幏鍙栨埧闂村璞� + var room = this.GetRoomByFilePath(fileName); + if (room != null) + { + this.dicRooms[room.Id] = (room); + } } } //璁剧疆褰撳墠妤煎眰鐨処D @@ -84,9 +88,6 @@ /// </summary> public void RefreshAllRoomByLocation() { - var homeTemp = Config.Instance.Home; - homeTemp.ListRooms.Clear(); - var listFile = Global.FileListByHomeId(); //鎴戠殑鍠滅埍鐨勬埧闂村繀椤昏鍦ㄧ0浣嶆墠琛� @@ -94,7 +95,6 @@ if (listFile.Contains(fRoom) == true) { listFile.Remove(fRoom); - homeTemp.ListRooms.Add("Favorite"); } var listRoomFile = new List<string>(); @@ -103,7 +103,6 @@ if (fileName.StartsWith("Room_")) { string roomId = fileName.Replace("Room_", string.Empty).Replace(".json", string.Empty); - homeTemp.ListRooms.Add(roomId); listRoomFile.Add(fileName); } } @@ -117,8 +116,7 @@ this.CheckAdminFloorData(listRoomFile); } - homeTemp.Save(false); - InitAllRoom(); + this.InitAllRoom(); } /// <summary> @@ -128,7 +126,7 @@ { Application.RunOnMainThread(() => { - MainPage.ListRoomViewFrom.Instance?.RefreshListRoom(); + MainPage.LeftListRoomViewFrom.Instance?.RefreshListRoom(); }); } @@ -215,15 +213,12 @@ /// <param name="rorefreshRoomViewom">鏄惁鍒锋柊鎴块棿瑙嗗浘鍒楄〃鐣岄潰</param> public void AddRoom(Room room, bool refreshRoomView = true) { - if (Global.IsExistsByHomeId(room.FileName) == true - || Config.Instance.Home.ListRooms.Contains(room.Id) == true) + if (Global.IsExistsByHomeId(room.FileName) == true) { return; } //娣诲姞鍒扮紦瀛� this.dicRooms[room.Id] = room; - //鎶婃埧闂碔D娣诲姞鍒颁綇瀹� - Config.Instance.Home.AddRoomId(room.Id); //鐢熸垚鏂囦欢 room.Save(); //澶囦唤 @@ -243,8 +238,9 @@ /// 鍒犻櫎鎴块棿 /// </summary> /// <param name="roomId">鎴块棿ID</param> + /// <param name="refreshLeftView">鏄惁鍒锋柊宸︽粦鐣岄潰(姝ゅ彉閲忕洰鍓嶆槸缁欏垹闄ゅ叏閮ㄦ埧闂寸敤鐨�)</param> /// <returns></returns> - public void RemoveRoom(string roomId) + public void RemoveRoom(string roomId, bool refreshLeftView = true) { //鏍规嵁鎴块棿Id锛岃幏鍙栨埧闂村璞� var room = this.GetRoomById(roomId); @@ -279,8 +275,6 @@ } loveRoom.Save(false); } - - Config.Instance.Home.RemoveRoomId(roomId); this.dicRooms.Remove(roomId); string roomFilePath = room.FileName; @@ -293,9 +287,31 @@ //鏍规嵁鎴块棿ID,绉婚櫎鎸囧畾鐨勭湡瀹炵墿鐞嗚澶囩殑鎵�灞炴埧闂磋褰� Common.LocalDevice.Current.DeleteRealDeviceByRoomId(roomId); + if (refreshLeftView == true) + { + //HdlAutoBackupLogic.DeleteFile(roomFilePath); + //鍒锋柊鎴块棿瑙嗗浘鍒楄〃 + this.RefreshRoomListView(); + } + } - //鍒锋柊鎴块棿瑙嗗浘鍒楄〃 - this.RefreshRoomListView(); + /// <summary> + /// 鍒犻櫎鍏ㄩ儴鐨勬埧闂� + /// </summary> + public void DeleteAllRoom() + { + var listRoomId = new List<string>(); + foreach (var room in this.dicRooms.Values) + { + if (room.IsLove == false) + { + listRoomId.Add(room.Id); + } + } + foreach (var roomId in listRoomId) + { + this.RemoveRoom(roomId, false); + } } #endregion @@ -357,7 +373,7 @@ public string GetRoomNameByDevice(CommonDevice device) { var room = this.GetRoomByDevice(device); - return this.GetFloorRoomName(room); + return this.GetRoomName(room); } /// <summary> @@ -365,7 +381,7 @@ /// </summary> /// <returns>鎴块棿鍚�</returns> /// <param name="room">鎴块棿瀵硅薄</param> - public string GetFloorRoomName(Room room) + public string GetRoomName(Room room) { if (room == null) { @@ -480,7 +496,7 @@ { listRoom.Add(room); } - return listRoom; + return this.SortRoom(listRoom); } /// <summary> @@ -609,25 +625,6 @@ return true; } return false; - } - - /// <summary> - /// 鑾峰彇鎴块棿鎵�鍦ㄥ尯鍩� - /// 妤煎眰,鎴块棿鍚� - /// </summary> - /// <returns></returns> - public string GetZoneName(Room i_room) - { - if (string.IsNullOrEmpty(i_room.FloorId)) - { - return i_room.Name; - } - var floorName = HdlResidenceLogic.Current.GetFloorNameById(i_room.FloorId); - if (floorName == null) - { - return i_room.Name; - } - return $"{floorName}锛寋i_room.Name}"; } #endregion @@ -935,85 +932,87 @@ { i_floorKeys = string.Empty; } - Dictionary<string, List<string>> dicAllSort = new Dictionary<string, List<string>>(); - //璇诲彇鎴块棿椤哄簭 - string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.RoomSortFile); - var strData = UserCenterLogic.LoadFileContent(fullName); - if (strData != null) - { - dicAllSort = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, List<string>>>(strData); - } - - var listRoomSort = new List<string>(); - if (dicAllSort.ContainsKey(i_floorKeys) == true) - { - listRoomSort = dicAllSort[i_floorKeys]; - } - else - { - dicAllSort[i_floorKeys] = listRoomSort; - } - - var dicRoom = new Dictionary<string, Common.Room>(); + var listRoom = new List<Room>(); foreach (var room in this.dicRooms.Values) { - if (room.FloorId != i_floorKeys && i_floorKeys != string.Empty) + if (room.FloorId != i_floorKeys && i_floorKeys != string.Empty + || room.IsLove == true) { - //涓嶆槸鍚屼竴涓ゼ灞� + //涓嶆槸鍚屼竴涓ゼ灞�,涓嶈鎴戠殑鍠滅埍 continue; - } - if (room.IsLove == true) - { - //涓嶈鎴戠殑鍠滅埍 - continue; - } - if (listRoomSort.Contains(room.Id) == false) - { - //鏂版坊鍔犵殑鎴块棿 - listRoomSort.Add(room.Id); } if (getShard == false && room.IsSharedRoom == true) { //涓嶈鍒嗕韩鐨勬埧闂� continue; } - dicRoom[room.Id] = room; + listRoom.Add(room); } - - var listSortRoom = new List<Room>(); - for (int i = 0; i < listRoomSort.Count; i++) - { - if (dicRoom.ContainsKey(listRoomSort[i]) == true) - { - listSortRoom.Add(dicRoom[listRoomSort[i]]); - } - } - - //淇濆瓨椤哄簭 - UserCenterLogic.SaveFileContent(fullName, dicAllSort); - return listSortRoom; + return this.SortRoom(listRoom); } /// <summary> - /// 淇濆瓨鎴块棿鐨勯『搴� + /// 鎺掑簭鎴块棿瀵硅薄 /// </summary> - /// <param name="i_floorKeys">妤煎眰涓婚敭</param> - /// <param name="listSort">鎴块棿椤哄簭(鎴块棿鐨勪富閿�)</param> - public void SaveRoomSort(string i_floorKeys, List<string> listSort) + /// <param name="listRoom"></param> + /// <returns></returns> + public List<Room> SortRoom(List<Room> listRoom) { - Dictionary<string, List<string>> dicAllSort = new Dictionary<string, List<string>>(); - //璇诲彇鎴块棿椤哄簭 - string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.RoomSortFile); - var strData = UserCenterLogic.LoadFileContent(fullName); - if (strData != null) + //浠庝竴鍫嗘枃瀛椾腑,鑾峰彇杩欎竴鍫嗘枃瀛楅噷闈㈡暟瀛楀瓧绗︿覆鐨勬渶闀块暱搴� + var listName = new List<string>(); + foreach (var room in listRoom) { - dicAllSort = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, List<string>>>(strData); + listName.Add(room.Name); } + int numberLength = this.GetNumberMaxLength(listName); - //淇濆瓨椤哄簭 - dicAllSort[i_floorKeys] = listSort; - UserCenterLogic.SaveFileContent(fullName, dicAllSort); - dicAllSort.Clear(); + var listSort = new List<string[]>(); + foreach (var room in listRoom) + { + var strArry = new string[2]; + strArry[0] = room.Id; + strArry[1] = string.Empty; + + string value = string.Empty; + foreach (var c in room.Name) + { + if (char.IsNumber(c) == true) + { + //鏁板瓧 + value += c.ToString(); + continue; + } + else if (value != string.Empty) + { + //濡傛灉鎴块棿鍚嶅瓧甯︽湁鏁板瓧鐨勮瘽,鍒欏乏杈瑰姞闆�,鍥犱负杩欓噷鏈変釜鎺掑簭鐨勯棶棰� + strArry[1] += value.PadLeft(numberLength, '0'); + value = string.Empty; + } + strArry[1] += c.ToString(); + } + if (value != string.Empty) + { + //浠ユ暟瀛楃粨灏剧殑璇� + strArry[1] += value.PadLeft(numberLength, '0'); + } + listSort.Add(strArry); + } + //鎺掑簭 + listSort.Sort((obj1, obj2) => + { + if (obj1[1].CompareTo(obj2[1]) > 0) + { + return 1; + } + return -1; + }); + var listSortRoom = new List<Room>(); + foreach (var strArry in listSort) + { + var room = this.GetRoomById(strArry[0]); + listSortRoom.Add(room); + } + return listSortRoom; } /// <summary> @@ -1022,46 +1021,61 @@ /// <returns></returns> public Dictionary<string, string> GetFloorSortList() { - //璇诲彇妤煎眰椤哄簭 - var listFloorSort = new List<string>(); - string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.FloorSortFile); - var strData = UserCenterLogic.LoadFileContent(fullName); - if (strData != null) + //浠庝竴鍫嗘枃瀛椾腑,鑾峰彇杩欎竴鍫嗘枃瀛楅噷闈㈡暟瀛楀瓧绗︿覆鐨勬渶闀块暱搴� + var listName = new List<string>(); + foreach (var floorName in Config.Instance.Home.FloorDics.Values) { - listFloorSort = Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>>(strData); + listName.Add(floorName); } - foreach (string keys in Common.Config.Instance.Home.FloorDics.Keys) - { - if (listFloorSort.Contains(keys) == false) - { - //鏂版坊鍔犵殑妤煎眰 - listFloorSort.Add(keys); - } - } + int numberLength = this.GetNumberMaxLength(listName); + var listSort = new List<string[]>(); + foreach (var floorId in Config.Instance.Home.FloorDics.Keys) + { + var strArry = new string[2]; + strArry[0] = floorId; + strArry[1] = string.Empty; + + string value = string.Empty; + string floorName = Config.Instance.Home.FloorDics[floorId]; + foreach (var c in floorName) + { + if (char.IsNumber(c) == true) + { + //鏁板瓧 + value += c.ToString(); + continue; + } + else if (value != string.Empty) + { + //濡傛灉鎴块棿鍚嶅瓧甯︽湁鏁板瓧鐨勮瘽,鍒欏乏杈瑰姞闆�,鍥犱负杩欓噷鏈変釜鎺掑簭鐨勯棶棰� + strArry[1] += value.PadLeft(numberLength, '0'); + value = string.Empty; + } + strArry[1] += c.ToString(); + } + if (value != string.Empty) + { + //浠ユ暟瀛楃粨灏剧殑璇� + strArry[1] += value.PadLeft(numberLength, '0'); + } + listSort.Add(strArry); + } + //妤煎眰鎺掑簭 + listSort.Sort((obj1, obj2) => + { + if (obj1[1].CompareTo(obj2[1]) > 0) + { + return 1; + } + return -1; + }); var dic = new Dictionary<string, string>(); - for (int i = 0; i < listFloorSort.Count; i++) + foreach (var strArry in listSort) { - if (Config.Instance.Home.FloorDics.ContainsKey(listFloorSort[i]) == true) - { - dic[listFloorSort[i]] = Config.Instance.Home.FloorDics[listFloorSort[i]]; - } + dic[strArry[0]] = Config.Instance.Home.FloorDics[strArry[0]]; } - - //淇濆瓨椤哄簭 - UserCenterLogic.SaveFileContent(fullName, listFloorSort); return dic; - } - - /// <summary> - /// 淇濆瓨妤煎眰鐨勯『搴� - /// </summary> - /// <param name="listSort">妤煎眰鐨勪富閿�</param> - public void SaveFloorSort(List<string> listSort) - { - string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.FloorSortFile); - //淇濆瓨椤哄簭 - UserCenterLogic.SaveFileContent(fullName, listSort); } #endregion @@ -1094,24 +1108,78 @@ #region 鈻� 涓�鑸柟娉昣__________________________ /// <summary> + /// 鑾峰彇鎴块棿鎬绘暟 + /// </summary> + /// <returns></returns> + public int GetRoomCount() + { + return this.dicRooms.Count; + } + + /// <summary> /// 妫�娴嬫垜鐨勫枩鐖辫繖涓埧闂村璞� /// </summary> private void CheckLoveRoom() { - if (Config.Instance.Home.ListRooms.Contains("Favorite") == false) + if (this.dicRooms.ContainsKey("Favorite") == true) + { + return; + } + //璇诲彇鏈湴鎴戠殑鍠滅埍鏂囦欢 + string favoriteFile = System.IO.Path.Combine(Common.Config.Instance.FullPath, "Room_Favorite.json"); + var fileContent = HdlFileLogic.Current.ReadFileTextContent(favoriteFile); + if (fileContent != null) + { + var love = Newtonsoft.Json.JsonConvert.DeserializeObject<Room>(fileContent); + this.dicRooms["Favorite"] = love; + } + else { //榛樿娣诲姞鍠滅埍鐨勬埧闂�--绂佹淇敼鎴块棿鍚� var love = new Room { Name = Language.StringByID(R.MyInternationalizationString.Favorite), BackgroundImage = "RoomIcon/0.jpg", Id = "Favorite" }; love.Save(false); - //娣诲姞鍒癶ouse 鎴块棿璺緞鍒楄〃 - var currentHome = Config.Instance.Home; - currentHome.ListRooms.Insert(0, love.Id); - currentHome.Save(false); - this.dicRooms["Favorite"] = love; } } + /// <summary> + /// 浠庝竴鍫嗘枃瀛椾腑,鑾峰彇杩欎竴鍫嗘枃瀛楅噷闈㈡暟瀛楀瓧绗︿覆鐨勬渶闀块暱搴� + /// </summary> + /// <param name="listText"></param> + /// <returns></returns> + private int GetNumberMaxLength(List<string> listText) + { + int maxLength = 0; + foreach (var text in listText) + { + string value = string.Empty; + foreach (var c in text) + { + if (char.IsNumber(c) == true) + { + //鏁板瓧 + value += c.ToString(); + continue; + } + else if (value != string.Empty) + { + //鍒ゆ柇鏁板瓧闀垮害 + if (maxLength <= value.Length) + { + maxLength = value.Length; + } + value = string.Empty; + } + } + //鍒ゆ柇鏁板瓧闀垮害 + if (maxLength <= value.Length) + { + maxLength = value.Length; + } + } + return maxLength; + } + #endregion } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs index afe0b4c..32f3a09 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs @@ -1366,7 +1366,7 @@ if (this.UserPassword == null) { - var data = Global.ReadFileByDirectory(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardUserPassword); + var data = HdlFileLogic.Current.ReadFileByteContent(DirNameResourse.SafeguardUserPassword); if (data != null) { this.UserPassword = System.Text.Encoding.UTF8.GetString(data); @@ -1384,7 +1384,7 @@ if (result != GarrisonMode.None && result != GarrisonMode.RemoveGarrison) { //淇濆瓨鍔犲瘑鐨勫瘑鐮佸埌鏈湴 - Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardUserPassword, System.Text.Encoding.UTF8.GetBytes(this.UserPassword)); + HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SafeguardUserPassword, this.UserPassword); } return result; } @@ -1473,7 +1473,7 @@ if (result2 != GarrisonMode.None && result2 != GarrisonMode.RemoveGarrison) { //淇濆瓨鍔犲瘑瀵嗙爜鍒版湰鍦� - Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardUserPassword, System.Text.Encoding.UTF8.GetBytes(this.UserPassword)); + HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SafeguardUserPassword, this.UserPassword); } return result2; } @@ -1588,7 +1588,7 @@ if (result2 != -1) { //淇濆瓨鍒板姞瀵嗗瘑鐮佹湰鍦� - Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardUserPassword, System.Text.Encoding.UTF8.GetBytes(this.UserPassword)); + HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SafeguardUserPassword, this.UserPassword); } return result2; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs index b7c17d8..aaeab0e 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs @@ -166,6 +166,7 @@ //瓒呮椂鏃堕棿 int TimeOut = 0; bool receiptAll = false; + bool canReceve = false; var listScene = new List<Scene.GetSceneAllInfo>(); Action<string, string> action = (topic, message) => @@ -178,6 +179,8 @@ var sceneGetAllInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<Scene.GetSceneAllInfo>(jobject["Data"].ToString()); listScene.Add(sceneGetAllInfo); + //鏇村鎺ユ敹寰楀埌鍦烘櫙 + canReceve = true; if (sceneGetAllInfo.ScenesNum == sceneGetAllInfo.ScenesSum) { //鎺ユ敹瀹屾垚 @@ -200,7 +203,13 @@ } mainGateway.Actions -= action; action = null; - if (receiptAll == false) + if (canReceve == false) + { + //鑾峰彇鍦烘櫙鍒楄〃澶辫触,缃戝叧鍥炲瓒呮椂 + this.ShowTipMsg(Language.StringByID(R.MyInternationalizationString.uGetSceneListFailAndTimeOut)); + return null; + } + else if (receiptAll == false) { //缃戠粶涓嶇ǔ瀹氾紝鍦烘櫙鍒楄〃淇℃伅缂烘崯 this.ShowTipMsg(Language.StringByID(R.MyInternationalizationString.uNetworkUnStableAndSceneInfoIsNotFull)); @@ -610,6 +619,22 @@ } /// <summary> + /// 娓呯┖鏈湴鍏ㄩ儴鐨勫満鏅暟鎹� + /// </summary> + public void DeleteAllLocalScene() + { + var listScene = new List<SceneUI>(); + foreach (var scene in this.dicScenes.Values) + { + listScene.Add(scene); + } + foreach (var scene in listScene) + { + this.DeleteLocalScene(scene); + } + } + + /// <summary> /// 鍒犻櫎鍦烘櫙(杩欎釜鍙Щ闄ゅ唴瀛�) /// </summary> /// <param name="scene"></param> @@ -643,6 +668,20 @@ #region 鈻� 鑾峰彇鍦烘櫙___________________________ /// <summary> + /// 鑾峰彇鏈湴鍏ㄩ儴鐨勫満鏅�(鍖呭惈鏈垎閰�) + /// </summary> + /// <returns></returns> + public List<SceneUI> GetAllLocalScene() + { + //鎴块棿鐨勫満鏅斁鍦ㄥ墠闈� + var listScene = this.GetAllRoomSceneList(); + //鏈垎閰嶇殑鍦烘櫙 + var listUnalloctScene = this.GetUnalloctedScenes(); + listScene.AddRange(listUnalloctScene); + return listScene; + } + + /// <summary> /// 閫氳繃鍦烘櫙id鑾峰彇鍦烘櫙 /// </summary> /// <returns>The scene UIB y scene identifier.</returns> diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs index 4b0826e..3a55f87 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs @@ -62,7 +62,7 @@ List<string> listFile = new List<string>(); //鏂囦欢澶� - string strDir = System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory); + string strDir = DirNameResourse.DownLoadShardDirectory; //涓嶅厑璁告寜绯荤粺鐨勮繑鍥為敭 Shared.Common.CommonPage.BackKeyCanClick = false; @@ -84,7 +84,7 @@ //鏂囦欢鍚嶅瓧 listFile.Add(dataResult.ShareName); //淇濆瓨鍒版寚瀹氭枃浠跺す涓� - Global.WriteFileToDirectoryByBytes(strDir, dataResult.ShareName, dataResult.ShareDataBytes); + HdlFileLogic.Current.SaveTextToFile(System.IO.Path.Combine(strDir, dataResult.ShareName), System.Text.Encoding.UTF8.GetString(dataResult.ShareDataBytes)); //璁剧疆杩涘害鍊� ProgressFormBar.Current.SetValue(i + 1, listMarkCount); } @@ -103,13 +103,13 @@ /// <returns></returns> public byte[] GetShardFileContent(string fileName) { - string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory, fileName); + string fullName = System.IO.Path.Combine(DirNameResourse.DownLoadShardDirectory, fileName); if (System.IO.File.Exists(fullName) == false) { return null; } - string path = System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory); - var varByte = Global.ReadFileByDirectory(path, fileName); + string path = System.IO.Path.Combine(DirNameResourse.DownLoadShardDirectory, fileName); + var varByte = HdlFileLogic.Current.ReadFileByteContent(path); return varByte; } @@ -119,10 +119,7 @@ /// <returns></returns> public List<string> GetLocalAllShardFile() { - string path = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory); - var listFile = HdlAutoBackupLogic.GetFileFromDirectory(path); - - return listFile; + return HdlFileLogic.Current.GetFileFromDirectory(DirNameResourse.DownLoadShardDirectory); } /// <summary> @@ -132,7 +129,7 @@ /// <returns></returns> public bool IsFileExists(string fileName) { - string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory, fileName); + string fullName = System.IO.Path.Combine(DirNameResourse.DownLoadShardDirectory, fileName); if (System.IO.File.Exists(fullName) == false) { return false; @@ -154,9 +151,9 @@ { return; } - string oldName = UserCenterLogic.CombinePath(fileName); - string newName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory, fileName); - System.IO.File.Copy(oldName, newName, true); + string oldName = System.IO.Path.Combine(Config.Instance.FullPath, fileName); + string newName = System.IO.Path.Combine(DirNameResourse.DownLoadShardDirectory, fileName); + HdlFileLogic.Current.CopyFile(oldName, newName); } /// <summary> @@ -166,12 +163,9 @@ public void AddShardFile(Common.Room room) { room.IsSharedRoom = true; - var data = Newtonsoft.Json.JsonConvert.SerializeObject(room); - var byteData = System.Text.Encoding.UTF8.GetBytes(data); - - string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory, room.FileName); + string fullName = System.IO.Path.Combine(DirNameResourse.DownLoadShardDirectory, room.FileName); //鍐欏叆鍐呭 - Shared.IO.FileUtils.WriteFileByBytes(fullName, byteData); + HdlFileLogic.Current.SaveFileContent(fullName, room); } /// <summary> @@ -181,12 +175,9 @@ public void AddShardFile(Common.SceneUI scene) { scene.IsSharedScene = true; - var data = Newtonsoft.Json.JsonConvert.SerializeObject(scene); - var byteData = System.Text.Encoding.UTF8.GetBytes(data); - - string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory, scene.FileName); + string fullName = System.IO.Path.Combine(DirNameResourse.DownLoadShardDirectory, scene.FileName); //鍐欏叆鍐呭 - Shared.IO.FileUtils.WriteFileByBytes(fullName, byteData); + HdlFileLogic.Current.SaveFileContent(fullName, scene); } /// <summary> @@ -195,12 +186,9 @@ /// <param name="dic">妤煎眰</param> public void AddShardFile(Dictionary<string, string> dic) { - var data = Newtonsoft.Json.JsonConvert.SerializeObject(dic); - var byteData = System.Text.Encoding.UTF8.GetBytes(data); - - string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory, DirNameResourse.ShardFloorFile); + string fullName = System.IO.Path.Combine(DirNameResourse.DownLoadShardDirectory, DirNameResourse.ShardFloorFile); //鍐欏叆鍐呭 - Shared.IO.FileUtils.WriteFileByBytes(fullName, byteData); + HdlFileLogic.Current.SaveFileContent(fullName, dic); } #endregion @@ -213,11 +201,8 @@ /// <param name="fileName">鎸囧畾鏂囦欢鍚嶅瓧</param> public void DeleteShardFile(string fileName) { - fileName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory, fileName); - if (System.IO.File.Exists(fileName) == true) - { - System.IO.File.Delete(fileName); - } + fileName = System.IO.Path.Combine(DirNameResourse.DownLoadShardDirectory, fileName); + HdlFileLogic.Current.DeleteFile(fileName); } /// <summary> @@ -227,8 +212,7 @@ { this.dicShardDeviceFile.Clear(); //鍒涘缓鏂囦欢澶� - string strDir = System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory); - Global.CreateEmptyDirectory(strDir, true); + HdlFileLogic.Current.CreateDirectory(DirNameResourse.DownLoadShardDirectory, true); } #endregion @@ -300,15 +284,9 @@ //鐢熸垚鏂囦欢 foreach (string fileName in listDbFile) { - var oldPath = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory, fileName); + var oldPath = System.IO.Path.Combine(DirNameResourse.DownLoadShardDirectory, fileName); var newPath = System.IO.Path.Combine(Config.Instance.FullPath, fileName); - System.IO.File.Copy(oldPath, newPath, true); - - if (fileName.StartsWith("Room_") == true) - { - //鎴块棿鏂囦欢鐗规畩澶勭悊 - Config.Instance.Home.AddRoomId(fileName.Replace("Room_", string.Empty).Replace(".json", string.Empty)); - } + HdlFileLogic.Current.CopyFile(oldPath, newPath); } //娓呯┖鍏变韩鏂囦欢澶� this.ClearShardDirectory(); @@ -405,8 +383,6 @@ //鍒犻櫎鎺夎繖涓埧闂存枃浠� Global.DeleteFilebyHomeId(fileName); dicUpdateTime.Remove(fileName); - - Config.Instance.Home.RemoveRoomId(nowRoom.Id); } //妫�娴嬫湰鍦板満鏅枃浠�,鏄惁瀛樺湪宸茬粡鍙栨秷浜嗗叡浜簡鐨� else if (fileName.StartsWith("Scene_") == true) @@ -448,7 +424,7 @@ private Dictionary<string, string> GetAllShardFileAgoUpdateTime() { var dicTime = new Dictionary<string, string>(); - var data = Global.ReadFileByDirectory(DirNameResourse.LocalMemoryDirectory, DirNameResourse.ShardFileUpdateTimeFile); + var data = HdlFileLogic.Current.ReadFileByteContent(DirNameResourse.ShardFileUpdateTimeFile); if (data == null) { //鐩爣鏂囦欢涓嶅瓨鍦� @@ -464,9 +440,7 @@ /// <param name="dicTime"></param> private void SaveAllShardFileAgoUpdateTime(Dictionary<string, string> dicTime) { - var data = Newtonsoft.Json.JsonConvert.SerializeObject(dicTime); - var byteData = System.Text.Encoding.UTF8.GetBytes(data); - Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.ShardFileUpdateTimeFile, byteData); + HdlFileLogic.Current.SaveFileContent(DirNameResourse.ShardFileUpdateTimeFile, dicTime); } #endregion @@ -1079,7 +1053,7 @@ /// <returns></returns> private string UpLoadBigBackupFileToDB(MemberShardInfoData memberShardInfo, string fileName) { - string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory, fileName); + string fullName = System.IO.Path.Combine(DirNameResourse.DownLoadShardDirectory, fileName); if (System.IO.File.Exists(fullName) == false) { return null; @@ -1309,7 +1283,6 @@ } listDeleteFile.Add(device.FilePath); } - //鍐嶅紕鍦烘櫙 foreach (var sceneUI in listSceneUI) { diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs index 7bf85cc..ce24a39 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs @@ -151,8 +151,8 @@ } get { - //10绉掑悗鍏佽鍐嶆璁块棶 - if (m_CanAccessHttp == true || (DateTime.Now - oldAccessHttpTime).TotalMilliseconds > 10 * 1000) + //8绉掑悗鍏佽鍐嶆璁块棶 + if (m_CanAccessHttp == true || (DateTime.Now - oldAccessHttpTime).TotalMilliseconds > 8 * 1000) { oldAccessHttpTime = DateTime.Now; return true; @@ -368,23 +368,43 @@ /// <summary> /// 鐩戝惉瀹夊崜缃戠粶鍙樺寲 /// </summary> - /// <param name="value"></param> + /// <param name="value">0:娌℃湁缃戠粶 1:4G 2:wifi</param> private void NetworkStateChanged(int value) { //娌℃湁缃戠粶 if (value == 0) { this.CanAccessHttp = false; + //鍏抽棴Socket + ZigBee.Common.Application.FindGateWaySocket.Stop(); } - //鍙互鍙�4G - else if (value == 1) + //WIFI鎴栬��4G鏃� + if (value == 1 || value == 2) { + //鍏佽鑱旂綉 this.CanAccessHttp = true; - } - //WIFI - else if (value == 2) - { - this.CanAccessHttp = true; + + //妫�娴嬫槸鍚﹀凡缁忓畬鎴愯处鍙蜂俊鎭垵濮嬪寲 + if (UserCenterResourse.UserInfo.InitUserInfoSuccess == false + && Common.Config.Instance.HomeId != string.Empty) + { + HdlThreadLogic.Current.RunThread(() => + { + ProgressBar.Show(); + //閲嶆柊鍒濆鍖栬处鍙蜂俊鎭� + UserCenterLogic.ReInitUserAccoutInfo(); + ProgressBar.Close(); + + }, ShowErrorMode.NO); + } + //閲嶆柊鍒濆鍖朣ocket + ZigBee.Common.Application.FindGateWaySocket.Stop(); + if (value == 2) + { + ZigBee.Common.Application.FindGateWaySocket.Start(); + } + //鏂帀鏈湴杩炴帴 + HdlGatewayLogic.Current.ClearAllRealGateway(); } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs index daed4fb..062c873 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs @@ -31,13 +31,6 @@ ShowNotNetMsg(listNotShowError); return false; } - //妫�娴嬫槸鍚﹀凡缁忓畬鎴愯处鍙蜂俊鎭垵濮嬪寲 - if (UserCenterResourse.UserInfo.InitUserInfoSuccess == false) - { - //涓嶇缁撴灉鎬庝箞鏍�,濡傛灉璋冪敤浜嗚繖涓嚱鏁�,闇�瑕侀噸澶磋幏鍙朤oken,鎵�浠ュ繀椤昏繑鍥炲け璐� - ReInitUserAccoutInfo(listNotShowError); - return false; - } //鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮� var connectMode = GetHttpConnectMode(checkAuthority); //鑾峰彇浠庢帴鍙i偅閲屽彇鍒扮殑姣旂壒鏁版嵁 @@ -76,13 +69,6 @@ { //褰撳墠鏃犳硶璁块棶缃戠粶(褰撻渶瑕侀噸鏂板彂閫佹椂,璺宠繃杩欎釜鍒ゆ柇) ShowNotNetMsg(listNotShowError); - return "Error"; - } - //妫�娴嬫槸鍚﹀凡缁忓畬鎴愯处鍙蜂俊鎭垵濮嬪寲 - if (UserCenterResourse.UserInfo.InitUserInfoSuccess == false) - { - //涓嶇缁撴灉鎬庝箞鏍�,濡傛灉璋冪敤浜嗚繖涓嚱鏁�,闇�瑕侀噸澶磋幏鍙朤oken,鎵�浠ュ繀椤昏繑鍥炲け璐� - ReInitUserAccoutInfo(listNotShowError); return "Error"; } @@ -127,13 +113,6 @@ { //褰撳墠鏃犳硶璁块棶缃戠粶(褰撻渶瑕侀噸鏂板彂閫佹椂,璺宠繃杩欎釜鍒ゆ柇) ShowNotNetMsg(listNotShowError); - return null; - } - //妫�娴嬫槸鍚﹀凡缁忓畬鎴愯处鍙蜂俊鎭垵濮嬪寲 - if (UserCenterResourse.UserInfo.InitUserInfoSuccess == false) - { - //涓嶇缁撴灉鎬庝箞鏍�,濡傛灉璋冪敤浜嗚繖涓嚱鏁�,闇�瑕侀噸澶磋幏鍙朤oken,鎵�浠ュ繀椤昏繑鍥炲け璐� - ReInitUserAccoutInfo(listNotShowError); return null; } //鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮� @@ -182,13 +161,6 @@ { //褰撳墠鏃犳硶璁块棶缃戠粶(褰撻渶瑕侀噸鏂板彂閫佹椂,璺宠繃杩欎釜鍒ゆ柇) ShowNotNetMsg(listNotShowError); - return null; - } - //妫�娴嬫槸鍚﹀凡缁忓畬鎴愯处鍙蜂俊鎭垵濮嬪寲 - if (UserCenterResourse.UserInfo.InitUserInfoSuccess == false) - { - //涓嶇缁撴灉鎬庝箞鏍�,濡傛灉璋冪敤浜嗚繖涓嚱鏁�,闇�瑕侀噸澶磋幏鍙朤oken,鎵�浠ュ繀椤昏繑鍥炲け璐� - ReInitUserAccoutInfo(listNotShowError); return null; } //鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮� @@ -562,6 +534,12 @@ HdlGatewayLogic.Current.SynchronizeDbGateway(); //浠庢湰鍦伴噸鏂板姞杞藉叏閮ㄧ殑鎴块棿 HdlRoomLogic.Current.RefreshAllRoomByLocation(); + //鏂紑杩滅▼Mqtt杩炴帴,閲嶆柊杩炴帴 + HdlThreadLogic.Current.RunThread(async () => + { + HdlGatewayLogic.Current.ClearAllRealGateway(); + await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient(); + }, ShowErrorMode.NO); } /// <summary> @@ -584,62 +562,6 @@ Config.Instance.Home.Longitude = Longitude; Config.Instance.Home.Latitude = Latitude; Config.Instance.Home.Save(false); - } - - #endregion - - #region 鈻� 鍒犻櫎鏈湴鏂囦欢_______________________ - - /// <summary> - /// 鍒犻櫎鏈湴鎵�鏈夋枃浠� - /// </summary> - /// <param name="all">true:鍏ㄩ儴鍒犻櫎(鐢ㄤ簬浣忓畢鍒犻櫎) false:閲嶈鐨勬枃浠朵笉鍒犻櫎</param> - public static void DeleteAllLocationFile(bool all = true) - { - string dPath = Config.Instance.FullPath; - if (System.IO.Directory.Exists(dPath) == false) - { - return; - } - - //鐒跺悗鑾峰彇鍏ㄩ儴鐨勬枃浠� - List<string> listFile = Global.FileListByHomeId(); - foreach (string file in listFile) - { - if (all == false && IsNotDeleteFile(file) == true) - { - //杩欐槸涓嶈兘鍒犻櫎鐨勬枃浠� - continue; - } - //鍒犻櫎鏂囦欢 - Global.DeleteFilebyHomeId(file); - } - //濡傛灉鏄妸鏂囦欢鍏ㄩ儴鍒犻櫎鐨勮瘽锛岄偅涔堟枃浠跺す涔熶竴璧峰垹闄ゆ帀 - if (all == true) - { - //鍒犻櫎鏂囦欢澶� - System.IO.Directory.Delete(dPath, true); - } - } - - /// <summary> - /// 鍒ゆ柇鏄笉鏄笉搴旇鍒犻櫎鐨勬枃浠� - /// </summary> - /// <param name="fileName"></param> - /// <returns></returns> - public static bool IsNotDeleteFile(string fileName) - { - if (fileName == "Config.json") - { - //涓嶈兘鍒犻櫎Config鏂囦欢 - return true; - } - else if (fileName.StartsWith("House_") == true) - { - //涓嶈兘鍒犻櫎浣忓畢鏂囦欢 - return true; - } - return false; } #endregion @@ -781,29 +703,6 @@ #region 鈻� 鎷兼帴淇℃伅___________________________ /// <summary> - /// 鎷兼帴璺緞(鍏ㄨ矾寰�)锛屼互浣忓畢ID鐨勬枃浠跺す涓鸿捣鐐癸紝褰撴病鏈夋寚瀹氬弬鏁版椂锛屽垯杩斿洖銆愪綇瀹匢D鐨勬枃浠跺す銆戠殑鍏ㄨ矾寰� - /// </summary> - /// <param name="listNames">瑕佹嫾鎺ョ殑璺緞</param> - /// <returns></returns> - public static string CombinePath(params object[] listNames) - { - string rootPath = Config.Instance.FullPath; - if (listNames == null || listNames.Length == 0) - { - return rootPath; - } - foreach (var file in listNames) - { - if (file == null) - { - continue; - } - rootPath = System.IO.Path.Combine(rootPath, file.ToString()); - } - return rootPath; - } - - /// <summary> /// 鎷兼帴缃戝叧鍥炲瓒呮椂鐨勪俊鎭� /// </summary> /// <param name="errorMsg">閿欒淇℃伅</param> @@ -893,12 +792,6 @@ if (Common.Config.Instance.HomeId != UserCenterResourse.AccountOption.OldHomeStringId || Common.Config.Instance.Account != UserCenterResourse.AccountOption.OldAccountId) { - //鏂紑杩滅▼Mqtt杩炴帴 - HdlThreadLogic.Current.RunThread(async () => - { - await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient(); - }, ShowErrorMode.NO); - //娓呯┖鎵�鏈夋垚鍛樼紦瀛� ClearAllMemberMemory(); @@ -906,7 +799,7 @@ var optionInfo = UserCenterResourse.AccountOption.Load(); UserCenterResourse.AccountOption = optionInfo; //鍙樻洿鏍圭敤鎴峰浘鐗囩洰褰曡矾寰� - UserCenterResourse.AccountOption.UserPictruePath = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Config.Instance.Guid, DirNameResourse.UserPictrueDirectory); + UserCenterResourse.AccountOption.UserPictruePath = DirNameResourse.UserPictrueDirectory; //鍔犺浇浣忓畢閰嶇疆淇℃伅 UserCenterResourse.ResidenceOption = UserCenterResourse.ResidenceOption.Load(); @@ -921,9 +814,8 @@ //璇诲彇闅愬尶閰嶇疆 HdlBackupLogic.Current.LoadHideOption(); } - //棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶� - CreatAllUserCenterDirectory(); + HdlFileLogic.Current.CreatAllUserCenterDirectory(); //鍏抽棴鎵�鏈夋帴鏀� HdlGatewayReceiveLogic.Current.RemoveAllEvent(); @@ -957,6 +849,13 @@ HdlGatewayLogic.Current.SynchronizeDbGateway(); } + //鏂紑杩滅▼Mqtt杩炴帴,閲嶆柊杩炴帴 + HdlThreadLogic.Current.RunThread(async () => + { + HdlGatewayLogic.Current.ClearAllRealGateway(); + await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient(); + }, ShowErrorMode.NO); + //鍒锋柊APP鍓嶄竴娆¢�夋嫨鐨勭綉鍏矷D(鍙互鍙嶅璋冪敤,闇�瑕佸湪缃戝叧鍒濆鍖栧畬浜嗕箣鍚庢墠鑳借皟鐢�) HdlGatewayLogic.Current.RefreshAppOldSelectGatewayId(); @@ -984,7 +883,7 @@ //娓呯┖鎵�鏈夋垚鍛樼紦瀛� ClearAllMemberMemory(); //棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶� - CreatAllUserCenterDirectory(); + HdlFileLogic.Current.CreatAllUserCenterDirectory(); //鍏抽棴鎵�鏈夋帴鏀� HdlGatewayReceiveLogic.Current.RemoveAllEvent(); //鍒濆鍖栨湰鍦扮殑缃戝叧淇℃伅 @@ -1050,7 +949,7 @@ //搴忓垪鍖栧璞� var requestJson = JsonConvert.SerializeObject(pra); //璁块棶鎺ュ彛 - byte[] byteData = CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync("ZigbeeUsers/GetAccountInfo", Encoding.UTF8.GetBytes(requestJson)); + byte[] byteData = CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync("ZigbeeUsers/GetAccountInfo", Encoding.UTF8.GetBytes(requestJson), "POST", 4); if (byteData == null) { return -1; @@ -1089,29 +988,27 @@ userInfo.AuthorityText = Language.StringByID(R.MyInternationalizationString.uMember); } - if (UserCenterResourse.UserInfo.AuthorityNo != userInfo.AuthorityNo) + //UserInfo.AuthorityNo==0浠h〃鏈湴杩樻病鏈夌敓鎴愭枃浠�,杩欎釜鏃跺�欎笉闇�瑕佸鐞� + if (UserCenterResourse.UserInfo.AuthorityNo != userInfo.AuthorityNo + && UserCenterResourse.UserInfo.AuthorityNo != 0) { //濡傛灉鐧婚檰鐨勮处鍙风殑鏉冮檺鍜屼笂涓�娆$殑涓嶄竴鏍�,鍒欏垹闄ゆ湰鍦拌繖涓綇瀹呭叏閮ㄧ殑鏂囦欢,浠庡ご鍐嶆潵 - string dirPath = CombinePath(); + string dirPath = Config.Instance.FullPath; if (System.IO.Directory.Exists(dirPath) == true) { try { //鍚屾鏁版嵁鐨勫垽鏂枃浠�(浠ラ槻涓囦竴鍒犻櫎鏁翠釜鏂囦欢澶瑰け璐ョ殑鏃跺��,杩欎釜鏂囦欢琚垹鐨勮瘽,搴旇娌′粈涔堝ぇ闂) - string SynchronizeFile = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoDownLoadBackupCheckFile); + string SynchronizeFile = DirNameResourse.AutoDownLoadBackupCheckFile; //濡傛灉鏈湴宸茬粡鎷ユ湁浜嗚繖涓枃浠讹紝鍒欒鏄庝笉鏄柊鎵嬫満锛屼笉鍐嶈嚜鍔ㄨ繕鍘� - if (System.IO.File.Exists(SynchronizeFile) == true) - { - System.IO.File.Delete(SynchronizeFile); - } - //鍒犻櫎鏁翠釜鏂囦欢澶� - System.IO.Directory.Delete(dirPath, true); + HdlFileLogic.Current.DeleteFile(SynchronizeFile); + HdlFileLogic.Current.DeleteDirectory(dirPath); } catch { } //鍒涘缓浣忓畢鏂囦欢澶� Global.CreateHomeDirectory(Config.Instance.HomeId); //棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶� - CreatAllUserCenterDirectory(); + HdlFileLogic.Current.CreatAllUserCenterDirectory(); } } if (string.IsNullOrEmpty(userInfo.UserName) == true) @@ -1134,6 +1031,8 @@ //瀵嗙爜楠岃瘉 UserCenterResourse.AccountOption.PswAuthentication = UserCenterResourse.UserInfo.StringPwd == null ? string.Empty : UserCenterResourse.UserInfo.StringPwd; UserCenterResourse.UserInfo.StringPwd = null; + //淇濆瓨缂撳瓨 + UserCenterResourse.AccountOption.Save(); //鍒濆鍖栫鐞嗗憳鎺у埗涓讳汉鐨勮繛鎺ュ湴鍧�(鍥犱负杩欎釜杩炴帴Token鏄笉浼氭敼鍙樼殑,鎵�浠ュ彧闇�瑕佸垵濮嬪寲涓�娆�) var flage = InitAdminConnectMainInfo(); @@ -1149,8 +1048,7 @@ /// <returns></returns> private static UserInformation GetUserInformationFromLocation() { - string fileName = CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.UserInfoFile); - var value = LoadFileContent(fileName); + var value = HdlFileLogic.Current.ReadFileTextContent(DirNameResourse.UserInfoFile); if (value == null) { return new UserInformation(); @@ -1163,25 +1061,10 @@ /// 閲嶆柊鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅(鏃ㄥ湪瀵瑰簲閭d竴鐬棿,缃戠粶涓嶅ソ,瀵艰嚧璇垽鐨勬儏鍐�) /// </summary> /// <returns></returns> - private static bool ReInitUserAccoutInfo(List<string> listNotShowError) + public static bool ReInitUserAccoutInfo() { //閲嶆柊鍒濆鍖栬处鍙蜂俊鎭� var result = InitUserAccoutInfo(false); - //杩炴帴涓嶄簡澶栫綉鐨勬椂鍊� - if (result == -1) - { - if (listNotShowError != null && listNotShowError.Contains("NotCheck") == true) - { - //鏈夎繖涓爣璇嗘椂,涓嶆彁绀洪敊璇� - return false; - } - Application.RunOnMainThread(() => - { - //褰撳墠鏃犵綉缁滆繛鎺�,璇风‘璁ょ綉缁� - var alert = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uNowIsDonotNetworkAndCheckNetwork)); - alert.Show(); - }); - } if (result == 1) { //鍚屾浜戠鐨勭綉鍏砳d锛屽鏋滄湰鍦版嫢鏈変簯绔笉瀛樺湪鐨刬d锛屽垯琛ㄧず搴旇琚崲缁戜簡锛岀洿鎺ュ垹闄� @@ -1199,9 +1082,8 @@ /// </summary> private static void SaveUserInformationToLocation() { - string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.UserInfoFile); //鍐欏叆鍐呭 - SaveFileContent(fullName, UserCenterResourse.UserInfo); + HdlFileLogic.Current.SaveFileContent(DirNameResourse.UserInfoFile, UserCenterResourse.UserInfo); //鎼炰竴涓嬩富浜虹殑榛樿澶村儚 string defultFile = IO.FileUtils.GetImageFilePath("Center/Admin.png"); @@ -1265,54 +1147,6 @@ #endregion - #region 鈻� 棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶筥________ - - /// <summary> - /// 棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶� - /// </summary> - public static void CreatAllUserCenterDirectory() - { - //鏈湴缂撳瓨鐨勬牴鐩綍 - string LocalDirectory = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory); - Global.CreateEmptyDirectory(LocalDirectory); - - //鑷姩澶囦唤銆愭枃浠跺す銆�(缂栬緫,杩藉姞) - string directory = System.IO.Path.Combine(LocalDirectory, DirNameResourse.AutoBackupDirectory); - Global.CreateEmptyDirectory(directory); - - //鑷姩澶囦唤銆愭枃浠跺す銆�(鍒犻櫎) - directory = System.IO.Path.Combine(LocalDirectory, DirNameResourse.AutoBackupdeleteDirectory); - Global.CreateEmptyDirectory(directory); - - //涓嬭浇澶囦唤鐨勬椂鍊欐墍浣跨敤鐨勪复鏃躲�愭枃浠跺す銆� - directory = System.IO.Path.Combine(LocalDirectory, DirNameResourse.DownLoadBackupTempDirectory); - Global.CreateEmptyDirectory(directory); - - //淇濆瓨瀹夐槻璁板綍鐨勩�愭枃浠跺す銆� - directory = System.IO.Path.Combine(LocalDirectory, DirNameResourse.SafeguardAlarmDirectory); - Global.CreateEmptyDirectory(directory); - - //涓婁紶缃戝叧澶囦唤鏂囦欢鍒颁簯绔殑涓存椂銆愭枃浠跺す銆� - directory = System.IO.Path.Combine(LocalDirectory, DirNameResourse.GatewayBackupDirectory); - Global.CreateEmptyDirectory(directory); - - //涓嬭浇鍒嗕韩鏂囦欢鐨勪复鏃躲�愭枃浠跺す銆� - directory = System.IO.Path.Combine(LocalDirectory, DirNameResourse.DownLoadShardDirectory); - Global.CreateEmptyDirectory(directory); - - //LOG鍑哄姏銆愭枃浠跺す銆� - directory = System.IO.Path.Combine(LocalDirectory, DirNameResourse.LogDirectory); - Global.CreateEmptyDirectory(directory); - - //鐢ㄦ埛鍥剧墖鐩綍璺緞銆愭枃浠跺す銆� - if (UserCenterResourse.AccountOption.UserPictruePath != string.Empty && !System.IO.Directory.Exists(UserCenterResourse.AccountOption.UserPictruePath)) - { - System.IO.Directory.CreateDirectory(UserCenterResourse.AccountOption.UserPictruePath); - } - } - - #endregion - #region 鈻� 鑾峰彇鎺у埗涓讳汉璐﹀彿鐨凾oken____________ /// <summary> @@ -1339,7 +1173,7 @@ /// <param name="result">鍚屾缁撴灉 -1锛氬紓甯� 0:宸茬粡鍚屾杩囷紝涓嶉渶瑕佸悓姝� 1锛氭甯稿悓姝� 2:娌℃湁鑷姩澶囦唤鏁版嵁</param> private static void ShowGuideForm(int result) { - var checkFile = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, DirNameResourse.GuideFile); + var checkFile = DirNameResourse.GuideFile; if (System.IO.File.Exists(checkFile) == true) { //涓嶉渶瑕佹樉绀� @@ -1482,89 +1316,6 @@ { var utcTime = Convert.ToDateTime(timeText); return TimeZoneInfo.ConvertTimeFromUtc(utcTime, TimeZoneInfo.Local); - } - - #endregion - - #region 鈻� 鏂囦欢淇濆瓨鍜岃鍙朹____________________ - - /// <summary> - /// 鏂囦欢淇濆瓨(鏁村ぉ蹇樿,鎵�浠ュ缓涓�涓嚱鏁版潵鐜╃帺) - /// </summary> - /// <param name="fullName">鍏ㄨ矾寰�</param> - /// <param name="obj">闇�瑕佸簭鍒楀寲鐨勪笢瑗�</param> - public static void SaveFileContent(string fullName, object obj) - { - var data = JsonConvert.SerializeObject(obj); - SaveTexToFile(fullName, data); - } - - /// <summary> - /// 鏂囦欢淇濆瓨(鏁村ぉ蹇樿,鎵�浠ュ缓涓�涓嚱鏁版潵鐜╃帺) - /// </summary> - /// <param name="fullName">鍏ㄨ矾寰�</param> - /// <param name="obj">闇�瑕佸簭鍒楀寲鐨勪笢瑗�</param> - public static void SaveTexToFile(string fullName, string textValue) - { - var byteData = Encoding.UTF8.GetBytes(textValue); - //鍐欏叆鍐呭 - System.IO.FileStream fileStream = null; - try - { - fileStream = new System.IO.FileStream(fullName, System.IO.FileMode.Create, System.IO.FileAccess.Write); - fileStream.Write(byteData, 0, byteData.Length); - fileStream.Flush(); - } - catch { } - finally - { - fileStream?.Close(); - } - } - - /// <summary> - /// 璇诲彇鏂囦欢,涓嶉檺鍒朵綇瀹�(鏂囦欢涓嶅瓨鍦ㄨ繑鍥瀗ull,鏁村ぉ蹇樿,鎵�浠ュ缓涓�涓嚱鏁版潵鐜╃帺) - /// </summary> - /// <param name="fullName">鍏ㄨ矾寰�</param> - /// <returns></returns> - public static string LoadFileContent(string fullName) - { - //璇诲彇鏂囦欢 - var varByte = ReadFileContent(fullName); - if (varByte == null) - { - return null; - } - return Encoding.UTF8.GetString(varByte); - } - - /// <summary> - /// 璇诲彇鏂囦欢,涓嶉檺鍒朵綇瀹�,鏂囦欢涓嶅瓨鍦ㄨ繑鍥瀗ull - /// </summary> - /// <param name="fullName">鍏ㄨ矾寰�</param> - /// <returns></returns> - public static byte[] ReadFileContent(string fullName) - { - if (System.IO.File.Exists(fullName) == false) - { - return null; - } - System.IO.FileStream fileStream = null; - try - { - fileStream = new System.IO.FileStream(fullName, System.IO.FileMode.Open, System.IO.FileAccess.Read); - byte[] array = new byte[fileStream.Length]; - fileStream.Read(array, 0, array.Length); - return array; - } - catch - { - return null; - } - finally - { - fileStream?.Close(); - } } #endregion diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Resourse/DirectoryFileNameResourse.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Resourse/DirectoryFileNameResourse.cs index 31507b1..b1d5862 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Resourse/DirectoryFileNameResourse.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Resourse/DirectoryFileNameResourse.cs @@ -13,120 +13,177 @@ /// <summary> /// 鏈湴缂撳瓨鐨勬牴鐩綍銆愭枃浠跺す銆戯紝涓嶉渶瑕佸浠斤紝涔熶笉闇�瑕佷笂浼狅紝鍙敤浜庡綋鍓嶆墜鏈虹殑缂撳瓨 /// </summary> - public const string LocalMemoryDirectory = "43ae770b6035427b21bddd7e6a1eeb88"; + public static string LocalMemoryDirectory + { + get { return System.IO.Path.Combine(Common.Config.Instance.FullPath, "43ae770b6035427b21bddd7e6a1eeb88"); } + } /// <summary> /// 鑷姩澶囦唤銆愭枃浠跺す銆�(缂栬緫,杩藉姞) /// </summary> - public const string AutoBackupDirectory = "d560f44a32930569c0328bfe0c7d3beaf6a58bcb2d5f1d3b"; + public static string AutoBackupDirectory + { + get { return System.IO.Path.Combine(LocalMemoryDirectory, "d560f44a32930569c0328bfe0c7d3beaf6a58bcb2d5f1d3b"); } + } /// <summary> /// 鑷姩澶囦唤銆愭枃浠跺す銆�(鍒犻櫎) /// </summary> - public const string AutoBackupdeleteDirectory = "eced1a7b88bb9776ff31c79f6e7a48d69eac74ee0c447d6b"; - /// <summary> - /// 鏄惁鑷姩涓嬭浇浜戠鐨勫浠芥暟鎹殑銆愬垽鏂枃浠躲�� - /// </summary> - public const string AutoDownLoadBackupCheckFile = "93ee2d7241c3d19d7d94317f51a94d7fab1400f8f4f37a5a"; + public static string AutoBackupdeleteDirectory + { + get { return System.IO.Path.Combine(LocalMemoryDirectory, "eced1a7b88bb9776ff31c79f6e7a48d69eac74ee0c447d6b"); } + } /// <summary> /// 涓嬭浇澶囦唤鐨勬椂鍊欐墍浣跨敤鐨勪复鏃躲�愭枃浠跺す銆� /// </summary> - public const string DownLoadBackupTempDirectory = "2492bc79ce8b87b49beaea261f87d52efc5dd3dfae2c6811be65781d5faccd40"; + public static string DownLoadBackupTempDirectory + { + get { return System.IO.Path.Combine(LocalMemoryDirectory, "2492bc79ce8b87b49beaea261f87d52efc5dd3dfae2c6811be65781d5faccd40"); } + } /// <summary> /// 淇濆瓨APP鏈�鍚庨�夋嫨鐨勭綉鍏矷D鐨勩�愭枃浠跺悕瀛椼��(涓嶉渶瑕佸浠藉強涓婁紶) /// </summary> - public const string AppOldSelectGatewayFile = "1f2d13116b051b76b111b99246bb23f1"; + public static string AppOldSelectGatewayFile + { + get { return System.IO.Path.Combine(LocalMemoryDirectory, "1f2d13116b051b76b111b99246bb23f1"); } + } /// <summary> /// 淇濆瓨瀹夐槻璁板綍鐨勩�愭枃浠跺す銆� /// </summary> - public const string SafeguardAlarmDirectory = "b101c307ddc2fae59a133a31604304560180c5748135de81"; + public static string SafeguardAlarmDirectory + { + get { return System.IO.Path.Combine(LocalMemoryDirectory, "b101c307ddc2fae59a133a31604304560180c5748135de81"); } + } /// <summary> /// 淇濆瓨闂ㄩ攣璁板綍鐨勩�愭枃浠跺す銆� /// </summary> - public const string DoorLockAlarmDirectory = "4662b1f6eb97dbe44395a2546fd47c273a3def89f56951c6"; + public static string DoorLockAlarmDirectory + { + get { return System.IO.Path.Combine(LocalMemoryDirectory, "4662b1f6eb97dbe44395a2546fd47c273a3def89f56951c6"); } + } /// <summary> /// 瀹夐槻鐢ㄦ埛瀵嗙爜鐨勭紦瀛樺瘑鐮併�愭枃浠躲�� /// </summary> - public const string SafeguardUserPassword = "b101c307ddc2fae587d864275bb8a23478b37ce3bd5c5db1"; - /// <summary> - /// 涓婁紶缃戝叧澶囦唤鏂囦欢鍒颁簯绔殑涓存椂銆愭枃浠跺す銆� - /// </summary> - public const string GatewayBackupDirectory = "99a6644e29e7bdcd65d85219312eb4f4cf013d26f4e12925"; + public static string SafeguardUserPassword + { + get { return System.IO.Path.Combine(LocalMemoryDirectory, "b101c307ddc2fae587d864275bb8a23478b37ce3bd5c5db1"); } + } /// <summary> /// 涓嬭浇鍒嗕韩鏂囦欢鐨勪复鏃躲�愭枃浠跺す銆� /// </summary> - public const string DownLoadShardDirectory = "98f878a57c59bb6538677bc55187ffab6e8def815981fdbe"; + public static string DownLoadShardDirectory + { + get { return System.IO.Path.Combine(LocalMemoryDirectory, "98f878a57c59bb6538677bc55187ffab6e8def815981fdbe"); } + } /// <summary> /// 璁板綍鍒嗕韩鏂囦欢鏇存柊鏃堕棿鐨勩�愭枃浠躲�� /// </summary> - public const string ShardFileUpdateTimeFile = "b4137733cb527d033a3f63d2b32cd6e0f886eef3cee19601"; - /// <summary> - /// 璁板綍鑷姩澶囦唤鏂囦欢鏇存柊鏃堕棿鐨勩�愭枃浠躲�� - /// </summary> - public const string AutoBackFileUpdateTimeFile = "9479e724666d970f1a2df4fa67cc456b74b31c4d3fce3b4f8c8eef2f2c0559ec"; + public static string ShardFileUpdateTimeFile + { + get { return System.IO.Path.Combine(LocalMemoryDirectory, "b4137733cb527d033a3f63d2b32cd6e0f886eef3cee19601"); } + } /// <summary> /// 淇濆瓨鐢ㄦ埛涓汉淇℃伅鐨勩�愭枃浠躲�� /// </summary> - public const string UserInfoFile = "c24d43aab01bbe521535c9fae517ffab"; + public static string UserInfoFile + { + get { return System.IO.Path.Combine(LocalMemoryDirectory, "c24d43aab01bbe521535c9fae517ffab"); } + } /// <summary> /// 淇濆瓨鏂綉鏃跺�欙紝澶囦唤缃戝叧id鐢ㄧ殑銆愭枃浠躲�� /// </summary> - public const string BackupGatewayIdFile = "5f7fdfe4258d4cd19a433412468a586834643bed528cdba1"; + public static string BackupGatewayIdFile + { + get { return System.IO.Path.Combine(LocalMemoryDirectory, "5f7fdfe4258d4cd19a433412468a586834643bed528cdba1"); } + } /// <summary> /// 鑷姩澶囦唤涓嶉渶瑕佸啀娆℃彁閱掔殑銆愭枃浠跺悕銆�(涓嶉渶瑕佸浠藉強涓婁紶) /// </summary> - public const string AutoBackupNotPromptedFile = "9479e724666d970fb9ae5dff2b739cf1bc8c1a95d63bf182dc8f290cac98592f"; + public static string AutoBackupNotPromptedFile + { + get { return System.IO.Path.Combine(LocalMemoryDirectory, "9479e724666d970fb9ae5dff2b739cf1bc8c1a95d63bf182dc8f290cac98592f"); } + } /// <summary> /// 骞叉帴鐐圭鏈夊睘鎬х殑淇濆瓨鏂囦欢 /// </summary> - public const string DryContactFunctionFile = "10afbada0199511de13edc60259ed03e6ebc817d8a53adce"; + public static string DryContactFunctionFile + { + get { return System.IO.Path.Combine(Common.Config.Instance.FullPath, "10afbada0199511de13edc60259ed03e6ebc817d8a53adce"); } + } /// <summary> /// 瀛樻斁鐢ㄦ埛鍥剧墖鐨勩�愭枃浠跺す銆� /// </summary> - public const string UserPictrueDirectory = "e3263f227598072fef2a204fb1656cd2"; + public static string UserPictrueDirectory + { + get { return System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Common.Config.Instance.Guid, "e3263f227598072fef2a204fb1656cd2"); } + } /// <summary> /// 淇濆瓨璐﹀彿閰嶇疆鐨勩�愭枃浠躲�� /// </summary> - public const string AccountOptionFile = "d33690329dfdf2e5dcce0280893b95a0db47b5be13b46aa0"; + public static string AccountOptionFile + { + get { return System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Common.Config.Instance.Guid, "d33690329dfdf2e5dcce0280893b95a0db47b5be13b46aa0"); } + } /// <summary> /// 淇濆瓨浣忓畢閰嶇疆鐨勩�愭枃浠躲�� /// </summary> - public const string ResidenceOptionFile = "b79583bed6909a52849eaea268449aee15f29d3bdf8b5ca3"; - /// <summary> - /// 淇濆瓨妤煎眰椤哄簭鐨勩�愭枃浠躲�� - /// </summary> - public const string FloorSortFile = "2b156ce95c29de53578282f4d7228f60"; - /// <summary> - /// 淇濆瓨鎴块棿椤哄簭鐨勩�愭枃浠躲�� - /// </summary> - public const string RoomSortFile = "b1b9f1a50064016f62dea3f160703de2"; + public static string ResidenceOptionFile + { + get { return System.IO.Path.Combine(LocalMemoryDirectory, "b79583bed6909a52849eaea268449aee15f29d3bdf8b5ca3"); } + } /// <summary> /// 淇濆瓨Log鐨勩�愭枃浠跺す銆� /// </summary> - public const string LogDirectory = "820c65b54b6f3f2a"; + public static string LogDirectory + { + get { return System.IO.Path.Combine(LocalMemoryDirectory, "820c65b54b6f3f2a"); } + } /// <summary> - /// 鍒嗕韩妤煎眰鐨勩�愭枃浠躲�� + /// 鏄惁鑷姩涓嬭浇浜戠鐨勫浠芥暟鎹殑銆愬垽鏂枃浠躲�� /// </summary> - public const string ShardFloorFile = "5f05f7a6f26c51d1b096dc777f6c02f2"; + public static string AutoDownLoadBackupCheckFile + { + get { return System.IO.Path.Combine(LocalMemoryDirectory, "93ee2d7241c3d19d7d94317f51a94d7fab1400f8f4f37a5a"); } + } /// <summary> /// 鐗╃悊璁惧灞炰簬鍝釜鎴块棿鐨勩�愭枃浠躲�� /// </summary> - public const string DeviceRoomIdFile = "020945dd7966a7550090d3c04a04d93cd2278eb4e6aebcf6"; + public static string DeviceRoomIdFile + { + get { return System.IO.Path.Combine(Common.Config.Instance.FullPath, "020945dd7966a7550090d3c04a04d93cd2278eb4e6aebcf6"); } + } /// <summary> /// 淇濆瓨鎰忚鍙嶉娆℃暟鐨勩�愭枃浠躲�� /// </summary> - public const string SuggestionFile = "f782709778b751ef2b3840f17e407ead"; + public static string SuggestionFile + { + get { return System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Common.Config.Instance.Guid, "f782709778b751ef2b3840f17e407ead"); } + } /// <summary> /// 妫�娴嬪紩瀵肩殑銆愭枃浠躲�� /// </summary> - public const string GuideFile = "cad1afb384fb482de753fc37ebe84f9e"; + public static string GuideFile + { + get { return System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, "cad1afb384fb482de753fc37ebe84f9e"); } + } /// <summary> - /// 鎵撳紑Gbs鐨勫垽鏂�愭枃浠躲��(涓存椂) + /// 璁板綍鍙戦�佸拰鎺ユ敹鐨勬暟鎹甃og /// </summary> - public const string OpenGbsFile = "cd8f75492cb65ef0951442460336db62"; + public static string SendAndReceveDataLog + { + get { return System.IO.Path.Combine(Common.Config.Instance.FullPath, LocalMemoryDirectory, "SendAndReceveLog.log"); } + } + /// <summary> + /// 璁板綍SocketReceive鏁版嵁Log + /// </summary> + public static string SocketReceiveDataLog + { + get { return System.IO.Path.Combine(Common.Config.Instance.FullPath, LocalMemoryDirectory, "SocketReceiveDataLog.log"); } + } + /// <summary> + /// 鍒嗕韩妤煎眰鐨勩�愭枃浠跺悕銆� + /// </summary> + public const string ShardFloorFile = "5f05f7a6f26c51d1b096dc777f6c02f2"; - /// <summary> - /// 璁板綍鑷姩澶囦唤涓婁紶鏃ユ湡鐨勩�愭枃浠躲��,涓嶅姞瀵� - /// </summary> - public const string UpLoadAutoBackDayFile = "UpLoadAutoBackDayFile"; + //------------------------浠ヤ笅涓鸿緟鍔╂枃浠�------------------------ /// <summary> /// 鏄剧ず鍔熻兘鑿滃崟鐨勩�愭爣璇嗘枃浠躲��,涓嶅姞瀵� /// </summary> @@ -143,12 +200,5 @@ /// 鍔熻兘澶囦唤鐨勫悕瀛� 杩欎釜涓滆タ涓嶅姞瀵� /// </summary> public const string OptionBackupName = "##Option##"; - /// <summary> - /// 璁板綍鍙戦�佸拰鎺ユ敹鐨勬暟鎹甃og - /// </summary> - public static string SendAndReceveDataLog - { - get { return System.IO.Path.Combine(Common.Config.Instance.FullPath, LocalMemoryDirectory, "SendAndReceveLog.log"); } - } } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs index 2bc736f..159013b 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs @@ -176,7 +176,7 @@ listText.Add(Language.StringByID(R.MyInternationalizationString.uReverseDirection));//鍙嶅悜 var form = new BottomItemSelectForm(); - form.AddForm(Language.StringByID(R.MyInternationalizationString.uDirectionSelect), listText, nowSelectNo); + form.AddForm(Language.StringByID(R.MyInternationalizationString.uDirectionSelect), listText, null, nowSelectNo); form.FinishSelectEvent += (index) => { //鍙樻洿鏂瑰悜 diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/SiphonateDirectionAndLimitSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/SiphonateDirectionAndLimitSettionForm.cs index 2c022f5..e78ed9b 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/SiphonateDirectionAndLimitSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/SiphonateDirectionAndLimitSettionForm.cs @@ -120,7 +120,7 @@ listText.Add(Language.StringByID(R.MyInternationalizationString.uReverseDirection));//鍙嶅悜 var form = new BottomItemSelectForm(); - form.AddForm(Language.StringByID(R.MyInternationalizationString.uDirectionSelect), listText, nowSelectNo); + form.AddForm(Language.StringByID(R.MyInternationalizationString.uDirectionSelect), listText, null, nowSelectNo); form.FinishSelectEvent += (index) => { //鍙樻洿鏂瑰悜 diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs index 5080f98..cc2bc06 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs @@ -60,6 +60,8 @@ this.SetDoorTime(); //鏂板叆缃戠殑璁惧,娓呯┖鎺夊畠鐨勬埧闂� this.ClearDeviceFromRoom(); + //娣诲姞璁惧鐨勬椂鍊�,鍏抽棴宸﹀垝鑿滃崟鐨勬湭鍒嗛厤鐣岄潰 + MainPage.LeftListRoomViewFrom.Instance?.CloseUnallocatedRoomForm(); } /// <summary> diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceDryContactSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceDryContactSettionForm.cs index 3f9f949..2a11755 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceDryContactSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceDryContactSettionForm.cs @@ -196,7 +196,7 @@ //杩欓噷鍏堝幓鑾峰彇瀹冪殑骞叉帴鐐圭被鍨� this.ShowProgressBar(); //鑾峰彇绗竷鍥炶矾鐨勯厤缃俊鎭� - listRelayInfo7 = await HdlDevicePanelLogic.Current.GetDryContactConfigureInfo(nowSelectDevice); + listRelayInfo7 = HdlDevicePanelLogic.Current.GetDryContactConfigureInfo(nowSelectDevice); if (listRelayInfo7 == null) { //鍏抽棴杩涘害鏉� @@ -324,7 +324,7 @@ var title = Language.StringByID(R.MyInternationalizationString.uSelectDryContactFunction); var form = new BottomItemSelectForm(); - form.AddForm(title, listText, nowSelectNo); + form.AddForm(title, listText, null, nowSelectNo); form.FinishSelectEvent += (selectNo) => { if (selectNo == nowSelectNo) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceGeneralInformationForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceGeneralInformationForm.cs index 2575716..86eabac 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceGeneralInformationForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceGeneralInformationForm.cs @@ -129,11 +129,15 @@ rowMac.AddBottomLine(); //鍒堕�犲晢 - string strProtuct = listDevice[0].DriveCode > 0 ? "HDL" : listDevice[0].ManufacturerName; + string strProtuct = listDevice[0].ManufacturerName; + if (listDevice[0].DriveCode > 0 || Common.LocalDevice.Current.IsHdlDevice(listDevice[0]) == true) + { + strProtuct = "骞垮窞娌充笢绉戞妧鏈夐檺鍏徃"; + } var rowProtuct = new FrameRowControl(listView.rowSpace / 2); rowProtuct.UseClickStatu = false; listView.AddChidren(rowProtuct); - rowProtuct.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uManufacturerName), 400); + rowProtuct.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uManufacturerName), 600); rowProtuct.AddMostRightView(strProtuct, 600); listView.AdjustRealHeight(Application.GetRealHeight(23)); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs index 37db0f1..e81a59c 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs @@ -342,7 +342,7 @@ var form = new BottomItemSelectForm(); form.CancelCallEvent = false;//鍏佽鍙栨秷 - form.AddForm(title, listText, nowSelectNo); + form.AddForm(title, listText, null, nowSelectNo); form.FinishSelectEvent += (selectNo) => { if (selectNo == nowSelectNo) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBrightnessAdjustForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBrightnessAdjustForm.cs index ce40ff6..041add9 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBrightnessAdjustForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBrightnessAdjustForm.cs @@ -635,7 +635,7 @@ var form = new BottomItemSelectForm(); form.CancelCallEvent = false;//鍏佽鍙栨秷 - form.AddForm(title, listText, nowSelectNo); + form.AddForm(title, listText, null, nowSelectNo); form.FinishSelectEvent += (selectNo) => { if (selectNo == nowSelectNo) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs index 9ac4066..6148494 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs @@ -627,7 +627,7 @@ var form = new BottomItemSelectForm(); form.CancelCallEvent = false;//鍏佽鍙栨秷 - form.AddForm(title, listText, nowSelectNo); + form.AddForm(title, listText, null, nowSelectNo); form.FinishSelectEvent += (selectNo) => { if (selectNo == nowSelectNo) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorWorkModeMenuForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorWorkModeMenuForm.cs index 39ffcf6..70d9c84 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorWorkModeMenuForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorWorkModeMenuForm.cs @@ -132,7 +132,7 @@ row1.ButtonClickEvent += (sender, e) => { var form = new BottomItemSelectForm(); - form.AddForm(btnCaption1.Text, listSelect, this.pirConfigure.mode == 0 ? 1 : 0); + form.AddForm(btnCaption1.Text, listSelect, null, this.pirConfigure.mode == 0 ? 1 : 0); form.FinishSelectEvent += (value) => { this.isDataChanged = true; @@ -170,7 +170,7 @@ row2.ButtonClickEvent += (sender, e) => { var form = new BottomItemSelectForm(); - form.AddForm(btnCaption2.Text, listSelect, this.pirConfigure.type); + form.AddForm(btnCaption2.Text, listSelect, null, this.pirConfigure.type); form.FinishSelectEvent += (value) => { this.isDataChanged = true; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs index e3971b1..ce4b49b 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs @@ -106,7 +106,7 @@ rowBeloneArea.SelectRoomEvent += (roomKeys) => { //鍙樻洿缃戝叧鎴块棿 - HdlGatewayLogic.Current.ChangedGatewayRoom(this.zbGateway, roomKeys); + HdlGatewayLogic.Current.ChangedGatewayRoom(this.zbGateway.GwId, roomKeys); }; //鎵�灞炰綇瀹� @@ -355,10 +355,10 @@ /// 璁剧疆缃戝叧鍚嶅瓧 /// </summary> /// <param name="gatewayName">缃戝叧鍚嶇О</param> - private async void SetGatewayName(string gatewayName, bool closeForm) + private void SetGatewayName(string gatewayName, bool closeForm) { //淇敼缃戝叧鍚� - var result = await HdlGatewayLogic.Current.ReName(zbGateway, gatewayName); + var result = HdlGatewayLogic.Current.ReName(zbGateway, gatewayName); //缃戝叧淇敼澶辫触 if (result == false) { diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayProductInfoForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayProductInfoForm.cs index b509b41..ef5a516 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayProductInfoForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayProductInfoForm.cs @@ -140,7 +140,7 @@ rowBeloneArea.SelectRoomEvent += (roomKeys) => { //鍙樻洿缃戝叧鎴块棿 - HdlGatewayLogic.Current.ChangedGatewayRoom(this.zbGateway, roomKeys); + HdlGatewayLogic.Current.ChangedGatewayRoom(this.zbGateway.GwId, roomKeys); }; //瀹屾垚鍒濆鍖栨甯� @@ -220,12 +220,12 @@ /// </summary> /// <param name="gatewayName">缃戝叧鍚嶇О</param> /// <param name="closeForm">鍏抽棴鐣岄潰</param> - private async void SetGatewayName(string gatewayName, bool closeForm) + private void SetGatewayName(string gatewayName, bool closeForm) { //鎵撳紑杩涘害鏉� this.ShowProgressBar(); //淇敼鏈湴缃戝叧鍚� - var result = await HdlGatewayLogic.Current.ReName(zbGateway, gatewayName); + var result = HdlGatewayLogic.Current.ReName(zbGateway, gatewayName); //鍏抽棴杩涘害鏉� this.CloseProgressBar(); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewaySearchListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewaySearchListForm.cs index 03fad5d..ca44a7a 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewaySearchListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewaySearchListForm.cs @@ -120,23 +120,15 @@ //搴曠嚎 frameRow.frameTable.AddBottomLine(); } - frameRow.frameTable.ButtonClickEvent += (sender, e) => - { - var form = new GatewayProductInfoForm(); - form.AddForm(gateway); - }; - if (dicZbGatewayDiv[gwid] == 2) { - //鎹㈢粦 - var btnBind = new NormalViewControl(Application.GetRealWidth(184), frameRow.Height, false); - btnBind.BackgroundColor = 0xfffb744a; - btnBind.TextAlignment = TextAlignment.Center; - btnBind.TextColor = UserCenterColor.Current.White; - btnBind.TextSize = 12; - btnBind.TextID = R.MyInternationalizationString.uReBindAgain; - frameRow.AddRightView(btnBind); - btnBind.ButtonClickEvent += (sender, e) => + //闇�閲嶆柊缁戝畾 + frameRow.frameTable.AddMostRightView(Language.StringByID(R.MyInternationalizationString.uNeedToRebind), 300); + } + + frameRow.frameTable.ButtonClickEvent += (sender, e) => + { + if (dicZbGatewayDiv[gwid] == 2) { //纭缁戝畾鏃х綉鍏筹紵 string msg = Language.StringByID(R.MyInternationalizationString.uRebindGatewayMsg); @@ -145,8 +137,14 @@ var form = new GatewayRebindForm(); form.AddForm(gateway, dicZbGatewayDiv); }); - }; - } + } + else + { + var form = new GatewayProductInfoForm(); + form.AddForm(gateway); + } + }; + //瀹氫綅 var btnPosition = frameRow.AddEditorControl(false); btnPosition.TextID = R.MyInternationalizationString.uFixedPosition; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Guide/GuideCommonForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Guide/GuideCommonForm.cs index 04abc3d..2d00dab 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Guide/GuideCommonForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Guide/GuideCommonForm.cs @@ -37,7 +37,7 @@ /// </summary> public virtual void ShowFrom() { - Phone.MainPage.ListRoomViewFrom.Instance.CanClick = false; + Phone.MainPage.LeftListRoomViewFrom.Instance.CanClick = false; UserView.UserPage.Instance.AddChidren(this); this.BackgroundColor = Common.ZigbeeColor.Current.GXCGrayBackgroundColor; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Guide/GuideForm2.cs b/ZigbeeApp/Shared/Phone/UserCenter/Guide/GuideForm2.cs index 2242d3b..278d0dd 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Guide/GuideForm2.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Guide/GuideForm2.cs @@ -54,7 +54,7 @@ var btnKnwon = this.AddIKnwonButton(); btnKnwon.ButtonClickEvent += (sender, e) => { - Phone.MainPage.ListRoomViewFrom.Instance.CanClick = true; + Phone.MainPage.LeftListRoomViewFrom.Instance.CanClick = true; this.RemoveFromParent(); }; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlBackupListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlBackupListForm.cs index 8f5900b..c8a666e 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlBackupListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlBackupListForm.cs @@ -528,28 +528,6 @@ #region 鈻� 涓�鑸柟娉昣__________________________ /// <summary> - /// 鎶婃湰鍦版墍鏈夋枃浠剁Щ鍔ㄥ埌鑷姩澶囦唤鏂囦欢澶� - /// </summary> - private void CopyLocationAllFileToAutoBackDirectory() - { - List<string> listAllFile = Shared.Common.Global.FileListByHomeId(); - - string strroot = Common.Config.Instance.FullPath; - string autoPath = System.IO.Path.Combine(strroot, DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupDirectory); - foreach (string file in listAllFile) - { - //鍒ゆ柇鏄惁鏄簲璇ヤ笂浼犵殑鏂囦欢 - if (HdlBackupLogic.Current.IsNotUpLoadFile(file) == true) - { - continue; - } - string sourseName = System.IO.Path.Combine(strroot, file); - string newName = System.IO.Path.Combine(autoPath, file); - System.IO.File.Copy(sourseName, newName, true); - } - } - - /// <summary> /// 妫�娴嬪鑰冨悕绉� /// </summary> /// <param name="backName"></param> diff --git a/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionDirectoryListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionDirectoryListForm.cs index 43f19bc..7999dcc 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionDirectoryListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionDirectoryListForm.cs @@ -64,7 +64,7 @@ row1.ButtonClickEvent += (sender, e) => { var form = new HideOptionFileListForm(); - form.AddForm(UserCenterLogic.CombinePath()); + form.AddForm(Common.Config.Instance.FullPath); }; //鏌ョ湅鍏ㄩ儴鏂囦欢 @@ -84,10 +84,11 @@ private void AddRowControl(VerticalListControl listView, string directory, string directoryValue, bool addLine) { - string myPath = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, directoryValue); - if (directoryValue == DirNameResourse.LocalMemoryDirectory) + string localDir = DirNameResourse.LocalMemoryDirectory; + string myPath = System.IO.Path.Combine(localDir, directoryValue); + if (localDir.EndsWith(directoryValue) == true) { - myPath = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory); + myPath = localDir; } if (System.IO.Directory.Exists(myPath) == false) { diff --git a/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionFileListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionFileListForm.cs index 0f19b03..a4a3e23 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionFileListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionFileListForm.cs @@ -57,7 +57,7 @@ { this.ClearBodyFrame(); - var listAllFile = HdlAutoBackupLogic.GetFileFromDirectory(directory); + var listAllFile = HdlFileLogic.Current.GetFileFromDirectory(directory); listAllFile.Sort(); var listView = new VerticalListControl(23); @@ -90,7 +90,7 @@ } }); }; - if (directory == UserCenterLogic.CombinePath()) + if (directory == Common.Config.Instance.FullPath) { btnButon.CanClick = false; } @@ -118,12 +118,26 @@ } row1.frameTable.AddRightArrow(); + var btnUpLoad = row1.AddEditorControl(); + btnUpLoad.Text = "涓婁紶"; + btnUpLoad.ButtonClickEvent += (sender, e) => + { + this.ShowMassage(ShowMsgType.Confirm, "鏄惁涓婁紶璇ユ枃浠�(娴嬭瘯)?", () => + { + HdlThreadLogic.Current.RunThread(() => + { + string tagrtFile = System.IO.Path.Combine(directory, fileName); + HdlBackupLogic.Current.UpLoadByteDataToOptionBackup(fileName, HdlFileLogic.Current.ReadFileByteContent(tagrtFile)); + }); + }); + }; + var btnDelete = row1.AddDeleteControl(); btnDelete.ButtonClickEvent += (sender, e) => { this.ShowMassage(ShowMsgType.Confirm, "鏄惁娓呴櫎璇ョ紦瀛樻枃浠�", () => { - var myFile = UserCenterLogic.CombinePath(directory, fileName); + var myFile = System.IO.Path.Combine(Common.Config.Instance.FullPath, directory, fileName); try { System.IO.File.Delete(myFile); @@ -140,7 +154,7 @@ row1.frameTable.ButtonClickEvent += (sender, e) => { var form = new HideOptionFileContentForm(); - form.AddForm(UserCenterLogic.CombinePath(directory, fileName)); + form.AddForm(System.IO.Path.Combine(Common.Config.Instance.FullPath, directory, fileName)); }; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionMainForm.cs index 7bfb326..40234dc 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionMainForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionMainForm.cs @@ -76,29 +76,11 @@ this.AddNormalRowControl("Socket閾炬帴", 400, ZigBee.Common.Application.FindGateWaySocket.busSocket.Connected == true ? "true" : "false", 400); } - int count = HdlGatewayLogic.Current.GetAllLocalGateway().Count; + int count = ZbGateway.GateWayList.Count; var row1 = new FrameRowControl(listView.rowSpace / 2); listView.AddChidren(row1); row1.UseClickStatu = false; - row1.AddLeftCaption("鏈湴缃戝叧", 400); - if (count > 0) - { - row1.UseClickStatu = true; - row1.AddRightArrow(); - row1.ButtonClickEvent += (sender, e) => - { - var form = new HideOptionGatewayListForm(); - form.AddForm(1); - }; - } - row1.AddMostRightView(count + "涓�", 400); - row1.AddBottomLine(); - - count = ZigBee.Device.ZbGateway.GateWayList.Count; - row1 = new FrameRowControl(listView.rowSpace / 2); - listView.AddChidren(row1); - row1.UseClickStatu = false; - row1.AddLeftCaption("缂撳瓨涓殑缃戝叧", 400); + row1.AddLeftCaption("骞挎挱鍒扮殑缃戝叧", 400); if (count > 0) { row1.UseClickStatu = true; @@ -155,6 +137,7 @@ } else { + UserCenterResourse.HideOption.WriteSendAndReceveDataToFile = 0; btnSwitchLog.IsSelected = false; var txtvalue = HdlFileLogic.Current.ReadFileTextContent(DirNameResourse.SendAndReceveDataLog); if (txtvalue != null) @@ -165,6 +148,52 @@ form.SetTextContent(txtvalue); } } + }; + + row1 = new FrameRowControl(listView.rowSpace / 2); + listView.AddChidren(row1); + row1.AddLeftCaption("SocketReceive", 600); + row1.AddBottomLine(); + var btnSocketReceiveLog = row1.AddMostRightSwitchIcon(); + btnSocketReceiveLog.ButtonClickEvent += (sender, e) => + { + if (btnSocketReceiveLog.IsSelected == false) + { + this.ShowMassage(ShowMsgType.Confirm, "鏄惁鎵撳紑璁板綍SocketReceive鐨勮褰�?", () => + { + btnSocketReceiveLog.IsSelected = true; + HdlFileLogic.Current.DeleteFile(DirNameResourse.SocketReceiveDataLog); + UserCenterResourse.HideOption.WriteSocketReceiveDataToFile = 1; + }); + } + else + { + UserCenterResourse.HideOption.WriteSocketReceiveDataToFile = 0; + btnSocketReceiveLog.IsSelected = false; + var txtvalue = HdlFileLogic.Current.ReadFileTextContent(DirNameResourse.SocketReceiveDataLog); + if (txtvalue != null) + { + var form = new HideOptionFileContentForm(); + form.AddForm(string.Empty); + + form.SetTextContent(txtvalue); + } + } + }; + + row1 = new FrameRowControl(listView.rowSpace / 2); + listView.AddChidren(row1); + row1.AddLeftCaption("閲嶆柊鍒濆鍖朣ocket", 600); + row1.AddRightArrow(); + row1.AddBottomLine(); + row1.ButtonClickEvent += (sender, e) => + { + this.ShowMassage(ShowMsgType.Confirm, "鏄惁閲嶆柊鍒濆鍖朣ocket瀵硅薄?", () => + { + ZigBee.Common.Application.FindGateWaySocket.Stop(); + ZigBee.Common.Application.FindGateWaySocket.Start(); + this.ShowMassage(ShowMsgType.Tip, "鍒濆鍖栧畬鎴�"); + }); }; row1 = new FrameRowControl(listView.rowSpace / 2); @@ -282,10 +311,10 @@ /// </summary> public override void CloseFormBefore() { - Shared.Phone.UserCenter.UserCenterResourse.DicReceiveGatewayTest = null; + UserCenterResourse.DicReceiveGatewayTest = null; UserCenterResourse.HideOption.CheckCanReceiveGateway = 0; - UserCenterResourse.HideOption.WriteSendAndReceveDataToFile = 1; - + UserCenterResourse.HideOption.WriteSendAndReceveDataToFile = 0; + UserCenterResourse.HideOption.WriteSocketReceiveDataToFile = 0; base.CloseFormBefore(); } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs index 1809c0f..9d711f8 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs @@ -97,7 +97,7 @@ } listDirectory.Sort(); - listAllFile = HdlAutoBackupLogic.GetFileFromDirectory(directory.TrimEnd('/')); + listAllFile = HdlFileLogic.Current.GetFileFromDirectory(directory.TrimEnd('/')); listAllFile.Sort(); } @@ -185,6 +185,20 @@ } row1.frameTable.AddRightArrow(); + var btnUpLoad = row1.AddEditorControl(); + btnUpLoad.Text = "涓婁紶"; + btnUpLoad.ButtonClickEvent += (sender, e) => + { + this.ShowMassage(ShowMsgType.Confirm, "鏄惁涓婁紶璇ユ枃浠�(娴嬭瘯)?", () => + { + HdlThreadLogic.Current.RunThread(() => + { + string tagrtFile = System.IO.Path.Combine(directory, fileName); + HdlBackupLogic.Current.UpLoadByteDataToOptionBackup(fileName, HdlFileLogic.Current.ReadFileByteContent(tagrtFile)); + }); + }); + }; + var btnDelete = row1.AddDeleteControl(); btnDelete.ButtonClickEvent += (sender, e) => { diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs index 36ed38d..1f576c5 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs @@ -358,7 +358,7 @@ return; } pra.Account = dicMemberAccount[keys]; - var result = UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra); + var result = UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string> { "NotCheck" }); if (result == null) { continue; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs index edac8a3..27ccb52 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs @@ -416,7 +416,7 @@ { var pra = new AccountInfoPra(); pra.Account = memberInfo.Account; - var result = UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra); + var result = UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string> { "NotCheck" }); if (result == null) { return; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/EditorRoomInforForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/EditorRoomInforForm.cs index cd14c9d..af6cd06 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/EditorRoomInforForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/EditorRoomInforForm.cs @@ -306,12 +306,12 @@ if (changedFloor == false) { //鍒锋柊宸︽粦鐨勬埧闂村垪琛ㄧ晫闈㈢殑鎸囧畾鎴块棿鐨勪俊鎭� - MainPage.ListRoomViewFrom.Instance.RefreshRoomInfo(this.editorRoom); + MainPage.LeftListRoomViewFrom.Instance.RefreshRoomInfo(this.editorRoom); } else { //鍒锋柊宸︽粦鐨勬埧闂村垪琛ㄧ晫闈㈢殑鎴块棿鍒楄〃淇℃伅 - MainPage.ListRoomViewFrom.Instance.RefreshListRoom(); + MainPage.LeftListRoomViewFrom.Instance.RefreshListRoom(); } //绠椾簡,杩欓噷濡傛灉鎸変笅淇濆瓨,鍒欎富椤甸渶瑕侀噸鏂板埛鏂� diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/FloorListRoomForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/FloorListRoomForm.cs index 8dfdc85..3558710 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/FloorListRoomForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/FloorListRoomForm.cs @@ -19,10 +19,6 @@ /// 妤煎眰鐨勪富閿� /// </summary> private string floorKeys = string.Empty; - /// <summary> - /// 鎴块棿椤哄簭 - /// </summary> - private List<string> listRoomSort = new List<string>(); #endregion @@ -81,11 +77,6 @@ { //鑾峰彇妤煎眰鐨勬埧闂� var listRoom = HdlRoomLogic.Current.GetFloorSortRoom(this.floorKeys); - this.listRoomSort.Clear(); - for (int i = 0; i < listRoom.Count; i++) - { - this.listRoomSort.Add(listRoom[i].Id); - } this.listView.RemoveAll(); listView.Height = bodyFrameLayout.Height + Application.GetRealHeight(6); @@ -156,9 +147,6 @@ //璋冩暣楂樺害 frameRow.RemoveFromParent(); listView.AdjustRealHeight(Application.GetRealHeight(23)); - //淇濆瓨椤哄簭 - this.listRoomSort.Remove(room.Id); - HdlRoomLogic.Current.SaveRoomSort(floorKeys, this.listRoomSort); }); }; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs index 31d37fa..3300808 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs @@ -450,7 +450,7 @@ /// <param name="ResidenceName"></param> /// <param name="info"></param> /// <returns></returns> - private async void EditorResidenceName(string ResidenceName, Common.ResponseEntity.ResidenceObj info, NormalViewControl btnHome) + private void EditorResidenceName(string ResidenceName, Common.ResponseEntity.ResidenceObj info, NormalViewControl btnHome) { //妫�娴嬭兘鍚︿繚瀛樹綇瀹� if (this.CheckIsCanSaveResidence(info.Id, ResidenceName, true) == false) @@ -467,7 +467,7 @@ Pra.LoginAccessToken = Config.Instance.Token; //缂栬緫浣忓畢 - bool flage = UserCenterLogic.GetResultStatuByRequestHttps("App/EditHome", false, Pra); + bool flage = UserCenterLogic.GetResultStatuByRequestHttps("App/EditHome", false, Pra, new List<string> { "NotCheck" }); //鍏抽棴杩涘害鏉� this.CloseProgressBar(); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs index 09a400e..dee8d57 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs @@ -24,14 +24,6 @@ /// </summary> private VerticalFrameControl listBackContr = null; /// <summary> - /// 妤煎眰椤哄簭 - /// </summary> - private List<string> listFloorSort = new List<string>(); - /// <summary> - /// 鎴块棿椤哄簭 - /// </summary> - private List<string> listRoomSort = new List<string>(); - /// <summary> /// 褰撳墠APP鐨勪綇瀹呮ā寮� 0:杩樻病鏈夎缃湁妯″紡 1:妤煎眰妯″紡 2:娌℃湁妤煎眰妯″紡 /// </summary> private int AppResidenceMode = 0; @@ -282,23 +274,17 @@ { //鑾峰彇妤煎眰 var dicFloor = HdlRoomLogic.Current.GetFloorSortList(); - this.listFloorSort.Clear(); - foreach (string keys in dicFloor.Keys) - { - listFloorSort.Add(keys); - } - - if (Common.Config.Instance.Home.FloorDics.Count == 0) + if (dicFloor.Count == 0) { return; } HdlThreadLogic.Current.RunMainInThread(() => { - int count = listFloorSort.Count - 1; - for (int i = 0; i < listFloorSort.Count; i++) + int count = dicFloor.Count; + foreach (var keys in dicFloor.Keys) { - string keys = listFloorSort[i]; - this.AddFloorRow(keys, dicFloor[keys], i != count); + count--; + this.AddFloorRow(keys, dicFloor[keys], count != 0); } //璋冩暣鎺т欢楂樺害 this.AdjustContrlTableHeight(); @@ -392,9 +378,6 @@ HdlRoomLogic.Current.RemoveRoom(roomId); } Common.Config.Instance.Home.Save(); - //淇濆瓨椤哄簭 - listFloorSort.Remove(keys); - HdlRoomLogic.Current.SaveFloorSort(listFloorSort); if (Common.Config.Instance.Home.FloorDics.Count == 0) { @@ -540,12 +523,6 @@ { //鑾峰彇妤煎眰鐨勬埧闂� var listRoom = HdlRoomLogic.Current.GetFloorSortRoom(string.Empty); - this.listRoomSort.Clear(); - for (int i = 0; i < listRoom.Count; i++) - { - this.listRoomSort.Add(listRoom[i].Id); - } - for (int i = 0; i < listRoom.Count; i++) { //娣诲姞鎴块棿琛� @@ -593,7 +570,6 @@ //濡傛灉鏄垎浜殑鎴块棿锛屼笉鑳界紪杈戝拰淇敼 return; } - //缂栬緫 var btnEditor = frameRow.AddEditorControl(); btnEditor.ButtonClickEvent += (sender, e) => @@ -614,9 +590,6 @@ this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uDeleteRoomMsg), () => { HdlRoomLogic.Current.RemoveRoom(room.Id); - //淇濆瓨椤哄簭 - this.listRoomSort.Remove(room.Id); - HdlRoomLogic.Current.SaveRoomSort(string.Empty, this.listRoomSort); var listAllRoom = HdlRoomLogic.Current.GetAllListRooms(); if (listAllRoom.Count <= 1) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs index 88f393c..419cc54 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs @@ -166,8 +166,12 @@ { continue; } - var sceneUi = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.SceneUI>(System.Text.Encoding.UTF8.GetString(byteData)); - listScene.Add(sceneUi); + try + { + var sceneUi = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.SceneUI>(System.Text.Encoding.UTF8.GetString(byteData)); + listScene.Add(sceneUi); + } + catch { } } if (listScene.Count == 0) { @@ -449,11 +453,15 @@ } //浠庡垎浜枃浠朵腑搴忓垪鍖栧洖鏉� var deviceData = HdlShardLogic.Current.GetShardFileContent(deviceFile); - var device = ZigBee.Device.CommonDevice.CommonDeviceByByteString(strArry[1], System.Text.Encoding.UTF8.GetString(deviceData)); - if (device != null) + try { - listDevice.Add(device); + var device = ZigBee.Device.CommonDevice.CommonDeviceByByteString(strArry[1], System.Text.Encoding.UTF8.GetString(deviceData)); + if (device != null) + { + listDevice.Add(device); + } } + catch { } } } return listDevice; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedListRoomForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedListRoomForm.cs index 911fad6..7feed80 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedListRoomForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedListRoomForm.cs @@ -276,6 +276,7 @@ continue; } var device = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice>(System.Text.Encoding.UTF8.GetString(byteData)); + device.Type = (DeviceType)device.DeviceID; listDevice.Add(device); } //鑾峰彇鍏ㄩ儴鍦烘櫙 diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Suggestion/FeedbackForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Suggestion/FeedbackForm.cs index 66bb4c1..2e36d6f 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Suggestion/FeedbackForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Suggestion/FeedbackForm.cs @@ -242,13 +242,7 @@ this.UploadSuggestion(txtInput.Text, txtEmail.Text); }; - - var strFile = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Common.Config.Instance.Guid, DirNameResourse.SuggestionFile); - if (System.IO.File.Exists(strFile) == false) - { - return; - } - var data = UserCenterLogic.LoadFileContent(strFile); + var data = HdlFileLogic.Current.ReadFileTextContent(DirNameResourse.SuggestionFile); if (data != null) { var strNowData = DateTime.Now.ToString("yyyyMMdd"); @@ -292,10 +286,8 @@ { //淇濆瓨娆℃暟 this.suggestionCount--; - var strFile = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Common.Config.Instance.Guid, DirNameResourse.SuggestionFile); - var byteData = System.Text.Encoding.UTF8.GetBytes(this.suggestionCount + DateTime.Now.ToString("yyyyMMdd")); //鍐欏叆鍐呭 - Shared.IO.FileUtils.WriteFileByBytes(strFile, byteData); + HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SuggestionFile, this.suggestionCount + DateTime.Now.ToString("yyyyMMdd")); HdlThreadLogic.Current.RunMain(() => { diff --git a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs index 86a34af..a2fb881 100755 --- a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs +++ b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs @@ -66,6 +66,7 @@ BackgroundColor = Shared.Common.ZigbeeColor.Current.MainColor; Shared.Application.LocationAction += (lon, lat) => { + //涓婃姤缁忕含搴� Login.AccountLogic.Instance.ReceiveAppLatAndLon(lon.ToString(), lat.ToString()); }; } diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs b/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs index f2f87b9..002e5a4 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs @@ -32,7 +32,10 @@ { return; } - isInited = true; + isInited = true; + + //鍒濆鍖朣ocket + FindGateWaySocket.Start(); new System.Threading.Thread(async () => { @@ -96,7 +99,6 @@ var broadcastIpAddress = new Shared.Net.NetWiFi().BroadcastIpAddress; - if (Shared.Application.IsWifi) { if (0 < gateWayList.Count) @@ -151,11 +153,7 @@ FindGateWaySocket.BeginSend(new System.Net.IPEndPoint(broadcastIpAddress, 7624), broadBytes); } } - catch - { - //鍏抽棴Socket,涓嬫鍙戦�佷細鑷姩杩炴帴 - FindGateWaySocket.Stop(); - } + catch{} System.Threading.Thread.Sleep(500); } }) @@ -173,7 +171,6 @@ var bytes = new byte[1024]; var len = FindGateWaySocket.busSocket.Receive(bytes, bytes.Length, System.Net.Sockets.SocketFlags.None); - if (bytes[43] == 0xA2) { //骞挎挱鍥炲缃戝叧鐨勫熀鏈俊鎭鐞� @@ -281,12 +278,17 @@ } } } + else + { + //璋冭瘯鐢� + if (Shared.Phone.UserCenter.UserCenterResourse.HideOption.WriteSocketReceiveDataToFile == 1) + { + var data33 = Encoding.UTF8.GetString(bytes).Replace("锟�)", string.Empty).TrimStart('\0').TrimEnd('\0'); + Shared.Phone.UserCenter.HdlLogLogic.Current.WriteLog(3, data33); + } + } } - catch - { - //鍏抽棴Socket,涓嬫鍙戦�佷細鑷姩杩炴帴 - FindGateWaySocket.Stop(); - } + catch{} } #endregion } @@ -387,10 +389,20 @@ { try { - Start(7624); - busSocket.BeginSendTo(bytes, 0, bytes.Length, SocketFlags.None, iPEndPoint, new AsyncCallback(asyncEndSend), null); + if (IsRunning) + { + busSocket.BeginSendTo(bytes, 0, bytes.Length, SocketFlags.None, iPEndPoint, new AsyncCallback(asyncEndSend), null); + } + } - catch { } + catch (Exception ex) + { + //璋冭瘯鐢� + if (Shared.Phone.UserCenter.UserCenterResourse.HideOption.WriteSocketReceiveDataToFile == 1) + { + Shared.Phone.UserCenter.HdlLogLogic.Current.WriteLog(3, "鍙戦�佸紓甯�(BeginSendTo)\r\n" + ex.Message); + } + } } /// <summary> @@ -403,7 +415,14 @@ { int bytesSent = busSocket.EndSendTo(iar); } - catch { } + catch(Exception ex) + { + //璋冭瘯鐢� + if (Shared.Phone.UserCenter.UserCenterResourse.HideOption.WriteSocketReceiveDataToFile == 1) + { + Shared.Phone.UserCenter.HdlLogLogic.Current.WriteLog(3, "寮傛鍙戦�佺粨鏉熷紓甯�(asyncEndSend)\r\n" + ex.Message); + } + } } } } diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Common/Global.cs b/ZigbeeApp/Shared/Phone/ZigBee/Common/Global.cs index 633fda0..4a7371a 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Common/Global.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Common/Global.cs @@ -96,118 +96,6 @@ System.IO.Directory.CreateDirectory(path); } } - - /// <summary> - /// 鍦ㄥ綋鍓嶄綇瀹呮枃浠跺す涓嬪垱寤轰竴涓┖鐨勬枃浠跺す锛坱z) - /// </summary> - /// <param name="directoryName">闇�瑕佸垱寤虹殑鏂囦欢澶瑰悕瀛�</param> - /// <param name="clear">濡傛灉鏂囦欢澶瑰瓨鍦紝鏄惁闇�瑕佹竻绌烘枃浠跺す</param> - public static void CreateEmptyDirectory(string directoryName, bool clear = false) - { - string creatName = Config.Instance.FullPath; - creatName = System.IO.Path.Combine(creatName, directoryName); - if (!System.IO.Directory.Exists(creatName)) - { - System.IO.Directory.CreateDirectory(creatName); - } - else if (clear == true) - { - //濡傛灉瀛樺湪锛屽垯娓呯┖鍏ㄩ儴鏂囦欢 - var files = System.IO.Directory.GetFiles(creatName); - foreach (var file in files) - { - System.IO.File.Delete(file); - } - } - } - - /// <summary> - /// 灏嗕俊鎭啓鍏ユ寚瀹氱殑鏂囦欢澶归噷(鏍圭洰褰曚负褰撳墠浣忓畢鐨勬枃浠跺す)(tz) - /// </summary> - /// <param name="directoryName">鎸囧畾鐨勬枃浠跺す璺緞</param> - /// <param name="fileName">鏂囦欢鍚�</param> - /// <param name="bytes">鍐呭</param> - public static void WriteFileToDirectoryByBytes(string directoryName, string fileName, byte[] bytes) - { - //鍏堝幓鍒涘缓瀹冨惂 - Global.CreateEmptyDirectory(directoryName); - - //鎷兼帴璺緞 - string fullName = Config.Instance.FullPath; - fullName = System.IO.Path.Combine(fullName, directoryName); - fullName = System.IO.Path.Combine(fullName, fileName); - //鍐欏叆鍐呭 - Shared.IO.FileUtils.WriteFileByBytes(fullName, bytes); - } - - /// <summary> - /// 璇诲彇鎸囧畾鐨勬枃浠跺す閲岀殑鎸囧畾鐨勬枃浠�(鏍圭洰褰曚负褰撳墠浣忓畢鐨勬枃浠跺す)(tz) - /// </summary> - /// <param name="directoryName">鎸囧畾鐨勬枃浠跺す璺緞</param> - /// <param name="fileName">鏂囦欢鍚�</param> - public static byte[] ReadFileByDirectory(string directoryName, string fileName) - { - //鎷兼帴璺緞 - string fullName = Config.Instance.FullPath; - fullName = System.IO.Path.Combine(fullName, directoryName); - fullName = System.IO.Path.Combine(fullName, fileName); - if (System.IO.File.Exists(fullName) == false) - { - return null; - } - return Shared.IO.FileUtils.ReadFile(fullName); - } - - /// <summary> - /// 绉诲姩鏂囦欢(tz) - /// </summary> - /// <param name="oldFile">闇�瑕佺Щ鍔ㄧ殑鏂囦欢(FullName)</param> - /// <param name="newFile">瑕佺Щ鍔ㄥ埌鐨勪綅缃�(FullName)</param> - public static void MoveFileToDirectory(string oldFile, string newFile) - { - //鍏堝垹闄� - if (System.IO.File.Exists(newFile) == true) - { - System.IO.File.Delete(newFile); - } - System.IO.File.Move(oldFile, newFile); - } - - /// <summary> - /// 灏嗘寚瀹氭枃浠跺す閲岄潰鐨勫叏閮ㄦ枃浠剁Щ鍔ㄥ埌褰撳墠浣忓畢鐨勬枃浠跺す鍐�(tz) - /// </summary> - /// <param name="directory"></param> - /// <param name="deleteDirectory">澶勭悊瀹屼箣鍚庯紝鏄惁鎶婃枃浠跺す鍒犻櫎</param> - public static void MoveDirectoryFileToHomeDirectory(string directory, bool deleteDirectory = false) - { - string rootPath = Config.Instance.FullPath; - string fulldirectory = System.IO.Path.Combine(rootPath, directory); - - if (System.IO.Directory.Exists(fulldirectory) == false) - { - return; - } - - var files = System.IO.Directory.GetFiles(fulldirectory); - var listFile = new List<string>(); - foreach (var file in files) - { - var f = file.Substring(fulldirectory.Length + 1); - listFile.Add(f); - } - - foreach (var file in listFile) - { - string oldFile = System.IO.Path.Combine(fulldirectory, file); - string newFile = System.IO.Path.Combine(rootPath, file); - //绉诲姩鏂囦欢 - Global.MoveFileToDirectory(oldFile, newFile); - } - if (deleteDirectory == true) - { - System.IO.Directory.Delete(fulldirectory); - } - } } } diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs index 408e3d2..9ff57e4 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs @@ -2485,7 +2485,7 @@ MainAccountId = Config.Instance.Home.MainUserDistributedMark, SharedHid = Config.Instance.Home.Id }; - var resultData = Shared.Phone.UserCenter.UserCenterLogic.GetByteResponseDataByRequestHttps("App/GetSharedHomeApiControl", false, pra); + var resultData = Shared.Phone.UserCenter.UserCenterLogic.GetByteResponseDataByRequestHttps("App/GetSharedHomeApiControl", false, pra, new List<string> { "NotCheck" }); if (resultData == null) { return; diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGatewayData.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGatewayData.cs index f7b8d43..ab48517 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGatewayData.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGatewayData.cs @@ -46,7 +46,7 @@ /// </summary> public long GwVersionDate = 0; /// <summary> - ///Linux缃戝叧绫诲瀷 + ///Linux缃戝叧绫诲瀷(涔熷彨缃戝叧闀滃儚绫诲瀷) /// </summary> public int LinuxImageType = -1; /// <summary> @@ -66,7 +66,7 @@ /// </summary> public int CoordinatorFirmwareVersion = -1; /// <summary> - /// 鍗忚皟鍣ㄩ暅鍍廔D(涔熷彨缃戝叧闀滃儚绫诲瀷) + /// 鍗忚皟鍣ㄩ暅鍍廔D /// </summary> public int CoordinatorImageId = -1; /// <summary> diff --git a/ZigbeeApp/Shared/R.cs b/ZigbeeApp/Shared/R.cs index 448024f..d78def6 100755 --- a/ZigbeeApp/Shared/R.cs +++ b/ZigbeeApp/Shared/R.cs @@ -5797,7 +5797,14 @@ /// 璁剧疆璁惧鍔熻兘绫诲瀷澶辫触 /// </summary> public const int uSetDeviceFunctionTypeFail = 16134; - + /// <summary> + /// 鑾峰彇鍦烘櫙鍒楄〃澶辫触,缃戝叧鍥炲瓒呮椂 + /// </summary> + public const int uGetSceneListFailAndTimeOut = 16135; + /// <summary> + /// 闇�閲嶆柊缁戝畾 + /// </summary> + public const int uNeedToRebind = 16136; diff --git a/ZigbeeApp/Shared/Shared.projitems b/ZigbeeApp/Shared/Shared.projitems index 7976e40..4d5db96 100755 --- a/ZigbeeApp/Shared/Shared.projitems +++ b/ZigbeeApp/Shared/Shared.projitems @@ -73,7 +73,6 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\RoomView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\SceneCategoryView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\SelectTime.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\SelectZone.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\TopFrameLayout.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\AddLogicPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\AddScenePage.cs" /> @@ -472,7 +471,7 @@ <Compile Include="$(MSBuildThisFileDirectory)Common\ResponseEntity\UserLoginRes.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Common\SendDataToServer.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Common\Room.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\ListRoomViewFrom.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\LeftListRoomViewFrom.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Residence\SelectLocalRoomImageForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Controls\CompoundControls\ProgressBar.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Controls\CompoundControls\SearchEditText.cs" /> -- Gitblit v1.8.0