Beispiel #1
0
        // With current design, all parameter-def properties are generic to any specific parameters,
        // so we just need to implement the prop-callback at the base class level and all derived
        // classes will inherit the implementation.
        /// <exception cref="XmlException">XML is not well-formed.</exception>
        internal override sealed bool ParamDefPropCallback(ParameterDefinition baseParam, XmlPrintCapReader reader)
        {
            NonNegativeIntParameterDefinition param = baseParam as NonNegativeIntParameterDefinition;
            bool handled = true;

            #if _DEBUG
            Trace.Assert(reader.CurrentElementNodeType == PrintSchemaNodeTypes.Property,
                         "THIS SHOULD NOT HAPPEN: NonNegativeIntParamDefPropCallback() gets non-Property node");
            #endif

            if (reader.CurrentElementPSFNameAttrValue == PrintSchemaTags.Keywords.ParameterProps.DefaultValue)
            {
                try
                {
                    param._defaultValue = reader.GetCurrentPropertyIntValueWithException();
                }
                // We want to catch internal FormatException to skip recoverable XML content syntax error
                #pragma warning suppress 56502
                #if _DEBUG
                catch (FormatException e)
                #else
                catch (FormatException)
                #endif
                {
                    #if _DEBUG
                    Trace.WriteLine("-Error- " + e.Message);
                    #endif
                }
            }
            else if (reader.CurrentElementPSFNameAttrValue == PrintSchemaTags.Keywords.ParameterProps.MaxValue)
            {
                try
                {
                    param._maxValue = reader.GetCurrentPropertyIntValueWithException();
                }
                // We want to catch internal FormatException to skip recoverable XML content syntax error
                #pragma warning suppress 56502
                #if _DEBUG
                catch (FormatException e)
                #else
                catch (FormatException)
                #endif
                {
                    #if _DEBUG
                    Trace.WriteLine("-Error- " + e.Message);
                    #endif
                }
            }
            else if (reader.CurrentElementPSFNameAttrValue == PrintSchemaTags.Keywords.ParameterProps.MinValue)
            {
                try
                {
                    param._minValue = reader.GetCurrentPropertyIntValueWithException();
                }
                // We want to catch internal FormatException to skip recoverable XML content syntax error
                #pragma warning suppress 56502
                #if _DEBUG
                catch (FormatException e)
                #else
                catch (FormatException)
                #endif
                {
                    #if _DEBUG
                    Trace.WriteLine("-Error- " + e.Message);
                    #endif
                }
            }
            else
            {
                handled = false;

                #if _DEBUG
                Trace.WriteLine("-Warning- skip unknown Property '" +
                                reader.CurrentElementNameAttrValue + "' at line " +
                                reader._xmlReader.LineNumber + ", position " +
                                reader._xmlReader.LinePosition);
                #endif
            }

            return(handled);
        }
Beispiel #2
0
        // derived types must implement following abstract methods

        /// <summary>
        /// Standard PrintCapabilities parameter-def property callback.
        /// </summary>
        internal abstract bool ParamDefPropCallback(ParameterDefinition baseParam, XmlPrintCapReader reader);