feat: add UpdatePreview method and PreviewPlate property
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -27,11 +27,23 @@ namespace OpenNest.Forms
|
||||
|
||||
public bool Accepted { get; private set; }
|
||||
|
||||
public Plate PreviewPlate
|
||||
{
|
||||
get => previewPlateView.Plate;
|
||||
set
|
||||
{
|
||||
previewPlateView.Plate = value;
|
||||
previewPlateView.ZoomToFit();
|
||||
}
|
||||
}
|
||||
|
||||
public NestProgressForm(CancellationTokenSource cts, bool showPlateRow = true)
|
||||
{
|
||||
this.cts = cts;
|
||||
InitializeComponent();
|
||||
|
||||
previewPlateView.AllowSelect = false;
|
||||
|
||||
if (!showPlateRow)
|
||||
{
|
||||
plateLabel.Visible = false;
|
||||
@@ -76,6 +88,20 @@ namespace OpenNest.Forms
|
||||
: progress.Phase.DisplayName();
|
||||
}
|
||||
|
||||
public void UpdatePreview(List<Part> bestParts)
|
||||
{
|
||||
if (IsDisposed || !IsHandleCreated)
|
||||
return;
|
||||
|
||||
var plate = previewPlateView.Plate;
|
||||
plate.Parts.Clear();
|
||||
|
||||
foreach (var part in bestParts)
|
||||
plate.Parts.Add((Part)part.Clone());
|
||||
|
||||
previewPlateView.ZoomToFit();
|
||||
}
|
||||
|
||||
public void ShowCompleted()
|
||||
{
|
||||
if (IsDisposed || !IsHandleCreated)
|
||||
@@ -135,6 +161,8 @@ namespace OpenNest.Forms
|
||||
if (!cts.IsCancellationRequested)
|
||||
cts.Cancel();
|
||||
|
||||
previewPlateView.Dispose();
|
||||
|
||||
base.OnFormClosing(e);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user