| | |
| | | public static bool CheckCanAddForm(CommonFormBase form)
|
| | | {
|
| | | //获取画面英文名字
|
| | | string formName = GetFormName(form);
|
| | | string formId = GetFormID(form);
|
| | |
|
| | | //二重追加不可
|
| | | if (UserCenterResourse.DicActionForm.ContainsKey(formName) == false)
|
| | | if (UserCenterResourse.DicActionForm.ContainsKey(formId) == false)
|
| | | {
|
| | | return true;
|
| | | }
|
| | | //暂时这样弄看看,如果重复,则关闭掉原来的界面
|
| | | var formTemp = UserCenterResourse.DicActionForm[formName];
|
| | | var formTemp = UserCenterResourse.DicActionForm[formId];
|
| | | formTemp.CloseForm();
|
| | | UserCenterResourse.DicActionForm.Remove(formName);
|
| | | UserCenterResourse.DicActionForm.Remove(formId);
|
| | |
|
| | | return true;
|
| | | }
|
| | |
| | | public static void AddActionForm(CommonFormBase form)
|
| | | {
|
| | | //获取画面英文名字
|
| | | string formName = GetFormName(form);
|
| | | string formId = GetFormID(form);
|
| | |
|
| | | //二重追加不可
|
| | | if (UserCenterResourse.DicActionForm.ContainsKey(formName) == false)
|
| | | if (UserCenterResourse.DicActionForm.ContainsKey(formId) == false)
|
| | | {
|
| | | form.FormID = formName;
|
| | | form.FormID = formId;
|
| | | //内存添加
|
| | | UserCenterResourse.DicActionForm[formName] = form;
|
| | | UserCenterResourse.DicActionForm[formId] = form;
|
| | | //添加画面时,它自身就是激活的界面
|
| | | UserCenterResourse.NowActionFormID = form.FormID;
|
| | |
|
| | |
| | | /// <summary>
|
| | | /// 从列表中移除画面
|
| | | /// </summary>
|
| | | /// <param name="form">Form</param>
|
| | | public static void RemoveActionForm(CommonFormBase form)
|
| | | /// <param name="i_closeForm">关闭的界面</param>
|
| | | public static void RemoveActionForm(CommonFormBase i_closeForm)
|
| | | {
|
| | | //获取画面英文名字
|
| | | string formName = GetFormName(form);
|
| | | //获取画面ID
|
| | | string formId = GetFormID(i_closeForm);
|
| | |
|
| | | if (UserCenterResourse.DicActionForm.ContainsKey(formName) == true)
|
| | | if (UserCenterResourse.DicActionForm.ContainsKey(formId) == true)
|
| | | {
|
| | | //刷新当前正在操作的画面ID
|
| | | if (UserCenterResourse.NowActionFormID == UserCenterResourse.DicActionForm[formName].FormID)
|
| | | {
|
| | | //向前推一位即为下一个激活的界面
|
| | | int index = UserCenterResourse.listActionFormId.IndexOf(UserCenterResourse.NowActionFormID) - 1;
|
| | | //初始值
|
| | | UserCenterResourse.NowActionFormID = string.Empty;
|
| | | var actionForm = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1);
|
| | |
|
| | | if (index >= 0)
|
| | | {
|
| | | if (actionForm != null && actionForm is CommonFormBase)
|
| | | {
|
| | | string formId = ((CommonFormBase)actionForm).FormID;
|
| | | //对应徐梅继承了底层,但是不初始化数据的问题
|
| | | if (UserCenterResourse.listActionFormId.Contains(formId) == true)
|
| | | {
|
| | | //调用界面重新激活的函数
|
| | | CallFormActionAgainEvent(form, index);
|
| | | }
|
| | | }
|
| | | else if (actionForm != null && actionForm is UserView.UserPage)
|
| | | {
|
| | | //这里它已经退到主页了
|
| | | var nowForm = UserView.UserPage.Instance.GetNowActionForm();
|
| | | nowForm?.FormActionAgainEvent();
|
| | | }
|
| | | }
|
| | | else if (actionForm != null && actionForm is UserView.UserPage)
|
| | | {
|
| | | //这里它已经退到主页了
|
| | | var nowForm = UserView.UserPage.Instance.GetNowActionForm();
|
| | | nowForm?.FormActionAgainEvent();
|
| | | }
|
| | | }
|
| | | //移除ID
|
| | | UserCenterResourse.listActionFormId.Remove(UserCenterResourse.DicActionForm[formName].FormID);
|
| | | UserCenterResourse.listActionFormId.Remove(formId);
|
| | | //移除画面
|
| | | UserCenterResourse.DicActionForm.Remove(formName);
|
| | | }
|
| | | }
|
| | | UserCenterResourse.DicActionForm.Remove(formId);
|
| | | //清空
|
| | | UserCenterResourse.NowActionFormID = string.Empty;
|
| | |
|
| | | /// <summary>
|
| | | /// 调用界面重新激活的函数
|
| | | /// </summary>
|
| | | /// <param name="form">关闭的界面对象</param>
|
| | | /// <param name="index">当前需要重新激活界面的索引</param>
|
| | | private static void CallFormActionAgainEvent(CommonFormBase form, int index)
|
| | | {
|
| | | //设置当前激活的画面ID
|
| | | UserCenterResourse.NowActionFormID = UserCenterResourse.listActionFormId[index];
|
| | | //追加条件一:关闭的界面为EditorCommonForm的时候才处理
|
| | | if ((form is EditorCommonForm) && UserCenterResourse.DicActionForm.ContainsKey(UserCenterResourse.NowActionFormID) == true)
|
| | | {
|
| | | try
|
| | | var actionForm = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1);
|
| | | if (actionForm == null)
|
| | | {
|
| | | var Myform = UserCenterResourse.DicActionForm[UserCenterResourse.NowActionFormID] as EditorCommonForm;
|
| | | //点击很快时,这个东西会是null,但是DicActionForm里面不是null,不知道为什么
|
| | | if (Myform != null)
|
| | | return;
|
| | | }
|
| | | //如果关闭的界面是DialogCommonForm类型,则不需要触发激活函数
|
| | | if (i_closeForm is DialogCommonForm)
|
| | | {
|
| | | if (actionForm is EditorCommonForm)
|
| | | {
|
| | | UserCenterResourse.NowActionFormID = GetFormID((EditorCommonForm)actionForm);
|
| | | }
|
| | | return;
|
| | | }
|
| | | //关闭的界面为EditorCommonForm的时候
|
| | | else if ((i_closeForm is EditorCommonForm) && (actionForm is EditorCommonForm))
|
| | | {
|
| | | //接下来激活的界面id
|
| | | UserCenterResourse.NowActionFormID = GetFormID((CommonFormBase)actionForm);
|
| | | try
|
| | | {
|
| | | var Myform = actionForm as EditorCommonForm;
|
| | | //重置左滑使能
|
| | | Myform.ScrollEnabled = Myform.ScrollEnabled;
|
| | | //触发界面再次激活的事件
|
| | |
| | | HdlLogLogic.Current.WriteLog(1, Myform.FormID + " 被激活");
|
| | | }
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | //Log出力
|
| | | HdlLogLogic.Current.WriteLog(ex, "界面重新激活异常 " + UserCenterResourse.NowActionFormID);
|
| | | }
|
| | | }
|
| | | catch (Exception ex)
|
| | | else if (actionForm is UserView.UserPage)
|
| | | {
|
| | | //出现未知错误,数据丢失
|
| | | //var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError));
|
| | | //alert.Show();
|
| | |
|
| | | //Log出力
|
| | | HdlLogLogic.Current.WriteLog(ex, "界面重新激活异常 " + UserCenterResourse.NowActionFormID);
|
| | | //清空
|
| | | UserCenterResourse.NowActionFormID = string.Empty;
|
| | | //这里它已经退到主页了
|
| | | var nowForm = UserView.UserPage.Instance.GetNowActionForm();
|
| | | nowForm?.FormActionAgainEvent();
|
| | | }
|
| | | else
|
| | | {
|
| | | //清空
|
| | | UserCenterResourse.NowActionFormID = string.Empty;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 获取画面英文名字
|
| | | /// 获取画面ID
|
| | | /// </summary>
|
| | | /// <returns>The form name.</returns>
|
| | | /// <param name="form">Form.</param>
|
| | | public static string GetFormName(CommonFormBase form)
|
| | | private static string GetFormID(CommonFormBase form)
|
| | | {
|
| | | if (form.FormID != string.Empty)
|
| | | {
|