Example #1
0
        private void addButton_Click(object sender, RoutedEventArgs e)
        {
            PeriodErrorTextBlock.Text = string.Empty;
            if (!int.TryParse(PeriodTextBox.Text.Trim(), out var period))
            {
                PeriodErrorTextBlock.Text = "* Not a number";
                PeriodTextBox.Focus();
                return;
            }

            if (period < 1)
            {
                PeriodErrorTextBlock.Text = "* Value should be >= 1";
                PeriodTextBox.Focus();
                return;
            }

            Period       = period;
            Type         = (CalculationMethod)TypeComboBox.SelectedIndex;
            DialogResult = true;
        }
Example #2
0
        private void addButton_Click(object sender, RoutedEventArgs e)
        {
            PeriodErrorTextBlock.Text         = string.Empty;
            OverboughtLineErrorTextBlock.Text = string.Empty;
            OversoldLineErrorTextBlock.Text   = string.Empty;

            {
                if (!int.TryParse(PeriodTextBox.Text.Trim(), out var period))
                {
                    PeriodErrorTextBlock.Text = "* Not a number";
                    PeriodTextBox.Focus();
                    return;
                }

                if (period < 1)
                {
                    PeriodErrorTextBlock.Text = "* Value should be >= 1";
                    PeriodTextBox.Focus();
                    return;
                }

                Period = period;
            }

            {
                if (OverboughtLineSlider.Value <= OversoldLineSlider.Value)
                {
                    OverboughtLineErrorTextBlock.Text = "* should be higher than Oversold Line";
                    OversoldLineErrorTextBlock.Text   = "* should be lower than Overbought Line";
                    OverboughtLineSlider.Focus();
                    return;
                }

                OverboughtLine = OverboughtLineSlider.Value;
                OversoldLine   = OversoldLineSlider.Value;
            }

            DialogResult = true;
        }