diff options
author | sr55 <[email protected]> | 2013-03-07 22:11:11 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2013-03-07 22:11:11 +0000 |
commit | 0058e66974b545911342f72078469653384b509d (patch) | |
tree | 91ee17656180a2065deb72c33abeb31a88a14ecc /win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs | |
parent | abb517d43f2d80b030fed462107bbfa67385673f (diff) |
WinGui: Some Threading, Performance and Log window fixes.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5308 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs | 66 |
1 files changed, 62 insertions, 4 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs index 5bf95d22f..ad76a56b2 100644 --- a/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs @@ -10,7 +10,6 @@ namespace HandBrakeWPF.ViewModels
{
using System;
- using System.Collections.Generic;
using System.Diagnostics;
using System.Windows;
@@ -36,6 +35,16 @@ namespace HandBrakeWPF.ViewModels /// </summary>
private readonly IScanServiceWrapper scanService;
+ /// <summary>
+ /// The selected tab.
+ /// </summary>
+ private int selectedTab;
+
+ /// <summary>
+ /// The encode log index.
+ /// </summary>
+ private int encodeLogIndex;
+
#endregion
/// <summary>
@@ -52,12 +61,24 @@ namespace HandBrakeWPF.ViewModels this.encodeService = encodeService;
this.scanService = scanService;
this.Title = "Log Viewer";
+ this.encodeLogIndex = 0;
}
/// <summary>
/// Gets or sets the selected tab.
/// </summary>
- public int SelectedTab { get; set; }
+ public int SelectedTab
+ {
+ get
+ {
+ return this.selectedTab;
+ }
+ set
+ {
+ this.selectedTab = value;
+ this.NotifyOfPropertyChange(() => this.SelectedTab);
+ }
+ }
/// <summary>
/// Gets Log.
@@ -97,7 +118,7 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void CopyLog()
{
- Clipboard.SetDataObject(this.SelectedTab == 0 ? this.ScanLog : this.EncodeLog, true);
+ Clipboard.SetDataObject(this.SelectedTab == 1 ? this.ScanLog : this.EncodeLog, true);
}
/// <summary>
@@ -109,6 +130,8 @@ namespace HandBrakeWPF.ViewModels this.encodeService.EncodeCompleted += EncodeServiceEncodeCompleted;
this.encodeService.EncodeStatusChanged += this.EncodeServiceEncodeStatusChanged;
this.scanService.ScanStatusChanged += this.ScanServiceScanStatusChanged;
+ this.scanService.ScanStared += this.scanService_ScanStared;
+ this.encodeService.EncodeStarted += this.encodeService_EncodeStarted;
base.OnActivate();
this.NotifyOfPropertyChange(() => this.ScanLog);
@@ -140,7 +163,12 @@ namespace HandBrakeWPF.ViewModels /// </param>
private void EncodeServiceEncodeStatusChanged(object sender, EncodeProgressEventArgs e)
{
- this.NotifyOfPropertyChange(() => this.EncodeLog);
+ if (encodeLogIndex != this.encodeService.LogIndex || this.encodeService.LogIndex == -1)
+ {
+ this.NotifyOfPropertyChange(() => this.EncodeLog);
+ }
+
+ encodeLogIndex = this.encodeService.LogIndex;
}
/// <summary>
@@ -155,6 +183,8 @@ namespace HandBrakeWPF.ViewModels this.encodeService.EncodeCompleted -= EncodeServiceEncodeCompleted;
this.encodeService.EncodeStatusChanged -= this.EncodeServiceEncodeStatusChanged;
this.scanService.ScanStatusChanged -= this.ScanServiceScanStatusChanged;
+ this.scanService.ScanStared -= this.scanService_ScanStared;
+ this.encodeService.EncodeStarted -= this.encodeService_EncodeStarted;
base.OnDeactivate(close);
}
@@ -186,5 +216,33 @@ namespace HandBrakeWPF.ViewModels {
this.NotifyOfPropertyChange(() => this.EncodeLog);
}
+
+ /// <summary>
+ /// The encode service encode started.
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ private void encodeService_EncodeStarted(object sender, EventArgs e)
+ {
+ this.SelectedTab = 0;
+ }
+
+ /// <summary>
+ /// The scan service scan stared.
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ private void scanService_ScanStared(object sender, EventArgs e)
+ {
+ this.SelectedTab = 1;
+ }
}
}
\ No newline at end of file |