Skip to content

Commit

Permalink
Moved cancellation to the begin of the loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekStoj91 committed May 23, 2023
1 parent 2fc11bb commit c85cc54
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
18 changes: 9 additions & 9 deletions FOnlineScalex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ public void DoWork(string inDir, string outDir, bool recursive, double eqDiff,
string outFile = string.Empty;
foreach (string srcFile in fileArray)
{
// can be cancelled externally
if (Cancelled && OnCancel != null)
{
OnCancel();
logger.Log("FOnlineScalex cancelled by user!");
break;
}

// if it's png or FRM file
// get extensionless filename
// string extLessFilename = Regex.Replace(srcFile, "[.][^.]+$", string.Empty);
Expand Down Expand Up @@ -277,15 +285,7 @@ public void DoWork(string inDir, string outDir, bool recursive, double eqDiff,
// ProcessingFile = outFile;
// Frame = dstFrames?.FirstOrDefault();
// OnProgressUpdate((int)Math.Floor(Progress), outFile, dstFrames?.FirstOrDefault());
//}

// can be cancelled externally
if (Cancelled && OnCancel != null)
{
OnCancel();
logger.Log("FOnlineScalex cancelled by user!");
break;
}
//}

}

Expand Down
4 changes: 2 additions & 2 deletions MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ private void InitToolTip()
toolTip.SetToolTip(this.cboxScale, "Checked - scale image, Unchecked - original size.");

toolTip.SetToolTip(this.btnGo, "Commence processing");
toolTip.SetToolTip(this.btnStop, "Interrupt processing");
toolTip.SetToolTip(this.btnStop, "Cancel processing");

toolTip.SetToolTip(this.tboxCurrProc, "Currently processing file");
toolTip.SetToolTip(this.progBar, "Progress of the processing");
Expand Down Expand Up @@ -335,7 +335,7 @@ private void howToUseToolStripMenuItem_Click(object sender, EventArgs e)
sb.Append("8) GO Let the app go.\n");
sb.Append("\n");
sb.Append("9) STOPS stops the app.\n");
sb.Append("(App can be interrupted anytime during it's processing)\n");
sb.Append("(App can be cancelled anytime during it's processing)\n");
MessageBox.Show(sb.ToString(), "How To Use", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

Expand Down

0 comments on commit c85cc54

Please sign in to comment.