Esempio n. 1
0
        //      ------

        private void initialiseButton_Click(object sender, RoutedEventArgs e)
        {
            try {
                bool?newSelected;
                switch (InitialiseSelectedComboBox.SelectedIndex)
                {
                case 0: newSelected = null; break;

                case 1: newSelected = false; break;

                case 2: newSelected = true; break;

                default:
                    throw new NotSupportedException();
                }
                bool?isRequired;
                switch (InitialiseIsRequriedComboBox.SelectedIndex)
                {
                case 0: isRequired = null; break;

                case 1: isRequired = false; break;

                case 2: isRequired = true; break;

                default:
                    throw new NotSupportedException();
                }
                TestCheckedTextBox.Initialise(newSelected, isRequired);
            } catch (Exception ex) {
                MessageBox.Show(ex.Message, "Exception occurred", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 2
0
        //      ------

        private void initialiseButton_Click(object sender, RoutedEventArgs e)
        {
            try {
                bool?isRequired = InitialiseIsRequriedComboBox.SelectedIndex switch
                {
                    0 => null,
                    1 => false,
                    2 => true,
                    _ => throw new NotSupportedException(),
                };
                TestCheckedTextBox.Initialise(InitialiseTextTextBox.Text, isRequired);
            } catch (Exception ex) {
                MessageBox.Show(ex.Message, "Exception occurred", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }