Ejemplo n.º 1
0
        /// <summary>
        /// 打开多例模式下的分割字符串窗口
        /// </summary>
        /// <param name="t">所需文本框</param>
        /// <param name="isShowTop">是否显示为顶层窗体</param>
        /// <returns></returns>
        public Form initPrototypeExample(bool isShowTop)
        {
            SplitCharsForm splitChars = this;

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

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