Beispiel #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);
                    }
                }
                if (columnName == "gpuAffinity" || columnName == validationName)
                {
                    if (!ValidationRules.IsIntNullable(gpuAffinity))
                    {
                        error = "Gpu Affinity must be integer or empty";
                        AppLogger.Add("ERROR! " + error);
                    }
                }

                MainWindow.ConfigModifyIndicator();
                return(error);
            }
        }
Beispiel #2
0
        public bool Validate()
        {
            bool isValid = ValidationRules.IsFloat(cameraLocationX.ToString()) && ValidationRules.IsFloat(cameraLocationY.ToString()) &&
                           ValidationRules.IsFloat(cameraLocationZ.ToString()) && ValidationRules.IsIntNullable(cameraTrackerCh) && ValidationRules.IsFloat(eyeDist) &&
                           ValidationRules.IsFloat(lagMaxTime) && (ValidationRules.IsInt(portCs) || (Convert.ToDouble(portCs) > 0)) && (ValidationRules.IsInt(portSs) || (Convert.ToDouble(portSs) > 0));

            if (!isValid)
            {
                string a = this[validationName];
            }
            //Validate items in lists
            isValid = isValid && ValidateList <Screen>(ref _screens);
            isValid = isValid && ValidateList <ClusterNode>(ref _clusterNodes);
            isValid = isValid && ValidateList <Viewport>(ref _viewports);
            isValid = isValid && ValidateList <SceneNode>(ref _sceneNodes);
            isValid = isValid && ValidateList <BaseInput>(ref _inputs);

            //Check id uniqueness for listitems
            if (screens.GroupBy(n => n.id).Any(c => c.Count() > 1))
            {
                isValid = false;
                AppLogger.Add("ERROR! All Screen Id's should be unique! Rename duplicate Id's");
            }
            if (clusterNodes.GroupBy(n => n.id).Any(c => c.Count() > 1))
            {
                isValid = false;
                AppLogger.Add("ERROR! All Cluster node Id's should be unique! Rename duplicate Id's");
            }
            if (viewports.GroupBy(n => n.id).Any(c => c.Count() > 1))
            {
                isValid = false;
                AppLogger.Add("ERROR! All Viewport Id's should be unique! Rename duplicate Id's");
            }
            if (sceneNodes.GroupBy(n => n.id).Any(c => c.Count() > 1))
            {
                isValid = false;
                AppLogger.Add("ERROR! All Scene node Id's should be unique! Rename duplicate Id's");
            }
            if (inputs.GroupBy(n => n.id).Any(c => c.Count() > 1))
            {
                isValid = false;
                AppLogger.Add("ERROR! All Input Id's should be unique! Rename duplicate Id's");
            }

            //check master node
            if (!clusterNodes.Exists(x => x.isMaster))
            {
                isValid = false;
                AppLogger.Add("ERROR! Master Cluster Node is not selected! Check Master Node");
            }

            return(isValid);
        }
Beispiel #3
0
        public override bool Validate()
        {
            bool isValid = ValidationRules.IsName(id) && ValidationRules.IsIp(address) &&
                           ValidationRules.IsIntNullable(gpuAffinity);

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

            return(isValid);
        }
Beispiel #4
0
        //Implementation IDataErrorInfo methods
        public string this[string columnName]
        {
            get
            {
                string error = String.Empty;
                if (columnName == "cameraLocationX" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloat(cameraLocationX.ToString()))
                    {
                        error = "Camera location X should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "cameraLocationY" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloat(cameraLocationY.ToString()))
                    {
                        error = "Camera location Y should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "cameraLocationZ" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloat(cameraLocationZ.ToString()))
                    {
                        error = "Camera location Z should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "cameraTrackerCh" || columnName == validationName)
                {
                    if (!ValidationRules.IsIntNullable(cameraTrackerCh))
                    {
                        error = "Camera tracker channel should be an integer";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "eyeDist" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloat(eyeDist.ToString()))
                    {
                        error = "Eye distance should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "lagMaxTime" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloat(lagMaxTime.ToString()))
                    {
                        error = "Maximum delay time should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "portCs" || columnName == validationName)
                {
                    if (!(ValidationRules.IsInt(portCs) || Convert.ToInt32(portCs) > 0))
                    {
                        error = "Client port should be a positive number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "portSs" || columnName == validationName)
                {
                    if (!(ValidationRules.IsInt(portSs) || Convert.ToInt32(portSs) > 0))
                    {
                        error = "Server port should be a positive number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }

                MainWindow.ConfigModifyIndicator();
                return(error);
            }
        }
Beispiel #5
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);
            }
        }