/// <summary> /// Event that handles the click event of FillRangeButton. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FillRangesButton_Click(object sender, RoutedEventArgs e) { FillRanges fillRange = new FillRanges(); fillRange.Show(); fillRange.Closed += new EventHandler(fillRange_Closed); }
void fillRange_Closed(object sender, EventArgs e) { FillRanges fillRange = sender as FillRanges; if (fillRange.DialogResult == true) { int startValue = fillRange.StartValue; int endValue = fillRange.EndValue; int rangeValue = fillRange.RangeValue; List <EwavRuleRecodeDataRow> rangeTable = new List <EwavRuleRecodeDataRow>(); EwavRuleRecodeDataRow row = new EwavRuleRecodeDataRow(); row.col1 = "LOVALUE"; row.col2 = startValue.ToString(); row.col3 = "LOVALUE - <" + startValue.ToString(); rangeTable.Add(row); for (int i = startValue; i < endValue; i = i + rangeValue) { string lowerBound = i.ToString(); string upperBound = (i + rangeValue).ToString(); if ((i + rangeValue) > endValue) { upperBound = endValue.ToString(); } row = new EwavRuleRecodeDataRow(); row.col1 = lowerBound; row.col2 = upperBound; row.col3 = lowerBound + " - <" + upperBound; rangeTable.Add(row); } row = new EwavRuleRecodeDataRow(); row.col1 = endValue.ToString(); row.col2 = "HIVALUE"; row.col3 = endValue.ToString() + " - < HIVALUE"; rangeTable.Add(row); dataGridViewRecode.ItemsSource = rangeTable; } }