Example #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 = "Input ID should contain only letters, numbers and _";
                 AppLogger.Add("ERROR! " + error);
             }
         }
         if (columnName == "address" || columnName == validationName)
         {
             if (!ValidationRules.IsAddress(address))
             {
                 error = "Input Address in format [email protected]";
                 AppLogger.Add("ERROR! " + error);
             }
         }
         MainWindow.ConfigModifyIndicator();
         return(error);
     }
 }
Example #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);
        }
Example #3
0
        public override bool Validate()
        {
            bool isValid = ValidationRules.IsName(id) && ValidationRules.IsAddress(address);

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

            return(isValid);
        }
Example #4
0
        public override bool Validate()
        {
            bool isValid = ValidationRules.IsName(id) && ValidationRules.IsInt(x.ToString()) && ValidationRules.IsInt(y.ToString()) &&
                           (ValidationRules.IsInt(width.ToString()) || Convert.ToInt32(width) > 0) && (ValidationRules.IsInt(height.ToString()) || Convert.ToInt32(height) > 0);

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

            return(isValid);
        }
Example #5
0
        public override bool Validate()
        {
            bool isValid = ValidationRules.IsName(id) && ValidationRules.IsFloat(locationX.ToString()) && ValidationRules.IsFloat(locationY.ToString()) &&
                           ValidationRules.IsFloat(locationZ.ToString()) && ValidationRules.IsFloat(rotationP.ToString()) && ValidationRules.IsFloat(rotationY.ToString()) &&
                           ValidationRules.IsFloat(rotationR.ToString()) && (ValidationRules.IsFloat(sizeX) || (Convert.ToDouble(sizeX) > 0)) && (ValidationRules.IsFloat(sizeY) || (Convert.ToDouble(sizeY) > 0));

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

            return(isValid);
        }
Example #6
0
        public new bool Validate()
        {
            bool isValid = ValidationRules.IsName(id) && ValidationRules.IsAddress(address) && ValidationRules.IsFloat(locationX.ToString()) &&
                           ValidationRules.IsFloat(locationY.ToString()) && ValidationRules.IsFloat(locationZ.ToString()) && ValidationRules.IsFloat(rotationP.ToString()) &&
                           ValidationRules.IsFloat(rotationY.ToString()) && ValidationRules.IsFloat(rotationR.ToString());

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

            return(isValid);
        }
Example #7
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);
        }
Example #8
0
 public void DeleteSceneNode(SceneNodeView item)
 {
     if (item.children != null)
     {
         foreach (SceneNodeView child in item.children.ToList())
         {
             DeleteSceneNode(child);
         }
     }
     if (item.node.parent == null)
     {
         sceneNodesView.Remove(item);
     }
     else
     {
         SceneNodeView parentNode = FindParentNode(item);
         if (parentNode != null)
         {
             parentNode.children.Remove(item);
         }
     }
     AppLogger.Add("Scene node " + item.node.id + " deleted");
     sceneNodes.Remove(item.node);
 }
Example #9
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 = "Screen ID should contain only letters, numbers and _";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "locationX" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloat(locationX.ToString()))
                    {
                        error = "Location X should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "locationY" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloat(locationY.ToString()))
                    {
                        error = "Location Y should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "locationZ" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloat(locationZ.ToString()))
                    {
                        error = "Location Z should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "rotationP" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloat(rotationP.ToString()))
                    {
                        error = "Pitch should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "rotationY" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloat(rotationY.ToString()))
                    {
                        error = "Yaw should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "rotationR" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloat(rotationR.ToString()))
                    {
                        error = "Roll should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "sizeX" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloat(sizeX) || (Convert.ToDouble(sizeX) < 0))
                    {
                        error = "The X size parameter should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "sizeY" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloat(sizeY) || (Convert.ToDouble(sizeY) < 0))
                    {
                        error = "The Y size parameter should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }

                MainWindow.ConfigModifyIndicator();
                return(error);
            }
        }
Example #10
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 = "Viewport ID should contain only letters, numbers and _";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "x" || columnName == validationName)
                {
                    if (!ValidationRules.IsInt(x.ToString()))
                    {
                        error = "x should be an integer";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "y" || columnName == validationName)
                {
                    if (!ValidationRules.IsInt(y.ToString()))
                    {
                        error = "y should be an integer";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "width" || columnName == validationName)
                {
                    if (!ValidationRules.IsInt(width.ToString()) || Convert.ToInt32(width) < 0)
                    {
                        error = "Width should be an integer";
                        AppLogger.Add("ERROR! " + error);
                    }
                }

                if (columnName == "height" || columnName == validationName)
                {
                    if (!ValidationRules.IsInt(height.ToString()) || Convert.ToInt32(height) < 0)
                    {
                        error = "Height should be an integer";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                //switch (columnName)
                //{
                //    case "id":
                //        if (!ValidationRules.IsName(id))
                //        {
                //            error = "Viewport ID should contain only letters, numbers and _";
                //        }
                //        break;
                //    case "x":
                //        if (!ValidationRules.IsInt(x.ToString()))
                //        {
                //            error = "x should be an integer";
                //        }
                //        break;
                //    case "y":
                //        if (!ValidationRules.IsInt(y.ToString()))
                //        {
                //            error = "y should be an integer";
                //        }
                //        break;
                //    case "width":
                //        if (!ValidationRules.IsInt(width.ToString()))
                //        {
                //            error = "Width should be an integer";
                //        }
                //        break;
                //    case "height":
                //        if (!ValidationRules.IsInt(height.ToString()))
                //        {
                //            error = "Height should be an integer";
                //        }
                //        break;
                //}
                //if (!string.IsNullOrEmpty(error))
                //{
                //    AppLogger.Add("ERROR! " + error);
                //}
                return(error);
            }
        }
Example #11
0
        //Implementation IDataErrorInfo methods for validation
        //ayamashev: check this 'new'
        public new string this[string columnName]
        {
            get
            {
                string error = String.Empty;
                if (columnName == "id" || columnName == validationName)
                {
                    if (!ValidationRules.IsName(id))
                    {
                        error = "Input ID should contain only letters, numbers and _";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "address" || columnName == validationName)
                {
                    if (!ValidationRules.IsAddress(address))
                    {
                        error = "Input Address in format [email protected]";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "locationX" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloat(locationX.ToString()))
                    {
                        error = "Location X should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "locationY" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloat(locationY.ToString()))
                    {
                        error = "Location Y should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "locationZ" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloat(locationZ.ToString()))
                    {
                        error = "Location Z should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "rotationP" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloat(rotationP.ToString()))
                    {
                        error = "Pitch should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "rotationY" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloat(rotationY.ToString()))
                    {
                        error = "Yaw should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }
                if (columnName == "rotationR" || columnName == validationName)
                {
                    if (!ValidationRules.IsFloat(rotationR.ToString()))
                    {
                        error = "Roll should be a floating point number";
                        AppLogger.Add("ERROR! " + error);
                    }
                }

                MainWindow.ConfigModifyIndicator();
                return(error);
            }
        }
Example #12
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);
            }
        }
Example #13
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);
            }
        }
Example #14
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);
            }
        }