Show a progress dialog while resolving referenced components
"Trova componenti referenziati" ran the recursive BFS synchronously on the UI thread with no feedback. Runs it on a background task instead and shows a modal dialog with a percentage bar, updated as each .asm in the queue is processed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bb99c4f4c5
commit
ee408219bd
2 files changed
+55
-4
No files matched your search
@@ -0,0 +1,37 @@
|
||||
namespace CadSearchGui;
|
||||
|
||||
public sealed class ProgressoComponentiForm : Form
|
||||
{
|
||||
private readonly Label _lbl = new();
|
||||
private readonly ProgressBar _bar = new();
|
||||
|
||||
public ProgressoComponentiForm()
|
||||
{
|
||||
Text = "Ricerca componenti referenziati in corso...";
|
||||
FormBorderStyle = FormBorderStyle.FixedDialog;
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
MinimizeBox = false;
|
||||
MaximizeBox = false;
|
||||
ControlBox = false;
|
||||
ClientSize = new Size(400, 88);
|
||||
|
||||
_lbl.Text = "Preparazione...";
|
||||
_lbl.AutoSize = true;
|
||||
_lbl.Location = new Point(16, 16);
|
||||
|
||||
_bar.Location = new Point(16, 44);
|
||||
_bar.Size = new Size(368, 24);
|
||||
_bar.Minimum = 0;
|
||||
_bar.Maximum = 100;
|
||||
|
||||
Controls.Add(_lbl);
|
||||
Controls.Add(_bar);
|
||||
}
|
||||
|
||||
public void Aggiorna(int fatti, int totale)
|
||||
{
|
||||
int percento = totale > 0 ? (int)Math.Clamp(100.0 * fatti / totale, 0, 100) : 0;
|
||||
_bar.Value = percento;
|
||||
_lbl.Text = $"{fatti} / {totale} componenti analizzati ({percento}%)";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user