public void GeneratePinList(int pinCount)
{
int pins = Items.Count;
if (pinCount > pins)
{
for (int i = 1; i <= (pinCount - pins); i++)
{
var item = new ListViewItem("" + (pins + i + 1));
var pin = new ConnectorPin();
pin.ID = "" + (Items.Count + 1);
pin.name = "N/A";
AddPin(pin);
}
}
else if (pinCount < pins)
{
for (int i = pins; i > pinCount; i--)
{
try
{
Items.RemoveAt(i - 1);
}
catch (Exception er)
{
MessageBox.Show(string.Format("An Error occurred removing connector pin {0}\n{1}", i, er.Message));
}
}
}
}