Ejemplo n.º 1
0
        /// <summary>
        /// 打开多例模式下的对象
        /// </summary>
        /// <param name="isShowTop">是否显示为顶层窗体</param>
        /// <returns></returns>
        public Control initPrototypeExample(bool isShowTop)
        {
            RedrawPromptMessBut conThis = this;

            conThis.Name = EnumUtils.GetDescription(DefaultNameEnum.PROMPT_MESSAGE) + DateTime.Now.Ticks.ToString();
            if (isShowTop)
            {
                conThis.BringToFront();
            }
            // 加入到多例工厂
            ControlCacheFactory.addPrototypeCache(DefaultNameEnum.PROMPT_MESSAGE, conThis);
            return(conThis);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 打开单例模式下的对象
        /// </summary>
        /// <param name="isShowTop">是否显示为顶层窗体</param>
        /// <returns></returns>
        public Control initSingleExample(bool isShowTop)
        {
            RedrawPromptMessBut conThis = null;
            Control             con     = ControlCacheFactory.getSingletonCache(DefaultNameEnum.PROMPT_MESSAGE);

            if (con == null || !(con is RedrawPromptMessBut))
            {
                conThis      = this;
                conThis.Name = EnumUtils.GetDescription(DefaultNameEnum.PROMPT_MESSAGE);
                ControlCacheFactory.addSingletonCache(conThis);
            }
            else
            {
                conThis = (RedrawPromptMessBut)con;
            }

            if (isShowTop)
            {
                conThis.BringToFront();
            }
            return(conThis);
        }