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
- WmfPlaceableFileHeader.cs
- NullableBoolConverter.cs
- BitmapEffect.cs
- CatalogPart.cs
- ADMembershipProvider.cs
- HttpModuleAction.cs
- BamlStream.cs
- NullRuntimeConfig.cs
- RequestCachePolicy.cs
- ValidatorCompatibilityHelper.cs
- CompareValidator.cs
- HttpListenerResponse.cs
- CollectionConverter.cs
- WmlTextViewAdapter.cs
- DecoratedNameAttribute.cs
- XmlSchemaAnnotated.cs
- OuterGlowBitmapEffect.cs
- ToolStripItemClickedEventArgs.cs
- ButtonColumn.cs
- IndicCharClassifier.cs
- WebServicesDescriptionAttribute.cs
- ServerIdentity.cs
- AppSettingsSection.cs
- PixelFormats.cs
- ParallelRangeManager.cs
- WebPartTransformer.cs
- SQLDouble.cs
- HwndSourceKeyboardInputSite.cs
- WebPartDisplayMode.cs
- VarRefManager.cs
- XmlSchemaProviderAttribute.cs
- RequestBringIntoViewEventArgs.cs
- WebEvents.cs
- DataTableNewRowEvent.cs
- SHA1CryptoServiceProvider.cs
- OutArgument.cs
- XamlBuildTaskServices.cs
- CryptoApi.cs
- BitmapImage.cs
- ParameterInfo.cs
- PersonalizationStateInfo.cs
- TextTreeInsertUndoUnit.cs
- validationstate.cs
- Context.cs
- PromptEventArgs.cs
- LeaseManager.cs
- BamlRecords.cs
- Trace.cs
- PatternMatcher.cs
- StrongNameMembershipCondition.cs
- AnnotationAuthorChangedEventArgs.cs
- ConfigurationSectionGroupCollection.cs
- TimersDescriptionAttribute.cs
- MetadataProperty.cs
- ContractMapping.cs
- WindowsClaimSet.cs
- XMLSyntaxException.cs
- DataSetUtil.cs
- DCSafeHandle.cs
- OrderPreservingMergeHelper.cs
- BodyGlyph.cs
- WindowsStatusBar.cs
- DocumentGridContextMenu.cs
- Screen.cs
- ClientBuildManager.cs
- PrintingPermissionAttribute.cs
- NumericUpDownAccelerationCollection.cs
- AccessedThroughPropertyAttribute.cs
- CompositeFontParser.cs
- ExpandedWrapper.cs
- UniqueIdentifierService.cs
- SymLanguageVendor.cs
- ColumnResizeUndoUnit.cs
- __ComObject.cs
- HwndSourceParameters.cs
- ValueQuery.cs
- DiscoveryServerProtocol.cs
- PageParserFilter.cs
- ImagingCache.cs
- CustomTokenProvider.cs
- TextRenderingModeValidation.cs
- WinFormsUtils.cs
- ValidationError.cs
- ButtonPopupAdapter.cs
- EntityViewContainer.cs
- SizeKeyFrameCollection.cs
- ResourceDictionary.cs
- CodeIterationStatement.cs
- ImmutableDispatchRuntime.cs
- ClipboardProcessor.cs
- FamilyTypeface.cs
- DbDataSourceEnumerator.cs
- DataConnectionHelper.cs
- XmlHierarchicalEnumerable.cs
- Relationship.cs
- CriticalHandle.cs
- RijndaelManagedTransform.cs
- RegexFCD.cs
- GridPattern.cs
- ReaderContextStackData.cs