/// <summary> /// 关闭"隐藏其他属性"的窗体,且显示其他所有窗体 /// </summary> /// <param name="uiFormName">需要关闭的窗体名称</param> private void ExitUIFormsAndHideOther(string uiFormName) { BaseUIForm baseUiForm = null; // 参数检查 if (string.IsNullOrEmpty(uiFormName)) { return; } _dicCurrentShowUiForms.TryGetValue(uiFormName, out baseUiForm); if (baseUiForm == null) { return; } // 隐藏当前窗体,并且在 _dicCurrentShowUiForms 中移除 baseUiForm.Hiding(); _dicCurrentShowUiForms.Remove(uiFormName); // 把 _dicCurrentShowUiForms 和 _staCurrentUiForms 中所有的窗体都显示 foreach (var item in _dicCurrentShowUiForms) { item.Value.ReDisplay(); } foreach (BaseUIForm uiForm in _staCurrentUiForms) { uiForm.ReDisplay(); } }
/// <summary> /// 退出指定UI窗体 /// </summary> /// <param name="uiFormName">指定的窗体名称</param> private void ExitUIForms(string uiFormName) { BaseUIForm baseUiForm = null; if (string.IsNullOrEmpty(uiFormName)) { return; } // _dicCurrentShowUiForms 中不存在 uiFormName,直接返回 _dicCurrentShowUiForms.TryGetValue(uiFormName, out baseUiForm); if (baseUiForm == null) { return; } // 指定窗体,标记为“隐藏窗体”,并从 _dicCurrentShowUiForms 移除 baseUiForm.Hiding(); _dicCurrentShowUiForms.Remove(uiFormName); }
/// <summary> /// “反向切换”属性窗体的出栈 /// </summary> private void PopUIForm() { if (_staCurrentUiForms.Count >= 2) { // 出栈处理 BaseUIForm topUiForm = _staCurrentUiForms.Pop(); // 隐藏处理 topUiForm.Hiding(); // 新的栈顶重新显示 BaseUIForm nextUiForm = _staCurrentUiForms.Peek(); nextUiForm.ReDisplay(); } else if (_staCurrentUiForms.Count == 1) { // 出栈处理 BaseUIForm topUiForm = _staCurrentUiForms.Pop(); // 隐藏处理 topUiForm.Hiding(); } else { return; } }