private void FillDataFromControlsToBuffers() { _customScaleProperties = new CustomScaleProperties(); _customScaleProperties.ScaleName = ScaleTBox.Text; // Adding the TextBox content to the list _customComments.Where(txtBox => txtBox.IsEnabled == true).ToList().ForEach(textBox => { _customScaleProperties.CustomComments.Add(textBox.Text); }); // Adding the Label content to the list _customLabels.Where(label => label.Content.ToString() != "").ToList().ForEach(label => { _customScaleProperties.CustomScaleLabels.Add(label.Content.ToString()); }); _customScalePropertiesList.Add(_customScaleProperties); }
private void OnModifyClicked(object sender, RoutedEventArgs e) { var customScaleProperties = new CustomScaleProperties(); if (ScaleTBox.Text != "") { if (ValidateScaleProperties(2)) { customScaleProperties.ScaleName = ScaleTBox.Text; _customLabels.ToList().ForEach(label => { if (label.Content.ToString() != "") { customScaleProperties.CustomScaleLabels.Add(label.Content.ToString()); } }); _customComments.ToList().ForEach(textbox => { if (textbox.Text != "") { customScaleProperties.CustomComments.Add(textbox.Text); } }); var scaleList = new List <CustomScaleProperties> { customScaleProperties }; RemoveSelectedScale(); StoreCustomScaleConfiguration(scaleList); ScaleLBox.Items.Add(customScaleProperties.ScaleName); MessageBox.Show("The Scale has been modified.", "Info", MessageBoxButton.OK, MessageBoxImage.Information); ClearFields(); } } else { MessageBox.Show("No Scale has been selected.", "Info", MessageBoxButton.OK, MessageBoxImage.Information); } }