Files
OpenNest/OpenNest/Forms/CutParametersForm.cs
T
ajandClaude Opus 5.5 90a6d9e4d2 refactor(core): drop System.Drawing.Common and fix CutParameters namespace
Core only uses System.Drawing.Color, which ships in the shared framework, so
the System.Drawing.Common package (Windows-only beyond primitives) was an
unneeded dependency of the cross-platform domain library. The desktop app
keeps its own reference.

CutParameters lives in OpenNest.Core but declared namespace OpenNest.Api,
forcing Core and desktop files to import the Api namespace for a Core type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 13:15:48 -04:00

65 lines
1.8 KiB
C#

using System;
using System.Windows.Forms;
namespace OpenNest.Forms
{
public partial class CutParametersForm : Form
{
private Units units;
public CutParametersForm()
{
InitializeComponent();
Units = OpenNest.Units.Inches;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
numericUpDown1.Value = Properties.Settings.Default.LastFeedrate;
numericUpDown2.Value = Properties.Settings.Default.LastRapidFeedrate;
numericUpDown3.Value = Properties.Settings.Default.LastPierceTime;
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
base.OnClosing(e);
Properties.Settings.Default.LastFeedrate = numericUpDown1.Value;
Properties.Settings.Default.LastRapidFeedrate = numericUpDown2.Value;
Properties.Settings.Default.LastPierceTime = numericUpDown3.Value;
Properties.Settings.Default.Save();
}
public Units Units
{
get { return units; }
set
{
units = value;
SetUnits(value);
}
}
private void SetUnits(Units units)
{
var suffix = UnitsHelper.GetShortTimeUnitPair(units);
numericUpDown1.Suffix = " " + suffix;
numericUpDown2.Suffix = " " + suffix;
}
public CutParameters GetCutParameters()
{
return new CutParameters()
{
Feedrate = (double)numericUpDown1.Value,
RapidTravelRate = (double)numericUpDown2.Value,
PierceTime = TimeSpan.FromSeconds((double)numericUpDown3.Value),
Units = units,
};
}
}
}