Added cancel option to load example data
This commit is contained in:
@@ -286,14 +286,17 @@ namespace CutList.Forms
|
|||||||
UpdateRunButtonState();
|
UpdateRunButtonState();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadExampleData()
|
private void LoadExampleData(bool clearCurrentData = true)
|
||||||
{
|
{
|
||||||
const int PartCount = 50;
|
const int PartCount = 50;
|
||||||
const double Min = 1;
|
const double Min = 1;
|
||||||
const double Max = 120;
|
const double Max = 120;
|
||||||
|
|
||||||
parts.Clear();
|
if (clearCurrentData)
|
||||||
bins.Clear();
|
{
|
||||||
|
parts.Clear();
|
||||||
|
bins.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
var random = new Random();
|
var random = new Random();
|
||||||
|
|
||||||
@@ -314,7 +317,6 @@ namespace CutList.Forms
|
|||||||
LengthInputValue = "144\"",
|
LengthInputValue = "144\"",
|
||||||
Quantity = 9999
|
Quantity = 9999
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly Random random = new Random();
|
private static readonly Random random = new Random();
|
||||||
@@ -326,14 +328,19 @@ namespace CutList.Forms
|
|||||||
|
|
||||||
private void toolStripButton3_Click(object sender, EventArgs e)
|
private void toolStripButton3_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
var clearData = true;
|
||||||
|
|
||||||
if (parts.Count > 0 || bins.Count > 0)
|
if (parts.Count > 0 || bins.Count > 0)
|
||||||
{
|
{
|
||||||
var result = MessageBox.Show("Are you sure you want to clear the current data?", "Clear Data", MessageBoxButtons.YesNo);
|
var dialogResult = MessageBox.Show("Are you sure you want to clear the current data?", "Clear Data", MessageBoxButtons.YesNoCancel);
|
||||||
if (result == DialogResult.No)
|
|
||||||
|
if (dialogResult == DialogResult.Cancel)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
clearData = dialogResult == DialogResult.Yes;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadExampleData();
|
LoadExampleData(clearData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user