Пример #1
0
        public override bool Validate()
        {
            bool isValid = ValidationRules.IsName(id) && ValidationRules.IsFloatNullable(locationX.ToString()) && ValidationRules.IsFloatNullable(locationY.ToString()) &&
                           ValidationRules.IsFloatNullable(locationZ.ToString()) && ValidationRules.IsFloatNullable(rotationP.ToString()) &&
                           ValidationRules.IsFloatNullable(rotationY.ToString()) && ValidationRules.IsFloatNullable(rotationR.ToString());

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

            return(isValid);
        }
Пример #2
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 = "Scene Nodes ID should contain only letters, numbers and _";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "locationX" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloatNullable(locationX.ToString()))
                    {
                        error = "Location X should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "locationY" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloatNullable(locationY.ToString()))
                    {
                        error = "Location Y should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "locationZ" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloatNullable(locationZ.ToString()))
                    {
                        error = "Location Z should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "rotationP" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloatNullable(rotationP.ToString()))
                    {
                        error = "Pitch should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "rotationY" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloatNullable(rotationY.ToString()))
                    {
                        error = "Yaw should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "rotationR" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloatNullable(rotationR.ToString()))
                    {
                        error = "Roll should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "trackerCh" || columnName == validationName)
                {
                    if (!ValidationRules.IsIntNullable(trackerCh))
                    {
                        error = "Tracker channel should be a positive integer";
                        AppLogger.Add("ERROR! " + error);
                    }
                }

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