| | |
| | | //需优先于刷新房间,同步云端的网关id,如果本地拥有云端不存在的id,则表示应该被换绑了,直接删除
|
| | | HdlGatewayLogic.Current.SynchronizeDbGateway();
|
| | | //从本地重新加载全部的房间
|
| | | Common.Room.RefreshAllRoomByLocation();
|
| | | HdlRoomLogic.Current.RefreshAllRoomByLocation();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | /// <param name="noticeDb">是否通知云端</param>
|
| | | public static void ReLoginAgain(string account = "", bool noticeDb = true)
|
| | | {
|
| | | UserCenterResourse.Option.OldAccountId = string.Empty;
|
| | | UserCenterResourse.AccountOption.OldAccountId = string.Empty;
|
| | | //关闭所有接收
|
| | | HdlGatewayReceiveLogic.Current.RemoveAllEvent();
|
| | | //清除升级列表
|
| | |
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | //检测APP是否能够退出
|
| | | while (UserCenterResourse.Option.AppCanSignout == false)
|
| | | while (UserCenterResourse.AccountOption.AppCanSignout == false)
|
| | | {
|
| | | await Task.Delay(500);
|
| | | }
|
| | |
| | | public async static Task<bool> InitUserCenterMenmoryAndThread(bool ShowPrompted = true)
|
| | | {
|
| | | //APP缓存加载开始
|
| | | UserCenterResourse.Option.AppCanSignout = false;
|
| | | UserCenterResourse.AccountOption.AppCanSignout = false;
|
| | | //还原远程连接变量
|
| | | ZigBee.Device.ZbGateway.AllowRemoteCtrl = true;
|
| | |
|
| | | //只有在住宅ID不一样的时候才做这个操作
|
| | | if (Common.Config.Instance.HomeId != UserCenterResourse.Option.OldHomeStringId
|
| | | || Common.Config.Instance.Account != UserCenterResourse.Option.OldAccountId)
|
| | | if (Common.Config.Instance.HomeId != UserCenterResourse.AccountOption.OldHomeStringId
|
| | | || Common.Config.Instance.Account != UserCenterResourse.AccountOption.OldAccountId)
|
| | | {
|
| | | try
|
| | | {
|
| | |
| | | });
|
| | |
|
| | | //加载账号配置信息
|
| | | var optionInfo = UserCenterResourse.Option.Load();
|
| | | UserCenterResourse.Option = optionInfo;
|
| | | var optionInfo = UserCenterResourse.AccountOption.Load();
|
| | | UserCenterResourse.AccountOption = optionInfo;
|
| | | //变更根用户图片目录路径
|
| | | UserCenterResourse.Option.UserPictruePath = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Config.Instance.Guid, DirNameResourse.UserPictrueDirectory);
|
| | | UserCenterResourse.AccountOption.UserPictruePath = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Config.Instance.Guid, DirNameResourse.UserPictrueDirectory);
|
| | |
|
| | | //加载住宅配置信息
|
| | | UserCenterResourse.ResidenceOption = UserCenterResourse.ResidenceOption.Load();
|
| | |
|
| | | //初始化登陆账号的信息
|
| | | var hadNet = await InitUserAccoutInfo();
|
| | |
| | | //保存用户的登陆信息到本地
|
| | | SaveUserInformationToLocation();
|
| | |
|
| | | UserCenterResourse.Option.OldHomeStringId = Common.Config.Instance.HomeId;
|
| | | UserCenterResourse.Option.OldAccountId = Common.Config.Instance.Account;
|
| | | UserCenterResourse.AccountOption.OldHomeStringId = Common.Config.Instance.HomeId;
|
| | | UserCenterResourse.AccountOption.OldAccountId = Common.Config.Instance.Account;
|
| | |
|
| | | //同步数据(二次调用没关系)
|
| | | int result = -1;
|
| | |
| | | }
|
| | |
|
| | | //初始化房间(郭雪城那边不做处理,需要这里特殊执行一步)
|
| | | Room.RefreshAllRoomByLocation();
|
| | | HdlRoomLogic.Current.RefreshAllRoomByLocation();
|
| | |
|
| | | //刷新APP前一次选择的网关ID(可以反复调用,需要在网关初始化完了之后才能调用)
|
| | | HdlGatewayLogic.Current.RefreshAppOldSelectGatewayId();
|
| | |
| | | ShowGuideForm(result);
|
| | | }
|
| | | //APP缓存加载完成
|
| | | UserCenterResourse.Option.AppCanSignout = true;
|
| | | UserCenterResourse.AccountOption.AppCanSignout = true;
|
| | |
|
| | | return true;
|
| | | }
|
| | |
| | | UserCenterResourse.UserInfo.InitUserInfoSuccess = false;
|
| | | //获取本地记录的用户信息
|
| | | UserCenterResourse.UserInfo = GetUserInformationFromLocation();
|
| | | UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.Option.UserPictruePath, "Admin.png");
|
| | | UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, "Admin.png");
|
| | |
|
| | | //获取登录账号的信息
|
| | | var pra = new AccountInfoPra();
|
| | |
| | | }
|
| | |
|
| | | UserCenterResourse.UserInfo = userInfo;
|
| | | UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.Option.UserPictruePath, "Admin.png");
|
| | | UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, "Admin.png");
|
| | | if (UserCenterResourse.UserInfo.HeadImage != null)
|
| | | {
|
| | | //写入头像内容
|
| | |
| | | }
|
| | | UserCenterResourse.UserInfo.HeadImage = null;
|
| | | //手势密码
|
| | | UserCenterResourse.Option.GestureAuthentication = UserCenterResourse.UserInfo.GesturePwd == null ? string.Empty : UserCenterResourse.UserInfo.GesturePwd;
|
| | | UserCenterResourse.AccountOption.GestureAuthentication = UserCenterResourse.UserInfo.GesturePwd == null ? string.Empty : UserCenterResourse.UserInfo.GesturePwd;
|
| | | UserCenterResourse.UserInfo.GesturePwd = null;
|
| | | //密码验证
|
| | | UserCenterResourse.Option.PswAuthentication = UserCenterResourse.UserInfo.StringPwd == null ? string.Empty : UserCenterResourse.UserInfo.StringPwd;
|
| | | UserCenterResourse.AccountOption.PswAuthentication = UserCenterResourse.UserInfo.StringPwd == null ? string.Empty : UserCenterResourse.UserInfo.StringPwd;
|
| | | UserCenterResourse.UserInfo.StringPwd = null;
|
| | |
|
| | | //初始化管理员控制主人的连接地址(因为这个连接Token是不会改变的,所以只需要初始化一次)
|
| | |
| | | Global.CreateEmptyDirectory(directory);
|
| | |
|
| | | //用户图片目录路径【文件夹】
|
| | | if (UserCenterResourse.Option.UserPictruePath != string.Empty && !System.IO.Directory.Exists(UserCenterResourse.Option.UserPictruePath)) |
| | | if (UserCenterResourse.AccountOption.UserPictruePath != string.Empty && !System.IO.Directory.Exists(UserCenterResourse.AccountOption.UserPictruePath)) |
| | | { |
| | | System.IO.Directory.CreateDirectory(UserCenterResourse.Option.UserPictruePath); |
| | | System.IO.Directory.CreateDirectory(UserCenterResourse.AccountOption.UserPictruePath); |
| | | }
|
| | | }
|
| | |
|