Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / ConsoleCancelEventArgs.cs / 1305376 / ConsoleCancelEventArgs.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================================== ** ** Class: ConsoleCancelEventArgs ** ** ** Purpose: This class provides support goop for hooking Control-C and ** Control-Break, then preventing Control-C from interrupting the ** process. ** ** =============================================================================*/ namespace System { using System; using System.Diagnostics.Contracts; public delegate void ConsoleCancelEventHandler(Object sender, ConsoleCancelEventArgs e); [Serializable] public sealed class ConsoleCancelEventArgs : EventArgs { private ConsoleSpecialKey _type; private bool _cancel; // Whether to cancel the CancelKeyPress event internal ConsoleCancelEventArgs(ConsoleSpecialKey type) { _type = type; _cancel = false; } // Whether to cancel the break event. By setting this to true, the // Control-C will not kill the process. public bool Cancel { get { return _cancel; } set { if (SpecialKey == ConsoleSpecialKey.ControlBreak && value == true) throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CantCancelCtrlBreak")); Contract.EndContractBlock(); _cancel = value; } } public ConsoleSpecialKey SpecialKey { get { return _type; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================================== ** ** Class: ConsoleCancelEventArgs ** ** ** Purpose: This class provides support goop for hooking Control-C and ** Control-Break, then preventing Control-C from interrupting the ** process. ** ** =============================================================================*/ namespace System { using System; using System.Diagnostics.Contracts; public delegate void ConsoleCancelEventHandler(Object sender, ConsoleCancelEventArgs e); [Serializable] public sealed class ConsoleCancelEventArgs : EventArgs { private ConsoleSpecialKey _type; private bool _cancel; // Whether to cancel the CancelKeyPress event internal ConsoleCancelEventArgs(ConsoleSpecialKey type) { _type = type; _cancel = false; } // Whether to cancel the break event. By setting this to true, the // Control-C will not kill the process. public bool Cancel { get { return _cancel; } set { if (SpecialKey == ConsoleSpecialKey.ControlBreak && value == true) throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CantCancelCtrlBreak")); Contract.EndContractBlock(); _cancel = value; } } public ConsoleSpecialKey SpecialKey { get { return _type; } } } } // 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
- TextDecorationLocationValidation.cs
- RightsManagementSuppressedStream.cs
- TextParaClient.cs
- X509CertificateRecipientClientCredential.cs
- Bold.cs
- FactoryGenerator.cs
- BitConverter.cs
- InitializerFacet.cs
- SpotLight.cs
- IgnorePropertiesAttribute.cs
- OdbcDataReader.cs
- BufferBuilder.cs
- XmlSchema.cs
- SessionEndedEventArgs.cs
- CallContext.cs
- ExpressionBuilderCollection.cs
- OneOfScalarConst.cs
- CategoryGridEntry.cs
- EventMemberCodeDomSerializer.cs
- LicenseProviderAttribute.cs
- SignatureDescription.cs
- InkPresenterAutomationPeer.cs
- RuntimeWrappedException.cs
- AbandonedMutexException.cs
- LinearGradientBrush.cs
- BooleanStorage.cs
- FormsAuthenticationModule.cs
- Expression.cs
- PeerNameRecord.cs
- Int64.cs
- HttpModuleCollection.cs
- DataContractSerializer.cs
- SwitchLevelAttribute.cs
- HtmlUtf8RawTextWriter.cs
- RenderingEventArgs.cs
- Color.cs
- MessageQueueException.cs
- TypedDataSourceCodeGenerator.cs
- SkewTransform.cs
- LocationSectionRecord.cs
- ControlValuePropertyAttribute.cs
- WebException.cs
- TextWriterTraceListener.cs
- TextClipboardData.cs
- ManualWorkflowSchedulerService.cs
- ResXFileRef.cs
- ActionFrame.cs
- IndentTextWriter.cs
- WebPartsPersonalization.cs
- ContextInformation.cs
- HttpModuleAction.cs
- BaseTemplateParser.cs
- EventInfo.cs
- FormsAuthenticationEventArgs.cs
- XmlAtomicValue.cs
- SiteIdentityPermission.cs
- DecoratedNameAttribute.cs
- DataGridViewCellConverter.cs
- SetterBaseCollection.cs
- TextBoxDesigner.cs
- SimpleBitVector32.cs
- ReachPageContentCollectionSerializerAsync.cs
- OutArgument.cs
- Reference.cs
- SemanticResolver.cs
- ProgressPage.cs
- Material.cs
- SemanticAnalyzer.cs
- EdmFunctionAttribute.cs
- StoreUtilities.cs
- BaseTreeIterator.cs
- TypeRestriction.cs
- PageAsyncTask.cs
- PackageRelationshipSelector.cs
- Formatter.cs
- SqlRowUpdatedEvent.cs
- ContextMarshalException.cs
- ToolboxComponentsCreatedEventArgs.cs
- MSG.cs
- SizeAnimation.cs
- embossbitmapeffect.cs
- ConfigurationLockCollection.cs
- XmlSchemaObject.cs
- ToolStrip.cs
- TransportChannelListener.cs
- WebPartCloseVerb.cs
- FormsAuthenticationCredentials.cs
- HeaderElement.cs
- WebPartUtil.cs
- ConnectionManagementElementCollection.cs
- RequestCacheValidator.cs
- HttpCapabilitiesBase.cs
- BuildProvidersCompiler.cs
- HtmlTableCellCollection.cs
- LeftCellWrapper.cs
- ChildTable.cs
- SqlInternalConnection.cs
- UntrustedRecipientException.cs
- ObjectTypeMapping.cs
- EventWaitHandleSecurity.cs