Beispiel #1
0
        /// <summary>
        /// 打开单例模式下的查找和替换窗口
        /// <param name="t">所需文本框</param        /// </summary>
        /// <returns></returns>
        public Form initSingleExample(bool isShowTop)
        {
            FindAndReplace findAndReplace = null;
            Form           form           = FormCacheFactory.getSingletonCache(DefaultNameEnum.FIND_REPLACE_FORM);

            if (form == null || form.IsDisposed || !(form is FindAndReplace))
            {
                findAndReplace      = this;
                findAndReplace.Name = EnumUtils.GetDescription(DefaultNameEnum.FIND_REPLACE_FORM);
                // 将窗体放入单例窗体工厂中
                findAndReplace = FormCacheFactory.ininSingletonForm(findAndReplace, false);
            }
            else
            {
                findAndReplace = (FindAndReplace)form;
                findAndReplace.Activate();
            }
            if (isShowTop)
            {
                FormCacheFactory.addTopFormCache(findAndReplace);
            }
            findAndReplace.MinimumSize = findAndReplace.Size;
            findAndReplace.Visible     = false;
            return(findAndReplace);
        }
Beispiel #2
0
        /// <summary>
        /// 打开多例模式下的查找和替换窗口
        /// </summary>
        /// <param name="isShowTop">是否显示为顶层窗体</param>
        /// <returns></returns>
        public Form initPrototypeExample(bool isShowTop)
        {
            FindAndReplace findAndReplace = this;

            findAndReplace.Name = EnumUtils.GetDescription(DefaultNameEnum.FIND_REPLACE_FORM) + DateTime.Now.Ticks.ToString();;
            // 加入到顶层窗体集合
            if (isShowTop)
            {
                FormCacheFactory.addTopFormCache(findAndReplace);
            }
            // 加入到多例工厂
            FormCacheFactory.addPrototypeCache(DefaultNameEnum.FIND_REPLACE_FORM, findAndReplace);
            findAndReplace.Activate();
            findAndReplace.Visible = false;
            return(findAndReplace);
        }