Пример #1
0
        private void SubmitBtn_Click(object sender, RoutedEventArgs e)
        {
            BenthicGroup benthicGroup = new BenthicGroup();
            string       itemGroup    = benthicGroup.getItemGroup(categoryTextBox.Text);

            if (itemGroup == null)
            {
                MessageBox.Show("Wrong category name. Try again.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
            }

            else
            {
                var    dataInput      = new DataInputSet();
                double currentLength  = 0;
                double previousLength = 0;

                try
                {
                    currentLength = Convert.ToDouble(lengthTextBox.Text);
                }
                catch (Exception)
                {
                    MessageBox.Show("Wrong intersect length. Try again.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                    goto skip;
                }

                foreach (var data in InputData)
                {
                    previousLength += Convert.ToDouble(data.Length);
                }

                double deltaLength = currentLength - previousLength;
                if (deltaLength < 0)
                {
                    MessageBox.Show("Intersect length less than previous input. Try again.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                    goto skip;
                }

                dataInput.Length       = deltaLength.ToString();
                dataInput.Depth        = depthTextBox.Text;
                dataInput.Category     = categoryTextBox.Text;
                dataInput.BenthicGroup = itemGroup;
                InputData.Add(dataInput);
                dataGrid.ItemsSource = InputData;
                dataGrid.Items.Refresh();

                lengthTextBox.Text   = "";
                depthTextBox.Text    = "";
                categoryTextBox.Text = "";
                lengthTextBox.Focus();
            }
            skip :;

            if (InputData.Count != 0)
            {
                createChartBtn.IsEnabled = true;
            }
        }
Пример #2
0
        private void DataGrid_CurrentCellChanged(object sender, EventArgs e)
        {
            foreach (var data in InputData)
            {
                string categoryName = data.Category;
                var    benthicGroup = new BenthicGroup();
                string itemGroup    = benthicGroup.getItemGroup(categoryName);
                data.BenthicGroup = itemGroup;
            }

            try
            {
                dataGrid.Items.Refresh();
            }
            catch (Exception)
            {
                //throw;
            }
        }