Пример #1
0
        //Implementation IDataErrorInfo methods for validation
        public string this[string columnName]
        {
            get
            {
                string error = String.Empty;
                if (columnName == "id" || columnName == validationName)
                {
                    if (!ValidationRules.IsName(id))
                    {
                        error = "Cluster node ID should contain only letters, numbers and _";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "address" || columnName == validationName)
                {
                    if (!ValidationRules.IsIp(address))
                    {
                        error = "Cluster node addres should be IP address";
                        AppLogger.Add("ERROR! " + error);
                    }
                }

                MainWindow.ConfigModifyIndicator();
                return(error);
            }
        }
Пример #2
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (ValidationRules.IsIp(inputTb.Text))
     {
         DialogResult = true;
     }
     else
     {
         inputTb.BorderBrush = System.Windows.Media.Brushes.Red;
     }
 }
Пример #3
0
        public override bool Validate()
        {
            bool isValid = ValidationRules.IsName(id) && ValidationRules.IsIp(address);

            if (!isValid)
            {
                AppLogger.Add("ERROR! Errors in Clustr Node [" + id + "]");
                string a = this[validationName];
            }

            return(isValid);
        }
Пример #4
0
        //Implementation IDataErrorInfo methods for validation
        public string this[string columnName]
        {
            get
            {
                string error = String.Empty;
                if (columnName == "id" || columnName == validationName)
                {
                    if (!ValidationRules.IsName(id))
                    {
                        error = "Cluster node ID should contain only letters, numbers and _";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "address" || columnName == validationName)
                {
                    if (!ValidationRules.IsIp(address))
                    {
                        error = "Cluster node address should be IP address";
                        AppLogger.Add("ERROR! " + error);
                    }
                }

                if (columnName == "winX" || columnName == validationName)
                {
                    if (isWindowed == true)
                    {
                        if (!ValidationRules.IsInt(winX.ToString()))
                        {
                            error = "x should be an integer";
                            AppLogger.Add("ERROR! " + error);
                        }
                    }
                }
                if (columnName == "winY" || columnName == validationName)
                {
                    if (isWindowed == true)
                    {
                        if (!ValidationRules.IsInt(winY.ToString()))
                        {
                            error = "y should be an integer";
                            AppLogger.Add("ERROR! " + error);
                        }
                    }
                }
                if (columnName == "resX" || columnName == validationName)
                {
                    if (isWindowed == true)
                    {
                        if (!ValidationRules.IsInt(resX.ToString()) || Convert.ToInt32(resX) < 0)
                        {
                            error = "Width should be an integer";
                            AppLogger.Add("ERROR! " + error);
                        }
                    }
                }

                if (columnName == "resY" || columnName == validationName)
                {
                    if (isWindowed == true)
                    {
                        if (!ValidationRules.IsInt(resY.ToString()) || Convert.ToInt32(resY) < 0)
                        {
                            error = "Height should be an integer";
                            AppLogger.Add("ERROR! " + error);
                        }
                    }
                }

                MainWindow.ConfigModifyIndicator();
                return(error);
            }
        }