Skip to content

Commit f2c60fa

Browse files
committed
process exception on WinForm
1 parent a634909 commit f2c60fa

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/IME WL Converter Win/Forms/MainForm.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,16 @@ private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
519519
{
520520
if (!streamExport)
521521
{
522-
fileContent = mainBody.Convert(files);
522+
try
523+
{
524+
fileContent = mainBody.Convert(files);
525+
}
526+
catch(Exception ex)
527+
{
528+
mainBody.Dispose();
529+
this.richTextBox1.AppendText(ex.Message);
530+
throw ex;
531+
}
523532
}
524533
}
525534
else

src/ImeWlConverterCore/MainBody.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace Studyzy.IMEWLConverter
1515
{
1616
public delegate void ProcessNotice(string message);
17-
public class MainBody
17+
public class MainBody:IDisposable
1818
{
1919
public event ProcessNotice ProcessNotice;
2020
private WordLibraryList allWlList = new WordLibraryList();
@@ -429,5 +429,10 @@ private WordLibraryList ConvertChinese(WordLibraryList wordLibraryList)
429429
}
430430
return wordLibraryList;
431431
}
432+
433+
public void Dispose()
434+
{
435+
this.timer.Stop();
436+
}
432437
}
433438
}

0 commit comments

Comments
 (0)