public static bool isIntCorrect(string str, out Color color, iMargin m = null) { Int32 iValue; color = cEmpty; if (string.IsNullOrEmpty(str)) return false; color = cErr; if (!Int32.TryParse(str, out iValue)) return false; if (m != null) { color = cOutOfRange; if (iValue < m.Low) return false; if (iValue > m.High) return false; } color = cNormal; return true; }
private bool GroupCheck() { var isCorrect = true; Color color; var margin = new iMargin(); margin.High = 99999; margin.Low = 0; if (!Checker.isIntCorrect(tbDimLength.Text, out color, margin)) isCorrect = false; tbDimLength.BackColor = color; margin.Low = 1; if (!cbMonitoring.Checked) { if (!Checker.isIntCorrect(tbCount.Text, out color, margin)) isCorrect = false; tbCount.BackColor = color; } margin.High = 10000; margin.Low = 10; if (!Checker.isIntCorrect(tbDelay.Text, out color, margin)) isCorrect = false; tbDelay.BackColor = color; return isCorrect; }