Working folder (phase 1): CSV/raw/step/step_finali all used to live split across two different implicit locations (CSV in the "repo root" found by walking up for CLAUDE.md, raw/step next to the input distinta file) with neither shown to the user. That repo-root lookup also silently breaks once the app runs as a standalone published exe on a machine with no repo/ CLAUDE.md at all. Replaced both with one explicit "cartella di lavoro", auto-suggested (last used, remembered the same way as the DB path) and changeable from phase 1, with no dependency on any repo marker file. Rename: CadSearchGui was the working name from before the app had a product identity; renamed folders, csproj files, namespace and the AppData settings folder to PrepStep throughout, matching the exe name already in use. Product-facing name stays "Cevolani StepPrep". Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
75 lines
3.0 KiB
C#
75 lines
3.0 KiB
C#
using System.Diagnostics;
|
|
|
|
namespace PrepStep;
|
|
|
|
/// <summary>Mostra l'esito della risoluzione ricorsiva dell'albero componenti: i PRT e i
|
|
/// sotto-assiemi trovati nell'indice e già copiati in "raw" a partire dagli assiemi iniziali.</summary>
|
|
public class PrtMancantiForm : Form
|
|
{
|
|
public PrtMancantiForm(List<(string Codice, string Tipo, string Percorso)> righe, List<string> codiciNonTrovati, string cartellaRaw)
|
|
{
|
|
int numPrt = righe.Count(r => r.Tipo == "prt");
|
|
int numAsm = righe.Count(r => r.Tipo == "asm");
|
|
|
|
Text = "Componenti referenziati trovati";
|
|
ClientSize = new Size(720, 440);
|
|
StartPosition = FormStartPosition.CenterParent;
|
|
Font = new Font("Segoe UI", 9.5f);
|
|
|
|
var lblInfo = new Label
|
|
{
|
|
Dock = DockStyle.Top,
|
|
AutoSize = true,
|
|
Padding = new Padding(12, 8, 12, 8),
|
|
Text = $"Copiati in \"{cartellaRaw}\": {numPrt} PRT e {numAsm} sotto-assiemi trovati nell'indice."
|
|
+ (codiciNonTrovati.Count > 0
|
|
? $" {codiciNonTrovati.Count} codici referenziati non corrispondono a nessun file indicizzato "
|
|
+ "(righe 'non trovato' sotto: possono essere disegni, componenti davvero mancanti, "
|
|
+ "o falsi positivi della scansione)."
|
|
: ""),
|
|
};
|
|
|
|
var grid = new DataGridView
|
|
{
|
|
Dock = DockStyle.Fill,
|
|
ReadOnly = true,
|
|
AllowUserToAddRows = false,
|
|
AllowUserToDeleteRows = false,
|
|
RowHeadersVisible = false,
|
|
SelectionMode = DataGridViewSelectionMode.FullRowSelect,
|
|
AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill,
|
|
};
|
|
grid.Columns.Add("codice", "Codice");
|
|
grid.Columns.Add("tipo", "Tipo");
|
|
grid.Columns.Add("percorso", "Percorso CAD");
|
|
grid.Columns["codice"]!.FillWeight = 20;
|
|
grid.Columns["tipo"]!.FillWeight = 10;
|
|
grid.Columns["percorso"]!.FillWeight = 70;
|
|
foreach (var (codice, tipo, percorso) in righe.OrderBy(r => r.Tipo).ThenBy(r => r.Codice))
|
|
{
|
|
grid.Rows.Add(codice, tipo, percorso);
|
|
}
|
|
foreach (var codice in codiciNonTrovati.OrderBy(c => c))
|
|
{
|
|
int i = grid.Rows.Add(codice, "non trovato", "");
|
|
grid.Rows[i].DefaultCellStyle.ForeColor = Color.DarkRed;
|
|
}
|
|
|
|
var btnApriCartella = new Button { Text = "Apri cartella raw", Dock = DockStyle.Bottom, Height = 34 };
|
|
UiStile.Secondario(btnApriCartella);
|
|
btnApriCartella.Click += (_, _) =>
|
|
{
|
|
try { Process.Start("explorer.exe", cartellaRaw); }
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(this, $"Impossibile aprire Esplora risorse:\n{ex.Message}", "Errore",
|
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
};
|
|
|
|
Controls.Add(grid);
|
|
Controls.Add(lblInfo);
|
|
Controls.Add(btnApriCartella);
|
|
}
|
|
}
|