捕捉主控制器异常

This commit is contained in:
ChsBuffer
2020-07-29 22:33:01 +08:00
parent 8c9953a5d4
commit 3488e7bbf3
5 changed files with 105 additions and 42 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -45,8 +46,22 @@ namespace Netch.Forms
var server = ServerComboBox.SelectedItem as Models.Server;
var mode = ModeComboBox.SelectedItem as Models.Mode;
var result = false;
if (_mainController.Start(server, mode))
try
{
// TODO 完善控制器异常处理
result = _mainController.Start(server, mode);
}
catch (Exception e)
{
if (e is DllNotFoundException || e is FileNotFoundException)
MessageBoxX.Show(e.Message + "\n\n" + i18N.Translate("Missing File or runtime components"), owner: this);
Netch.Application_OnException(this, new ThreadExceptionEventArgs(e));
}
if (result)
{
Task.Run(() =>
{