fix: auto-select first part and refresh quantity in CadConverter file list

Fire SelectedIndexChanged when the first item is added so the preview
loads automatically. Invalidate the file list after quantity changes so
the badge repaints immediately.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-24 23:01:51 -04:00
parent d5b5ab57e3
commit f626fbe063
2 changed files with 9 additions and 3 deletions

View File

@@ -63,7 +63,11 @@ namespace OpenNest.Controls
public void AddItem(FileListItem item)
{
items.Add(item);
if (items.Count == 1) selectedIndex = 0;
if (items.Count == 1)
{
selectedIndex = 0;
SelectedIndexChanged?.Invoke(this, selectedIndex);
}
Invalidate();
}

View File

@@ -194,8 +194,10 @@ namespace OpenNest.Forms
private void OnQuantityChanged(object sender, EventArgs e)
{
var item = CurrentItem;
if (item != null)
item.Quantity = (int)numQuantity.Value;
if (item == null) return;
item.Quantity = (int)numQuantity.Value;
fileList.Invalidate();
}
private void OnCustomerChanged(object sender, EventArgs e)