| | |
| | | /// <param name="all">true:全部删除(用于住宅删除) false:重要的文件不删除</param>
|
| | | public static void DeleteAllLocationFile(bool all = true)
|
| | | {
|
| | | string dPath = UserCenterResourse.LocalRootPath;
|
| | | string dPath = Config.Instance.FullPath;
|
| | | if (System.IO.Directory.Exists(dPath) == false)
|
| | | {
|
| | | return;
|
| | |
| | | /// <param name="noticeDb">是否通知云端</param>
|
| | | public static void ReLoginAgain(string account = "", bool noticeDb = true)
|
| | | {
|
| | | UserCenterResourse.oldAccountId = string.Empty;
|
| | | UserCenterResourse.Option.OldAccountId = string.Empty;
|
| | | //关闭所有接收
|
| | | HdlDeviceAttributeLogic.Current.RemoveAllEvent();
|
| | | //清除升级列表
|
| | |
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | //检测APP是否能够退出
|
| | | while (UserCenterResourse.AppCanSignout == false)
|
| | | while (UserCenterResourse.Option.AppCanSignout == false)
|
| | | {
|
| | | await Task.Delay(500);
|
| | | }
|
| | |
| | | try
|
| | | {
|
| | | ZigBee.Device.ZbGateway.RemoteMqttClient?.DisconnectAsync();
|
| | | ZigBee.Device.ZbGateway.RemoteMqttClient = null;
|
| | | }
|
| | | catch { }
|
| | |
|
| | |
| | | /// <returns></returns>
|
| | | public static string CombinePath(params object[] listNames)
|
| | | {
|
| | | string rootPath = UserCenterResourse.LocalRootPath;
|
| | | string rootPath = Config.Instance.FullPath;
|
| | | if (listNames == null || listNames.Length == 0)
|
| | | {
|
| | | return rootPath;
|
| | |
| | | public async static Task<bool> InitUserCenterMenmoryAndThread()
|
| | | {
|
| | | //APP缓存加载开始
|
| | | UserCenterResourse.AppCanSignout = false;
|
| | | UserCenterResourse.Option.AppCanSignout = false;
|
| | |
|
| | | //强制指定不关闭进度条
|
| | | ProgressBar.SetCloseBarFlag(true);
|
| | |
|
| | | //只有在住宅ID不一样的时候才做这个操作
|
| | | if (Common.Config.Instance.HomeId != UserCenterResourse.oldHomeStringId
|
| | | || Common.Config.Instance.Account != UserCenterResourse.oldAccountId)
|
| | | if (Common.Config.Instance.HomeId != UserCenterResourse.Option.OldHomeStringId
|
| | | || Common.Config.Instance.Account != UserCenterResourse.Option.OldAccountId)
|
| | | {
|
| | | //变更根目录路径
|
| | | UserCenterResourse.LocalRootPath = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Config.Instance.Guid, Config.Instance.Home.Id);
|
| | | UserCenterResourse.UserPictruePath = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Config.Instance.Guid, DirNameResourse.UserPictrueDirectory);
|
| | |
|
| | | //加载账号配置信息
|
| | | var optionInfo = UserCenterResourse.Option.Load();
|
| | | UserCenterResourse.Option = optionInfo;
|
| | | //变更根用户图片目录路径
|
| | | UserCenterResourse.Option.UserPictruePath = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Config.Instance.Guid, DirNameResourse.UserPictrueDirectory);
|
| | |
|
| | | //初始化登陆账号的信息
|
| | | await InitUserAccoutInfo();
|
| | |
| | | //保存用户的登陆信息到本地
|
| | | SaveUserInformationToLocation();
|
| | |
|
| | | UserCenterResourse.oldHomeStringId = Common.Config.Instance.HomeId;
|
| | | UserCenterResourse.oldAccountId = Common.Config.Instance.Account;
|
| | | UserCenterResourse.Option.OldHomeStringId = Common.Config.Instance.HomeId;
|
| | | UserCenterResourse.Option.OldAccountId = Common.Config.Instance.Account;
|
| | |
|
| | | //同步数据(二次调用没关系)
|
| | | var result = await HdlAutoBackupLogic.SynchronizeDbAutoBackupData();
|
| | |
| | | ProgressBar.SetAppendText(string.Empty);
|
| | |
|
| | | //0:已经同步过,不需要同步,这个时候需要提示备份
|
| | | if (result == 0)
|
| | | {
|
| | | //开启自动备份提示
|
| | | //HdlAutoBackupLogic.ShowAutoBackupPromptedForm();
|
| | | }
|
| | | //if (result == 0)
|
| | | //{
|
| | | // //开启自动备份提示
|
| | | // HdlAutoBackupLogic.ShowAutoBackupPromptedForm();
|
| | | //}
|
| | | }
|
| | |
|
| | | //恢复可关闭进度条
|
| | | ProgressBar.SetCloseBarFlag(false);
|
| | | //APP缓存加载完成
|
| | | UserCenterResourse.AppCanSignout = true;
|
| | | UserCenterResourse.Option.AppCanSignout = true;
|
| | |
|
| | | return true;
|
| | | }
|
| | |
| | | {
|
| | | //获取本地记录的用户信息
|
| | | UserCenterResourse.UserInfo = GetUserInformationFromLocation();
|
| | | UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.UserPictruePath, "Admin.png");
|
| | | UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.Option.UserPictruePath, "Admin.png");
|
| | |
|
| | | //获取登录账号的信息
|
| | | var pra = new AccountInfoPra();
|
| | |
| | | }
|
| | |
|
| | | UserCenterResourse.UserInfo = userInfo;
|
| | | UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.UserPictruePath, "Admin.png");
|
| | | UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.Option.UserPictruePath, "Admin.png");
|
| | |
|
| | | //初始化管理员控制主人的连接地址(因为这个连接Token是不会改变的,所以只需要初始化一次)
|
| | | await InitAdminConnectMainInfo();
|
| | |
| | | {
|
| | | return;
|
| | | }
|
| | | string nowFile = System.IO.Path.Combine(UserCenterResourse.UserPictruePath, "Admin.png");
|
| | | string nowFile = System.IO.Path.Combine(UserCenterResourse.Option.UserPictruePath, "Admin.png");
|
| | | if (System.IO.File.Exists(nowFile) == true)
|
| | | {
|
| | | return;
|
| | |
| | | Global.CreateEmptyDirectory(directory);
|
| | |
|
| | | //用户图片目录路径【文件夹】
|
| | | if (!System.IO.Directory.Exists(UserCenterResourse.UserPictruePath)) |
| | | if (UserCenterResourse.Option.UserPictruePath != string.Empty && !System.IO.Directory.Exists(UserCenterResourse.Option.UserPictruePath)) |
| | | { |
| | | System.IO.Directory.CreateDirectory(UserCenterResourse.UserPictruePath); |
| | | System.IO.Directory.CreateDirectory(UserCenterResourse.Option.UserPictruePath); |
| | | }
|
| | | }
|
| | |
|