diff options
author | sr55 <[email protected]> | 2016-03-26 19:27:11 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2016-03-26 19:27:11 +0000 |
commit | 6685f23b8aeb8afd98103500a8cfebc0c3b9c1ea (patch) | |
tree | 14507d75c49c4f1a97f18c331e88998aeaa38e2b /win/CS/HandBrakeWPF/Views | |
parent | 1c64294301cb511a1e088750f810121c4661aabc (diff) |
WinGui: Fix a couple of silent errors with the new logging system.
Diffstat (limited to 'win/CS/HandBrakeWPF/Views')
-rw-r--r-- | win/CS/HandBrakeWPF/Views/LogView.xaml.cs | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/win/CS/HandBrakeWPF/Views/LogView.xaml.cs b/win/CS/HandBrakeWPF/Views/LogView.xaml.cs index 2ab427752..67d2f21df 100644 --- a/win/CS/HandBrakeWPF/Views/LogView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/LogView.xaml.cs @@ -60,28 +60,39 @@ namespace HandBrakeWPF.Views /// </param>
private void Vm_LogMessageReceived(object sender, HandBrake.ApplicationServices.Services.Logging.EventArgs.LogEventArgs e)
{
- if (e == null)
+ try
{
- LogViewModel vm = this.DataContext as LogViewModel;
- if (vm != null)
+ if (e == null)
{
- this.logText.Clear();
- this.logText.AppendText(vm.ActivityLog);
+ Caliburn.Micro.Execute.OnUIThread(
+ () =>
+ {
+ LogViewModel vm = this.DataContext as LogViewModel;
+ if (vm != null)
+ {
+ this.logText.Clear();
+ this.logText.AppendText(vm.ActivityLog);
+ }
+ else
+ {
+ Debug.WriteLine("Failed to Reset Log correctly.");
+ }
+ });
}
else
{
- Debug.WriteLine("Failed to Reset Log correctly.");
+ // This works better than Data Binding because of the scroll.
+ this.logText.AppendText(Environment.NewLine + e.Log.Content);
+
+ if (this.AutoScroll.IsChecked)
+ {
+ this.logText.ScrollToEnd();
+ }
}
}
- else
+ catch (Exception exc)
{
- // This works better than Data Binding because of the scroll.
- this.logText.AppendText(Environment.NewLine + e.Log.Content);
-
- if (this.AutoScroll.IsChecked)
- {
- this.logText.ScrollToEnd();
- }
+ Debug.WriteLine(exc);
}
}
|