private bool Set_EnumValues()
        {
            SignalFormatProperties oBackupFormat = oCurrentFormat.Get_Clone();

            oCurrentFormat.Enums.Clear();

            foreach (DataGridViewRow oRow in Grid_Enum.Rows)
            {
                EnumerationValue sEnum = new EnumerationValue();

                int EnumVal;
                if (!(oRow.Cells[0].Value == null))
                {
                    if (int.TryParse(oRow.Cells[0].Value.ToString(), out EnumVal))
                    {
                        if (!(EnumValueExists(EnumVal)))
                        {
                            sEnum.Value = EnumVal;
                        }
                        else
                        {
                            oCurrentFormat = oBackupFormat.Get_Clone();
                            MessageBox.Show("Enumeration value '" + EnumVal.ToString() + "' is defined twice !", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return(false);
                        }
                    }
                    else
                    {
                        oCurrentFormat = oBackupFormat.Get_Clone();
                        MessageBox.Show("An enumeration value must be a numerical value !", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return(false);
                    }
                }
                else
                {
                    oCurrentFormat = oBackupFormat.Get_Clone();
                    MessageBox.Show("An enumeration value cannot be empty !", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(false);
                }


                string EnumTxt;
                if (!(oRow.Cells[1].Value == null))
                {
                    EnumTxt = oRow.Cells[1].Value.ToString();
                    if (!(EnumTextExists(EnumTxt)))
                    {
                        sEnum.Text = EnumTxt;
                    }
                    else
                    {
                        oCurrentFormat = oBackupFormat.Get_Clone();
                        MessageBox.Show("Enumeration text '" + EnumTxt + "' is defined twice !", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return(false);
                    }
                }
                else
                {
                    oCurrentFormat = oBackupFormat.Get_Clone();
                    MessageBox.Show("An enumeration text cannot be empty !", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(false);
                }

                oCurrentFormat.Enums.Add(sEnum);
            }

            return(true);
        }
        /// <summary>
        /// Read the SignalFormatProperties XML node and set the current object
        /// </summary>
        /// <param name="xSignalFormat">XML Node to read</param>
        /// <returns>Read error flag: True = No Error / False = Error</returns>
        public bool ReadSignalFormatXmlNode(XmlNode xSignalFormat)
        {
            XmlNode xFormatType = xSignalFormat.SelectSingleNode("FormatType");

            if (!(xFormatType == null))
            {
                SignalValueFormat eFormatType;
                if (Enum.TryParse(xFormatType.InnerText, out eFormatType))
                {
                    FormatType = eFormatType;
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }

            XmlNode xFormatDec = xSignalFormat.SelectSingleNode("FormatDecimals");

            if (!(xFormatDec == null))
            {
                int nDec;
                if (int.TryParse(xFormatDec.InnerText, out nDec))
                {
                    Decimals = nDec;
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }

            switch (FormatType)
            {
            case SignalValueFormat.Enum:

            {
                XmlNode xFormatEnums = xSignalFormat.SelectSingleNode("FormatEnums");
                if (!(xFormatEnums == null))
                {
                    Enums = new List <EnumerationValue>();

                    foreach (XmlNode xEnum in xFormatEnums.ChildNodes)
                    {
                        EnumerationValue sEnum = new EnumerationValue();

                        XmlNode xEnumVal = xEnum.SelectSingleNode("EnumValue");
                        if (!(xEnumVal == null))
                        {
                            int eVal;
                            if (int.TryParse(xEnumVal.InnerText, out eVal))
                            {
                                sEnum.Value = eVal;
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }

                        XmlNode xEnumText = xEnum.SelectSingleNode("EnumText");
                        if (!(xEnumText == null))
                        {
                            sEnum.Text = xEnumText.InnerText;
                        }
                        else
                        {
                            return(false);
                        }

                        Enums.Add(sEnum);
                    }
                }
                else
                {
                    return(false);
                }
            }

            break;

            case SignalValueFormat.Checkbox:
            case SignalValueFormat.Button:

            {
                XmlNode xControlProps = xSignalFormat.SelectSingleNode("ControlProperties");
                if (!(xControlProps == null))
                {
                    SignalControlFormatProperties sCtrlProps = new SignalControlFormatProperties();

                    XmlNode xCtrlText = xControlProps.SelectSingleNode("ControlText");
                    if (!(xCtrlText == null))
                    {
                        sCtrlProps.Text = xCtrlText.InnerText;
                    }
                    else
                    {
                        return(false);
                    }

                    XmlNode xCtrlOnValue = xControlProps.SelectSingleNode("ControlOnValue");
                    if (!(xCtrlOnValue == null))
                    {
                        int Val = 0;
                        if (int.TryParse(xCtrlOnValue.InnerText, out Val))
                        {
                            sCtrlProps.On_Value = Val;
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }

                    XmlNode xCtrlOffValue = xControlProps.SelectSingleNode("ControlOffValue");
                    if (!(xCtrlOffValue == null))
                    {
                        int Val = 0;
                        if (int.TryParse(xCtrlOffValue.InnerText, out Val))
                        {
                            sCtrlProps.Off_Value = Val;
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }

                    sControlProperties = new SignalControlFormatProperties();
                    sControlProperties = sCtrlProps;
                }
                else
                {
                    return(false);
                }
            }

            break;
            }

            return(true);
        }