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
- VersionedStream.cs
- StreamingContext.cs
- SourceLocation.cs
- StringReader.cs
- CollectionViewGroupInternal.cs
- WsatConfiguration.cs
- DataPagerCommandEventArgs.cs
- NoResizeSelectionBorderGlyph.cs
- SamlAuthorityBinding.cs
- ObjectComplexPropertyMapping.cs
- HtmlButton.cs
- AttachedProperty.cs
- PriorityRange.cs
- DefaultBindingPropertyAttribute.cs
- ResourcePool.cs
- SafeLocalMemHandle.cs
- DataTableReader.cs
- Slider.cs
- PaperSource.cs
- AutomationEvent.cs
- TypedOperationInfo.cs
- ApplicationContext.cs
- ExpressionPrefixAttribute.cs
- CommonObjectSecurity.cs
- mediapermission.cs
- MailAddressCollection.cs
- MediaEntryAttribute.cs
- PhysicalFontFamily.cs
- DelayDesigner.cs
- OleDbRowUpdatingEvent.cs
- TakeQueryOptionExpression.cs
- ConstrainedDataObject.cs
- TypedRowGenerator.cs
- CharKeyFrameCollection.cs
- EntityDataSource.cs
- EntityRecordInfo.cs
- UnknownWrapper.cs
- ModelFunctionTypeElement.cs
- SelectorAutomationPeer.cs
- BuildManagerHost.cs
- GetReadStreamResult.cs
- SQLMoney.cs
- CheckBoxFlatAdapter.cs
- ResourceCategoryAttribute.cs
- PixelShader.cs
- GlyphShapingProperties.cs
- ResolveCriteriaApril2005.cs
- _NestedMultipleAsyncResult.cs
- SortExpressionBuilder.cs
- OleStrCAMarshaler.cs
- ResourceIDHelper.cs
- CodeTypeReferenceCollection.cs
- QilSortKey.cs
- SafeNativeMethods.cs
- AxDesigner.cs
- Privilege.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- RequestQueryParser.cs
- GZipDecoder.cs
- columnmapkeybuilder.cs
- RightsManagementEncryptedStream.cs
- _NtlmClient.cs
- EtwTrace.cs
- IdleTimeoutMonitor.cs
- TraceShell.cs
- CqlIdentifiers.cs
- ComponentResourceManager.cs
- FloaterBaseParagraph.cs
- ListBoxDesigner.cs
- PointAnimationBase.cs
- DataException.cs
- XmlReflectionMember.cs
- PasswordRecovery.cs
- DataKey.cs
- UnknownBitmapDecoder.cs
- SoapExtensionTypeElementCollection.cs
- ProfileSection.cs
- GZipUtils.cs
- SEHException.cs
- AccessedThroughPropertyAttribute.cs
- RefreshEventArgs.cs
- StructureChangedEventArgs.cs
- UrlPath.cs
- ControlCachePolicy.cs
- KerberosSecurityTokenParameters.cs
- FixedBufferAttribute.cs
- NewArray.cs
- FrameworkElementAutomationPeer.cs
- SerializationAttributes.cs
- ToolBarButton.cs
- TagMapCollection.cs
- NewItemsContextMenuStrip.cs
- XamlBrushSerializer.cs
- FrameworkPropertyMetadata.cs
- OleServicesContext.cs
- NamedElement.cs
- GlyphInfoList.cs
- TypedTableBaseExtensions.cs
- DataColumn.cs
- ExchangeUtilities.cs