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
- PointF.cs
- EditingCommands.cs
- ViewStateModeByIdAttribute.cs
- ToolZone.cs
- NamespaceMapping.cs
- BaseTransportHeaders.cs
- ApplicationDirectoryMembershipCondition.cs
- BadImageFormatException.cs
- SqlRewriteScalarSubqueries.cs
- DataServiceConfiguration.cs
- HWStack.cs
- ExceptionUtility.cs
- ScrollPattern.cs
- GlobalId.cs
- ProcessModelInfo.cs
- AssemblyHash.cs
- EntityContainerEmitter.cs
- InputProcessorProfilesLoader.cs
- WorkItem.cs
- BitVector32.cs
- selecteditemcollection.cs
- HMACSHA384.cs
- KeyGestureValueSerializer.cs
- COSERVERINFO.cs
- DrawingVisualDrawingContext.cs
- Form.cs
- MembershipValidatePasswordEventArgs.cs
- ServicesUtilities.cs
- MediaTimeline.cs
- ColorPalette.cs
- ScrollItemProviderWrapper.cs
- PasswordRecoveryAutoFormat.cs
- JoinTreeSlot.cs
- DataServices.cs
- GroupBoxRenderer.cs
- SecurityDocument.cs
- Byte.cs
- MediaTimeline.cs
- MetadataLocation.cs
- CopyCodeAction.cs
- localization.cs
- FrameworkRichTextComposition.cs
- IPAddress.cs
- UTF7Encoding.cs
- TableRowCollection.cs
- PathFigureCollection.cs
- _NtlmClient.cs
- TextElementEditingBehaviorAttribute.cs
- SecurityTimestamp.cs
- OrderedDictionary.cs
- HtmlGenericControl.cs
- ObjectIDGenerator.cs
- MiniCustomAttributeInfo.cs
- HtmlFormParameterReader.cs
- ManagementDateTime.cs
- HyperLinkField.cs
- DbReferenceCollection.cs
- cookiecollection.cs
- CollectionTypeElement.cs
- ReadOnlyObservableCollection.cs
- DataGridViewRowPostPaintEventArgs.cs
- HierarchicalDataSourceControl.cs
- Icon.cs
- ColumnWidthChangingEvent.cs
- EventToken.cs
- XmlNotation.cs
- MultiByteCodec.cs
- AngleUtil.cs
- AttributeTable.cs
- OdbcParameterCollection.cs
- CustomCategoryAttribute.cs
- XmlSchema.cs
- StorageFunctionMapping.cs
- SslStream.cs
- HttpServerVarsCollection.cs
- GenericIdentity.cs
- ApplicationCommands.cs
- SqlTriggerAttribute.cs
- StandardOleMarshalObject.cs
- SiteMapHierarchicalDataSourceView.cs
- PrimitiveSchema.cs
- CompilerState.cs
- FixedFlowMap.cs
- BaseDataBoundControl.cs
- HttpRawResponse.cs
- DiagnosticStrings.cs
- ContentPosition.cs
- ContextInformation.cs
- HttpContextWrapper.cs
- AnonymousIdentificationModule.cs
- XmlDeclaration.cs
- SerializationInfoEnumerator.cs
- ProfileModule.cs
- PhonemeConverter.cs
- GenericTypeParameterBuilder.cs
- InstanceCollisionException.cs
- XmlNodeChangedEventArgs.cs
- PerformanceCounterManager.cs
- PolicyValidationException.cs
- FloaterBaseParaClient.cs