diff options
Diffstat (limited to 'win')
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Scan/LibScan.cs | 22 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 4 |
2 files changed, 16 insertions, 10 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs index 7be5db8f0..fdeb88b2d 100644 --- a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs +++ b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs @@ -25,7 +25,6 @@ namespace HandBrakeWPF.Services.Scan using HandBrake.ApplicationServices.Services.Logging.Interfaces; using HandBrake.ApplicationServices.Services.Logging.Model; - using HandBrakeWPF.Properties; using HandBrakeWPF.Services.Encode.Model; using HandBrakeWPF.Services.Encode.Model.Models; using HandBrakeWPF.Services.Scan.EventArgs; @@ -122,6 +121,8 @@ namespace HandBrakeWPF.Services.Scan } } + this.isCancelled = false; + // Handle the post scan operation. this.postScanOperation = postAction; @@ -141,15 +142,18 @@ namespace HandBrakeWPF.Services.Scan { try { - this.ServiceLogMessage("Stopping Scan."); + this.ServiceLogMessage("Stopping Scan ..."); this.IsScanning = false; this.instance.StopScan(); + this.ServiceLogMessage("Scan Stopped ..."); } catch (Exception exc) { - this.isCancelled = false; - this.ScanCompleted?.Invoke(this, new ScanCompletedEventArgs(false, exc, Resources.ScanService_ScanStopFailed, null)); - // Do Nothing. + this.ServiceLogMessage(exc.ToString()); + } + finally + { + this.ScanCompleted?.Invoke(this, new ScanCompletedEventArgs(this.isCancelled, null, null, null)); } } @@ -206,7 +210,7 @@ namespace HandBrakeWPF.Services.Scan } catch (AccessViolationException e) { - Console.WriteLine(e); + Debug.WriteLine(e); } return bitmapImage; @@ -266,8 +270,6 @@ namespace HandBrakeWPF.Services.Scan { this.ServiceLogMessage("Scan Failed ..." + Environment.NewLine + exc); this.Stop(); - - this.ScanCompleted?.Invoke(this, new ScanCompletedEventArgs(false, exc, "An Error has occured in ScanService.ScanSource()", null)); } } @@ -286,7 +288,7 @@ namespace HandBrakeWPF.Services.Scan /// </param> private void InstanceScanCompleted(object sender, System.EventArgs e) { - this.ServiceLogMessage("Scan Finished ..."); + this.ServiceLogMessage("Processing Scan Information ..."); bool cancelled = this.isCancelled; this.isCancelled = false; @@ -318,10 +320,12 @@ namespace HandBrakeWPF.Services.Scan } this.postScanOperation = null; // Reset + this.ServiceLogMessage("Scan Finished for Queue Edit ..."); } else { this.ScanCompleted?.Invoke(this, new ScanCompletedEventArgs(cancelled, null, string.Empty, sourceData)); + this.ServiceLogMessage("Scan Finished ..."); } } diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index f29e6fac0..283111b11 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1619,6 +1619,7 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void CancelScan()
{
+ this.ShowStatusWindow = false;
this.scanService.Cancel();
}
@@ -2346,6 +2347,8 @@ namespace HandBrakeWPF.ViewModels Execute.OnUIThread(() =>
{
+ this.ShowStatusWindow = false;
+
if (e.Successful)
{
this.NotifyOfPropertyChange(() => this.ScannedSource);
@@ -2358,7 +2361,6 @@ namespace HandBrakeWPF.ViewModels this.OpenAlertWindow(Resources.Main_ScanNoTitlesFound, Resources.Main_ScanNoTitlesFoundMessage);
}
- this.ShowStatusWindow = false;
if (e.Successful)
{
this.SourceLabel = this.SourceName;
|