using MJTop.Data; using System; using System.Collections.Generic; using System.Dynamic; using System.Windows.Forms; namespace DBCHM { public static class FormUtils { /// /// 静态构造函数执行1次,记载 可以处理DBCHM的数据库类型 /// static FormUtils() { DictDBType = EnumExt.All(); DictDBType.Remove(DBType.Oracle.ToString()); } /// /// 所有数据库类型 对应的端口 /// public static readonly Dictionary DictPort = new Dictionary() { { DBType.SQLite.ToString(),string.Empty}, { DBType.SqlServer.ToString(),"1433"}, { DBType.MySql.ToString(),"3306"}, { DBType.OracleDDTek.ToString(),"1521"}, //{ DBType.Oracle.ToString(),"1521"}, { DBType.PostgreSql.ToString(),"5432"}, { DBType.DB2.ToString(),"50000"}, }; /// /// 所有数据库类型 /// public static Dictionary DictDBType { get; private set; } /// /// 是否正常的Close /// public static bool IsOK_Close { get; set; } = false; public static ProgressArg ProgArg { get; set; } /// /// Loading加载 /// /// loading提示消息 /// 当前窗体 this /// 异步执行方法 /// 异步执行方法的参数 public static void ShowProcessing(string msg, Form owner, Action work, object workArg = null) { try { FrmProcessing processingForm = new FrmProcessing(msg); dynamic expObj = new ExpandoObject(); expObj.Form = processingForm; expObj.WorkArg = workArg; processingForm.SetWorkAction(work, expObj); processingForm.ShowDialog(owner); if (processingForm.WorkException != null) { throw processingForm.WorkException; } } catch (System.Exception ex) { LogUtils.LogError("FrmProcessing", Developer.SysDefault, ex, msg); } } } }