public virtual ValidationResult Validate(ref PrimesBigInteger bi) { if (m_Value != null) { if (m_Value.GetType() == typeof(string) && !string.IsNullOrEmpty(m_Value.ToString().Trim())) { try { bi = calculator.Evaluate(m_Value.ToString()); return(ValidationResult.OK); } catch { if (string.IsNullOrEmpty(this.m_Message)) { this.m_Message = Primes.Resources.lang.Validation.Validation.BigIntegerValidator; } } } else { if (m_Value.GetType() == typeof(PrimesBigInteger)) { bi = m_Value as PrimesBigInteger; return(ValidationResult.OK); } else { if (string.IsNullOrEmpty(this.m_Message)) { this.m_Message = Primes.Resources.lang.Validation.Validation.BigIntegerValidator; } } } } return(ValidationResult.WARNING); }
private void okButton_Click(object sender, EventArgs e) { try { SevenZ.Calculator.Calculator clc = new SevenZ.Calculator.Calculator(); double xMin = clc.Evaluate(xMinTextBox.Text); double xMax = clc.Evaluate(xMaxTextBox.Text); double yMin = clc.Evaluate(yMinTextBox.Text); double yMax = clc.Evaluate(yMaxTextBox.Text); int xIntervals = Convert.ToInt32(clc.Evaluate(xIntervalsTextBox.Text)); int yIntervals = Convert.ToInt32(clc.Evaluate(yIntervalsTextBox.Text)); if (xMin < xMax && xMax > xMin && yMin < yMax && yMax > yMin && xIntervals > 0 && yIntervals > 0) { Grid.XMin = xMin; Grid.XMax = xMax; Grid.YMin = yMin; Grid.YMax = yMax; Grid.xIntervals = xIntervals; Grid.yIntervals = yIntervals; Grid.xyPixel(); this.Close(); } else { throw new Exception(); } } catch { MessageBox.Show("Not a number!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }