/// <summary> /// 打开单例模式下的查找和替换窗口 /// </summary> /// <returns></returns> public Form initSingleExample(bool isShowTop) { SetCodingForm formThis = null; Form form = FormCacheFactory.getSingletonCache(DefaultNameEnum.SET_CODING_FORM); if (form == null || form.IsDisposed || !(form is SetCodingForm)) { formThis = this; formThis.Name = EnumUtils.GetDescription(DefaultNameEnum.SET_CODING_FORM); // 将窗体放入单例窗体工厂中 formThis = FormCacheFactory.ininSingletonForm(formThis, false); } else { formThis = (SetCodingForm)form; formThis.Activate(); } if (isShowTop) { FormCacheFactory.addTopFormCache(formThis); } formThis.MinimumSize = formThis.Size; formThis.Visible = false; return(formThis); }
/// <summary> /// 打开多例模式下的查找和替换窗口 /// </summary> /// <param name="isShowTop">是否显示为顶层窗体</param> /// <returns></returns> public Form initPrototypeExample(bool isShowTop) { SetCodingForm formThis = this; formThis.Name = EnumUtils.GetDescription(DefaultNameEnum.SET_CODING_FORM) + DateTime.Now.Ticks.ToString();; // 加入到顶层窗体集合 if (isShowTop) { FormCacheFactory.addTopFormCache(formThis); } // 加入到多例工厂 FormCacheFactory.addPrototypeCache(DefaultNameEnum.SET_CODING_FORM, formThis); formThis.Activate(); formThis.Visible = false; return(formThis); }