summaryrefslogtreecommitdiffstats
path: root/win/CS
diff options
context:
space:
mode:
authorsr55 <[email protected]>2017-04-11 14:24:38 +0100
committersr55 <[email protected]>2017-04-11 14:24:38 +0100
commitec65fcbcc62ad86b275e1c1a36ae1bb1672771e4 (patch)
tree954e0b7114cb4165b01d757bdbe775fa0e94ce6b /win/CS
parent0a8dde9d78fc57ef19e53f50405e9a3124802267 (diff)
WinGui: Cancel Scan will now close the status panel if the scan cancellation fails for any reason. Rejigged the logging in the scan service to help debug intermittent failures of the scan completed event from firing.
Diffstat (limited to 'win/CS')
-rw-r--r--win/CS/HandBrakeWPF/Services/Scan/LibScan.cs22
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs4
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;