diff --git a/Img/docImg/chmd.png b/Img/docImg/chmd.png index 1429b03d32974aedecaf61625268b6d71258627c..17879bf11d59217b7e742ba669cd9bb50d21c2f2 100644 Binary files a/Img/docImg/chmd.png and b/Img/docImg/chmd.png differ diff --git a/README.md b/README.md index 3ec376d2da0865592baccbd23c4034b9a4ab000d..3dbeea96d65d5bf66ea7d8d68d3c822d828bf664 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@
SmartSQL -

SmartSQL

+

SmartSQL

⚡一款方便、快捷的数据库文档查询、生成工具
diff --git a/SmartSQL/SmartSQL/App.xaml.cs b/SmartSQL/SmartSQL/App.xaml.cs index 4b44aec8d4f6d2e445994fa8699087f8e997fc1e..0690f05df1fa198b666d5185c3a9e8b6cf7b4f3b 100644 --- a/SmartSQL/SmartSQL/App.xaml.cs +++ b/SmartSQL/SmartSQL/App.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Text; using System.Threading.Tasks; using System.Windows; @@ -37,38 +37,40 @@ namespace SmartSQL try { e.Handled = true; //把 Handled 属性设为true,表示此异常已处理,程序可以继续运行,不会强制退出 - Growl.WarningGlobal("UI线程异常:" + e.Exception); + //Growl.WarningGlobal("UI线程异常:" + e.Exception); + Growl.WarningGlobal("程序异常,请稍后再试"); } catch (Exception) { //此时程序出现严重异常,将强制结束退出 - Growl.WarningGlobal("UI线程发生致命错误"); + Growl.WarningGlobal("程序异常,请稍后再试"); } } void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { - StringBuilder sbEx = new StringBuilder(); - if (e.IsTerminating) - { - sbEx.Append("非UI线程发生致命错误:"); - } - sbEx.Append("非UI线程异常:"); - if (e.ExceptionObject is Exception) - { - sbEx.Append(((Exception)e.ExceptionObject).Message); - } - else - { - sbEx.Append(e.ExceptionObject); - } - Growl.WarningGlobal(sbEx.ToString()); + //StringBuilder sbEx = new StringBuilder(); + //if (e.IsTerminating) + //{ + // sbEx.Append("非UI线程发生致命错误:"); + //} + //sbEx.Append("非UI线程异常:"); + //if (e.ExceptionObject is Exception) + //{ + // sbEx.Append(((Exception)e.ExceptionObject).Message); + //} + //else + //{ + // sbEx.Append(e.ExceptionObject); + //} + Growl.WarningGlobal("程序异常,请稍后再试"); } void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e) { //task线程内未处理捕获 - Growl.WarningGlobal("Task线程异常:" + e.Exception.Message); + //Growl.WarningGlobal("Task线程异常:" + e.Exception.Message); + Growl.WarningGlobal("程序异常,请稍后再试"); e.SetObserved();//设置该异常已察觉(这样处理后就不会引起程序崩溃) } } diff --git a/SmartSQL/SmartSQL/MainWindow.xaml.cs b/SmartSQL/SmartSQL/MainWindow.xaml.cs index 591fc3287c0fb1b9a0f4fede0a8e05cf1676afc5..45f9f29c85a3dc4d770e3b1f04c73b4d43750faa 100644 --- a/SmartSQL/SmartSQL/MainWindow.xaml.cs +++ b/SmartSQL/SmartSQL/MainWindow.xaml.cs @@ -286,10 +286,24 @@ namespace SmartSQL }).ToList(); } #endregion - - var dbInstance = ExporterFactory.CreateInstance(selectConnection.DbType, selectConnection.SelectedDbConnectString(selectDataBase)); - var model = dbInstance.Init(); - dataSource = model; + var model = new Model(); + try + { + var dbInstance = ExporterFactory.CreateInstance(selectConnection.DbType, selectConnection.SelectedDbConnectString(selectDataBase)); + model = dbInstance.Init(); + dataSource = model; + } + catch (Exception ex) + { + Dispatcher.BeginInvoke(new Action(() => + { + Growl.Warning(new GrowlInfo + { + Message = $"连接失败 {selectConnection.ConnectName},原因:" + ex.Message, ShowDateTime = false, + Type = InfoType.Error + }); + })); + } var textColor = "#333444"; #region 数据表 foreach (var table in model.Tables)