-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNumericListGeneratorForm.cs
More file actions
608 lines (545 loc) · 22.4 KB
/
NumericListGeneratorForm.cs
File metadata and controls
608 lines (545 loc) · 22.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
using System.ComponentModel;
using System.Diagnostics;
using System.Text;
using System.Windows.Forms.VisualStyles;
using NLog;
namespace Numeric_List_Generator
{
/// <summary>
/// Represents the main form for generating numeric lists.
/// </summary>
[DebuggerDisplay(value: $"{{{nameof(GetDebuggerDisplay)}(),nq}}")]
public partial class NumericListGeneratorForm : Form
{
/// <summary>
/// Logger instance for logging messages and exceptions.
/// </summary>
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
/// <summary>
/// Indicates whether the cancellation of the list generation process is requested.
/// </summary>
private bool _isCancelling;
/// <summary>
/// Stores the duration of the list generation process.
/// </summary>
private TimeSpan _timeSpan;
/// <summary>
/// Stores the backup of the list for undo operation.
/// </summary>
private string _backupListUndo = string.Empty, _backupListRedo = string.Empty;
/// <summary>
/// Stores the start time of the list generation process.
/// </summary>
private DateTime _startTime, _endTime;
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="NumericListGeneratorForm"/> class.
/// </summary>
public NumericListGeneratorForm()
{
InitializeComponent();
KeyDown += NumericListGeneratorForm_KeyDown;
KeyPreview = true; // Ensures the form receives key events before the controls
Logger.Info(message: "NumericListGeneratorForm initialisiert.");
}
#endregion
#region Helpers
/// <summary>
/// Get Debugger Display
/// </summary>
/// <returns>Return the debugger display</returns>
private string GetDebuggerDisplay() => ToString();
/// <summary>
/// Set a specific text to the status bar
/// </summary>
/// <param name="text">text with some information</param>
private void SetStatusBar(string text)
{
toolStripStatusLabelInformation.Enabled = !string.IsNullOrEmpty(value: text);
toolStripStatusLabelInformation.Text = text;
}
/// <summary>
/// Updates the status bar with the current statistics of the list.
/// </summary>
private void UpdateStatusBarStatistic()
{
if (toolStripStatusLabelSize.ForeColor == SystemColors.ControlText)
{
toolStripStatusLabelSize.Text = $@"Größe: {textBoxList.Text.Length} Bytes";
}
if (toolStripStatusLabelLines.ForeColor == SystemColors.ControlText)
{
toolStripStatusLabelLines.Text = $@"Zeilen: {textBoxList.Lines.LongLength}";
}
if (toolStripStatusLabelTimeSpan.ForeColor == SystemColors.ControlText)
{
toolStripStatusLabelTimeSpan.Text = $@"Dauer: {_timeSpan:hh\:mm\:ss\.ff}";
}
}
/// <summary>
/// Disables all controls on the form.
/// </summary>
private void DisableControls()
{
toolStripMenuItemList.Enabled = false;
textBoxStringBeforeNumber.Enabled = false;
numericUpDownNumberMinimum.Enabled = false;
numericUpDownNumberMaximum.Enabled = false;
checkBoxFillWithZeros.Enabled = false;
textBoxStringAfterNumber.Enabled = false;
buttonCreateList.Enabled = false;
buttonAddToList.Enabled = false;
buttonDeleteList.Enabled = false;
buttonCopyList.Enabled = false;
buttonSaveList.Enabled = false;
buttonUndo.Enabled = false;
buttonRedo.Enabled = false;
toolStripMenuItemListUndo.Enabled = false;
toolStripMenuItemListRedo.Enabled = false;
textBoxList.Enabled = false;
}
/// <summary>
/// Enables all controls on the form.
/// </summary>
private void EnableControls()
{
toolStripMenuItemList.Enabled = true;
textBoxStringBeforeNumber.Enabled = true;
numericUpDownNumberMinimum.Enabled = true;
numericUpDownNumberMaximum.Enabled = true;
checkBoxFillWithZeros.Enabled = true;
textBoxStringAfterNumber.Enabled = true;
buttonCreateList.Enabled = true;
buttonAddToList.Enabled = true;
buttonDeleteList.Enabled = true;
buttonCopyList.Enabled = true;
buttonSaveList.Enabled = true;
buttonUndo.Enabled = true;
toolStripMenuItemListUndo.Enabled = true;
textBoxList.Enabled = true;
}
/// <summary>
/// Checks if the form should stay on top of other windows.
/// </summary>
private void CheckStayOnTop() => TopMost = toolStripMenuItemSettingsStayOnTop.Checked;
/// <summary>
/// Generates the list asynchronously.
/// </summary>
private async Task GenerateListAsync()
{
buttonCancelProgress.Enabled = true;
try
{
StringBuilder sb = new();
for (int i = (int)numericUpDownNumberMinimum.Value; i <= (int)numericUpDownNumberMaximum.Value; i++)
{
if (_isCancelling)
{
break;
}
if (sb.Length > 0)
{
_ = sb.AppendLine();
}
_ = checkBoxFillWithZeros.Checked
? sb.Append(handler: $"{textBoxStringBeforeNumber.Text}{i.ToString().PadLeft(totalWidth: ((int)numericUpDownNumberMaximum.Value).ToString().Length, paddingChar: '0')}{textBoxStringAfterNumber.Text}")
: sb.Append(handler: $"{textBoxStringBeforeNumber.Text}{i}{textBoxStringAfterNumber.Text}");
progressBar.Value = i;
_endTime = DateTime.Now;
_timeSpan = _endTime - _startTime;
_backupListRedo = sb.ToString();
await Task.Delay(millisecondsDelay: 0);
}
textBoxList.Text += sb.ToString();
UpdateStatusBarStatistic();
}
catch (Exception ex)
{
// Log the exception (example: log to a file or logging framework)
const string message = "Ein unerwarteter Fehler ist beim Hinzufügen zur Liste aufgetreten.";
Debug.WriteLine(value: ex);
Logger.Error(exception: ex, message: message);
_ = MessageBox.Show(text: message, caption: @"Fehler", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Error);
}
buttonCancelProgress.Enabled = false;
_isCancelling = false;
progressBar.Value = 0;
}
#endregion
#region Form event handlers
/// <summary>
/// Handles the Load event of the form.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void NumericListGeneratorForm_Load(object sender, EventArgs e)
{
SetStatusBar(text: string.Empty);
buttonUndo.Enabled = false;
buttonRedo.Enabled = false;
buttonCancelProgress.Enabled = false;
toolStripMenuItemListUndo.Enabled = false;
toolStripMenuItemListRedo.Enabled = false;
UpdateStatusBarStatistic();
}
#endregion
#region Enter event handlers
/// <summary>
/// Called when the mouse pointer moves over a control.
/// </summary>
/// <param name="sender">The event source.</param>
/// <param name="e">The <see cref="EventArgs"/> instance that contains the event data.</param>
private void SetStatusBar_Enter(object sender, EventArgs e)
{
// Set the status bar text based on the sender's accessible description
switch (sender)
{
// If the sender is a control with an accessible description, set the status bar text
// If the sender is a ToolStripItem with an accessible description, set the status bar text
case Control { AccessibleDescription: not null } control:
SetStatusBar(text: control.AccessibleDescription);
break;
case ToolStripItem { AccessibleDescription: not null } item:
SetStatusBar(text: item.AccessibleDescription);
break;
}
}
#endregion
#region Leave event handlers
/// <summary>
/// Clears the information text of the status bar.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance that contains the event data.</param>
private void ClearStatusBar_Leave(object sender, EventArgs e) => SetStatusBar(text: string.Empty);
#endregion
#region Click event handlers
/// <summary>
/// Handles the Click event of the Add To List button.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ButtonAddToList_Click(object sender, EventArgs e)
{
try
{
DisableControls();
if (!string.IsNullOrEmpty(value: textBoxList.Text))
{
textBoxList.Text += Environment.NewLine;
}
_backupListUndo = textBoxList.Text;
_startTime = DateTime.Now;
progressBar.Minimum = 0;
progressBar.Maximum = (int)numericUpDownNumberMaximum.Value;
progressBar.Value = 0;
progressBar.Step = 1;
backgroundWorker.RunWorkerAsync();
}
catch (Exception ex)
{
// Log the exception (example: log to a file or logging framework)
const string message = "Ein unerwarteter Fehler ist beim Hinzufügen zur Liste aufgetreten.";
Debug.WriteLine(value: ex);
Logger.Error(exception: ex, message: message);
_ = MessageBox.Show(text: $@"{message} Bitte versuchen Sie es erneut.", caption: "Fehler", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Error);
EnableControls();
}
}
/// <summary>
/// Handles the Click event of the Copy List button.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ButtonCopyList_Click(object sender, EventArgs e)
{
textBoxList.SelectAll();
textBoxList.Copy();
_ = MessageBox.Show(text: @"Die Liste wurde in die Zwischenablage kopiert.");
}
/// <summary>
/// Handles the Click event of the Save List button.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ButtonSaveList_Click(object sender, EventArgs e)
{
try
{
using SaveFileDialog save = new()
{
FileName = "liste.txt",
Filter = "Textdatei | *.txt"
};
if (save.ShowDialog() != DialogResult.OK)
{
return;
}
using StreamWriter writer = new(stream: save.OpenFile());
writer.WriteLine(value: textBoxList.Text);
_ = MessageBox.Show(text: @"Die Liste wurde in die Textdatei kopiert.");
}
catch (Exception ex)
{
// Log the exception (example: log to a file or logging framework)
const string message = "Ein unerwarteter Fehler ist beim Hinzufügen zur Liste aufgetreten.";
Debug.WriteLine(value: ex);
Logger.Error(exception: ex, message: message);
_ = MessageBox.Show(text: $@"{message} Bitte versuchen Sie es erneut.", caption: "Fehler", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Error);
}
}
/// <summary>
/// Handles the Click event of the Delete List button.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ButtonDeleteList_Click(object sender, EventArgs e)
{
textBoxList.Clear();
_timeSpan = TimeSpan.Zero;
UpdateStatusBarStatistic();
}
/// <summary>
/// Handles the Click event of the Create List button.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ButtonCreateList_Click(object sender, EventArgs e)
{
DisableControls();
ButtonDeleteList_Click(sender: sender, e: e);
ButtonAddToList_Click(sender: sender, e: e);
}
/// <summary>
/// Handles the Click event of the Undo button.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ButtonUndo_Click(object sender, EventArgs e)
{
textBoxList.Text = _backupListUndo;
buttonUndo.Enabled = false;
buttonRedo.Enabled = true;
toolStripMenuItemListUndo.Enabled = false;
toolStripMenuItemListRedo.Enabled = true;
UpdateStatusBarStatistic();
}
/// <summary>
/// Handles the Click event of the Redo button.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ButtonRedo_Click(object sender, EventArgs e)
{
textBoxList.Text = _backupListRedo;
buttonUndo.Enabled = true;
buttonRedo.Enabled = false;
toolStripMenuItemListUndo.Enabled = true;
toolStripMenuItemListRedo.Enabled = false;
UpdateStatusBarStatistic();
}
/// <summary>
/// Handles the Click event of the Size status label.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ToolStripStatusLabelSize_Click(object sender, EventArgs e)
{
if (toolStripStatusLabelSize.ForeColor == SystemColors.ControlText)
{
toolStripStatusLabelSize.ForeColor = SystemColors.GrayText;
toolStripStatusLabelSize.Text = toolStripStatusLabelSize.Tag?.ToString() ?? string.Empty;
}
else
{
toolStripStatusLabelSize.ForeColor = SystemColors.ControlText;
}
}
/// <summary>
/// Handles the Click event of the Lines status label.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ToolStripStatusLabelLines_Click(object sender, EventArgs e)
{
if (toolStripStatusLabelLines.ForeColor == SystemColors.ControlText)
{
toolStripStatusLabelLines.ForeColor = SystemColors.GrayText;
toolStripStatusLabelLines.Text = toolStripStatusLabelLines.Tag?.ToString() ?? string.Empty;
}
else
{
toolStripStatusLabelLines.ForeColor = SystemColors.ControlText;
}
}
/// <summary>
/// Handles the Click event of the TimeSpan status label.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ToolStripStatusLabelTimeSpan_Click(object sender, EventArgs e)
{
if (toolStripStatusLabelTimeSpan.ForeColor == SystemColors.ControlText)
{
toolStripStatusLabelTimeSpan.ForeColor = SystemColors.GrayText;
toolStripStatusLabelTimeSpan.Text = toolStripStatusLabelTimeSpan.Tag?.ToString() ?? string.Empty;
}
else
{
toolStripStatusLabelTimeSpan.ForeColor = SystemColors.ControlText;
}
}
/// <summary>
/// Handles the Click event of the Style status label.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ToolStripStatusLabelStyle_Click(object sender, EventArgs e)
{
Application.VisualStyleState = Application.VisualStyleState == VisualStyleState.ClientAndNonClientAreasEnabled
? VisualStyleState.NoneEnabled
: VisualStyleState.ClientAndNonClientAreasEnabled;
Invalidate(invalidateChildren: true);
}
/// <summary>
/// Handles the Click event of the Info menu item.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ToolStripMenuItemInfo_Click(object sender, EventArgs e)
{
using AboutBoxForm formAboutBox = new();
formAboutBox.TopMost = TopMost;
_ = formAboutBox.ShowDialog();
}
/// <summary>
/// Handles the Click event of the License menu item.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ToolStripMenuItemLicense_Click(object sender, EventArgs e)
{
using LicenseForm formLicense = new();
formLicense.TopMost = TopMost;
_ = formLicense.ShowDialog();
}
/// <summary>
/// Handles the Click event of the Exit menu item.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ToolStripMenuItemExit_Click(object sender, EventArgs e) => Close();
/// <summary>
/// Handles the Click event of the Create List menu item.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ToolStripMenuItemListCreate_Click(object sender, EventArgs e) => ButtonCreateList_Click(sender: sender, e: e);
/// <summary>
/// Handles the Click event of the Add List menu item.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ToolStripMenuItemListAdd_Click(object sender, EventArgs e) => ButtonAddToList_Click(sender: sender, e: e);
/// <summary>
/// Handles the Click event of the Delete List menu item.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ToolStripMenuItemListDelete_Click(object sender, EventArgs e) => ButtonDeleteList_Click(sender: sender, e: e);
/// <summary>
/// Handles the Click event of the Undo menu item.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ToolStripMenuItemListUndo_Click(object sender, EventArgs e) => ButtonUndo_Click(sender: sender, e: e);
/// <summary>
/// Handles the Click event of the Redo menu item.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ToolStripMenuItemListRedo_Click(object sender, EventArgs e) => ButtonRedo_Click(sender: sender, e: e);
/// <summary>
/// Handles the Click event of the Copy List menu item.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ToolStripMenuItemListCopy_Click(object sender, EventArgs e) => ButtonCopyList_Click(sender: sender, e: e);
/// <summary>
/// Handles the Click event of the Save List menu item.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ToolStripMenuItemListSave_Click(object sender, EventArgs e) => ButtonSaveList_Click(sender: sender, e: e);
/// <summary>
/// Handles the Click event of the Disable Visual Style menu item.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ToolStripMenuItemSettingsDisableVisualStyle_Click(object sender, EventArgs e) => ToolStripStatusLabelStyle_Click(sender: sender, e: e);
/// <summary>
/// Handles the Click event of the Stay On Top menu item.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ToolStripMenuItemSettingsStayOnTop_Click(object sender, EventArgs e) => CheckStayOnTop();
/// <summary>
/// Handles the Click event of the Batch menu item.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ToolStripMenuItemBatch_Click(object sender, EventArgs e)
{
Hide();
using BatchForm formBatch = new();
formBatch.TopMost = TopMost;
_ = formBatch.ShowDialog();
Show();
}
#endregion
#region KeyDown event handler
/// <summary>
/// Handles the KeyDown event of the ExportDataSheetForm.
/// Closes the form when the Escape key is pressed.
/// </summary>
/// <param name="sender">The event source.</param>
/// <param name="e">The <see cref="EventArgs"/> instance that contains the event data.</param>
private void NumericListGeneratorForm_KeyDown(object? sender, KeyEventArgs e)
{
// Check if the Escape key was pressed
// If so, close the form
if (e.KeyCode == Keys.Escape)
{
Close();
}
}
#endregion
#region BackgroundWorker event handlers
/// <summary>
/// Performs the asynchronous generation of the list in the background.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.ComponentModel.DoWorkEventArgs"/> instance containing the event data.</param>
private async void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e) => await GenerateListAsync();
/// <summary>
/// Called when the progress of the background work changes.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.ComponentModel.ProgressChangedEventArgs"/> instance containing the event data.</param>
private void BackgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) => progressBar.PerformStep();
/// <summary>
/// Called when the background work is completed.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.ComponentModel.RunWorkerCompletedEventArgs"/> instance containing the event data.</param>
private void BackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) => EnableControls();
#endregion
/// <summary>
/// Handles the Click event of the Cancel Progress button.
/// Sets the isCancelling flag to true to indicate that the list generation process should be cancelled.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ButtonCancelProgress_Click(object sender, EventArgs e) => _isCancelling = true;
}
}