Skip to content

Commit

Permalink
process exception on WinForm
Browse files Browse the repository at this point in the history
  • Loading branch information
studyzy committed May 6, 2019
1 parent a634909 commit f2c60fa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/IME WL Converter Win/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,16 @@ private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
if (!streamExport)
{
fileContent = mainBody.Convert(files);
try
{
fileContent = mainBody.Convert(files);
}
catch(Exception ex)
{
mainBody.Dispose();
this.richTextBox1.AppendText(ex.Message);
throw ex;
}
}
}
else
Expand Down
7 changes: 6 additions & 1 deletion src/ImeWlConverterCore/MainBody.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace Studyzy.IMEWLConverter
{
public delegate void ProcessNotice(string message);
public class MainBody
public class MainBody:IDisposable
{
public event ProcessNotice ProcessNotice;
private WordLibraryList allWlList = new WordLibraryList();
Expand Down Expand Up @@ -429,5 +429,10 @@ private WordLibraryList ConvertChinese(WordLibraryList wordLibraryList)
}
return wordLibraryList;
}

public void Dispose()
{
this.timer.Stop();
}
}
}

0 comments on commit f2c60fa

Please sign in to comment.