internal override sealed bool AddOptionCallback(PrintCapabilityOption baseOption) { bool added = false; ResolutionOption option = baseOption as ResolutionOption; // Validate the option is complete before adding it to the collection // QualitativeResolution is NOT required if ((option.ResolutionX > 0) && (option.ResolutionY > 0)) { this.Resolutions.Add(option); added = true; } return(added); }
/// <exception cref="XmlException">XML is not well-formed.</exception> internal override sealed bool OptionPropCallback(PrintCapabilityOption baseOption, XmlPrintCapReader reader) { ResolutionOption option = baseOption as ResolutionOption; bool handled = false; if (reader.CurrentElementNodeType == PrintSchemaNodeTypes.ScoredProperty) { handled = true; if (reader.CurrentElementNameAttrValue == PrintSchemaTags.Keywords.PageResolutionKeys.ResolutionX) { try { option._resolutionX = 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.CurrentElementNameAttrValue == PrintSchemaTags.Keywords.PageResolutionKeys.ResolutionY) { try { option._resolutionY = 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.CurrentElementNameAttrValue == PrintSchemaTags.Keywords.PageResolutionKeys.QualitativeResolution) { int enumValue; if (PrintSchemaMapper.CurrentPropertyQValueToEnumValue(reader, PrintSchemaTags.Keywords.PageResolutionKeys.QualityNames, PrintSchemaTags.Keywords.PageResolutionKeys.QualityEnums, out enumValue)) { option._qualityValue = (PageQualitativeResolution)enumValue; } } else { handled = false; #if _DEBUG Trace.WriteLine("-Warning- skip unknown ScoredProperty '" + reader.CurrentElementNameAttrValue + "' at line " + reader._xmlReader.LineNumber + ", position " + reader._xmlReader.LinePosition); #endif } } return(handled); }
internal override sealed PrintCapabilityOption NewOptionCallback(PrintCapabilityFeature baseFeature) { ResolutionOption option = new ResolutionOption(baseFeature); return(option); }