Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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. // //----------------------------------------------------------------------------- /* */ 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
- DbConvert.cs
- TypeBuilder.cs
- DebugHandleTracker.cs
- ExpressionEditorAttribute.cs
- CommandBindingCollection.cs
- Int16.cs
- MarkupCompilePass2.cs
- EdmComplexTypeAttribute.cs
- TokenBasedSet.cs
- CacheSection.cs
- NamedElement.cs
- ErrorStyle.cs
- CurrentTimeZone.cs
- RectangleGeometry.cs
- Clipboard.cs
- TrackingWorkflowEventArgs.cs
- PowerModeChangedEventArgs.cs
- GenerateScriptTypeAttribute.cs
- UIHelper.cs
- BitmapEffectDrawing.cs
- CodePageUtils.cs
- XmlSchemaCompilationSettings.cs
- ValidationError.cs
- DesignOnlyAttribute.cs
- EndEvent.cs
- HtmlImage.cs
- MetadataItem.cs
- CacheSection.cs
- CacheEntry.cs
- ColorDialog.cs
- IsolatedStorageFilePermission.cs
- XmlDataLoader.cs
- ListViewGroupItemCollection.cs
- XmlSchemaValidationException.cs
- Decorator.cs
- KeyEvent.cs
- InitializerFacet.cs
- NonParentingControl.cs
- ProfileBuildProvider.cs
- DeclaredTypeElement.cs
- XmlDataSource.cs
- EncoderNLS.cs
- _BaseOverlappedAsyncResult.cs
- NumericExpr.cs
- WinEventWrap.cs
- ContextDataSourceContextData.cs
- TcpTransportElement.cs
- QueryOpeningEnumerator.cs
- ModulesEntry.cs
- PrincipalPermission.cs
- SelectionWordBreaker.cs
- ModulesEntry.cs
- WebPartMenuStyle.cs
- ListItemCollection.cs
- CurrentChangingEventManager.cs
- FixedSOMElement.cs
- XmlHelper.cs
- UniqueIdentifierService.cs
- CategoriesDocumentFormatter.cs
- InteropBitmapSource.cs
- AsyncStreamReader.cs
- FormViewRow.cs
- FlowDocument.cs
- CommentEmitter.cs
- TypeConverterHelper.cs
- Resources.Designer.cs
- UserControlCodeDomTreeGenerator.cs
- errorpatternmatcher.cs
- CommandManager.cs
- TreeNodeCollection.cs
- DataRelationCollection.cs
- ProcessProtocolHandler.cs
- HttpApplication.cs
- ConfigViewGenerator.cs
- MsmqAppDomainProtocolHandler.cs
- TraceUtils.cs
- EventsTab.cs
- WorkflowInvoker.cs
- RightsDocument.cs
- ConversionHelper.cs
- ImageKeyConverter.cs
- ISO2022Encoding.cs
- HttpCapabilitiesBase.cs
- _IPv6Address.cs
- UnmanagedBitmapWrapper.cs
- HandleCollector.cs
- ObjectDataSourceSelectingEventArgs.cs
- ReadOnlyTernaryTree.cs
- SplashScreen.cs
- HttpRuntime.cs
- TableDetailsCollection.cs
- RemotingAttributes.cs
- SiteMapDataSourceView.cs
- MetadataArtifactLoader.cs
- SQLDecimalStorage.cs
- ContextMenuStripGroupCollection.cs
- DrawingCollection.cs
- BindingCollection.cs
- DataTableNameHandler.cs
- ObjectStateManagerMetadata.cs