예제 #1
0
        /// <summary>
        /// 根据UI窗体名称,将预设加载到“所有窗体”的集合中
        ///     检查指定类型的ui是否已经加载到集合缓存中,如果缓存中没有才进行创建。
        /// </summary>
        /// <param name="uiType"></param>
        /// <returns></returns>
        private BaseUIForms LoadUIFormFromAllUIFormsCatch(Type uiType)
        {
            //定义返回结果引用变量。
            BaseUIForms baseUIFormsResult = null;

            //检查_DicAllUIForms缓存中是否存在
            _DicAllUIForms.TryGetValue(uiType, out baseUIFormsResult);

            if (baseUIFormsResult == null)
            {
                //根据指定名称加载UI窗体预设  将预设加载到“所有窗体”的集合中
                baseUIFormsResult = this.CreateUiForms(uiType);
            }

            return(baseUIFormsResult);
        }
예제 #2
0
        /// <summary>
        /// 根据指定名称创建UI实体 将实体加载到“所有窗体”的集合中
        /// 1.根据uiType创建BaseUIforms实例
        /// 2.把UI克隆体加载到“所有UI窗体集合”
        /// 3.初始化UI窗体。
        /// </summary>
        /// <param name="uiType"></param>
        /// <returns></returns>
        private BaseUIForms CreateUiForms(Type uiType)
        {
            object yy = Activator.CreateInstance(uiType);
            //根据类型创建
            //BaseUIForms baseUIForms = Activator.CreateInstance(uiType) as BaseUIForms;
            BaseUIForms baseUIForms = yy as BaseUIForms;

            if (baseUIForms == null)
            {
                Log.Error("Error!BaseUIForms is null,please check the UIForm:" + uiType.Name);
                return(null);
            }
            //加载到“所有UI窗体集合”
            this._DicAllUIForms.Add(uiType, baseUIForms);

            return(baseUIForms);
        }
예제 #3
0
 /// <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();
     }
 }