mirror of
https://github.com/Tichau/FileConverter.git
synced 2026-11-24 11:32:21 +01:00
Add the possibility to cancel image conversions.
This commit is contained in:
1 parent
831e8d31f7
commit
2f1fa29b5c
1 file changed
+8
@@ -14,10 +14,12 @@ namespace FileConverter.ConversionJobs
|
||||
|
||||
public ConversionJob_ImageMagick() : base()
|
||||
{
|
||||
this.IsCancelable = true;
|
||||
}
|
||||
|
||||
public ConversionJob_ImageMagick(ConversionPreset conversionPreset) : base(conversionPreset)
|
||||
{
|
||||
this.IsCancelable = true;
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
@@ -199,6 +201,12 @@ namespace FileConverter.ConversionJobs
|
||||
|
||||
private void Image_Progress(object sender, ProgressEventArgs eventArgs)
|
||||
{
|
||||
if (this.CancelIsRequested)
|
||||
{
|
||||
eventArgs.Cancel = true;
|
||||
return;
|
||||
}
|
||||
|
||||
float alreadyCompletedPages = this.CurrentOuputFilePathIndex / (float)this.pageCount;
|
||||
this.Progress = alreadyCompletedPages + (float)eventArgs.Progress.ToDouble() / (100f * this.pageCount);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user