ATMLCommonLibrary.controls.ATMLControl.ValidateToSchema C# (CSharp) Method

ValidateToSchema() public static method

public static ValidateToSchema ( object item ) : bool
item object
return bool
        public static bool ValidateToSchema( object item )
        {
            bool validated = true;
            HourGlass.Enabled = true;
            try
            {
                //---------------------------------------//
                //--- Will Validate at the form level ---//
                //---------------------------------------//
                //SchemaManager.ValidateToSchema(item);
                /*
                MethodInfo miValidate = item.GetType().GetMethod("Validate");
                if (miValidate == null)
                    throw new Exception(string.Format("{0} does not support the Validate Method", item.GetType().Name));

                var errors = new SchemaValidationResult();
                object[] p = { errors };
                miValidate.Invoke(item, p);
                if (errors.HasErrors())
                {
                    ATMLErrorForm.ShowValidationMessage(errors.ErrorMessage, errors.Errors.ToString(), "Note: This error will not prevent you from continuing.");
                }
                else
                {
                    MessageBox.Show(string.Format(
                        "This {0} has passed all validation against the ATML Schema.",
                        item.GetType().Name), @"V a l i d a t i o n", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                 */
            }
            catch (Exception e)
            {
                HourGlass.Enabled = false;
                validated = false;
                ATMLErrorForm.ShowValidationMessage(
                    string.Format( "{0} has failed validation against the ATML schema.",
                                   item == null ? "Unknown" : item.GetType().Name ), e.Message,
                    "Note: This error will not prevent you from continuing." );
            }
            finally
            {
                HourGlass.Enabled = false;
            }
            return validated;
        }