| | |
| | | var actionForm = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1);
|
| | | if (actionForm != null && actionForm is CommonFormBase)
|
| | | {
|
| | | //调用界面重新激活的函数
|
| | | CallFormActionAgainEvent(form, index);
|
| | | string formId = ((CommonFormBase)actionForm).FormID;
|
| | | //对应徐梅继承了底层,但是不初始化数据的问题
|
| | | if (UserCenterResourse.listActionFormId.Contains(formId) == true)
|
| | | {
|
| | | //调用界面重新激活的函数
|
| | | CallFormActionAgainEvent(form, index);
|
| | | }
|
| | | }
|
| | | else if (actionForm != null && actionForm is UserView.UserPage)
|
| | | {
|
| | |
| | | /// <param name="noticeDb">是否通知云端</param>
|
| | | public static void ReLoginAgain(string account = "", bool noticeDb = true)
|
| | | {
|
| | | if (Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | //如果是虚拟住宅
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //收起左菜单
|
| | | CommonPage.Instance.CloseLeftMenu();
|
| | | //关闭所有打开了的界面
|
| | | CloseAllOpenForm();
|
| | |
|
| | | //显示登陆画面
|
| | | var formLogin = new Login.AccountLoginForm();
|
| | | Shared.Common.CommonPage.Instance.AddChidren(formLogin);
|
| | | formLogin.ShowForm(account);
|
| | | });
|
| | | return;
|
| | | }
|
| | | UserCenterResourse.AccountOption.OldAccountId = string.Empty;
|
| | | //关闭所有接收
|
| | | HdlGatewayReceiveLogic.Current.RemoveAllEvent();
|
| | |
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //收起左菜单
|
| | | CommonPage.Instance.CloseLeftMenu();
|
| | | //关闭所有打开了的界面
|
| | | CloseAllOpenForm();
|
| | |
|
| | | //显示登陆画面
|
| | | var formLogin = new Login.AccountLogin();
|
| | | var formLogin = new Login.AccountLoginForm();
|
| | | Shared.Common.CommonPage.Instance.AddChidren(formLogin);
|
| | | formLogin.Show(account);
|
| | | formLogin.ShowForm(account);
|
| | | });
|
| | |
|
| | | if (noticeDb == true)
|
| | |
| | | while (UserView.HomePage.Instance.ChildrenCount > 0)
|
| | | {
|
| | | var view = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1);
|
| | | //(因底层控件修改了, 父控件移除时, 不触;发子控件的移除事件)
|
| | | //(因底层控件修改了, 父控件移除时, 不触发子控件的移除事件)
|
| | | if (view is ViewGroup)
|
| | | {
|
| | | //关闭加载在ViewGroup里面的自定义界面Form
|
| | |
| | | ((CommonFormBase)view).CloseForm();
|
| | | i--;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 子控件的Y轴坐标____________________
|
| | |
|
| | | /// <summary>
|
| | | /// 指定位置类型获取Rowlayout的子控件的Y轴坐标(请确保子控件不大于父容器)
|
| | | /// </summary>
|
| | | /// <param name="fatherCtrHeight">父控件的真实高度</param>
|
| | | /// <param name="ctrHeight">子控件的真实高度</param>
|
| | | /// <param name="alignment">位置对齐方式</param>
|
| | | /// <param name="Space">上下间的空白间距,省略时,取行控件共通变量的值。设置为-1时,不计算空白间距</param>
|
| | | /// <returns></returns>
|
| | | public static int GetControlChidrenYaxis(int fatherCtrHeight, int ctrHeight, UViewAlignment alignment, int Space = 0)
|
| | | {
|
| | | if (Space < 0)
|
| | | {
|
| | | //不计算间距值
|
| | | Space = 0;
|
| | | }
|
| | |
|
| | | if (alignment == UViewAlignment.Center)
|
| | | {
|
| | | return fatherCtrHeight / 2 - ctrHeight / 2;
|
| | | }
|
| | | else if (alignment == UViewAlignment.Top)
|
| | | {
|
| | | return (fatherCtrHeight / 2 - Space / 2) / 2 - ctrHeight / 2;
|
| | | }
|
| | | else
|
| | | {
|
| | | int top = fatherCtrHeight / 2 + Space / 2;
|
| | | return top + (fatherCtrHeight - top) / 2 - ctrHeight / 2;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | /// <returns></returns>
|
| | | public async static Task<bool> InitUserCenterMenmoryAndThread(bool ShowPrompted = true)
|
| | | {
|
| | | //如果是虚拟住宅
|
| | | if (Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | //初始化虚拟住宅的个人中心的数据(切换住宅使用)
|
| | | InitUserCenterMenmoryByVirtualHome();
|
| | | return true;
|
| | | }
|
| | |
|
| | | //APP缓存加载开始
|
| | | UserCenterResourse.AccountOption.AppCanSignout = false;
|
| | | //还原远程连接权限变量
|
| | |
| | | //初始化本地的设备信息
|
| | | Common.LocalDevice.Current.ReFreshByLocal();
|
| | |
|
| | | //初始化房间(郭雪城那边不做处理,需要这里特殊执行一步)
|
| | | HdlRoomLogic.Current.RefreshAllRoomByLocation();
|
| | |
|
| | | if (hadNet == true)
|
| | | {
|
| | | //同步云端的网关id,如果本地拥有云端不存在的id,则表示应该被换绑了,直接删除
|
| | | HdlGatewayLogic.Current.SynchronizeDbGateway();
|
| | | }
|
| | |
|
| | | //初始化房间(郭雪城那边不做处理,需要这里特殊执行一步)
|
| | | HdlRoomLogic.Current.RefreshAllRoomByLocation();
|
| | |
|
| | | //刷新APP前一次选择的网关ID(可以反复调用,需要在网关初始化完了之后才能调用)
|
| | | HdlGatewayLogic.Current.RefreshAppOldSelectGatewayId();
|
| | |
| | | //0:已经同步过,不需要同步,这个时候需要提示备份
|
| | | if (result == 0 && ShowPrompted == true)
|
| | | {
|
| | | //开启自动备份提示
|
| | | //开启自动备份
|
| | | HdlAutoBackupLogic.ShowAutoBackupPromptedForm();
|
| | | }
|
| | | //显示引导界面
|
| | |
| | | UserCenterResourse.AccountOption.AppCanSignout = true;
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化虚拟住宅的个人中心的数据(切换住宅使用)
|
| | | /// </summary>
|
| | | private static void InitUserCenterMenmoryByVirtualHome()
|
| | | {
|
| | | //清空所有成员缓存
|
| | | ClearAllMemberMemory();
|
| | | //预创建个人中心全部的文件夹
|
| | | CreatAllUserCenterDirectory();
|
| | | //关闭所有接收
|
| | | HdlGatewayReceiveLogic.Current.RemoveAllEvent();
|
| | | //初始化本地的网关信息
|
| | | HdlGatewayLogic.Current.ReFreshByLocal();
|
| | | //初始化本地的设备信息
|
| | | Common.LocalDevice.Current.ReFreshByLocal();
|
| | | //初始化房间(郭雪城那边不做处理,需要这里特殊执行一步)
|
| | | HdlRoomLogic.Current.RefreshAllRoomByLocation();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | //当前主页,场景和功能所选择的分支 1:场景 2:功能
|
| | | UserCenterResourse.ResidenceOption.HomeMainPageSwitchIndex = 1;
|
| | | //当前分类,场景和功能所选择的分支 0:场景 1:功能 2:自动化
|
| | | UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex = 0;
|
| | | UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex = 0; |
| | | //切换住宅清除之前缓存数据; |
| | | Common.Logic.LogicList.Clear(); |
| | | Common.Logic.LockLogicList.Clear(); |
| | | Common.Logic.SoneLogicList.Clear();
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | #region ■ 文件保存和读取_____________________
|
| | |
|
| | | /// <summary>
|
| | | /// 文件保存(整天忘记,所以建一个函数来玩玩)
|
| | | /// 文件保存,仅限当前住宅(整天忘记,所以建一个函数来玩玩)
|
| | | /// </summary>
|
| | | /// <param name="fullName">全路径</param>
|
| | | /// <param name="obj">需要序列化的东西</param>
|
| | |
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 读取文件(文件不存在返回null,整天忘记,所以建一个函数来玩玩)
|
| | | /// 读取文件,不限制住宅(文件不存在返回null,整天忘记,所以建一个函数来玩玩)
|
| | | /// </summary>
|
| | | /// <param name="fullName">全路径</param>
|
| | | /// <returns></returns>
|
| | | public static string LoadFileContent(string fullName)
|
| | | {
|
| | | //读取文件
|
| | | var varByte = ReadFileContent(fullName);
|
| | | if (varByte == null)
|
| | | {
|
| | | return null;
|
| | | }
|
| | | return Encoding.UTF8.GetString(varByte);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 读取文件,不限制住宅,文件不存在返回null
|
| | | /// </summary>
|
| | | /// <param name="fullName">全路径</param>
|
| | | /// <returns></returns>
|
| | | public static byte[] ReadFileContent(string fullName)
|
| | | {
|
| | | if (System.IO.File.Exists(fullName) == false)
|
| | | {
|
| | | return null;
|
| | | }
|
| | | var varByte = Shared.IO.FileUtils.ReadFile(fullName);
|
| | | return System.Text.Encoding.UTF8.GetString(varByte);
|
| | | System.IO.FileStream fileStream = null;
|
| | | try
|
| | | {
|
| | | fileStream = new System.IO.FileStream(fullName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
|
| | | byte[] array = new byte[fileStream.Length];
|
| | | fileStream.Read(array, 0, array.Length);
|
| | | return array;
|
| | | }
|
| | | catch
|
| | | {
|
| | | return null;
|
| | | }
|
| | | finally
|
| | | {
|
| | | fileStream?.Close();
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|