Ejemplo n.º 1
0
        /// <summary>
        /// 打开单例模式下的查找和替换窗口
        /// </summary>
        /// <returns></returns>
        public Form initSingleExample(bool isShowTop)
        {
            RowGoToForm formThis = null;
            Form        form     = FormCacheFactory.getSingletonCache(DefaultNameEnum.ROW_GOTO_FORM);

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

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