From 488efb508eb0648773fe7b68e810e04bcd7ca075 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期五, 11 十二月 2020 15:58:15 +0800 Subject: [PATCH] 20201211 --- HDL-ON_iOS/ViewController.cs | 7 HDL_ON/UI/UI2/1-HomePage/HomePage.cs | 16 HDL_ON/DAL/DriverLayer/Control_TcpServer.cs | 2 HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockPasswordPage.cs | 48 HDL_ON/UI/UI0-Public/AppUnlockPage.cs | 38 HDL-ON_iOS/AppDelegate.cs | 4 HDL_ON/DAL/Mqtt/MqttClient.cs | 8 HDL_ON/Entity/UserInfo.cs | 53 HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs | 2 HDL-ON_iOS/Resources/Language.ini | 2 HDL_ON/DAL/Mqtt/MqttInfoConfig.cs | 4 HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs | 6 HDL_ON/Common/HDLCommon.cs | 58 HDL_ON/Entity/Room.cs | 34 .vs/HDL_APP_Project/xs/UserPrefs.xml | 49 + HDL_ON/DAL/DriverLayer/Control.cs | 6 HDL_ON/UI/MainPage.cs | 105 +- HDL_ON/UI/UI1-Login/LoginPage.cs | 2 HDL-ON_Android/Application.cs | 2 HDL_ON/Entity/Function/Scene.cs | 11 HDL_ON/DAL/FileUtils.cs | 840 ++++++++++++------------ HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs | 32 HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs | 77 + HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs | 2 HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs | 80 +- HDL_ON/UI/UI1-Login/LoginPageBLL.cs | 20 HDL_ON/Entity/DB_ResidenceData.cs | 18 HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs | 6 HDL_ON/Common/ImageUtlis.cs | 16 HDL_ON/Common/FileUtlis.cs | 205 +++++ HDL_ON/Entity/FunctionList.cs | 48 HDL_ON/Entity/Function/Function.cs | 4 HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs | 132 +- HDL_ON/Entity/OnAppConfig.cs | 39 HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs | 2 HDL_ON/Common/R.cs | 2 HDL_ON/DAL/Server/HttpServerRequest.cs | 12 HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/RoomBinglingFloorPage.cs | 2 HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPage.cs | 2 HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs | 2 HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockGesturePage.cs | 62 HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPage.cs | 34 43 files changed, 1,176 insertions(+), 920 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index b893560..8a03ad3 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -1,35 +1,60 @@ 锘�<Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default"> <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.6242be7109c740c6cb8999a8904b6e0ea8d45192" /> - <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/DAL/FileUtils.cs"> + <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/Common/ImageUtlis.cs"> <Files> - <File FileName="HDL_ON/UI/MainPage.cs" Line="170" Column="26" /> - <File FileName="HDL_ON/Common/FileUtlis.cs" Line="1" Column="1" /> - <File FileName="HDL_ON/DAL/FileUtils.cs" Line="24" Column="25" /> - <File FileName="HDL_ON/DAL/Mqtt/MqttInfoConfig.cs" Line="27" Column="51" /> + <File FileName="HDL_ON/UI/MainPage.cs" Line="106" Column="40" /> + <File FileName="HDL_ON/Entity/DB_ResidenceData.cs" Line="100" Column="1" /> + <File FileName="HDL_ON/Entity/UserInfo.cs" Line="172" Column="9" /> + <File FileName="HDL_ON/Entity/Room.cs" Line="505" Column="49" /> + <File FileName="HDL_ON/Entity/Function/Scene.cs" Line="30" Column="81" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs" Line="45" Column="14" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs" Line="405" Column="10" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs" Line="160" Column="126" /> + <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs" Line="236" Column="26" /> + <File FileName="HDL_ON/UI/UI1-Login/LoginPage.cs" Line="195" Column="50" /> + <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="317" Column="68" /> + <File FileName="HDL_ON/Entity/FunctionList.cs" Line="607" Column="26" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs" Line="481" Column="10" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListEditPage.cs" Line="25" Column="21" /> + <File FileName="HDL_ON/Common/ImageUtlis.cs" Line="1" Column="1" /> </Files> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> <Node name="HDL_APP_Project" expanded="True"> <Node name="HDL_ON" expanded="True"> - <Node name="Common" expanded="True" /> + <Node name="Common" expanded="True"> + <Node name="ImageUtlis.cs" selected="True" /> + </Node> <Node name="DAL" expanded="True"> + <Node name="DriverLayer" expanded="True" /> <Node name="Mqtt" expanded="True" /> <Node name="Server" expanded="True" /> - <Node name="FileUtils.cs" selected="True" /> </Node> - <Node name="Entity" expanded="True" /> + <Node name="Entity" expanded="True"> + <Node name="Function" expanded="True" /> + </Node> <Node name="UI" expanded="True"> - <Node name="BindingResidence" expanded="True" /> <Node name="UI0-Public" expanded="True" /> <Node name="UI1-Login" expanded="True" /> <Node name="UI2" expanded="True"> + <Node name="1-HomePage" expanded="True" /> + <Node name="3-Intelligence" expanded="True"> + <Node name="Scene" expanded="True" /> + </Node> <Node name="4-PersonalCenter" expanded="True"> - <Node name="AccountBindInfo" expanded="True" /> + <Node name="RoomListManage" expanded="True"> + <Node name="AddRoom" expanded="True" /> + </Node> + <Node name="UnlockSetting" expanded="True" /> + </Node> + <Node name="FuntionControlView" expanded="True"> + <Node name="EnvironmentalScience" expanded="True" /> </Node> </Node> </Node> </Node> + <Node name="HDL-ON_Android" expanded="True" /> <Node name="HDL-ON_iOS" expanded="True"> <Node name="Resources" expanded="True" /> </Node> @@ -48,10 +73,6 @@ <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" /> <MonoDevelop.Ide.DebuggingService.Breakpoints> <BreakpointStore> - <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Mqtt/MqttClient.cs" relfile="HDL_ON/DAL/Mqtt/MqttClient.cs" line="529" column="1" /> - <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL-ON_iOS/ViewController.cs" relfile="HDL-ON_iOS/ViewController.cs" line="87" column="1" /> - <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL-ON_iOS/ViewController.cs" relfile="HDL-ON_iOS/ViewController.cs" line="75" column="1" /> - <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/Function/Scene.cs" relfile="HDL_ON/Entity/Function/Scene.cs" line="267" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/Function/Function.cs" relfile="HDL_ON/Entity/Function/Function.cs" line="292" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs" line="449" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs" line="526" column="1" /> diff --git a/HDL-ON_Android/Application.cs b/HDL-ON_Android/Application.cs index 7317bbb..41c3685 100644 --- a/HDL-ON_Android/Application.cs +++ b/HDL-ON_Android/Application.cs @@ -81,7 +81,7 @@ { Console.WriteLine("HHH 缃戠粶鍙樺寲浣嗗浜庡悗鍙�"); } - + MainPage.InternetStatus = obj; }; }; BaseActivity.RefreshUIAction += (activity) => diff --git a/HDL-ON_iOS/AppDelegate.cs b/HDL-ON_iOS/AppDelegate.cs index c1567e0..480e78e 100644 --- a/HDL-ON_iOS/AppDelegate.cs +++ b/HDL-ON_iOS/AppDelegate.cs @@ -165,7 +165,7 @@ public override void OnResignActivation(UIApplication application) { Console.WriteLine("OnResignActivation"); - OnAppConfig.Instance.unlockTime = DateTime.Now; + UserInfo.Current.unlockTime = DateTime.Now; HDL_ON.DriverLayer.UdpSocket._BusSocket.Stop(); } @@ -195,7 +195,7 @@ { Console.WriteLine("OnActivated"); base.OnActivated(application); - + Console.WriteLine("oooo..."); //if (haveToSignOut == true) //{ ////寮哄埗涓嬬嚎 diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index c186fae..0536c30 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -390,6 +390,8 @@ 368=娆㈣繋浣跨敤ON+ 369=娣诲姞鏂颁綇瀹� 370=鎴愪负瀹跺涵鎴愬憳 +371=鍔熻兘鏃犳硶浣跨敤锛岃缁戝畾缃戝叧 +372=鏃犳硶鍒涘缓鍦烘櫙锛岃缁戝畾缃戝叧 5000=闊充箰 5001=缁勫悎 diff --git a/HDL-ON_iOS/ViewController.cs b/HDL-ON_iOS/ViewController.cs index 2f9ac1c..cc678f3 100644 --- a/HDL-ON_iOS/ViewController.cs +++ b/HDL-ON_iOS/ViewController.cs @@ -15,7 +15,7 @@ base.ViewDidLoad(); - if (string.IsNullOrEmpty(OnAppConfig.Instance.SetLanguage)) + if (string.IsNullOrEmpty(UserInfo.Current.SetLanguage)) { if (NSLocale.PreferredLanguages[0].Contains("zh-")) { @@ -32,7 +32,7 @@ } else { - Language.CurrentLanguage = OnAppConfig.Instance.SetLanguage; + Language.CurrentLanguage = UserInfo.Current.SetLanguage; } HDL_ON.MainPage.Show(); @@ -77,14 +77,17 @@ { Control.Ins.GatewayOnline = false; Control.Ins.IsRemote = false; + MainPage.InternetStatus = 0; } else if (internetStatus == NetworkStatus.ReachableViaCarrierDataNetwork)//3,4G鐨勭綉缁滆繛鎺� 1 { Control.Ins.SearchLoaclGateway(); + MainPage.InternetStatus = 1; } else if (internetStatus == NetworkStatus.ReachableViaWiFiNetwork) { Control.Ins.SearchLoaclGateway(); + MainPage.InternetStatus = 2; } } } diff --git a/HDL_ON/Common/FileUtlis.cs b/HDL_ON/Common/FileUtlis.cs index 013e023..60198fe 100644 --- a/HDL_ON/Common/FileUtlis.cs +++ b/HDL_ON/Common/FileUtlis.cs @@ -5,7 +5,7 @@ namespace HDL_ON.Common { - public class FileUtlis + public class FileUtlis { static Common.FileUtlis _temp; public static Common.FileUtlis Files @@ -23,6 +23,22 @@ /// 鏍圭洰褰� /// </summary> string RootPath = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "/"; + + string accountPath; + string AccountPath { + get + { + if (string.IsNullOrEmpty(accountPath) || !accountPath.Contains(UserInfo.Current.ID)) + { + accountPath = Path.Combine(RootPath, UserInfo.Current.CurReginID); + if (!Directory.Exists(accountPath)) + { + Directory.CreateDirectory(accountPath); + } + } + return accountPath + "/"; + } + } /// <summary> /// 浣忓畢鏂囦欢澶硅矾寰� /// </summary> @@ -31,9 +47,9 @@ { get { - if (string.IsNullOrEmpty(regionPath)) + if (string.IsNullOrEmpty(regionPath) || !regionPath.Contains(UserInfo.Current.CurReginID )) { - regionPath = Path.Combine(RootPath, DB_ResidenceData.residenceData.CurReginID); + regionPath = Path.Combine(AccountPath, UserInfo.Current.CurReginID); if (!Directory.Exists(regionPath)) { Directory.CreateDirectory(regionPath); @@ -42,15 +58,15 @@ return regionPath + "/"; } } + + /// <summary> - /// 鐢ㄦ埛淇℃伅璺緞 + /// 鏂囦欢鏄惁瀛樺湪 /// </summary> - string userInfoPath + /// <param name="filePath">File path.</param> + public bool Exists(string filePath) { - get - { - return "UserInfo_File"; - } + return File.Exists(Path.Combine(Files.RootPath, filePath)); } /// <summary> @@ -133,6 +149,177 @@ } } } + /// <summary> + /// 璇诲彇userInfo鏂囦欢 + /// </summary> + /// <returns></returns> + public byte[] ReadUserInfo() + { + var fileName = "UserInfo_File"; + FileStream fs = null; + try + { + if (File.Exists(Path.Combine(RootPath, fileName))) + { + fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Open, FileAccess.Read); + } + else if (File.Exists(fileName)) + { + fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); + } + else + { + return new byte[0]; + } + byte[] bytes = new byte[fs.Length]; + fs.Read(bytes, 0, bytes.Length); + return bytes; + } + catch + { + return new byte[0]; + } + finally + { + try + { + if (fs != null) + { + fs.Close(); + } + } + catch + { + + } + } + + } + /// <summary> + /// 淇濆瓨userInfo + /// </summary> + /// <param name="bytes"></param> + /// <returns></returns> + public bool WirteUserinfo(byte[] bytes) + { + var fileName = "UserInfo_File"; + FileStream fs = null; + + try + { + fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Create, FileAccess.Write); + fs.Write(bytes, 0, bytes.Length); + fs.Flush(); + MainPage.Log("SaveFile:" + fileName); + return true; + } + catch (Exception ex) + { + MainPage.Log("FileUtiles Code 113:" + ex.ToString()); + return false; + } + finally + { + try + { + if (fs != null) + { + fs.Close(); + } + } + catch (Exception ex) + { + MainPage.Log("FileUtils Code 121 :" + ex.ToString()); + } + } + } + + /// <summary> + /// 璇诲彇userInfo鏂囦欢 + /// </summary> + /// <returns></returns> + public byte[] ReadAppConfig() + { + var fileName = "OnAppConfig"; + FileStream fs = null; + try + { + if (File.Exists(Path.Combine(AccountPath, fileName))) + { + fs = new FileStream(Path.Combine(AccountPath, fileName), FileMode.Open, FileAccess.Read); + } + else if (File.Exists(fileName)) + { + fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); + } + else + { + return new byte[0]; + } + byte[] bytes = new byte[fs.Length]; + fs.Read(bytes, 0, bytes.Length); + return bytes; + } + catch + { + return new byte[0]; + } + finally + { + try + { + if (fs != null) + { + fs.Close(); + } + } + catch + { + + } + } + + } + /// <summary> + /// 淇濆瓨userInfo + /// </summary> + /// <param name="bytes"></param> + /// <returns></returns> + public bool WirteAppConfig(byte[] bytes) + { + var fileName = "OnAppConfig"; + FileStream fs = null; + + try + { + fs = new FileStream(Path.Combine(AccountPath, fileName), FileMode.Create, FileAccess.Write); + fs.Write(bytes, 0, bytes.Length); + fs.Flush(); + MainPage.Log("SaveFile:" + fileName); + return true; + } + catch (Exception ex) + { + MainPage.Log("FileUtiles Code 113:" + ex.ToString()); + return false; + } + finally + { + try + { + if (fs != null) + { + fs.Close(); + } + } + catch (Exception ex) + { + MainPage.Log("FileUtils Code 121 :" + ex.ToString()); + } + } + } + + public byte[] ReadFile(string fileName) { diff --git a/HDL_ON/Common/HDLCommon.cs b/HDL_ON/Common/HDLCommon.cs index 7656e26..963549a 100644 --- a/HDL_ON/Common/HDLCommon.cs +++ b/HDL_ON/Common/HDLCommon.cs @@ -223,20 +223,20 @@ #endregion - /// <summary> - /// 鎭㈠浣忓畢 - /// 2020-12-03 寰呮祴璇曟湭妫�娴� - /// </summary> - public void RestoreHomeBackup(string RegionID) - { - var isExist = FileUtils.ExistRegion(RegionID); - if (isExist) - { - //瀛樺湪鍒欐仮澶� - string newRegionRootPath = FileUtils.CreateRegionBackup(RegionID); - FileUtils.RestoreRegionFiles(newRegionRootPath); - } - } + ///// <summary> + ///// 鎭㈠浣忓畢 + ///// 2020-12-03 寰呮祴璇曟湭妫�娴� + ///// </summary> + //public void RestoreHomeBackup(string RegionID) + //{ + // var isExist = FileUtils.ExistRegion(RegionID); + // if (isExist) + // { + // //瀛樺湪鍒欐仮澶� + // string newRegionRootPath = FileUtils.CreateRegionBackup(RegionID); + // FileUtils.RestoreRegionFiles(newRegionRootPath); + // } + //} #region 鈻� 鎺ㄩ�佸鐞哶______________________ /// <summary> @@ -297,20 +297,20 @@ try { #region 淇濆瓨鏈湴鏁版嵁鑷虫枃浠跺す - string oldRegionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID.ToString()); - //娓呯┖涔嬪墠鐨勪綇瀹呮枃浠� - FileUtils.DeleteRegionFiles(oldRegionRootPath); - var backuplist = FileUtils.ReadFiles(); - //绉诲姩鏂囦欢 - foreach (var fileName in backuplist) - { - System.IO.FileInfo fileInfo = new System.IO.FileInfo(FileUtils.RootPath + fileName); - if (fileInfo.Exists) - { - fileInfo.MoveTo(oldRegionRootPath + fileName); - MainPage.Log("move file : " + fileName); - } - } + //string oldRegionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID.ToString()); + ////娓呯┖涔嬪墠鐨勪綇瀹呮枃浠� + //FileUtils.DeleteRegionFiles(oldRegionRootPath); + //var backuplist = FileUtils.ReadFiles(); + ////绉诲姩鏂囦欢 + //foreach (var fileName in backuplist) + //{ + // System.IO.FileInfo fileInfo = new System.IO.FileInfo(FileUtils.RootPath + fileName); + // if (fileInfo.Exists) + // { + // fileInfo.MoveTo(oldRegionRootPath + fileName); + // MainPage.Log("move file : " + fileName); + // } + //} #endregion } catch (Exception ex) @@ -319,7 +319,7 @@ } finally { - FileUtils.DeleteAllFile(); + //FileUtils.DeleteAllFile(); //2.娉ㄩ攢鎺ㄩ�� new HttpServerRequest().SignOutPush(); //3.璺宠浆鐧诲綍椤甸潰 diff --git a/HDL_ON/Common/ImageUtlis.cs b/HDL_ON/Common/ImageUtlis.cs index ce9f33e..c85b61e 100644 --- a/HDL_ON/Common/ImageUtlis.cs +++ b/HDL_ON/Common/ImageUtlis.cs @@ -107,12 +107,12 @@ else { //2.鑷畾涔夊浘鐗囷紝妫�娴嬫槸鍚︽湰鍦扮紦瀛樿繃锛屾病鏈夊垯浜戠涓嬭浇鐒跺悗缂撳瓨 - if (!ignoreCache && FileUtils.Exists(imageKey)) + if (!ignoreCache && Common.FileUtlis.Files.Exists(imageKey)) { //2.1 鏈湴鏈夌紦瀛樺苟涓斾笉蹇界暐缂撳瓨锛岀洿鎺ユ湰鍦拌鍙� if (imageView != null) { - imageView.ImageBytes = FileUtils.ReadFile(imageKey); + imageView.ImageBytes = Common.FileUtlis.Files.ReadFile(imageKey); //Utlis.WriteLine("imageKey 鍔犺浇鑷畾涔夌紦瀛樺浘鐗囨垚鍔�"); } } @@ -124,7 +124,7 @@ byte[] imageBytes = GetImageDownloadUrl(imageKey); if (imageBytes != null) { - FileUtils.WriteFileByBytes(imageKey, imageBytes); + Common.FileUtlis.Files.WriteFileByBytes(imageKey, imageBytes); //2.3 涓嬭浇鎴愬姛锛屾樉绀哄苟缂撳瓨鏈湴 Application.RunOnMainThread(() => { @@ -178,7 +178,7 @@ else { //2.鑷畾涔夊浘鐗囷紝妫�娴嬫槸鍚︽湰鍦扮紦瀛樿繃锛屾病鏈夊垯浜戠涓嬭浇鐒跺悗缂撳瓨 - if (!ignoreCache && FileUtils.Exists(imageKey)) + if (!ignoreCache && Common.FileUtlis.Files.Exists(imageKey)) { //2.1 鏈湴鏈夌紦瀛樺苟涓斾笉蹇界暐缂撳瓨锛岀洿鎺ユ湰鍦拌鍙� if (frameLayout != null) @@ -195,7 +195,7 @@ byte[] imageBytes = GetImageDownloadUrl(imageKey); if (imageBytes != null) { - FileUtils.WriteFileByBytes(imageKey, imageBytes); + Common.FileUtlis.Files.WriteFileByBytes(imageKey, imageBytes); //2.3 涓嬭浇鎴愬姛锛屾樉绀哄苟缂撳瓨鏈湴 Application.RunOnMainThread(() => { @@ -259,10 +259,10 @@ { var imageKey = GetHeadImageKey(userId); byte[] imageBytes; - if (!ignoreCache && FileUtils.Exists(imageKey)) + if (!ignoreCache && Common.FileUtlis.Files.Exists(imageKey)) { //鏈湴鏈夌紦瀛� - imageBytes = FileUtils.ReadFile(imageKey); + imageBytes = Common.FileUtlis.Files.ReadFile(imageKey); } else { @@ -271,7 +271,7 @@ if(imageBytes != null) { //淇濆瓨鍒版湰鍦� - FileUtils.WriteFileByBytes(imageKey, imageBytes); + Common.FileUtlis.Files.WriteFileByBytes(imageKey, imageBytes); } } diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index bd55f60..5d0453e 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -4,6 +4,8 @@ { public static class StringId { + public const int UnableToCreateScenarioPleaseBindGateway = 372; + public const int FunctionCannotBeUsedPleaseBindGateway = 371; public const int TobeFamily = 370; public const int AddNewResidence = 369; public const int WelcomeToOnPlus = 368; diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index 5f3c63b..45e6b5d 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -279,6 +279,12 @@ } } + public void SendApiReadCommand(List<string> functionIds) + { + var pm = new DAL.Server.HttpServerRequest(); + var pack = pm.RefreshDeviceStatus(functionIds); + } + /// <summary> /// 鍙戦�佽鍙栧懡浠� /// 鑷姩鍒ゆ柇鏄惁涓篈鍗忚璁惧 diff --git a/HDL_ON/DAL/DriverLayer/Control_TcpServer.cs b/HDL_ON/DAL/DriverLayer/Control_TcpServer.cs index eb77a42..b305916 100644 --- a/HDL_ON/DAL/DriverLayer/Control_TcpServer.cs +++ b/HDL_ON/DAL/DriverLayer/Control_TcpServer.cs @@ -203,7 +203,7 @@ break; case CommunicationTopic.BusPcGetAppOids: - var bytes = FileUtils.ReadFile(DB_ResidenceData.OidSavePathName); + var bytes = Common.FileUtlis.Files.ReadFile(DB_ResidenceData.OidSavePathName); if (bytes.Length > 0) { socket.Send(bytes); diff --git a/HDL_ON/DAL/FileUtils.cs b/HDL_ON/DAL/FileUtils.cs index be51fd5..7c0481f 100644 --- a/HDL_ON/DAL/FileUtils.cs +++ b/HDL_ON/DAL/FileUtils.cs @@ -1,448 +1,448 @@ -锘縰sing System; -using System.IO; -using System.Collections.Generic; -using Shared; +锘�//using System; +//using System.IO; +//using System.Collections.Generic; +//using Shared; -namespace HDL_ON -{ - public static class FileUtils - { - public static string RootPath = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "/"; +//namespace HDL_ON +//{ +// public static class FileUtils +// { +// public static string RootPath = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "/"; - /// <summary> - /// 鏄惁瀛樺湪鏂囦欢澶� - /// </summary> - /// <returns></returns> - public static bool IsExisFolder(string folderName) - { - bool result = false; - var path = Path.Combine(RootPath, folderName); - result = Directory.Exists(path); - return result; - } - /// <summary> - /// 鍒涘缓涓�涓綇瀹呯殑澶囦唤鏂囦欢澶� - /// </summary> - public static string CreateRegionBackup(string regionId) - { - var path = Path.Combine(RootPath, regionId); - if (!Directory.Exists(path)) - { - Directory.CreateDirectory(path); - } - return path + "/"; - } - /// <summary> - /// 鍒ゆ柇鏄惁宸茬粡瀛樺湪浣忓畢鐨勬湰鍦版枃浠跺す - /// </summary> - public static bool ExistRegion(string regionId) - { - var path = Path.Combine(RootPath, regionId); - return Directory.Exists(path); - } +// /// <summary> +// /// 鏄惁瀛樺湪鏂囦欢澶� +// /// </summary> +// /// <returns></returns> +// public static bool IsExisFolder(string folderName) +// { +// bool result = false; +// var path = Path.Combine(RootPath, folderName); +// result = Directory.Exists(path); +// return result; +// } +// /// <summary> +// /// 鍒涘缓涓�涓綇瀹呯殑澶囦唤鏂囦欢澶� +// /// </summary> +// public static string CreateRegionBackup(string regionId) +// { +// var path = Path.Combine(RootPath, regionId); +// if (!Directory.Exists(path)) +// { +// Directory.CreateDirectory(path); +// } +// return path + "/"; +// } +// /// <summary> +// /// 鍒ゆ柇鏄惁宸茬粡瀛樺湪浣忓畢鐨勬湰鍦版枃浠跺す +// /// </summary> +// public static bool ExistRegion(string regionId) +// { +// var path = Path.Combine(RootPath, regionId); +// return Directory.Exists(path); +// } - /// <summary> - /// 鍒犻櫎鎸囧畾鍖哄煙閲岄潰鐨勬墍鏈夋枃浠� - /// </summary> - /// <param name="path">Path.</param> - public static void DeleteRegionFiles(string path) - { - foreach (var fileName in ReadRegionFiles(path)) - { - File.Delete(Path.Combine(path, fileName)); - MainPage.Log("鍒犻櫎鏂囦欢鍚嶄负锛�" + fileName); - } - } +// /// <summary> +// /// 鍒犻櫎鎸囧畾鍖哄煙閲岄潰鐨勬墍鏈夋枃浠� +// /// </summary> +// /// <param name="path">Path.</param> +// public static void DeleteRegionFiles(string path) +// { +// foreach (var fileName in ReadRegionFiles(path)) +// { +// File.Delete(Path.Combine(path, fileName)); +// MainPage.Log("鍒犻櫎鏂囦欢鍚嶄负锛�" + fileName); +// } +// } - /// <summary> - /// 璇诲彇鍖哄煙鏂囦欢澶归噷闈㈢殑鏂囦欢 - /// </summary> - static List<string> ReadRegionFiles(string regionRootPath) - { - List<string> listFiles = new List<string>(); - DirectoryInfo TheFolder = new DirectoryInfo(regionRootPath); - foreach (FileInfo NextFile in TheFolder.GetFiles()) - { - listFiles.Add(NextFile.Name); - } - return listFiles; - } +// /// <summary> +// /// 璇诲彇鍖哄煙鏂囦欢澶归噷闈㈢殑鏂囦欢 +// /// </summary> +// static List<string> ReadRegionFiles(string regionRootPath) +// { +// List<string> listFiles = new List<string>(); +// DirectoryInfo TheFolder = new DirectoryInfo(regionRootPath); +// foreach (FileInfo NextFile in TheFolder.GetFiles()) +// { +// listFiles.Add(NextFile.Name); +// } +// return listFiles; +// } - /// <summary> - /// 鎭㈠鍖哄煙鏂囦欢澶归噷闈㈢殑鏂囦欢 - /// </summary> - public static void RestoreRegionFiles(string regionRootPath) - { - DirectoryInfo TheFolder = new DirectoryInfo(regionRootPath); - int index = 0; - var thFolders = TheFolder.GetFiles(); - int folderCount = thFolders.Length; - foreach (FileInfo NextFile in thFolders) - { - index++; - if (NextFile.Name.Contains(ImageUtlis.HEADIMAGE)) - { - continue; - } - if (NextFile.Name == "null" || NextFile.Name == "UserConfig" || NextFile.Name == "UserInfo_File" || NextFile.Name == "AccountListDB" || NextFile.Name == OnAppConfig.ConfigFile) - { - continue; - } - FileInfo fileInfo = new FileInfo(regionRootPath + NextFile.Name); - if (fileInfo.Exists) - { - fileInfo.MoveTo(Application.RootPath + NextFile.Name); - MainPage.Log("Restroe : " + NextFile.Name); - } - } - } +// /// <summary> +// /// 鎭㈠鍖哄煙鏂囦欢澶归噷闈㈢殑鏂囦欢 +// /// </summary> +// public static void RestoreRegionFiles(string regionRootPath) +// { +// DirectoryInfo TheFolder = new DirectoryInfo(regionRootPath); +// int index = 0; +// var thFolders = TheFolder.GetFiles(); +// int folderCount = thFolders.Length; +// foreach (FileInfo NextFile in thFolders) +// { +// index++; +// if (NextFile.Name.Contains(ImageUtlis.HEADIMAGE)) +// { +// continue; +// } +// if (NextFile.Name == "null" || NextFile.Name == "UserConfig" || NextFile.Name == "UserInfo_File" || NextFile.Name == "AccountListDB" || NextFile.Name == OnAppConfig.ConfigFile) +// { +// continue; +// } +// FileInfo fileInfo = new FileInfo(regionRootPath + NextFile.Name); +// if (fileInfo.Exists) +// { +// fileInfo.MoveTo(Application.RootPath + NextFile.Name); +// MainPage.Log("Restroe : " + NextFile.Name); +// } +// } +// } - /// <summary> - /// 閬嶅巻鏂囦欢 - /// </summary> - public static List<string> ReadFiles() - { - List<string> listFiles = new List<string>(); - DirectoryInfo TheFolder = new DirectoryInfo(RootPath); - foreach (FileInfo NextFile in TheFolder.GetFiles()) - { - listFiles.Add(NextFile.Name); - } - return listFiles; - } +// /// <summary> +// /// 閬嶅巻鏂囦欢 +// /// </summary> +// public static List<string> ReadFiles() +// { +// List<string> listFiles = new List<string>(); +// DirectoryInfo TheFolder = new DirectoryInfo(RootPath); +// foreach (FileInfo NextFile in TheFolder.GetFiles()) +// { +// listFiles.Add(NextFile.Name); +// } +// return listFiles; +// } - /// <summary> - /// 鏇存敼鏂囦欢鍚� - /// </summary> - /// <param name="oldFilePath">Old file path.</param> - /// <param name="newFilePath">New file path.</param> - public static void ReNameFile(string oldFilePath, string newFilePath) - { - if (oldFilePath == newFilePath) - { - return; - } - DeleteFile(newFilePath); - FileInfo fileInfo = new FileInfo(Application.RootPath + oldFilePath); - if (fileInfo.Exists) - { - fileInfo.MoveTo(Application.RootPath + newFilePath); - } - } +// /// <summary> +// /// 鏇存敼鏂囦欢鍚� +// /// </summary> +// /// <param name="oldFilePath">Old file path.</param> +// /// <param name="newFilePath">New file path.</param> +// public static void ReNameFile(string oldFilePath, string newFilePath) +// { +// if (oldFilePath == newFilePath) +// { +// return; +// } +// DeleteFile(newFilePath); +// FileInfo fileInfo = new FileInfo(Application.RootPath + oldFilePath); +// if (fileInfo.Exists) +// { +// fileInfo.MoveTo(Application.RootPath + newFilePath); +// } +// } - public static void ReNameFoler(string srcFolderPath, string destFolderPath) - { - if (srcFolderPath == destFolderPath) - { - return; - } - var srcPath = Path.Combine(RootPath, srcFolderPath); -#if DEBUG - DirectoryInfo root = new DirectoryInfo (RootPath); - foreach (DirectoryInfo d in root.GetDirectories ()) { - MainPage.Log ("鏂囦欢澶癸細" + d.Name); - } -#endif - if (Directory.Exists(srcPath)) - { - DirectoryInfo folder = new DirectoryInfo(srcPath); - var path = Path.Combine(RootPath, destFolderPath); - if (Directory.Exists(path)) - { - FileAttributes attr0 = File.GetAttributes(path); - if (attr0 == FileAttributes.Directory) - { - Directory.Delete(path, true); - } - else - { - File.Delete(path); - } - } - folder.MoveTo(path); +// public static void ReNameFoler(string srcFolderPath, string destFolderPath) +// { +// if (srcFolderPath == destFolderPath) +// { +// return; +// } +// var srcPath = Path.Combine(RootPath, srcFolderPath); +//#if DEBUG +// DirectoryInfo root = new DirectoryInfo (RootPath); +// foreach (DirectoryInfo d in root.GetDirectories ()) { +// MainPage.Log ("鏂囦欢澶癸細" + d.Name); +// } +//#endif +// if (Directory.Exists(srcPath)) +// { +// DirectoryInfo folder = new DirectoryInfo(srcPath); +// var path = Path.Combine(RootPath, destFolderPath); +// if (Directory.Exists(path)) +// { +// FileAttributes attr0 = File.GetAttributes(path); +// if (attr0 == FileAttributes.Directory) +// { +// Directory.Delete(path, true); +// } +// else +// { +// File.Delete(path); +// } +// } +// folder.MoveTo(path); -#if DEBUG - List<string> listFiles = new List<string> (); - DirectoryInfo TheFolder = new DirectoryInfo (path); - foreach (FileInfo NextFile in TheFolder.GetFiles ()) { - MainPage.Log (NextFile.Name); - } -#endif - } +//#if DEBUG +// List<string> listFiles = new List<string> (); +// DirectoryInfo TheFolder = new DirectoryInfo (path); +// foreach (FileInfo NextFile in TheFolder.GetFiles ()) { +// MainPage.Log (NextFile.Name); +// } +//#endif +// } -#if DEBUG - foreach (DirectoryInfo d in root.GetDirectories ()) { - MainPage.Log ("鏂囦欢澶癸細" + d.Name); - } -#endif - } +//#if DEBUG +// foreach (DirectoryInfo d in root.GetDirectories ()) { +// MainPage.Log ("鏂囦欢澶癸細" + d.Name); +// } +//#endif +// } - /// <summary> - /// 鏂囦欢鏄惁瀛樺湪 - /// </summary> - /// <param name="filePath">File path.</param> - public static bool Exists(string filePath) - { - //System.MainPage.WriteLog ("Exists==" + Path.Combine (RootPath, filePath)); - return File.Exists(Path.Combine(RootPath, filePath)); - } +// /// <summary> +// /// 鏂囦欢鏄惁瀛樺湪 +// /// </summary> +// /// <param name="filePath">File path.</param> +// public static bool Exists(string filePath) +// { +// //System.MainPage.WriteLog ("Exists==" + Path.Combine (RootPath, filePath)); +// return File.Exists(Path.Combine(RootPath, filePath)); +// } - /// <summary> - /// Deletes the file. - /// </summary> - /// <param name="fileName">File name.</param> - public static void DeleteFile(string fileName) - { - if (fileName == null || fileName == "Language.ini" || fileName == "AccountListDB" || fileName == OnAppConfig.ConfigFile) - { - return; - } - File.Delete(Path.Combine(RootPath, fileName)); - MainPage.Log("鍒犻櫎鏂囦欢鍚嶄负锛�" + fileName); - } +// /// <summary> +// /// Deletes the file. +// /// </summary> +// /// <param name="fileName">File name.</param> +// public static void DeleteFile(string fileName) +// { +// if (fileName == null || fileName == "Language.ini" || fileName == "AccountListDB" || fileName == OnAppConfig.ConfigFile) +// { +// return; +// } +// File.Delete(Path.Combine(RootPath, fileName)); +// MainPage.Log("鍒犻櫎鏂囦欢鍚嶄负锛�" + fileName); +// } - /// <summary> - /// Deletes all file. - /// </summary> - public static void DeleteAllFile() - { - List<string> filesList = ReadFiles(); - for (int j = 0; j < filesList.Count; j++) - { - var f = filesList[j]; - if (f == "linphonerc" || f == "AccountListDB" || f == "UserInfo_File" || f == OnAppConfig.ConfigFile) - continue; - DeleteFile(f); - } - } +// /// <summary> +// /// Deletes all file. +// /// </summary> +// public static void DeleteAllFile() +// { +// List<string> filesList = ReadFiles(); +// for (int j = 0; j < filesList.Count; j++) +// { +// var f = filesList[j]; +// if (f == "linphonerc" || f == "AccountListDB" || f == "UserInfo_File" || f == OnAppConfig.ConfigFile) +// continue; +// DeleteFile(f); +// } +// } - /// <summary> - /// Writes the file by bytes. - /// </summary> - /// <returns><c>true</c>, if file by bytes was writed, <c>false</c> otherwise.</returns> - /// <param name="fileName">File name.</param> - /// <param name="bytes">Bytes.</param> - public static bool WriteFileByBytes(string fileName, byte[] bytes) - { - if (fileName == null || (fileName = fileName.Trim()) == ("")) - { - return false; - } +// /// <summary> +// /// Writes the file by bytes. +// /// </summary> +// /// <returns><c>true</c>, if file by bytes was writed, <c>false</c> otherwise.</returns> +// /// <param name="fileName">File name.</param> +// /// <param name="bytes">Bytes.</param> +// public static bool WriteFileByBytes(string fileName, byte[] bytes) +// { +// if (fileName == null || (fileName = fileName.Trim()) == ("")) +// { +// return false; +// } - FileStream fs = null; +// FileStream fs = null; - try - { - fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Create, FileAccess.Write); - fs.Write(bytes, 0, bytes.Length); - fs.Flush(); - MainPage.Log("SaveFile:" + fileName); - return true; - } - catch (Exception ex) - { - MainPage.Log("FileUtiles Code 113:" + ex.ToString()); - return false; - } - finally - { - try - { - if (fs != null) - { - fs.Close(); - } - } - catch (Exception ex) - { - MainPage.Log("FileUtils Code 121 :" + ex.ToString()); - } - } - } +// try +// { +// fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Create, FileAccess.Write); +// fs.Write(bytes, 0, bytes.Length); +// fs.Flush(); +// MainPage.Log("SaveFile:" + fileName); +// return true; +// } +// catch (Exception ex) +// { +// MainPage.Log("FileUtiles Code 113:" + ex.ToString()); +// return false; +// } +// finally +// { +// try +// { +// if (fs != null) +// { +// fs.Close(); +// } +// } +// catch (Exception ex) +// { +// MainPage.Log("FileUtils Code 121 :" + ex.ToString()); +// } +// } +// } - /// <summary> - /// Writes the file by input stream. - /// </summary> - /// <returns><c>true</c>, if file by input stream was writed, <c>false</c> otherwise.</returns> - /// <param name="fileName">File name.</param> - /// <param name="inputStream">Input stream.</param> - /// <param name="isNeedRootPath">If set to <c>true</c> is need root path.</param> - public static bool WriteFileByInputStream(string fileName, Stream inputStream) - { - if (fileName == null || (fileName = fileName.Trim()) == ("")) - { - return false; - } - FileStream fs = null; +// /// <summary> +// /// Writes the file by input stream. +// /// </summary> +// /// <returns><c>true</c>, if file by input stream was writed, <c>false</c> otherwise.</returns> +// /// <param name="fileName">File name.</param> +// /// <param name="inputStream">Input stream.</param> +// /// <param name="isNeedRootPath">If set to <c>true</c> is need root path.</param> +// public static bool WriteFileByInputStream(string fileName, Stream inputStream) +// { +// if (fileName == null || (fileName = fileName.Trim()) == ("")) +// { +// return false; +// } +// FileStream fs = null; - try - { - byte[] buffer = new byte[4 * 1024]; - int length = 0; - while ((length = inputStream.Read(buffer, 0, buffer.Length)) != 0) - { - if (fs == null) - { - fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Create, FileAccess.Write); - } - fs.Write(buffer, 0, length); - fs.Flush(); - } +// try +// { +// byte[] buffer = new byte[4 * 1024]; +// int length = 0; +// while ((length = inputStream.Read(buffer, 0, buffer.Length)) != 0) +// { +// if (fs == null) +// { +// fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Create, FileAccess.Write); +// } +// fs.Write(buffer, 0, length); +// fs.Flush(); +// } - return true; - } - catch - { - return false; - } - finally - { - try - { - if (fs != null) - { - fs.Close(); - } - } - catch - { - } - } - } +// return true; +// } +// catch +// { +// return false; +// } +// finally +// { +// try +// { +// if (fs != null) +// { +// fs.Close(); +// } +// } +// catch +// { +// } +// } +// } - /// <summary> - /// read file - /// </summary> - /// <returns>The file.</returns> - /// <param name="fileName">File name.</param> - public static byte[] ReadImage(string fileName) - { - if (Shared.Application.IsPad) - { - fileName = "Pad/" + fileName; - } - else - { - fileName = "Phone/" + fileName; - } - FileStream fs = null; - try - { - if (File.Exists(Path.Combine(RootPath, fileName))) - { - fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Open, FileAccess.Read); - } - else if (File.Exists(fileName)) - { - fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); - } - else - { - return new byte[0]; - } - byte[] bytes = new byte[fs.Length]; - fs.Read(bytes, 0, bytes.Length); - return bytes; - } - catch - { - return new byte[0]; - } - finally - { - try - { - if (fs != null) - { - fs.Close(); - } - } - catch - { +// /// <summary> +// /// read file +// /// </summary> +// /// <returns>The file.</returns> +// /// <param name="fileName">File name.</param> +// public static byte[] ReadImage(string fileName) +// { +// if (Shared.Application.IsPad) +// { +// fileName = "Pad/" + fileName; +// } +// else +// { +// fileName = "Phone/" + fileName; +// } +// FileStream fs = null; +// try +// { +// if (File.Exists(Path.Combine(RootPath, fileName))) +// { +// fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Open, FileAccess.Read); +// } +// else if (File.Exists(fileName)) +// { +// fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); +// } +// else +// { +// return new byte[0]; +// } +// byte[] bytes = new byte[fs.Length]; +// fs.Read(bytes, 0, bytes.Length); +// return bytes; +// } +// catch +// { +// return new byte[0]; +// } +// finally +// { +// try +// { +// if (fs != null) +// { +// fs.Close(); +// } +// } +// catch +// { - } - } - } +// } +// } +// } - public static byte[] ReadFile(string fileName) - { - FileStream fs = null; - try - { - if (File.Exists(Path.Combine(RootPath, fileName))) - { - fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Open, FileAccess.Read); - } - else if (File.Exists(fileName)) - { - fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); - } - else - { - return new byte[0]; - } - byte[] bytes = new byte[fs.Length]; - fs.Read(bytes, 0, bytes.Length); - return bytes; - } - catch - { - return new byte[0]; - } - finally - { - try - { - if (fs != null) - { - fs.Close(); - } - } - catch - { +// public static byte[] ReadFile(string fileName) +// { +// FileStream fs = null; +// try +// { +// if (File.Exists(Path.Combine(RootPath, fileName))) +// { +// fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Open, FileAccess.Read); +// } +// else if (File.Exists(fileName)) +// { +// fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); +// } +// else +// { +// return new byte[0]; +// } +// byte[] bytes = new byte[fs.Length]; +// fs.Read(bytes, 0, bytes.Length); +// return bytes; +// } +// catch +// { +// return new byte[0]; +// } +// finally +// { +// try +// { +// if (fs != null) +// { +// fs.Close(); +// } +// } +// catch +// { - } - } - } +// } +// } +// } - /// <summary> - /// - /// </summary> - /// <param name="fileName"></param> - /// <param name="imagePath"></param> - public static void FileCopyToRootPath(string oldPath, string fileName) - { - System.IO.FileInfo fileInfo = new System.IO.FileInfo(oldPath); - if (fileInfo.Exists) - { - fileInfo.CopyTo(Path.Combine(RootPath, fileName), true); - //Utlis.WriteLine("FileCopyToRootPath : " + Path.Combine(RootPath, fileName)); - } - } +// /// <summary> +// /// +// /// </summary> +// /// <param name="fileName"></param> +// /// <param name="imagePath"></param> +// public static void FileCopyToRootPath(string oldPath, string fileName) +// { +// System.IO.FileInfo fileInfo = new System.IO.FileInfo(oldPath); +// if (fileInfo.Exists) +// { +// fileInfo.CopyTo(Path.Combine(RootPath, fileName), true); +// //Utlis.WriteLine("FileCopyToRootPath : " + Path.Combine(RootPath, fileName)); +// } +// } - } - //[System.Serializable] - //class Song - //{ - // //string [] ss = new string [] { }; - // public List<Album> album = new List<Album>(); - // public List<Artist> artist = new List<Artist>(); - // public string sss; - //} - //[System.Serializable] - //class Album - //{ - // public string albumname; - // public string artistname; - // public string artistpic; - //} - //[System.Serializable] - //class Artist - //{ - // public string artistname; - // public string artistpic; - //} +// } +// //[System.Serializable] +// //class Song +// //{ +// // //string [] ss = new string [] { }; +// // public List<Album> album = new List<Album>(); +// // public List<Artist> artist = new List<Artist>(); +// // public string sss; +// //} +// //[System.Serializable] +// //class Album +// //{ +// // public string albumname; +// // public string artistname; +// // public string artistpic; +// //} +// //[System.Serializable] +// //class Artist +// //{ +// // public string artistname; +// // public string artistpic; +// //} -} \ No newline at end of file +//} \ No newline at end of file diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs index 321d8b1..3161a9f 100644 --- a/HDL_ON/DAL/Mqtt/MqttClient.cs +++ b/HDL_ON/DAL/Mqtt/MqttClient.cs @@ -210,7 +210,7 @@ /// </summary> public static async Task StartCloudMqtt() { - if (OnAppConfig.Instance.internetStatus == 0) + if (MainPage.InternetStatus == 0) { return; } @@ -268,7 +268,8 @@ else { SetGatewayOnlineResetCheck(); - Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, DB_ResidenceData.residenceData.HomeGateway.aesKey); + var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, DB_ResidenceData.residenceData.HomeGateway.aesKey); + //bus鏁版嵁瑙f瀽 if (DB_ResidenceData.residenceData.GatewayType == 0) { @@ -287,7 +288,7 @@ else { //A鍗忚鏁版嵁澶勭悊 - var revString = Encoding.UTF8.GetString(e.ApplicationMessage.Payload); + var revString = Encoding.UTF8.GetString(bytes); Control.Ins.UpdataFunctionStatus(revString); } } @@ -309,6 +310,7 @@ if (RemoteMqttClient.ConnectedHandler == null) { RemoteMqttClient.UseConnectedHandler(async (e) => { + Control.Ins.GatewayOnline = true; IfNeedReadAllDeviceStatus = true; Utlis.WriteLine($"============>Mqtt杩滅▼杩炴帴鎴愬姛"); SendPushSignOut(); diff --git a/HDL_ON/DAL/Mqtt/MqttInfoConfig.cs b/HDL_ON/DAL/Mqtt/MqttInfoConfig.cs index c83e9f5..f609dc5 100644 --- a/HDL_ON/DAL/Mqtt/MqttInfoConfig.cs +++ b/HDL_ON/DAL/Mqtt/MqttInfoConfig.cs @@ -24,7 +24,7 @@ { try { - var MqttInfoConfigBytes = FileUtils.ReadFile(ConfigFile); + var MqttInfoConfigBytes = Common.FileUtlis.Files.ReadFile(ConfigFile); var MqttInfoConfigString = Encoding.UTF8.GetString(MqttInfoConfigBytes); MqttInfoConfig temp = null; if (MqttInfoConfigString != null) @@ -72,7 +72,7 @@ public void Save() { - FileUtils.WriteFileByBytes(ConfigFile, GetMqttInfoConfigBytes()); + Common.FileUtlis.Files.WriteFileByBytes(ConfigFile, GetMqttInfoConfigBytes()); } } } \ No newline at end of file diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs index 649d81e..a69df89 100644 --- a/HDL_ON/DAL/Server/HttpServerRequest.cs +++ b/HDL_ON/DAL/Server/HttpServerRequest.cs @@ -492,20 +492,20 @@ UserInfo.Current.regionList.Add(home); } - if (string.IsNullOrEmpty(DB_ResidenceData.residenceData.CurReginID)) + if (string.IsNullOrEmpty(UserInfo.Current.CurReginID)) { - DB_ResidenceData.residenceData.CurReginID = UserInfo.Current.regionList[0].RegionID; + UserInfo.Current.CurReginID = UserInfo.Current.regionList[0].RegionID; //鎭㈠澶囦唤 - HDLCommon.Current.RestoreHomeBackup(DB_ResidenceData.residenceData.CurReginID); + //HDLCommon.Current.RestoreHomeBackup(DB_ResidenceData.residenceData.CurReginID); } else { - var curRegion = UserInfo.Current.regionList.Find((obj) => obj.RegionID == DB_ResidenceData.residenceData.CurReginID); + var curRegion = UserInfo.Current.regionList.Find((obj) => obj.RegionID == UserInfo.Current.CurReginID); if(curRegion == null) { - DB_ResidenceData.residenceData.CurReginID = UserInfo.Current.regionList[0].RegionID; + UserInfo.Current.CurReginID = UserInfo.Current.regionList[0].RegionID; //鎭㈠澶囦唤 - HDLCommon.Current.RestoreHomeBackup(DB_ResidenceData.residenceData.CurReginID); + //HDLCommon.Current.RestoreHomeBackup(DB_ResidenceData.residenceData.CurReginID); } } diff --git a/HDL_ON/Entity/DB_ResidenceData.cs b/HDL_ON/Entity/DB_ResidenceData.cs index fba65b2..ed3d96a 100644 --- a/HDL_ON/Entity/DB_ResidenceData.cs +++ b/HDL_ON/Entity/DB_ResidenceData.cs @@ -29,14 +29,14 @@ } else { - var curRegion = UserInfo.Current.regionList.Find((obj) => obj.RegionID == CurReginID); + var curRegion = UserInfo.Current.regionList.Find((obj) => obj.RegionID == UserInfo.Current.CurReginID); if (curRegion == null) { if (UserInfo.Current.regionList != null && UserInfo.Current.regionList.Count > 0) { - CurReginID = UserInfo.Current.regionList[0].RegionID; + UserInfo.Current.CurReginID = UserInfo.Current.regionList[0].RegionID; //鎭㈠澶囦唤 - HDLCommon.Current.RestoreHomeBackup(CurReginID); + //HDLCommon.Current.RestoreHomeBackup(CurReginID); return UserInfo.Current.regionList[0]; } @@ -81,10 +81,6 @@ // } //} /// <summary> - /// 褰撳墠閫夋嫨鐨勪綇瀹呯储寮� - /// </summary> - public string CurReginID = ""; - /// <summary> /// 鍔熻兘绫诲瀷鍒楄〃 /// </summary> public List<ShowFunction> functionTypeList = new List<ShowFunction>(); @@ -98,7 +94,7 @@ { try { - var residenceDataBytes = FileUtils.ReadFile("DB_ResidenceData"); + var residenceDataBytes = Common.FileUtlis.Files.ReadFile("DB_ResidenceData"); var userConfigString = System.Text.Encoding.UTF8.GetString(residenceDataBytes); DB_ResidenceData temp = null; @@ -246,7 +242,7 @@ if (this == null || this.residecenInfo == null) return; var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); - FileUtils.WriteFileByBytes("DB_ResidenceData", ssd); + Common.FileUtlis.Files.WriteFileByBytes("DB_ResidenceData", ssd); MainPage.Log("Save DB_ResidenceData"); } @@ -293,7 +289,7 @@ { if (ins_OidList == null) { - var bytes = FileUtils.ReadFile(OidSavePathName); + var bytes = Common.FileUtlis.Files.ReadFile(OidSavePathName); if (bytes == null || bytes.Length == 0) { ins_OidList = new List<FunctionOid>(); @@ -329,7 +325,7 @@ { var oidBytes = System.Text.Encoding.UTF8.GetBytes(oidJsonString); - FileUtils.WriteFileByBytes(OidSavePathName, oidBytes); + Common.FileUtlis.Files.WriteFileByBytes(OidSavePathName, oidBytes); } #endregion diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 7559473..793f995 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -292,7 +292,7 @@ if (pack.Code == DAL.Server.StateCode.SUCCESS) { var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); - FileUtils.WriteFileByBytes(savePath, ssd); + Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); } else { @@ -302,7 +302,7 @@ else { var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); - FileUtils.WriteFileByBytes(savePath, ssd); + Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); } } diff --git a/HDL_ON/Entity/Function/Scene.cs b/HDL_ON/Entity/Function/Scene.cs index 3f388c9..a74b46a 100644 --- a/HDL_ON/Entity/Function/Scene.cs +++ b/HDL_ON/Entity/Function/Scene.cs @@ -27,7 +27,10 @@ public Scene() { sid = NewSid(); - gatewayId = DB_ResidenceData.residenceData.HomeGateway.gatewayId; + if (!string.IsNullOrEmpty(DB_ResidenceData.residenceData.HomeGateway.gatewayId)) + { + gatewayId = DB_ResidenceData.residenceData.HomeGateway.gatewayId; + } } /// <summary> /// 浜戠鍞竴ID @@ -249,7 +252,7 @@ else { var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); - FileUtils.WriteFileByBytes(savePath, ssd); + Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); MainPage.Log($"Save Scene Data : {savePath}"); } } @@ -267,7 +270,7 @@ if (revPack.Code == StateCode.SUCCESS) { var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); - FileUtils.WriteFileByBytes(savePath, ssd); + Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); } } else if (!string.IsNullOrEmpty(createTime) && !string.IsNullOrEmpty(modifyTime)) @@ -280,7 +283,7 @@ if (tempScene != null) { var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(tempScene)); - FileUtils.WriteFileByBytes(savePath, ssd); + Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); } } } diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs index 06fcf7a..fcc971a 100644 --- a/HDL_ON/Entity/FunctionList.cs +++ b/HDL_ON/Entity/FunctionList.cs @@ -18,7 +18,7 @@ { _FunctionList = new FunctionList(); #region 鎭㈠鏁版嵁 - var filePathList = FileUtils.ReadFiles(); + var filePathList = Common.FileUtlis.Files.ReadFiles(); foreach (var filePath in filePathList) { _FunctionList.IniFunctionList(filePath); @@ -109,12 +109,12 @@ { if (filePath.StartsWith("FunctionData_")) { - var functionDataBytes = FileUtils.ReadFile(filePath); + var functionDataBytes = Common.FileUtlis.Files.ReadFile(filePath); var functionDataString = System.Text.Encoding.UTF8.GetString(functionDataBytes); var tempFunction = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(functionDataString); if (tempFunction == null) { - FileUtils.DeleteFile(filePath); + Common.FileUtlis.Files.DeleteFile(filePath); return; } if (tempFunction.DeleteSign) @@ -170,7 +170,7 @@ } if (filePath.StartsWith("SceneData_")) { - var sceneDataBytes = FileUtils.ReadFile(filePath); + var sceneDataBytes = Common.FileUtlis.Files.ReadFile(filePath); var sceneDataString = System.Text.Encoding.UTF8.GetString(sceneDataBytes); var tempScene = Newtonsoft.Json.JsonConvert.DeserializeObject<Scene>(sceneDataString); List.scenes.Add(tempScene); @@ -495,12 +495,12 @@ /// </summary> public void DelAllFunctionData() { - var filePathList = FileUtils.ReadFiles(); + var filePathList = Common.FileUtlis.Files.ReadFiles(); foreach (var filePath in filePathList) { if (filePath.StartsWith("FunctionData_") && filePath.Length == 13 + 28) { - FileUtils.DeleteFile(filePath); + Common.FileUtlis.Files.DeleteFile(filePath); } } _FunctionList = new FunctionList(); @@ -516,7 +516,7 @@ var packCode = pm.DeleteScene(scene.userSceneId); if (packCode == StateCode.SUCCESS) { - FileUtils.DeleteFile(scene.savePath); + Common.FileUtlis.Files.DeleteFile(scene.savePath); List.scenes.Remove(scene); } else @@ -526,7 +526,7 @@ } else { - FileUtils.DeleteFile(scene.savePath); + Common.FileUtlis.Files.DeleteFile(scene.savePath); List.scenes.Remove(scene); } } @@ -573,7 +573,7 @@ _FunctionList.fans.Remove(_FunctionList.fans.Find((obj) => obj.deviceId == delTemp.deviceId)); break; } - FileUtils.DeleteFile(delTemp.savePath); + Common.FileUtlis.Files.DeleteFile(delTemp.savePath); } bool lockReadFunctionStatus = false; @@ -598,17 +598,29 @@ lockReadFunctionStatus = true; try { - foreach (var function in GetAllDeviceFunctionList()) + if (DriverLayer.Control.Ins.IsRemote) { - switch (function.functionCategory) + var functionIds = new List<string>(); + foreach (var function in GetAllDeviceFunctionList()) { - case FunctionCategory.Light: - case FunctionCategory.Electrical: - case FunctionCategory.SwitchDevice: - case FunctionCategory.Curtain: - case FunctionCategory.Thermostat: - DriverLayer.Control.Ins.SendReadCommand(function); - break; + functionIds.Add(function.deviceId); + } + DriverLayer.Control.Ins.SendApiReadCommand(functionIds); + } + else + { + foreach (var function in GetAllDeviceFunctionList()) + { + switch (function.functionCategory) + { + case FunctionCategory.Light: + case FunctionCategory.Electrical: + case FunctionCategory.SwitchDevice: + case FunctionCategory.Curtain: + case FunctionCategory.Thermostat: + DriverLayer.Control.Ins.SendReadCommand(function); + break; + } } } } diff --git a/HDL_ON/Entity/OnAppConfig.cs b/HDL_ON/Entity/OnAppConfig.cs index deb4144..c3091aa 100644 --- a/HDL_ON/Entity/OnAppConfig.cs +++ b/HDL_ON/Entity/OnAppConfig.cs @@ -12,14 +12,14 @@ /// <summary> /// OnAppConfig /// </summary> - public const string ConfigFile = "OnAppConfig"; + //public const string ConfigFile = "OnAppConfig"; static OnAppConfig instance; public static OnAppConfig Instance { get { if (instance == null) { try { - var userConfigBytes = FileUtils.ReadFile (ConfigFile); + var userConfigBytes = Common.FileUtlis.Files.ReadAppConfig (); var userConfigString = System.Text.Encoding.UTF8.GetString (userConfigBytes); OnAppConfig temp = null; if (userConfigString != null) { @@ -42,11 +42,7 @@ { return System.Text.Encoding.UTF8.GetBytes (Newtonsoft.Json.JsonConvert.SerializeObject (this)); } - /// <summary> - /// 缃戠粶杩炴帴鐘舵�� - /// 0:鏃犵綉缁� - /// </summary> - public int internetStatus = 2; + public void RefreshUserConfig () { @@ -55,33 +51,8 @@ public void SaveUserConfig () { - FileUtils.WriteFileByBytes (ConfigFile, GetUserConfigBytes ()); + Common.FileUtlis.Files.WirteAppConfig ( GetUserConfigBytes ()); } - - public string SetLanguage = ""; - - /// <summary> - /// 杞欢瑙i攣鐣岄潰 - /// 1:鍚姩鏃� - /// 2:甯冮槻鎾ら槻鏃� - /// 3:杩滅▼寮�閿佹椂 - /// </summary> - public List<string> appUnlockPage = new List<string>(); - /// <summary> - /// 杞欢瑙i攣鏂瑰紡 - /// 1:鏁板瓧瀵嗙爜 - /// 2:鎵嬪娍瀵嗙爜 - /// 3:鎸囩汗瀵嗙爜 - /// 4:闈㈠ID - /// </summary> - public List<string> appUnlockType = new List<string>(); - /// <summary> - /// 杞欢瑙i攣瀵嗙爜 - /// </summary> - public string appUnlockPasswrod = ""; - /// <summary> - /// 瑙i攣鏃堕棿 - /// </summary> - public DateTime unlockTime = DateTime.MinValue; + } } \ No newline at end of file diff --git a/HDL_ON/Entity/Room.cs b/HDL_ON/Entity/Room.cs index ea6c102..fd1094c 100644 --- a/HDL_ON/Entity/Room.cs +++ b/HDL_ON/Entity/Room.cs @@ -46,7 +46,7 @@ public SpatialInfo(string spatialType) { roomType = "FLOOR"; - parentId = DB_ResidenceData.residenceData.CurReginID; + parentId = UserInfo.Current.CurReginID; } public string roomId = ""; @@ -182,7 +182,7 @@ } } var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(FloorList)); - FileUtils.WriteFileByBytes(dataSavePath, ssd); + Common.FileUtlis.Files.WriteFileByBytes(dataSavePath, ssd); } } @@ -202,7 +202,7 @@ { try { - var floorsDataBytes = FileUtils.ReadFile("FloorsData"); + var floorsDataBytes = Common.FileUtlis.Files.ReadFile("FloorsData"); if (floorsDataBytes != null) { var floorsDataString = System.Text.Encoding.UTF8.GetString(floorsDataBytes); @@ -264,7 +264,7 @@ } } var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(CurrentSpatial.FloorList)); - FileUtils.WriteFileByBytes(dataSavePath, ssd); + Common.FileUtlis.Files.WriteFileByBytes(dataSavePath, ssd); } return revPack.Code; } @@ -279,7 +279,7 @@ if (revPack.Code == StateCode.SUCCESS) { var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(FloorList)); - FileUtils.WriteFileByBytes(dataSavePath, ssd); + Common.FileUtlis.Files.WriteFileByBytes(dataSavePath, ssd); } return revPack.Code; } @@ -301,7 +301,7 @@ CurrentSpatial.FloorList.Remove(tRoom); } var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(FloorList)); - FileUtils.WriteFileByBytes(dataSavePath, ssd); + Common.FileUtlis.Files.WriteFileByBytes(dataSavePath, ssd); } else { @@ -329,13 +329,13 @@ try { rooms = new List<Room> { }; - var filePathList = FileUtils.ReadFiles(); + var filePathList = Common.FileUtlis.Files.ReadFiles(); foreach (var filePath in filePathList) { if (filePath.StartsWith("RoomData_")) { - var roomDataBytes = FileUtils.ReadFile(filePath); + var roomDataBytes = Common.FileUtlis.Files.ReadFile(filePath); var roomDataString = System.Text.Encoding.UTF8.GetString(roomDataBytes); var room = Newtonsoft.Json.JsonConvert.DeserializeObject<Room>(roomDataString); if (room != null) @@ -375,7 +375,7 @@ room = tempRoom as Room; CurrentSpatial.RoomList.Add(room); var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(room)); - FileUtils.WriteFileByBytes(dataSavePath, ssd); + Common.FileUtlis.Files.WriteFileByBytes(dataSavePath, ssd); } } } @@ -397,7 +397,7 @@ { CurrentSpatial.RoomList.Remove(room); } - FileUtils.DeleteFile(room.dataSavePath); + Common.FileUtlis.Files.DeleteFile(room.dataSavePath); } return pack.Code; } @@ -408,7 +408,7 @@ { foreach(var localRoom in RoomList) { - FileUtils.DeleteFile(localRoom.dataSavePath); + Common.FileUtlis.Files.DeleteFile(localRoom.dataSavePath); } RoomList.Clear(); } @@ -450,7 +450,7 @@ if (needSave) { var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); - FileUtils.WriteFileByBytes(dataSavePath, ssd); + Common.FileUtlis.Files.WriteFileByBytes(dataSavePath, ssd); } return packCode; } @@ -503,16 +503,6 @@ if (f != null) { return f.roomName + " "; - } - else - { - foreach(var f1 in CurrentSpatial.FloorList) - { - if(f1.uid == parentId) - { - return f.roomName + " "; - } - } } } return ""; diff --git a/HDL_ON/Entity/UserInfo.cs b/HDL_ON/Entity/UserInfo.cs index e9719c4..4077417 100644 --- a/HDL_ON/Entity/UserInfo.cs +++ b/HDL_ON/Entity/UserInfo.cs @@ -11,7 +11,6 @@ [System.Serializable] public class UserInfo { - public static readonly string ConfigFile = "UserInfo_File"; /// <summary> /// 閫氱敤鏂规硶 /// </summary> @@ -27,7 +26,7 @@ { try { - UserInfo temp = Newtonsoft.Json.JsonConvert.DeserializeObject<UserInfo>(System.Text.Encoding.UTF8.GetString(FileUtils.ReadFile(ConfigFile))); + UserInfo temp = Newtonsoft.Json.JsonConvert.DeserializeObject<UserInfo>(System.Text.Encoding.UTF8.GetString(Common.FileUtlis.Files.ReadUserInfo())); if (temp == null) { m_Current = new UserInfo() { }; @@ -170,12 +169,16 @@ /// 鐢ㄦ埛浣忓畢鍒楄〃 /// </summary> public List<RegionInfoRes> regionList = new List<RegionInfoRes>(); + /// <summary> + /// 褰撳墠閫夋嫨鐨勪綇瀹呯储寮� + /// </summary> + public string CurReginID = ""; #endregion public void SaveUserInfo() { - FileUtils.WriteFileByBytes(ConfigFile, Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this))); + Common.FileUtlis.Files.WirteUserinfo( Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this))); } /// <summary> @@ -192,24 +195,30 @@ headImagePagePath = "LoginIcon/2.png";//閲嶇疆鐢ㄦ埛澶村儚 } - private byte[] convertByte(Image img) - { - MemoryStream ms = new MemoryStream(); - img.Save(ms, img.RawFormat); - //byte[] bytes = new byte[ms.Length]; - //ms.Read(bytes, 0, Convert.ToInt32(ms.Length)); - //浠ヤ笂涓ゅ彞鏀规垚涓嬮潰涓ゅ彞 - byte[] bytes = ms.ToArray(); - ms.Close(); - return bytes; - } - private Image convertImg(byte[] datas) - { - MemoryStream ms = new MemoryStream(datas); - Image img = Image.FromStream(ms, true);//鍦ㄨ繖閲屽嚭閿� - //娴佺敤瀹岃鍙婃椂鍏抽棴 - ms.Close(); - return img; - } + public string SetLanguage = ""; + + /// <summary> + /// 杞欢瑙i攣鐣岄潰 + /// 1:鍚姩鏃� + /// 2:甯冮槻鎾ら槻鏃� + /// 3:杩滅▼寮�閿佹椂 + /// </summary> + public List<string> appUnlockPage = new List<string>(); + /// <summary> + /// 杞欢瑙i攣鏂瑰紡 + /// 1:鏁板瓧瀵嗙爜 + /// 2:鎵嬪娍瀵嗙爜 + /// 3:鎸囩汗瀵嗙爜 + /// 4:闈㈠ID + /// </summary> + public List<string> appUnlockType = new List<string>(); + /// <summary> + /// 杞欢瑙i攣瀵嗙爜 + /// </summary> + public string appUnlockPasswrod = ""; + /// <summary> + /// 瑙i攣鏃堕棿 + /// </summary> + public DateTime unlockTime = DateTime.MinValue; } } \ No newline at end of file diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs index ea844b8..dbc4eed 100644 --- a/HDL_ON/UI/MainPage.cs +++ b/HDL_ON/UI/MainPage.cs @@ -48,6 +48,11 @@ /// 杩滅▼妯″紡 /// </summary> public static bool IsRemote = false; + /// <summary> + /// 缃戠粶杩炴帴鐘舵�� + /// 0:鏃犵綉缁� + /// </summary> + public static int InternetStatus = 2; ///// <summary> ///// 鍏徃浠g爜 @@ -102,7 +107,7 @@ pm.GetUserInfo();//鍒锋柊涓汉淇℃伅 }) { IsBackground = true }.Start(); - + GoUserPage(); //鍚姩瀵嗙爜楠岃瘉 new AppUnlockPage().LoadPage(); @@ -149,63 +154,69 @@ waitPage.Start(Language.StringByID(StringId.PleaseWait)); new System.Threading.Thread(() => { - if (UserInfo.Current.regionList.Count == 0) + try { - bool loadPage = true; - var pm = new DAL.Server.HttpServerRequest(); - while (UserInfo.Current.regionList.Count == 0) + if (UserInfo.Current.regionList.Count == 0) { - pm.GetHomePager();//鍒锋柊浣忓畢淇℃伅 - System.Threading.Thread.Sleep(1000); - if (loadPage) + bool loadPage = true; + var pm = new DAL.Server.HttpServerRequest(); + while (UserInfo.Current.regionList.Count == 0) { - loadPage = false; - Application.RunOnMainThread(() => + pm.GetHomePager();//鍒锋柊浣忓畢淇℃伅 + System.Threading.Thread.Sleep(3000); + if (loadPage) { - waitPage.Hide(); - var addResidencePage = new BindingResidencePage(); - BaseView.AddChidren(addResidencePage); - addResidencePage.LoadDialog(); - }); + loadPage = false; + Application.RunOnMainThread(() => + { + waitPage.Hide(); + var addResidencePage = new BindingResidencePage(); + BaseView.AddChidren(addResidencePage); + addResidencePage.LoadDialog(); + }); + } } } - } - ///绛夊緟鑾峰彇浣忓畢淇℃伅 - Application.RunOnMainThread(() => - { - waitPage.Hide(); - BaseView.RemoveAll(); - BasePageView = new PageLayout(); - BasePageView.ScrollEnabled = false; - BasePageView.IsShowPoint = false; - BasePageView.PageChange = (sender, e) => + ///绛夊緟鑾峰彇浣忓畢淇℃伅 + Application.RunOnMainThread(() => { - if (e < BasePageView.ChildrenCount - 1) - { - MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); - } - - while (e < BasePageView.ChildrenCount - 1) - { - BasePageView.GetChildren(BasePageView.ChildrenCount - 1).RemoveFromParent(); - } - }; - BasePageView.MouseDownEventHandler += (sender, e) => - { - BasePageView.ScrollEnabled = true; - }; - BasePageView.MouseUpEventHandler += (sender, e) => - { + waitPage.Hide(); + BaseView.RemoveAll(); + BasePageView = new PageLayout(); BasePageView.ScrollEnabled = false; - }; - BaseView.AddChidren(BasePageView); + BasePageView.IsShowPoint = false; + BasePageView.PageChange = (sender, e) => + { + if (e < BasePageView.ChildrenCount - 1) + { + MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); + } + + while (e < BasePageView.ChildrenCount - 1) + { + BasePageView.GetChildren(BasePageView.ChildrenCount - 1).RemoveFromParent(); + } + }; + BasePageView.MouseDownEventHandler += (sender, e) => + { + BasePageView.ScrollEnabled = true; + }; + BasePageView.MouseUpEventHandler += (sender, e) => + { + BasePageView.ScrollEnabled = false; + }; + BaseView.AddChidren(BasePageView); //璺宠浆椤甸潰---- var userPage = new UserPage(); - BasePageView.AddChidren(userPage); - userPage.LoadPage(); - BasePageView.PageIndex = 0; - }); + BasePageView.AddChidren(userPage); + userPage.LoadPage(); + BasePageView.PageIndex = 0; + }); + }catch(Exception ex) + { + MainPage.Log($"GoUserPage : {ex.Message}"); + } }).Start(); } diff --git a/HDL_ON/UI/UI0-Public/AppUnlockPage.cs b/HDL_ON/UI/UI0-Public/AppUnlockPage.cs index c5bd852..2fcd6b6 100644 --- a/HDL_ON/UI/UI0-Public/AppUnlockPage.cs +++ b/HDL_ON/UI/UI0-Public/AppUnlockPage.cs @@ -15,10 +15,10 @@ } Action action = () => { - OnAppConfig.Instance.unlockTime = DateTime.Now; + UserInfo.Current.unlockTime = DateTime.Now; }; //1:楠岃瘉鎸囩汗 - if (OnAppConfig.Instance.appUnlockType.Contains("3")) + if (UserInfo.Current.appUnlockType.Contains("3")) { Action fAction = () => { @@ -31,23 +31,23 @@ if (e == TouchIDUtils.TouchIDState.Success) { MainPage.Log("KK:TouchID楠岃瘉鎴愬姛"); - OnAppConfig.Instance.unlockTime = DateTime.Now; + UserInfo.Current.unlockTime = DateTime.Now; MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); } else { ///灏嗛獙璇佹寚绾圭殑椤甸潰绉婚櫎 MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); - if (OnAppConfig.Instance.appUnlockType.Contains("1")) + if (UserInfo.Current.appUnlockType.Contains("1")) { - var page = new AppUnlockPasswordPage(OnAppConfig.Instance.appUnlockPasswrod, action); + var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, action); MainPage.BasePageView.AddChidren(page); page.LoadPage("7"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } - else if (OnAppConfig.Instance.appUnlockType.Contains("2")) + else if (UserInfo.Current.appUnlockType.Contains("2")) { - var page = new AppUnlockGesturePage(OnAppConfig.Instance.appUnlockPasswrod, action); + var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, action); MainPage.BasePageView.AddChidren(page); page.LoadPage("7"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; @@ -56,20 +56,20 @@ } }; } - else if (OnAppConfig.Instance.appUnlockType.Contains("4")) + else if (UserInfo.Current.appUnlockType.Contains("4")) { //Face ID楠岃瘉 // } - else if (OnAppConfig.Instance.appUnlockType.Contains("1")) + else if (UserInfo.Current.appUnlockType.Contains("1")) { - var page = new AppUnlockPasswordPage(OnAppConfig.Instance.appUnlockPasswrod, action); + var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, action); MainPage.BasePageView.AddChidren(page); page.LoadPage("7"); } - else if (OnAppConfig.Instance.appUnlockType.Contains("2")) + else if (UserInfo.Current.appUnlockType.Contains("2")) { - var page = new AppUnlockGesturePage(OnAppConfig.Instance.appUnlockPasswrod, action); + var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, action); MainPage.BasePageView.AddChidren(page); page.LoadPage("7"); } @@ -97,7 +97,7 @@ public void LoadPage() { - if (OnAppConfig.Instance.unlockTime.AddSeconds(60) > DateTime.Now || OnAppConfig.Instance.appUnlockPasswrod == "" || OnAppConfig.Instance.appUnlockPage.Count == 0) + if (UserInfo.Current.unlockTime.AddSeconds(60) > DateTime.Now || UserInfo.Current.appUnlockPasswrod == "" || UserInfo.Current.appUnlockPage.Count == 0) { return; } @@ -153,7 +153,7 @@ TextAlignment = TextAlignment.Center, TextColor = CSS.CSS_Color.MainColor, TextSize = CSS.CSS_FontSize.TextFontSize, - TextID = OnAppConfig.Instance.appUnlockType.Contains("1") ? StringId.VerifyDigitalPassword : StringId.VerifyGesturePassword, + TextID = UserInfo.Current.appUnlockType.Contains("1") ? StringId.VerifyDigitalPassword : StringId.VerifyGesturePassword, }; bodyView.AddChidren(btnOtherVerify); @@ -163,18 +163,18 @@ MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); Action action = () => { - OnAppConfig.Instance.unlockTime = DateTime.Now; + UserInfo.Current.unlockTime = DateTime.Now; }; - if (OnAppConfig.Instance.appUnlockType.Contains("1")) + if (UserInfo.Current.appUnlockType.Contains("1")) { - var page = new AppUnlockPasswordPage(OnAppConfig.Instance.appUnlockPasswrod, action); + var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, action); MainPage.BasePageView.AddChidren(page); page.LoadPage(optionType); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } - else if (OnAppConfig.Instance.appUnlockType.Contains("2")) + else if (UserInfo.Current.appUnlockType.Contains("2")) { - var page = new AppUnlockGesturePage(OnAppConfig.Instance.appUnlockPasswrod, action); + var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, action); MainPage.BasePageView.AddChidren(page); page.LoadPage(optionType); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs index 5e95f8b..d1d3371 100644 --- a/HDL_ON/UI/UI1-Login/LoginPage.cs +++ b/HDL_ON/UI/UI1-Login/LoginPage.cs @@ -192,7 +192,7 @@ } else { - etAccount.Text = "13697499568"; + etAccount.Text = "18824864143"; } b = !b; etPassword.Text = "123456"; diff --git a/HDL_ON/UI/UI1-Login/LoginPageBLL.cs b/HDL_ON/UI/UI1-Login/LoginPageBLL.cs index e2b2aa8..0be9bde 100644 --- a/HDL_ON/UI/UI1-Login/LoginPageBLL.cs +++ b/HDL_ON/UI/UI1-Login/LoginPageBLL.cs @@ -617,16 +617,16 @@ * 鏌ョ湅鏈湴鏄惁瀛樺湪鏁版嵁 * 瀛樺湪鍒欏鍑� */ - var isExis = FileUtils.IsExisFolder(DB_ResidenceData.residenceData.CurReginID); - if (isExis) - { - FileUtils.DeleteAllFile(); - string regionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID); - FileUtils.RestoreRegionFiles(regionRootPath); - DB_ResidenceData.residenceData.EixtAccount(); - OnAppConfig.Instance.RefreshUserConfig(); - SpatialInfo.CurrentSpatial.InitRoomFunction(); - } + //var isExis = FileUtils.IsExisFolder(DB_ResidenceData.residenceData.CurReginID); + //if (isExis) + //{ + // FileUtils.DeleteAllFile(); + // string regionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID); + // FileUtils.RestoreRegionFiles(regionRootPath); + // DB_ResidenceData.residenceData.EixtAccount(); + // OnAppConfig.Instance.RefreshUserConfig(); + // SpatialInfo.CurrentSpatial.InitRoomFunction(); + //} Application.RunOnMainThread(() => { //璺宠浆椤甸潰---- diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs index 5ccfafc..1a3df0a 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using HDL_ON.DAL; +using HDL_ON.DriverLayer; using HDL_ON.Entity; using HDL_ON.UI.CSS; using Newtonsoft.Json; @@ -122,6 +123,21 @@ Radius = (uint)Application.GetRealWidth(3), }; topView.AddChidren(btnLinkStateTip); + if (Control.Ins.GatewayOnline) + { + if (Control.Ins.IsRemote) + { + bodyView.btnLinkStateTip.BackgroundColor = CSS.CSS_Color.LinkTipRemote; + } + else + { + bodyView.btnLinkStateTip.BackgroundColor = CSS.CSS_Color.MainColor; + } + } + else + { + bodyView.btnLinkStateTip.BackgroundColor = CSS.CSS_Color.LinkTipFail; + } btnResidenceName = new Button() { diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs index ea91731..2aded38 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs @@ -101,7 +101,7 @@ { Y = btnTipNot.Bottom, Height = Application.GetRealWidth(100), - TextID = StringId.TipNotOpen, + TextID = StringId.ContentIsEmpty, TextAlignment = TextAlignment.Center, TextColor = CSS.CSS_Color.TextualColor, TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel, diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs index ad9473e..407b8d4 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs @@ -12,7 +12,7 @@ /// <summary> /// 浣忓畢ID /// </summary> - public static string homeId = Entity.DB_ResidenceData.residenceData.CurReginID; + public static string homeId = UserInfo.Current.CurReginID; /// <summary> /// 缃戝叧ID /// </summary> diff --git a/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs b/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs index 0c34ede..4e490a8 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs @@ -69,34 +69,55 @@ }; bodyView.AddChidren(topView); - btnSceneTilte = new Button() + if (DB_ResidenceData.residenceData.GatewayType == 0) { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(170), - Height = Application.GetRealHeight(25), - TextAlignment = TextAlignment.CenterRight, - TextSize = CSS_FontSize.HeadlineFontSize, - TextColor = CSS_Color.PromptingColor1, - SelectedTextColor = CSS_Color.MainColor, - TextID = StringId.Scenes, - IsSelected = true - }; - topView.AddChidren(btnSceneTilte); + btnSceneTilte = new Button() + { + Y = Application.GetRealHeight(30), + //Width = Application.GetRealWidth(170), + Height = Application.GetRealHeight(25), + TextAlignment = TextAlignment.Center, + TextSize = CSS_FontSize.HeadlineFontSize, + TextColor = CSS_Color.PromptingColor1, + SelectedTextColor = CSS_Color.MainColor, + TextID = StringId.Scenes, + IsSelected = true + }; + topView.AddChidren(btnSceneTilte); + btnAutomationTitle = new Button(); - btnAutomationTitle = new Button() + } + else { - X = Application.GetRealWidth(209), - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(170), - Height = Application.GetRealHeight(25), - TextAlignment = TextAlignment.CenterLeft, - TextSize = CSS_FontSize.TextFontSize, - TextColor = CSS_Color.PromptingColor1, - SelectedTextColor = CSS_Color.MainColor, - TextID = StringId.Automation, - }; - topView.AddChidren(btnAutomationTitle); + btnSceneTilte = new Button() + { + Y = Application.GetRealHeight(30), + Width = Application.GetRealWidth(170), + Height = Application.GetRealHeight(25), + TextAlignment = TextAlignment.CenterRight, + TextSize = CSS_FontSize.HeadlineFontSize, + TextColor = CSS_Color.PromptingColor1, + SelectedTextColor = CSS_Color.MainColor, + TextID = StringId.Scenes, + IsSelected = true + }; + topView.AddChidren(btnSceneTilte); + + btnAutomationTitle = new Button() + { + X = Application.GetRealWidth(209), + Y = Application.GetRealHeight(30), + Width = Application.GetRealWidth(170), + Height = Application.GetRealHeight(25), + TextAlignment = TextAlignment.CenterLeft, + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.PromptingColor1, + SelectedTextColor = CSS_Color.MainColor, + TextID = StringId.Automation, + }; + topView.AddChidren(btnAutomationTitle); + } var btnAddIconBg = new Button() { X = Application.GetRealWidth(337), @@ -318,7 +339,6 @@ }; view.AddChidren(btnZone); - Button btnSettingIcon; btnSettingIcon = new Button() { @@ -380,9 +400,8 @@ //btnAddIcon.RemoveFromParent(); automationPage = new FrameLayout(); contentPageView.AddChidren(automationPage); - HDL_ON.UI.UI2.Intelligence.Automation.MainView.automationPage = automationPage; - HDL_ON.UI.UI2.Intelligence.Automation.MainView.MainShow(); - + UI2.Intelligence.Automation.MainView.automationPage = automationPage; + UI2.Intelligence.Automation.MainView.MainShow(); } #endregion } @@ -474,7 +493,7 @@ else { //璺宠浆鍒伴�昏緫鐣岄潰 - HDL_ON.UI.UI2.Intelligence.Automation.MainView.SkipAddLogicPage(); + UI2.Intelligence.Automation.MainView.SkipAddLogicPage(); } }; } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs index aa25881..48adb5c 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs @@ -1,4 +1,5 @@ 锘縰sing System; +using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; namespace HDL_ON.UI @@ -154,6 +155,11 @@ { btnAddSceneBg.MouseUpEventHandler = (sender, e) => { + if (!string.IsNullOrEmpty(DB_ResidenceData.residenceData.HomeGateway.gatewayId)) + { + new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.UnableToCreateScenarioPleaseBindGateway), true); + return; + } Action backAction = () => { this.RemoveFromParent(); action(); diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs index aa23898..62844ce 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs @@ -982,7 +982,7 @@ System.IO.File.Delete(imageView.ImagePath); } //閲嶅懡鍚嶄繚瀛� - FileUtils.WriteFileByBytes(imageUrl, imageBytes); + Common.FileUtlis.Files.WriteFileByBytes(imageUrl, imageBytes); imageView.ImagePath = null; imageView.ImageBytes = imageBytes; //涓婁紶鎴愬姛 diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs index 4cdd3c0..e00aa2f 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs @@ -177,14 +177,14 @@ /// <param name="homeTemp"></param> void LoadEvent_ChangeCurHome(RegionInfoRes homeTemp) { - if (DB_ResidenceData.residenceData.CurReginID == homeTemp.RegionID) + if (UserInfo.Current.CurReginID == homeTemp.RegionID) { return; } - string oldRegionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID.ToString()); - string newRegionRootPath = FileUtils.CreateRegionBackup(homeTemp.RegionID.ToString()); - DB_ResidenceData.residenceData.CurReginID = homeTemp.RegionID; - DB_ResidenceData.residenceData.SaveResidenceData(); + //string oldRegionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID.ToString()); + //string newRegionRootPath = FileUtils.CreateRegionBackup(homeTemp.RegionID.ToString()); + UserInfo.Current.CurReginID = homeTemp.RegionID; + UserInfo.Current.SaveUserInfo(); var waitPage = new Loading(); bodyView.AddChidren(waitPage); waitPage.Start(Language.StringByID(StringId.PleaseWait)); @@ -192,43 +192,43 @@ { try { - var backuplist = FileUtils.ReadFiles(); - int index = 0; - FileUtils.DeleteRegionFiles(oldRegionRootPath); - //绉诲姩鏂囦欢 - foreach (var fileName in backuplist) - { - System.IO.FileInfo fileInfo = new System.IO.FileInfo(FileUtils.RootPath + fileName); - if (fileName.Contains(ImageUtlis.HEADIMAGE) || fileName == OnAppConfig.ConfigFile) - { - continue; - } - if (fileInfo.Exists) - { - fileInfo.MoveTo(oldRegionRootPath + fileName); - MainPage.Log("move file : " + fileName); - } - index++; - Application.RunOnMainThread(() => - { - int pro = (int)(index * 1.0 / backuplist.Count * 50); - waitPage.Text = pro.ToString() + "%"; - }); - } - //鍒犻櫎鏈湴鏂囦欢 - foreach (var fileName in backuplist) - { - if (fileName.Contains(ImageUtlis.HEADIMAGE)) - { - continue; - } - FileUtils.DeleteFile(fileName); - } - //鍊掑嚭鏂颁綇瀹呮暟鎹� - FileUtils.RestoreRegionFiles(newRegionRootPath); + //var backuplist = FileUtils.ReadFiles(); + //int index = 0; + //FileUtils.DeleteRegionFiles(oldRegionRootPath); + ////绉诲姩鏂囦欢 + //foreach (var fileName in backuplist) + //{ + // System.IO.FileInfo fileInfo = new System.IO.FileInfo(FileUtils.RootPath + fileName); + // if (fileName.Contains(ImageUtlis.HEADIMAGE) || fileName == OnAppConfig.ConfigFile) + // { + // continue; + // } + // if (fileInfo.Exists) + // { + // fileInfo.MoveTo(oldRegionRootPath + fileName); + // MainPage.Log("move file : " + fileName); + // } + // index++; + // Application.RunOnMainThread(() => + // { + // int pro = (int)(index * 1.0 / backuplist.Count * 50); + // waitPage.Text = pro.ToString() + "%"; + // }); + //} + ////鍒犻櫎鏈湴鏂囦欢 + //foreach (var fileName in backuplist) + //{ + // if (fileName.Contains(ImageUtlis.HEADIMAGE)) + // { + // continue; + // } + // FileUtils.DeleteFile(fileName); + //} + ////鍊掑嚭鏂颁綇瀹呮暟鎹� + //FileUtils.RestoreRegionFiles(newRegionRootPath); + UserInfo.Current.CurReginID = homeTemp.RegionID; UserInfo.Current.SaveUserInfo(); DB_ResidenceData.residenceData.EixtAccount(); - DB_ResidenceData.residenceData.CurReginID = homeTemp.RegionID; OnAppConfig.Instance.SaveUserConfig(); SpatialInfo.CurrentSpatial.InitRoomFunction(); DB_ResidenceData.residenceData.SaveResidenceData(); diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs index ffbbe89..b60b3e9 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs @@ -95,20 +95,20 @@ try { #region 淇濆瓨鏈湴鏁版嵁鑷虫枃浠跺す - string oldRegionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID.ToString()); - //娓呯┖涔嬪墠鐨勪綇瀹呮枃浠� - FileUtils.DeleteRegionFiles(oldRegionRootPath); - var backuplist = FileUtils.ReadFiles(); - //绉诲姩鏂囦欢 - foreach (var fileName in backuplist) - { - System.IO.FileInfo fileInfo = new System.IO.FileInfo(FileUtils.RootPath + fileName); - if (fileInfo.Exists) - { - fileInfo.MoveTo(oldRegionRootPath + fileName); - MainPage.Log("move file : " + fileName); - } - } + //string oldRegionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID.ToString()); + ////娓呯┖涔嬪墠鐨勪綇瀹呮枃浠� + //FileUtils.DeleteRegionFiles(oldRegionRootPath); + //var backuplist = FileUtils.ReadFiles(); + ////绉诲姩鏂囦欢 + //foreach (var fileName in backuplist) + //{ + // System.IO.FileInfo fileInfo = new System.IO.FileInfo(FileUtils.RootPath + fileName); + // if (fileInfo.Exists) + // { + // fileInfo.MoveTo(oldRegionRootPath + fileName); + // MainPage.Log("move file : " + fileName); + // } + //} #endregion } catch (Exception ex) @@ -117,7 +117,7 @@ } finally { - FileUtils.DeleteAllFile(); + //FileUtils.DeleteAllFile(); //2.娉ㄩ攢鎺ㄩ�� new HttpServerRequest().SignOutPush(); //3.璺宠浆鐧诲綍椤甸潰 @@ -278,7 +278,7 @@ System.IO.File.Delete(imageView.ImagePath); } //閲嶅懡鍚嶄繚瀛� - FileUtils.WriteFileByBytes(imageUrl, imageBytes); + Common.FileUtlis.Files.WriteFileByBytes(imageUrl, imageBytes); imageView.ImagePath = null; imageView.ImageBytes = imageBytes; //涓婁紶鎴愬姛 diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs index b0447d5..c98be11 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs @@ -695,7 +695,7 @@ System.IO.File.Delete(imageView.ImagePath); } //閲嶅懡鍚嶄繚瀛� - FileUtils.WriteFileByBytes(imageUrl, imageBytes); + Common.FileUtlis.Files.WriteFileByBytes(imageUrl, imageBytes); imageView.ImagePath = null; imageView.ImageBytes = imageBytes; //涓婁紶鎴愬姛 diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/RoomBinglingFloorPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/RoomBinglingFloorPage.cs index 48bfdc7..2751883 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/RoomBinglingFloorPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/RoomBinglingFloorPage.cs @@ -94,7 +94,7 @@ { try { - var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = DB_ResidenceData.residenceData.CurReginID }; + var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = UserInfo.Current.CurReginID }; var addResult = SpatialInfo.CurrentSpatial.AddFloor(f); if (addResult == DAL.Server.StateCode.SUCCESS) { diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPage.cs index 6789283..2b6f794 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPage.cs @@ -125,7 +125,7 @@ { try { - var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = DB_ResidenceData.residenceData.CurReginID }; + var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = UserInfo.Current.CurReginID }; var addResult = SpatialInfo.CurrentSpatial.AddFloor(f); if (addResult == DAL.Server.StateCode.SUCCESS) { diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs index 6ca33ae..185b8b8 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs @@ -365,7 +365,7 @@ System.IO.File.Delete(imageView.ImagePath); } //閲嶅懡鍚嶄繚瀛� - FileUtils.WriteFileByBytes(imageUrl, imageBytes); + Common.FileUtlis.Files.WriteFileByBytes(imageUrl, imageBytes); imageView.ImagePath = null; imageView.ImageBytes = imageBytes; //涓婁紶鎴愬姛 diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockGesturePage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockGesturePage.cs index 0ed1e8d..af371d7 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockGesturePage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockGesturePage.cs @@ -149,11 +149,11 @@ this.RemoveFromParent(); return; } - if (OnAppConfig.Instance.appUnlockType.Contains("2")) + if (UserInfo.Current.appUnlockType.Contains("2")) { - OnAppConfig.Instance.appUnlockType = new System.Collections.Generic.List<string>(); - OnAppConfig.Instance.appUnlockPasswrod = ""; - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.appUnlockType = new System.Collections.Generic.List<string>(); + UserInfo.Current.appUnlockPasswrod = ""; + UserInfo.Current.SaveUserInfo(); this.RemoveFromParent(); backAction(); } @@ -170,36 +170,36 @@ { if (passwrod == oldPasswrod) { - if (optionType == "5" )//&& OnAppConfig.Instance.appUnlockType.Contains("3")) + if (optionType == "5" )//&& UserInfo.Current.appUnlockType.Contains("3")) { - if (OnAppConfig.Instance.appUnlockType.Contains("3")) - OnAppConfig.Instance.appUnlockType.Remove("3"); + if (UserInfo.Current.appUnlockType.Contains("3")) + UserInfo.Current.appUnlockType.Remove("3"); else - OnAppConfig.Instance.appUnlockType.Add("3"); + UserInfo.Current.appUnlockType.Add("3"); - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.SaveUserInfo(); this.RemoveFromParent(); } if ( optionType == "6") { - if (OnAppConfig.Instance.appUnlockType.Contains("4")) - OnAppConfig.Instance.appUnlockType.Remove("4"); + if (UserInfo.Current.appUnlockType.Contains("4")) + UserInfo.Current.appUnlockType.Remove("4"); else - OnAppConfig.Instance.appUnlockType.Add("4"); + UserInfo.Current.appUnlockType.Add("4"); - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.SaveUserInfo(); this.RemoveFromParent(); } - if (optionType == "8" && !OnAppConfig.Instance.appUnlockType.Contains("3")) + if (optionType == "8" && !UserInfo.Current.appUnlockType.Contains("3")) { - OnAppConfig.Instance.appUnlockType.Add("3"); - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.appUnlockType.Add("3"); + UserInfo.Current.SaveUserInfo(); this.RemoveFromParent(); } - if (!OnAppConfig.Instance.appUnlockType.Contains("4") && optionType == "9") + if (!UserInfo.Current.appUnlockType.Contains("4") && optionType == "9") { - OnAppConfig.Instance.appUnlockType.Remove("4"); - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.appUnlockType.Remove("4"); + UserInfo.Current.SaveUserInfo(); this.RemoveFromParent(); } backAction(); @@ -228,29 +228,29 @@ var unlockType = TouchIDUtils.getTouchIDSupperType() == TouchIDUtils.TouchIDSupperType.TouchID ? "3" : "4"; if (result) { - if (!OnAppConfig.Instance.appUnlockType.Contains(unlockType)) + if (!UserInfo.Current.appUnlockType.Contains(unlockType)) { - OnAppConfig.Instance.appUnlockType.Add(unlockType); + UserInfo.Current.appUnlockType.Add(unlockType); } } else { - if (OnAppConfig.Instance.appUnlockType.Contains(unlockType)) + if (UserInfo.Current.appUnlockType.Contains(unlockType)) { - OnAppConfig.Instance.appUnlockType.Remove(unlockType); + UserInfo.Current.appUnlockType.Remove(unlockType); } } - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.SaveUserInfo(); backAction(); }; page.AdditionalOperations(tipMsg, action); } - if (!OnAppConfig.Instance.appUnlockType.Contains("2")) + if (!UserInfo.Current.appUnlockType.Contains("2")) { - OnAppConfig.Instance.appUnlockType.Add("2"); + UserInfo.Current.appUnlockType.Add("2"); } - OnAppConfig.Instance.appUnlockPasswrod = passwrod; - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.appUnlockPasswrod = passwrod; + UserInfo.Current.SaveUserInfo(); backAction(); } else @@ -287,9 +287,9 @@ var resultObj = new HttpServerRequest().LoginByPassword( UserInfo.Current.AccountString, pw); if (resultObj.Code == StateCode.SUCCESS) { - OnAppConfig.Instance.appUnlockPasswrod = ""; - OnAppConfig.Instance.appUnlockType = new System.Collections.Generic.List<string>(); - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.appUnlockPasswrod = ""; + UserInfo.Current.appUnlockType = new System.Collections.Generic.List<string>(); + UserInfo.Current.SaveUserInfo(); this.RemoveFromParent(); backAction(); } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockPasswordPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockPasswordPage.cs index f64b708..495f3fd 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockPasswordPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockPasswordPage.cs @@ -229,11 +229,11 @@ this.RemoveFromParent(); return; } - if (OnAppConfig.Instance.appUnlockType.Contains("1")) + if (UserInfo.Current.appUnlockType.Contains("1")) { - OnAppConfig.Instance.appUnlockType =new System.Collections.Generic.List<string>();//.Remove("1"); - OnAppConfig.Instance.appUnlockPasswrod = ""; - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.appUnlockType =new System.Collections.Generic.List<string>();//.Remove("1"); + UserInfo.Current.appUnlockPasswrod = ""; + UserInfo.Current.SaveUserInfo(); this.RemoveFromParent(); backAction(); } @@ -253,22 +253,22 @@ { if (optionType == "5") { - if (OnAppConfig.Instance.appUnlockType.Contains("3")) - OnAppConfig.Instance.appUnlockType.Remove("3"); + if (UserInfo.Current.appUnlockType.Contains("3")) + UserInfo.Current.appUnlockType.Remove("3"); else - OnAppConfig.Instance.appUnlockType.Add("3"); + UserInfo.Current.appUnlockType.Add("3"); - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.SaveUserInfo(); this.RemoveFromParent(); } if (optionType == "6") { - if (OnAppConfig.Instance.appUnlockType.Contains("4")) - OnAppConfig.Instance.appUnlockType.Remove("4"); + if (UserInfo.Current.appUnlockType.Contains("4")) + UserInfo.Current.appUnlockType.Remove("4"); else - OnAppConfig.Instance.appUnlockType.Add("4"); + UserInfo.Current.appUnlockType.Add("4"); - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.SaveUserInfo(); this.RemoveFromParent(); } backAction(); @@ -298,29 +298,29 @@ { if (result) { - if (!OnAppConfig.Instance.appUnlockType.Contains(unlockType)) + if (!UserInfo.Current.appUnlockType.Contains(unlockType)) { - OnAppConfig.Instance.appUnlockType.Add(unlockType); + UserInfo.Current.appUnlockType.Add(unlockType); } } else { - if (OnAppConfig.Instance.appUnlockType.Contains(unlockType)) + if (UserInfo.Current.appUnlockType.Contains(unlockType)) { - OnAppConfig.Instance.appUnlockType.Remove(unlockType); + UserInfo.Current.appUnlockType.Remove(unlockType); } } backAction(); - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.SaveUserInfo(); }; page.AdditionalOperations(tipMsg, action); } - if (!OnAppConfig.Instance.appUnlockType.Contains("1")) + if (!UserInfo.Current.appUnlockType.Contains("1")) { - OnAppConfig.Instance.appUnlockType.Add("1"); + UserInfo.Current.appUnlockType.Add("1"); } - OnAppConfig.Instance.appUnlockPasswrod = passwrod; - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.appUnlockPasswrod = passwrod; + UserInfo.Current.SaveUserInfo(); backAction(); } else @@ -371,9 +371,9 @@ var resultObj = new HttpServerRequest().LoginByPassword( UserInfo.Current.AccountString, pw); if (resultObj.Code.ToUpper() == StateCode.SUCCESS) { - OnAppConfig.Instance.appUnlockPasswrod = ""; - OnAppConfig.Instance.appUnlockType = new System.Collections.Generic.List<string>(); - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.appUnlockPasswrod = ""; + UserInfo.Current.appUnlockType = new System.Collections.Generic.List<string>(); + UserInfo.Current.SaveUserInfo(); this.RemoveFromParent(); backAction(); } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPage.cs index 97db491..dc14851 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPage.cs @@ -147,10 +147,10 @@ bodyView.BackgroundColor = CSS_Color.BackgroundColor; //濡傛灉鐢ㄦ埛閰嶇疆浜嗛渶瑕佽В閿佺殑鐣岄潰浣嗘槸娌℃湁璁剧疆瀵嗙爜锛屽垯鍦ㄨ繑鍥炴椂娓呯┖闇�瑕佽В閿佺殑鐣岄潰 Action action = () => { - if(OnAppConfig.Instance.appUnlockPage.Count > 0&& OnAppConfig.Instance.appUnlockPasswrod == "") + if(UserInfo.Current.appUnlockPage.Count > 0&& UserInfo.Current.appUnlockPasswrod == "") { - OnAppConfig.Instance.appUnlockPage = new System.Collections.Generic.List<string>(); - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.appUnlockPage = new System.Collections.Generic.List<string>(); + UserInfo.Current.SaveUserInfo(); } }; new TopViewDiv(bodyView, Language.StringByID(StringId.InterpretationSettings)).LoadTopView(action); @@ -418,7 +418,7 @@ Height = Application.GetRealHeight(260), BackgroundColor = CSS_Color.MainBackgroundColor, ScrollEnabled = false, - Visible = OnAppConfig.Instance.appUnlockPage.Count > 0 + Visible = UserInfo.Current.appUnlockPage.Count > 0 }; bodyView.AddChidren(unlockOptionView); @@ -470,7 +470,7 @@ { Height = Application.GetRealHeight(50), }; - if ( !OnAppConfig.Instance.appUnlockType.Contains("2")) + if ( !UserInfo.Current.appUnlockType.Contains("2")) { unlockOptionView.AddChidren(passwordUnlockDiv); } @@ -504,7 +504,7 @@ Height = Application.GetMinRealAverage(38), UnSelectedImagePath = "Public/Switch_2.png", SelectedImagePath = "Public/SwitchOn_2.png", - IsSelected = OnAppConfig.Instance.appUnlockType.Contains("1") + IsSelected = UserInfo.Current.appUnlockType.Contains("1") }; passwordUnlockDiv.AddChidren(btnPasswordUnlockkSwtichIcon); @@ -532,7 +532,7 @@ { Height = Application.GetRealHeight(50), }; - if (OnAppConfig.Instance.appUnlockPasswrod != "" && OnAppConfig.Instance.appUnlockType.Contains("1")) + if (UserInfo.Current.appUnlockPasswrod != "" && UserInfo.Current.appUnlockType.Contains("1")) { unlockOptionView.AddChidren(resetPasswordDiv); } @@ -557,7 +557,7 @@ }; resetPasswordDiv.AddChidren(btnResetPasswordTitle); - if (OnAppConfig.Instance.appUnlockPasswrod != "" && OnAppConfig.Instance.appUnlockType.Contains("1")) + if (UserInfo.Current.appUnlockPasswrod != "" && UserInfo.Current.appUnlockType.Contains("1")) { unlockOptionView.AddChidren(new Button() { @@ -574,7 +574,7 @@ { Height = Application.GetRealHeight(50), }; - if (!OnAppConfig.Instance.appUnlockType.Contains("1")) + if (!UserInfo.Current.appUnlockType.Contains("1")) { unlockOptionView.AddChidren(gestureUnlockDiv); } @@ -606,7 +606,7 @@ Height = Application.GetMinRealAverage(38), UnSelectedImagePath = "Public/Switch_2.png", SelectedImagePath = "Public/SwitchOn_2.png", - IsSelected = OnAppConfig.Instance.appUnlockType.Contains("2") + IsSelected = UserInfo.Current.appUnlockType.Contains("2") }; gestureUnlockDiv.AddChidren(btnGestureUnlockkSwtichIcon); @@ -621,7 +621,7 @@ }; gestureUnlockDiv.AddChidren(btnGestureUnlockTitle); - if (!OnAppConfig.Instance.appUnlockType.Contains("1")) + if (!UserInfo.Current.appUnlockType.Contains("1")) { unlockOptionView.AddChidren(new Button() { @@ -639,7 +639,7 @@ { Height = Application.GetRealHeight(50), }; - if (OnAppConfig.Instance.appUnlockPasswrod != "" && OnAppConfig.Instance.appUnlockType.Contains("2")) + if (UserInfo.Current.appUnlockPasswrod != "" && UserInfo.Current.appUnlockType.Contains("2")) { unlockOptionView.AddChidren(resetGestureDiv); } @@ -664,7 +664,7 @@ }; resetGestureDiv.AddChidren(btnResetGestureTitle); - if (OnAppConfig.Instance.appUnlockPasswrod != "" && OnAppConfig.Instance.appUnlockType.Contains("2")) + if (UserInfo.Current.appUnlockPasswrod != "" && UserInfo.Current.appUnlockType.Contains("2")) { unlockOptionView.AddChidren(new Button() { @@ -696,7 +696,7 @@ { Height = Application.GetRealHeight(51), }; - if (sTouchID && OnAppConfig.Instance.appUnlockPasswrod != ""&&!OnAppConfig.Instance.appUnlockType.Contains("4")) + if (sTouchID && UserInfo.Current.appUnlockPasswrod != ""&&!UserInfo.Current.appUnlockType.Contains("4")) { unlockOptionView.AddChidren(fingerprintUnlockDiv); } @@ -729,7 +729,7 @@ Height = Application.GetMinRealAverage(38), UnSelectedImagePath = "Public/Switch_2.png", SelectedImagePath = "Public/SwitchOn_2.png", - IsSelected = OnAppConfig.Instance.appUnlockType.Contains("3") + IsSelected = UserInfo.Current.appUnlockType.Contains("3") }; fingerprintUnlockDiv.AddChidren(btnFingerprintUnlockSwtichIcon); @@ -750,7 +750,7 @@ { Height = Application.GetRealHeight(50), }; - if (sFaceID && OnAppConfig.Instance.appUnlockPasswrod != "" && !OnAppConfig.Instance.appUnlockType.Contains("4")) + if (sFaceID && UserInfo.Current.appUnlockPasswrod != "" && !UserInfo.Current.appUnlockType.Contains("4")) { unlockOptionView.AddChidren(faceIdUnlockDiv); } @@ -782,7 +782,7 @@ Height = Application.GetMinRealAverage(38), UnSelectedImagePath = "Public/Switch_2.png", SelectedImagePath = "Public/SwitchOn_2.png", - IsSelected = OnAppConfig.Instance.appUnlockType.Contains("4") + IsSelected = UserInfo.Current.appUnlockType.Contains("4") }; faceIdUnlockDiv.AddChidren(btnFaceIdUnlockSwtichIcon); diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs index a32e3b5..005603d 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs @@ -14,10 +14,10 @@ refreshAction = () => { LoadView_UnlockView(); - //fingerprintUnlockDiv.Visible = sTouchID && (OnAppConfig.Instance.appUnlockType.Contains("1") || OnAppConfig.Instance.appUnlockType.Contains("2")); - //faceIdUnlockDiv.Visible = sFaceID && (OnAppConfig.Instance.appUnlockType.Contains("1") || OnAppConfig.Instance.appUnlockType.Contains("2")); - //btnFingerprintUnlockSwtichIcon.IsSelected = OnAppConfig.Instance.appUnlockType.Contains("3"); - //btnFaceIdUnlockSwtichIcon.IsSelected = OnAppConfig.Instance.appUnlockType.Contains("4"); + //fingerprintUnlockDiv.Visible = sTouchID && (UserInfo.Current.appUnlockType.Contains("1") || UserInfo.Current.appUnlockType.Contains("2")); + //faceIdUnlockDiv.Visible = sFaceID && (UserInfo.Current.appUnlockType.Contains("1") || UserInfo.Current.appUnlockType.Contains("2")); + //btnFingerprintUnlockSwtichIcon.IsSelected = UserInfo.Current.appUnlockType.Contains("3"); + //btnFaceIdUnlockSwtichIcon.IsSelected = UserInfo.Current.appUnlockType.Contains("4"); }; } @@ -37,10 +37,10 @@ btnTipMsg.TextID = StringId.UnprotectedTipMsg; - OnAppConfig.Instance.appUnlockPage = new System.Collections.Generic.List<string>(); - OnAppConfig.Instance.appUnlockType = new System.Collections.Generic.List<string>(); - OnAppConfig.Instance.appUnlockPasswrod = ""; - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.appUnlockPage = new System.Collections.Generic.List<string>(); + UserInfo.Current.appUnlockType = new System.Collections.Generic.List<string>(); + UserInfo.Current.appUnlockPasswrod = ""; + UserInfo.Current.SaveUserInfo(); unlockOptionView.Visible = false; refreshAction(); }; @@ -48,7 +48,7 @@ if (!btnUnprotectedBg.IsSelected) { //1:楠岃瘉鎸囩汗 - if (OnAppConfig.Instance.appUnlockType.Contains("3")) + if (UserInfo.Current.appUnlockType.Contains("3")) { TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.PleaseVerifyTheFingerprint)); TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = (sender1, e) => @@ -65,16 +65,16 @@ else if (e == TouchIDUtils.TouchIDState.InputPassword || e == TouchIDUtils.TouchIDState.TouchIDLockout) { MainPage.Log("KK:鐢ㄦ埛閫夋嫨鎵嬪姩杈撳叆瀵嗙爜"); - if (OnAppConfig.Instance.appUnlockType.Contains("1")) + if (UserInfo.Current.appUnlockType.Contains("1")) { - var page = new AppUnlockPasswordPage(OnAppConfig.Instance.appUnlockPasswrod, action); + var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, action); MainPage.BasePageView.AddChidren(page); page.LoadPage("4"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } - else if (OnAppConfig.Instance.appUnlockType.Contains("1")) + else if (UserInfo.Current.appUnlockType.Contains("1")) { - var page = new AppUnlockGesturePage(OnAppConfig.Instance.appUnlockPasswrod, action); + var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, action); MainPage.BasePageView.AddChidren(page); page.LoadPage("4"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; @@ -82,21 +82,21 @@ } }; } - else if (OnAppConfig.Instance.appUnlockType.Contains("4")) + else if (UserInfo.Current.appUnlockType.Contains("4")) { //Face ID楠岃瘉 // } - else if (OnAppConfig.Instance.appUnlockType.Contains("1")) + else if (UserInfo.Current.appUnlockType.Contains("1")) { - var page = new AppUnlockPasswordPage(OnAppConfig.Instance.appUnlockPasswrod, action); + var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, action); MainPage.BasePageView.AddChidren(page); page.LoadPage("4"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } - else if (OnAppConfig.Instance.appUnlockType.Contains("2")) + else if (UserInfo.Current.appUnlockType.Contains("2")) { - var page = new AppUnlockGesturePage(OnAppConfig.Instance.appUnlockPasswrod, action); + var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, action); MainPage.BasePageView.AddChidren(page); page.LoadPage("4"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; @@ -104,7 +104,7 @@ } }; - if (OnAppConfig.Instance.appUnlockPasswrod != "") + if (UserInfo.Current.appUnlockPasswrod != "") { new PublicAssmebly().TipMsg(StringId.Tip, StringId.TipTurnOffUnlockingSetting, action1); } @@ -126,29 +126,29 @@ if (result) { btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = false; - if (!OnAppConfig.Instance.appUnlockPage.Contains("1")) + if (!UserInfo.Current.appUnlockPage.Contains("1")) { - OnAppConfig.Instance.appUnlockPage.Add("1"); - if (OnAppConfig.Instance.appUnlockPasswrod != "") - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.appUnlockPage.Add("1"); + if (UserInfo.Current.appUnlockPasswrod != "") + UserInfo.Current.SaveUserInfo(); } unlockOptionView.Visible = true; } else { - if (OnAppConfig.Instance.appUnlockPage.Contains("1")) + if (UserInfo.Current.appUnlockPage.Contains("1")) { - OnAppConfig.Instance.appUnlockPage.Remove("1"); + UserInfo.Current.appUnlockPage.Remove("1"); } - if (OnAppConfig.Instance.appUnlockPage.Count == 0) + if (UserInfo.Current.appUnlockPage.Count == 0) { btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = true; btnTipMsg.TextID = StringId.UnprotectedTipMsg; - OnAppConfig.Instance.appUnlockPasswrod = ""; + UserInfo.Current.appUnlockPasswrod = ""; unlockOptionView.Visible = false; refreshAction(); } - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.SaveUserInfo(); } }; btnStartupBg.MouseUpEventHandler = eventHandler2; @@ -165,29 +165,29 @@ if (result) { btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = false; - if (!OnAppConfig.Instance.appUnlockPage.Contains("2")) + if (!UserInfo.Current.appUnlockPage.Contains("2")) { - OnAppConfig.Instance.appUnlockPage.Add("2"); - if (OnAppConfig.Instance.appUnlockPasswrod != "") - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.appUnlockPage.Add("2"); + if (UserInfo.Current.appUnlockPasswrod != "") + UserInfo.Current.SaveUserInfo(); } unlockOptionView.Visible = true; } else { - if (OnAppConfig.Instance.appUnlockPage.Contains("2")) + if (UserInfo.Current.appUnlockPage.Contains("2")) { - OnAppConfig.Instance.appUnlockPage.Remove("2"); + UserInfo.Current.appUnlockPage.Remove("2"); } - if (OnAppConfig.Instance.appUnlockPage.Count == 0) + if (UserInfo.Current.appUnlockPage.Count == 0) { btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = result; btnTipMsg.TextID = StringId.UnprotectedTipMsg; - OnAppConfig.Instance.appUnlockPasswrod = ""; + UserInfo.Current.appUnlockPasswrod = ""; unlockOptionView.Visible = false; refreshAction(); } - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.SaveUserInfo(); } }; btnSecurityBg.MouseUpEventHandler = eventHandler3; @@ -203,29 +203,29 @@ if (result) { btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = false; - if (!OnAppConfig.Instance.appUnlockPage.Contains("3")) + if (!UserInfo.Current.appUnlockPage.Contains("3")) { - OnAppConfig.Instance.appUnlockPage.Add("3"); - if (OnAppConfig.Instance.appUnlockPasswrod != "") - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.appUnlockPage.Add("3"); + if (UserInfo.Current.appUnlockPasswrod != "") + UserInfo.Current.SaveUserInfo(); } unlockOptionView.Visible = true; } else { - if (OnAppConfig.Instance.appUnlockPage.Contains("3")) + if (UserInfo.Current.appUnlockPage.Contains("3")) { - OnAppConfig.Instance.appUnlockPage.Remove("3"); + UserInfo.Current.appUnlockPage.Remove("3"); } - if (OnAppConfig.Instance.appUnlockPage.Count == 0) + if (UserInfo.Current.appUnlockPage.Count == 0) { btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = true; btnTipMsg.TextID = StringId.UnprotectedTipMsg; - OnAppConfig.Instance.appUnlockPasswrod = ""; + UserInfo.Current.appUnlockPasswrod = ""; unlockOptionView.Visible = false; refreshAction(); } - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.SaveUserInfo(); } }; btnDoorlockBg.MouseUpEventHandler = eventHandler4; @@ -238,23 +238,23 @@ /// </summary> void LoadEvent_InitOptionState() { - if (OnAppConfig.Instance.appUnlockPage.Count == 0) + if (UserInfo.Current.appUnlockPage.Count == 0) { btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = true; } else { - if (OnAppConfig.Instance.appUnlockPage.Contains("1")) + if (UserInfo.Current.appUnlockPage.Contains("1")) { btnStartupBg.IsSelected = btnStartupSelectionIcon.IsSelected = btnStartupSelectionTip.IsSelected = true; btnTipMsg.Text = Language.StringByID(StringId.AtStartupTipMsg); } - if (OnAppConfig.Instance.appUnlockPage.Contains("2")) + if (UserInfo.Current.appUnlockPage.Contains("2")) { btnSecurityBg.IsSelected = btnSecuritySelectionIcon.IsSelected = btnSecuritySelectionTip.IsSelected = true; btnTipMsg.Text = Language.StringByID(StringId.DefenseAndUndefenseTipMsg); } - if (OnAppConfig.Instance.appUnlockPage.Contains("3")) + if (UserInfo.Current.appUnlockPage.Contains("3")) { btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = true; btnTipMsg.Text = Language.StringByID(StringId.RemoteUnlockingTipMsg); @@ -269,15 +269,15 @@ { btnPasswordUnlockTitle.MouseUpEventHandler = (sender, e) => { - var page = new AppUnlockPasswordPage(OnAppConfig.Instance.appUnlockPasswrod, refreshAction); + var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, refreshAction); MainPage.BasePageView.AddChidren(page); - page.LoadPage(OnAppConfig.Instance.appUnlockType.Contains("1") ? "3" : "1"); + page.LoadPage(UserInfo.Current.appUnlockType.Contains("1") ? "3" : "1"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; btnResetPasswordTitle.MouseUpEventHandler = (sender, e) => { - var page = new AppUnlockPasswordPage(OnAppConfig.Instance.appUnlockPasswrod, refreshAction); + var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, refreshAction); MainPage.BasePageView.AddChidren(page); page.LoadPage("2"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; @@ -285,14 +285,14 @@ btnGestureUnlockTitle.MouseUpEventHandler = (sender, e) => { - var page = new AppUnlockGesturePage(OnAppConfig.Instance.appUnlockPasswrod, refreshAction); + var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, refreshAction); MainPage.BasePageView.AddChidren(page); - page.LoadPage(OnAppConfig.Instance.appUnlockType.Contains("2") ? "3" : "1"); + page.LoadPage(UserInfo.Current.appUnlockType.Contains("2") ? "3" : "1"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; btnResetGestureTitle.MouseUpEventHandler = (sender, e) => { - var page = new AppUnlockGesturePage(OnAppConfig.Instance.appUnlockPasswrod, refreshAction); + var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, refreshAction); MainPage.BasePageView.AddChidren(page); page.LoadPage("3"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; @@ -316,18 +316,18 @@ var result = btnFingerprintUnlockSwtichIcon.IsSelected = !btnFingerprintUnlockSwtichIcon.IsSelected; if (result) { - if (!OnAppConfig.Instance.appUnlockType.Contains("3")) + if (!UserInfo.Current.appUnlockType.Contains("3")) { - OnAppConfig.Instance.appUnlockType.Add("3"); - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.appUnlockType.Add("3"); + UserInfo.Current.SaveUserInfo(); } } else { - if (OnAppConfig.Instance.appUnlockType.Contains("3")) + if (UserInfo.Current.appUnlockType.Contains("3")) { - OnAppConfig.Instance.appUnlockType.Remove("3"); - OnAppConfig.Instance.SaveUserConfig(); + UserInfo.Current.appUnlockType.Remove("3"); + UserInfo.Current.SaveUserInfo(); } } //MainPage.BasePageView.RemoveAt(MainPage.BasePageView.ChildrenCount - 1); @@ -335,16 +335,16 @@ } else// if (e == TouchIDUtils.TouchIDState.InputPassword || e == TouchIDUtils.TouchIDState.TouchIDLockout) { - if (OnAppConfig.Instance.appUnlockType.Contains("1")) + if (UserInfo.Current.appUnlockType.Contains("1")) { - var page = new AppUnlockPasswordPage(OnAppConfig.Instance.appUnlockPasswrod, refreshAction); + var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, refreshAction); MainPage.BasePageView.AddChidren(page); page.LoadPage("5"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } - else if (OnAppConfig.Instance.appUnlockType.Contains("2")) + else if (UserInfo.Current.appUnlockType.Contains("2")) { - var page = new AppUnlockGesturePage(OnAppConfig.Instance.appUnlockPasswrod, refreshAction); + var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, refreshAction); MainPage.BasePageView.AddChidren(page); page.LoadPage("5"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs index 103f7f6..13991b2 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs @@ -94,12 +94,12 @@ /// </summary> public static void Save() { - FileUtils.WriteFileByBytes(a31MusiceModeListFilePath, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(A31MusicModelList))); + Common.FileUtlis.Files.WriteFileByBytes(a31MusiceModeListFilePath, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(A31MusicModelList))); } public static void Refresh() { - if (null == Newtonsoft.Json.JsonConvert.DeserializeObject<System.Collections.Generic.List<A31MusicModel>>(System.Text.Encoding.UTF8.GetString(FileUtils.ReadFile(a31MusiceModeListFilePath)))) + if (null == Newtonsoft.Json.JsonConvert.DeserializeObject<System.Collections.Generic.List<A31MusicModel>>(System.Text.Encoding.UTF8.GetString(Common.FileUtlis.Files.ReadFile(a31MusiceModeListFilePath)))) { A31MusicModelList = new List<A31MusicModel> { }; //鍒濆鍖栨埧闂村垪琛� @@ -107,7 +107,7 @@ } else { - A31MusicModelList = Newtonsoft.Json.JsonConvert.DeserializeObject<System.Collections.Generic.List<A31MusicModel>>(System.Text.Encoding.UTF8.GetString(FileUtils.ReadFile(a31MusiceModeListFilePath))); + A31MusicModelList = Newtonsoft.Json.JsonConvert.DeserializeObject<System.Collections.Generic.List<A31MusicModel>>(System.Text.Encoding.UTF8.GetString(Common.FileUtlis.Files.ReadFile(a31MusiceModeListFilePath))); } if (A31MusicModelList == null) { -- Gitblit v1.8.0