/// <summary> /// 打开多例模式下的添加字符窗口 /// </summary> /// <param name="isShowTop">是否显示为顶层窗体</param> /// <returns></returns> public Form initPrototypeExample(bool isShowTop) { ThereofForm thereofForm = this; thereofForm.Name = EnumUtils.GetDescription(DefaultNameEnum.THEREOF_FORM) + DateTime.Now.Ticks.ToString();; // 加入到顶层窗体集合 if (isShowTop) { FormCacheFactory.addTopFormCache(thereofForm); } // 加入到多例工厂 FormCacheFactory.addPrototypeCache(DefaultNameEnum.THEREOF_FORM, thereofForm); thereofForm.Activate(); thereofForm.Visible = false; return(thereofForm); }
/// <summary> /// 打开单例模式下的添加字符窗口 /// </summary> /// <param name="isShowTop">是否显示为顶层窗体</param> /// <returns></returns> public Form initSingleExample(bool isShowTop) { ThereofForm thereofForm = null; Form form = FormCacheFactory.getSingletonCache(DefaultNameEnum.THEREOF_FORM); if (form == null || form.IsDisposed || !(form is AddCharsForm)) { thereofForm = this; thereofForm.Name = EnumUtils.GetDescription(DefaultNameEnum.THEREOF_FORM); thereofForm = FormCacheFactory.ininSingletonForm(thereofForm, false); } else { thereofForm = (ThereofForm)form; thereofForm.Activate(); } if (isShowTop) { FormCacheFactory.addTopFormCache(thereofForm); } thereofForm.Visible = false; return(thereofForm); }