Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- ImageFormatConverter.cs
- UndoManager.cs
- TreeNodeCollection.cs
- RuleInfoComparer.cs
- ConstructorBuilder.cs
- ConnectionPointCookie.cs
- WpfKnownTypeInvoker.cs
- LogReservationCollection.cs
- TypeViewSchema.cs
- TrackingRecord.cs
- TextElement.cs
- UnsafePeerToPeerMethods.cs
- ReachDocumentReferenceSerializer.cs
- RawTextInputReport.cs
- VirtualizedItemProviderWrapper.cs
- RootCodeDomSerializer.cs
- EdmFunctions.cs
- ObjectReaderCompiler.cs
- MenuCommands.cs
- TextBlockAutomationPeer.cs
- PackWebRequest.cs
- ErrorWebPart.cs
- ServiceInfoCollection.cs
- ImageAnimator.cs
- MsmqIntegrationMessageProperty.cs
- Select.cs
- ExpressionEditorAttribute.cs
- DynamicDocumentPaginator.cs
- SqlDataSource.cs
- DataSourceSelectArguments.cs
- PackagingUtilities.cs
- SqlInternalConnectionSmi.cs
- _ListenerAsyncResult.cs
- InfiniteIntConverter.cs
- CompoundFileReference.cs
- MappableObjectManager.cs
- SqlException.cs
- RelatedCurrencyManager.cs
- QuaternionValueSerializer.cs
- FontResourceCache.cs
- Exceptions.cs
- CommandBindingCollection.cs
- TreeViewEvent.cs
- MessagingActivityHelper.cs
- validationstate.cs
- StreamingContext.cs
- IsolatedStorageFileStream.cs
- StorageFunctionMapping.cs
- DataViewListener.cs
- UseLicense.cs
- StringOutput.cs
- CodeGenerator.cs
- Size.cs
- LassoSelectionBehavior.cs
- NativeMethods.cs
- XmlDataProvider.cs
- Point3DAnimationUsingKeyFrames.cs
- KeyEvent.cs
- CheckedListBox.cs
- WebControlsSection.cs
- RecordManager.cs
- SecurityStandardsManager.cs
- RemoteHelper.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- KnownTypesHelper.cs
- ToolstripProfessionalRenderer.cs
- EdmItemCollection.OcAssemblyCache.cs
- ToolStripMenuItemDesigner.cs
- BrowserTree.cs
- ProcessingInstructionAction.cs
- HotSpotCollection.cs
- ConnectionPoolManager.cs
- XmlSchemaDatatype.cs
- _LocalDataStoreMgr.cs
- FormsAuthenticationUser.cs
- WebPartTransformer.cs
- DocumentSchemaValidator.cs
- EventsTab.cs
- RegexGroup.cs
- BitmapCodecInfo.cs
- XXXInfos.cs
- codemethodreferenceexpression.cs
- EntityDataSourceUtil.cs
- OuterGlowBitmapEffect.cs
- TargetInvocationException.cs
- DataList.cs
- MaskInputRejectedEventArgs.cs
- CellConstant.cs
- RawStylusInput.cs
- ThreadInterruptedException.cs
- newinstructionaction.cs
- MatrixCamera.cs
- FreeIndexList.cs
- SQLDecimalStorage.cs
- DelegateHelpers.Generated.cs
- Operand.cs
- DelegatedStream.cs
- JapaneseLunisolarCalendar.cs
- BlurEffect.cs
- EventLogSession.cs