コード例 #1
0
        /// <summary>
        /// 显示【隐藏其他】类型窗体,将其他窗体隐藏
        /// </summary>
        /// <param name="uiType">ui窗体名称</param>
        private void EnterUIFormsAndHideOther(Type uiType)
        {
            FGUIBase baseUIForm        = null; //校验用窗体基类
            FGUIBase baseUIFormFormAll = null; //从【所有窗体集合】中取出的数据。

            _DicCurrentShowUIForms.TryGetValue(uiType, out baseUIForm);
            if (baseUIForm != null)
            {
                return;
            }

            //将【栈结构】和【当前显示中集合】中的窗体隐藏

            foreach (FGUIBase forms in _StaCurrentUIForms)
            {
                forms.Hiding();
            }

            foreach (Type key in _DicCurrentShowUIForms.Keys)
            {
                _DicCurrentShowUIForms[key].Hiding();
            }

            //显示当前窗体,并且加入到【当前显示中集合】
            _DicAllUIForms.TryGetValue(uiType, out baseUIFormFormAll);
            if (baseUIFormFormAll != null)
            {
                baseUIFormFormAll.Display();
                _DicCurrentShowUIForms.Add(uiType, baseUIFormFormAll);
            }
        }
コード例 #2
0
        /// <summary>
        /// UI窗体入栈 (隐藏其他窗台类型的显示逻辑)
        /// </summary>
        /// <param name="uiType">ui窗体名称</param>
        private void PushUiFormsToStack(Type uiType)
        {
            //检查【栈】内是否有其他窗体,如果有就将栈顶窗体冻结
            if (_StaCurrentUIForms.Count > 0)
            {
                FGUIBase topUiForms = _StaCurrentUIForms.Peek();
                //冻结栈顶窗体
                topUiForms.Freeze();
            }

            //从【所有窗体集合】中取出指定名称的窗体
            FGUIBase baseUiForms = null;

            _DicAllUIForms.TryGetValue(uiType, out baseUiForms);
            if (baseUiForms == null)
            {
                Log.Error("PushUIFormsToStack failed! the uiForms named【" + uiType + "】is null!");
            }
            else
            {
                //显示窗体
                baseUiForms.Display();
                //将窗体压栈
                _StaCurrentUIForms.Push(baseUiForms);
            }
        }