Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CommonUI / System / Drawing / Printing / InvalidPrinterException.cs / 1305376 / InvalidPrinterException.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Drawing.Printing { using System.Diagnostics; using System; using System.Security; using System.Security.Permissions; using System.Runtime.Serialization; using System.ComponentModel; using System.Runtime.InteropServices; using Microsoft.Win32; ////// /// [Serializable()] public class InvalidPrinterException : SystemException { private PrinterSettings settings; ////// Represents /// the /// exception that is thrown when trying to access a printer using invalid printer settings. /// ////// /// public InvalidPrinterException(PrinterSettings settings) : base(GenerateMessage(settings)) { this.settings = settings; } ////// Initializes a new instance of the ///class. /// protected InvalidPrinterException(SerializationInfo info, StreamingContext context) : base (info, context) { settings = (PrinterSettings)info.GetValue("settings", typeof(PrinterSettings)); } /// [SecurityPermissionAttribute(SecurityAction.Demand,SerializationFormatter=true)] public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException("info"); } IntSecurity.AllPrinting.Demand(); info.AddValue("settings", settings); base.GetObjectData(info, context); } static string GenerateMessage(PrinterSettings settings) { if (settings.IsDefaultPrinter) { return SR.GetString(SR.InvalidPrinterException_NoDefaultPrinter); } else { try { return SR.GetString(SR.InvalidPrinterException_InvalidPrinter, settings.PrinterName); } catch (SecurityException) { return SR.GetString(SR.InvalidPrinterException_InvalidPrinter, SR.GetString(SR.CantTellPrinterName)); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ControlBindingsCollection.cs
- DbMetaDataCollectionNames.cs
- ErrorWebPart.cs
- TemplateControlCodeDomTreeGenerator.cs
- ColumnHeaderCollectionEditor.cs
- PublishLicense.cs
- SizeConverter.cs
- MappingModelBuildProvider.cs
- DataContractSerializerElement.cs
- RequestCachePolicyConverter.cs
- SingleConverter.cs
- OracleEncoding.cs
- CustomWebEventKey.cs
- DataRowChangeEvent.cs
- ForwardPositionQuery.cs
- EUCJPEncoding.cs
- TdsParserStateObject.cs
- _SslStream.cs
- SafeMemoryMappedViewHandle.cs
- SafeRightsManagementPubHandle.cs
- PropertyOverridesTypeEditor.cs
- safelink.cs
- DynamicActivityTypeDescriptor.cs
- OutputScope.cs
- SchemaInfo.cs
- DefaultShape.cs
- GridItemPattern.cs
- Activity.cs
- ListSortDescriptionCollection.cs
- SecurityDocument.cs
- DataListItem.cs
- SecurityPolicySection.cs
- OutKeywords.cs
- GlyphCache.cs
- InvalidFilterCriteriaException.cs
- MetadataArtifactLoaderComposite.cs
- DesigntimeLicenseContext.cs
- XmlAtomicValue.cs
- CalculatedColumn.cs
- XmlAttributes.cs
- DesignSurfaceManager.cs
- ListControlActionList.cs
- WindowsTokenRoleProvider.cs
- DataObjectAttribute.cs
- FormViewModeEventArgs.cs
- XmlSiteMapProvider.cs
- XmlSchemaSimpleTypeList.cs
- GridViewColumnCollectionChangedEventArgs.cs
- SchemaMapping.cs
- DateRangeEvent.cs
- ExternalException.cs
- SchemaComplexType.cs
- SqlParameterizer.cs
- FormsAuthenticationConfiguration.cs
- SqlParameterizer.cs
- DataBoundControlAdapter.cs
- HMACRIPEMD160.cs
- SqlDataSourceSelectingEventArgs.cs
- MethodSet.cs
- DeflateEmulationStream.cs
- IdentifierService.cs
- GetPageNumberCompletedEventArgs.cs
- BooleanExpr.cs
- BindingList.cs
- TypeElementCollection.cs
- CompiledQueryCacheKey.cs
- DocumentXmlWriter.cs
- MarkerProperties.cs
- CompositeFontInfo.cs
- Currency.cs
- ProfileProvider.cs
- ThemeDictionaryExtension.cs
- XmlILOptimizerVisitor.cs
- StylusButtonEventArgs.cs
- PersistChildrenAttribute.cs
- ReturnType.cs
- ByteAnimationBase.cs
- ToolStripProgressBar.cs
- HttpServerUtilityBase.cs
- Tracer.cs
- BindUriHelper.cs
- PowerModeChangedEventArgs.cs
- Type.cs
- RewritingPass.cs
- BaseTemplateCodeDomTreeGenerator.cs
- CuspData.cs
- FolderLevelBuildProviderCollection.cs
- NonParentingControl.cs
- DragDeltaEventArgs.cs
- FileDialogCustomPlacesCollection.cs
- TraceContextRecord.cs
- HttpWebResponse.cs
- NativeWindow.cs
- DomainLiteralReader.cs
- ChangeProcessor.cs
- CompilerResults.cs
- ToolStripRenderer.cs
- ValidationErrorEventArgs.cs
- TextFormatterContext.cs
- LinearQuaternionKeyFrame.cs