Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / CommonUI / System / Drawing / Printing / InvalidPrinterException.cs / 1 / 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. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DNS.cs
- DateTimeEditor.cs
- RoleGroupCollection.cs
- SiteIdentityPermission.cs
- SchemaElementLookUpTableEnumerator.cs
- StaticExtensionConverter.cs
- PartialCachingAttribute.cs
- XmlComplianceUtil.cs
- SessionStateItemCollection.cs
- ConfigurationStrings.cs
- CssTextWriter.cs
- TcpConnectionPoolSettingsElement.cs
- LocationUpdates.cs
- SqlNodeAnnotations.cs
- NameValueFileSectionHandler.cs
- TableCellCollection.cs
- Module.cs
- WebControl.cs
- SimpleRecyclingCache.cs
- CodeTypeReferenceExpression.cs
- DeploymentSection.cs
- Control.cs
- DefaultShape.cs
- FileChangesMonitor.cs
- InkCanvasAutomationPeer.cs
- ReliableChannelFactory.cs
- Util.cs
- AuthenticationConfig.cs
- Crypto.cs
- XmlSchemaSimpleType.cs
- WindowProviderWrapper.cs
- Instrumentation.cs
- IdentityReference.cs
- WindowsFormsSynchronizationContext.cs
- MulticastOption.cs
- ConfigurationValues.cs
- PageWrapper.cs
- UriSectionData.cs
- PersonalizationProviderHelper.cs
- DbParameterHelper.cs
- PackageRelationshipCollection.cs
- CellTreeNode.cs
- Vars.cs
- HashCryptoHandle.cs
- DataPagerFieldCollection.cs
- PtsHelper.cs
- precedingsibling.cs
- FontInfo.cs
- SafeEventLogWriteHandle.cs
- UnionCqlBlock.cs
- BoundColumn.cs
- MimeImporter.cs
- DbConnectionPoolIdentity.cs
- VisualTreeUtils.cs
- KeyboardDevice.cs
- XPathNodePointer.cs
- Reference.cs
- SimpleHandlerFactory.cs
- IdentityNotMappedException.cs
- updateconfighost.cs
- DecoderExceptionFallback.cs
- StructuralObject.cs
- ParenthesizePropertyNameAttribute.cs
- InputScopeManager.cs
- Visual.cs
- NavigatingCancelEventArgs.cs
- Merger.cs
- ThreadInterruptedException.cs
- XPathAncestorQuery.cs
- EncryptedPackage.cs
- ProtectedConfigurationSection.cs
- CodeThrowExceptionStatement.cs
- FileDialog_Vista_Interop.cs
- mongolianshape.cs
- _IPv6Address.cs
- XmlQueryStaticData.cs
- ChangeConflicts.cs
- Package.cs
- ComplexLine.cs
- DataStreams.cs
- OdbcPermission.cs
- MultiPartWriter.cs
- DbDataReader.cs
- ConvertEvent.cs
- FrugalMap.cs
- BitmapEffectDrawing.cs
- JsonFormatWriterGenerator.cs
- NetworkInformationPermission.cs
- SafeNativeMethods.cs
- Util.cs
- XmlImplementation.cs
- Lease.cs
- DrawItemEvent.cs
- TrustLevel.cs
- StreamGeometryContext.cs
- Attributes.cs
- WindowsClientElement.cs
- Cursor.cs
- RegisteredHiddenField.cs
- _TLSstream.cs