Ejemplo n.º 1
0
        /// <summary>
        /// 打开多例模式下的添加字符窗口
        /// </summary>
        /// <param name="isShowTop">是否显示为顶层窗体</param>
        /// <returns></returns>
        public Form initPrototypeExample(bool isShowTop)
        {
            AddCharsForm addChars = this;

            addChars.Name = EnumUtils.GetDescription(DefaultNameEnum.ADD_CHARS_FORM) + DateTime.Now.Ticks.ToString();;
            // 加入到顶层窗体集合
            if (isShowTop)
            {
                FormCacheFactory.addTopFormCache(addChars);
            }
            // 加入到多例工厂
            FormCacheFactory.addPrototypeCache(DefaultNameEnum.ADD_CHARS_FORM, addChars);
            addChars.Activate();
            addChars.Visible = false;
            return(addChars);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 打开单例模式下的添加字符窗口
        /// </summary>
        /// <param name="isShowTop">是否显示为顶层窗体</param>
        /// <returns></returns>
        public Form initSingleExample(bool isShowTop)
        {
            AddCharsForm addChars = null;
            Form         form     = FormCacheFactory.getSingletonCache(DefaultNameEnum.ADD_CHARS_FORM);

            if (form == null || form.IsDisposed || !(form is AddCharsForm))
            {
                addChars      = this;
                addChars.Name = EnumUtils.GetDescription(DefaultNameEnum.ADD_CHARS_FORM);
                addChars      = FormCacheFactory.ininSingletonForm(addChars, false);
            }
            else
            {
                addChars = (AddCharsForm)form;
                addChars.Activate();
            }
            if (isShowTop)
            {
                FormCacheFactory.addTopFormCache(addChars);
            }
            addChars.Visible = false;
            return(addChars);
        }