Forex_Strategy_Builder.Instrument_Editor.ValidatePropertiesForm C# (CSharp) Method

ValidatePropertiesForm() private method

Validates the instrument properties
private ValidatePropertiesForm ( ) : bool
return bool
        bool ValidatePropertiesForm()
        {
            bool   isResult = true;
            string errorMessage = "";

            // Symbol
            if (!ValidateSymbol(tbxPropSymbol.Text, (Instrumet_Type)Enum.Parse(typeof(Instrumet_Type), tbxPropType.Text)))
                errorMessage += Environment.NewLine + Language.T("Wrong Symbol!");

            // Price In
            Regex regexPriceIn = new Regex(@"^[A-Z]{3}$");

            if (!regexPriceIn.IsMatch(tbxPropPriceIn.Text))
                errorMessage += Environment.NewLine + Language.T("Wrong Price!");

            // Commission
            if(cbxPropCommission.SelectedIndex == 1 && cbxPropCommScope.SelectedIndex != 1)
                errorMessage += Environment.NewLine + Language.T("Wrong commission settings!");

            // Base file name
            Regex regexFileName = new Regex(@"^[a-zA-Z\$\#][\w- ]*$");

            if (!regexFileName.IsMatch(tbxPropFileName.Text))
                errorMessage += Environment.NewLine + Language.T("Wrong Base name of the data files!");

            if(errorMessage != "")
            {
                isResult = false;
                MessageBox.Show(errorMessage, Language.T("Instrument Properties"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            return isResult;
        }