Make sure timer restarts in case of exception

This commit is contained in:
Chris Kaczor
2017-02-01 11:50:47 -05:00
parent 04cb9e6d69
commit 6f1f60dfbf

View File

@@ -72,17 +72,31 @@ namespace JenkinsStatusWindow
private void UpdateText()
{
var textResult = GetText();
// Update the window on the main thread
_dispatcher.Invoke(() =>
try
{
_floatingStatusWindow.SetText(textResult.WindowText.ToString());
var textResult = GetText();
_floatingStatusWindow.IconToolTipText = textResult.TooltipText.ToString();
});
// Update the window on the main thread
_dispatcher.Invoke(() =>
{
_floatingStatusWindow.SetText(textResult.WindowText.ToString());
_refreshTimer.Start();
_floatingStatusWindow.IconToolTipText = textResult.TooltipText.ToString();
});
}
catch (Exception exception)
{
_dispatcher.Invoke(() =>
{
_floatingStatusWindow.SetText(exception.Message);
_floatingStatusWindow.IconToolTipText = exception.Message;
});
}
finally
{
_refreshTimer.Start();
}
}
private TextResult GetText()