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 bool Accepted { get; private set; }
|
||||||
|
|
||||||
|
public Plate PreviewPlate
|
||||||
|
{
|
||||||
|
get => previewPlateView.Plate;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
previewPlateView.Plate = value;
|
||||||
|
previewPlateView.ZoomToFit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public NestProgressForm(CancellationTokenSource cts, bool showPlateRow = true)
|
public NestProgressForm(CancellationTokenSource cts, bool showPlateRow = true)
|
||||||
{
|
{
|
||||||
this.cts = cts;
|
this.cts = cts;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
previewPlateView.AllowSelect = false;
|
||||||
|
|
||||||
if (!showPlateRow)
|
if (!showPlateRow)
|
||||||
{
|
{
|
||||||
plateLabel.Visible = false;
|
plateLabel.Visible = false;
|
||||||
@@ -76,6 +88,20 @@ namespace OpenNest.Forms
|
|||||||
: progress.Phase.DisplayName();
|
: 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()
|
public void ShowCompleted()
|
||||||
{
|
{
|
||||||
if (IsDisposed || !IsHandleCreated)
|
if (IsDisposed || !IsHandleCreated)
|
||||||
@@ -135,6 +161,8 @@ namespace OpenNest.Forms
|
|||||||
if (!cts.IsCancellationRequested)
|
if (!cts.IsCancellationRequested)
|
||||||
cts.Cancel();
|
cts.Cancel();
|
||||||
|
|
||||||
|
previewPlateView.Dispose();
|
||||||
|
|
||||||
base.OnFormClosing(e);
|
base.OnFormClosing(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user