/// <summary> /// 清空栈集合。 /// </summary> private void ClearingStack() { Log.Debug("------------------------开始清理栈结构"); if (_StaCurrentUIForms != null && _StaCurrentUIForms.Count > 0) { while (this._StaCurrentUIForms.Count > 0) { BaseUIForms ui = this._StaCurrentUIForms.Pop(); ui.Hiding(); } _StaCurrentUIForms.Clear(); } Log.Debug("-----------------------栈结构清理结束"); }
/// <summary> /// 退出当前显示的【普通窗体】 /// </summary> /// <param name="uiType">UI窗体名称</param> private void ExitNormalForms(Type uiType) { BaseUIForms baseUIForms = null; //UI窗体基类 //参数校验【当前显示集合】中没有直接返回 _DicCurrentShowUIForms.TryGetValue(uiType, out baseUIForms); if (baseUIForms == null) { return; } //隐藏窗体 baseUIForms.Hiding(); //从【当前显示集合】中移除 _DicCurrentShowUIForms.Remove(uiType); }
/// <summary> /// 退出【反向切换】的窗体。从栈顶弹出隐藏,之后重新显示栈顶的窗体 /// </summary> private void ExitReverseChangeForms() { if (_StaCurrentUIForms.Count >= 2) { BaseUIForms topUIForm = _StaCurrentUIForms.Pop(); topUIForm.Hiding(); //因为Hiding的原因,会导致栈离的count提前减去。在这里判断一下防止emptyStack异常,以后有好的注意再优化!!!!!!!!! if (this._StaCurrentUIForms.Count > 0) { BaseUIForms nextUIForm = _StaCurrentUIForms.Peek(); nextUIForm.ReDisplay(); } } else if (_StaCurrentUIForms.Count == 1) { BaseUIForms topUIForm = _StaCurrentUIForms.Pop(); topUIForm.Hiding(); } }