/// <summary> /// 打开统计字符窗口 /// </summary> /// <param name="t">所需文本框</param> /// <param name="isShow">是否显示窗体</param> /// <returns></returns> public static CharsStatistics openCharsStatistics(TextBox t) { CharsStatistics charsStatistics = new CharsStatistics(t); charsStatistics.ShowDialog(); return(charsStatistics); }
/// <summary> /// 打开多例模式下的添加字符窗口 /// </summary> /// <param name="isShowTop">是否显示为顶层窗体</param> /// <returns></returns> public Form initPrototypeExample(bool isShowTop) { CharsStatistics charsStatistics = this; charsStatistics.Name = EnumUtils.GetDescription(DefaultNameEnum.CHARS_STATISTICS) + DateTime.Now.Ticks.ToString();; // 加入到顶层窗体集合 if (isShowTop) { FormCacheFactory.addTopFormCache(charsStatistics); } // 加入到多例工厂 FormCacheFactory.addPrototypeCache(DefaultNameEnum.CHARS_STATISTICS, charsStatistics); charsStatistics.Activate(); charsStatistics.Visible = false; return(charsStatistics); }
/// <summary> /// 打开单例模式下的添加字符窗口 /// </summary> /// <param name="isShowTop">是否显示为顶层窗体</param> /// <returns></returns> public Form initSingleExample(bool isShowTop) { CharsStatistics charsStatistics = null; Form form = FormCacheFactory.getSingletonCache(DefaultNameEnum.CHARS_STATISTICS); if (form == null || form.IsDisposed || !(form is AddCharsForm)) { charsStatistics = this; charsStatistics.Name = EnumUtils.GetDescription(DefaultNameEnum.CHARS_STATISTICS); charsStatistics = FormCacheFactory.ininSingletonForm(charsStatistics, false); } else { charsStatistics = (CharsStatistics)form; charsStatistics.Activate(); } if (isShowTop) { FormCacheFactory.addTopFormCache(charsStatistics); } charsStatistics.Visible = false; return(charsStatistics); }