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

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

            if (con == null || !(con is RedrawTextBox))
            {
                conThis      = this;
                conThis.Name = EnumUtils.GetDescription(DefaultNameEnum.TEXTBOX_NAME_DEF);
                ControlCacheFactory.addSingletonCache(conThis);
            }
            else
            {
                conThis = (RedrawTextBox)con;
            }
            if (isShowTop)
            {
                conThis.BringToFront();
            }
            return(conThis);
        }