private void OkBtn_Click(object sender, RoutedEventArgs e) { var resizeFactor = ResizeLabUtil.ConvertToFloat(ResizeFactorTextBox.Text); if (ResizeLabUtil.IsValidFactor(resizeFactor)) { _resizeLab.SlightAdjustResizeFactor = (float)resizeFactor; Close(); } else { MessageBox.Show("Please enter a value greater than 0", "Error"); } }
private void OkBtn_Click(object sender, RoutedEventArgs e) { List <float> proportionList = new List <float>(); for (int i = 1; i < ShapesGrid.Children.Count; i += 2) { var textBox = ShapesGrid.Children[i] as TextBox; var proportion = ResizeLabUtil.ConvertToFloat(textBox.Text); if (ResizeLabUtil.IsValidFactor(proportion)) { proportionList.Add(proportion.Value); } else { MessageBox.Show("Please enter a value greater than 0 (Shape " + (i + 1) / 2 + ")", "Error"); return; } } _resizeLab.AdjustProportionallyProportionList = proportionList; Close(); }