2026-09-21 11:18:43 +02:00
|
|
|
namespace PrepStep;
|
2026-09-17 09:55:14 +02:00
|
|
|
|
|
|
|
|
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}%)";
|
|
|
|
|
}
|
|
|
|
|
}
|