fix: restore auto-navigation on plate add in PlateManager
OnPlateAdded now navigates to the new plate when suppressNavigation is false, matching the original EditNestForm behavior. Fixed CanRemoveCurrent test to account for this auto-navigation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -199,6 +199,12 @@ namespace OpenNest
|
|||||||
private void OnPlateAdded(object sender, ItemAddedEventArgs<Plate> e)
|
private void OnPlateAdded(object sender, ItemAddedEventArgs<Plate> e)
|
||||||
{
|
{
|
||||||
PlateListChanged?.Invoke(this, EventArgs.Empty);
|
PlateListChanged?.Invoke(this, EventArgs.Empty);
|
||||||
|
|
||||||
|
if (!suppressNavigation)
|
||||||
|
{
|
||||||
|
CurrentIndex = Count - 1;
|
||||||
|
FireCurrentPlateChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPlateRemoved(object sender, ItemRemovedEventArgs<Plate> e)
|
private void OnPlateRemoved(object sender, ItemRemovedEventArgs<Plate> e)
|
||||||
|
|||||||
@@ -390,6 +390,8 @@ public class PlateManagerTests
|
|||||||
Assert.False(mgr.CanRemoveCurrent);
|
Assert.False(mgr.CanRemoveCurrent);
|
||||||
|
|
||||||
nest.CreatePlate();
|
nest.CreatePlate();
|
||||||
|
// Auto-navigated to plate2 (empty), go back to plate1 (has parts)
|
||||||
|
mgr.LoadFirst();
|
||||||
Assert.True(mgr.CanRemoveCurrent);
|
Assert.True(mgr.CanRemoveCurrent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user