Files
prep-step/CadSearchGui/ProgressoComponentiForm.cs
T
davideandClaude Sonnet 5 ee408219bd 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>
2026-09-17 09:55:14 +02:00

38 lines
1.1 KiB
C#

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}%)";
}
}