Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / clr / src / BCL / System / ConsoleCancelEventArgs.cs / 1 / 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; 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 (_type == ConsoleSpecialKey.ControlBreak && value == true) throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CantCancelCtrlBreak")); _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; 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 (_type == ConsoleSpecialKey.ControlBreak && value == true) throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CantCancelCtrlBreak")); _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
- Visual.cs
- PropertyReferenceExtension.cs
- DataGridTemplateColumn.cs
- AlignmentXValidation.cs
- TextChange.cs
- WebControl.cs
- ContainerFilterService.cs
- ArcSegment.cs
- VisualBrush.cs
- DropShadowEffect.cs
- MetadataPropertyAttribute.cs
- TraceLog.cs
- ContextBase.cs
- StreamWithDictionary.cs
- FacetDescription.cs
- XmlCountingReader.cs
- UserNameSecurityTokenAuthenticator.cs
- COM2PictureConverter.cs
- CombinedGeometry.cs
- XmlChildNodes.cs
- XslException.cs
- RuntimeWrappedException.cs
- ICollection.cs
- EntityException.cs
- PTUtility.cs
- MasterPage.cs
- DataTemplate.cs
- SqlTopReducer.cs
- TableSectionStyle.cs
- MouseGestureConverter.cs
- ProxyWebPartManager.cs
- EndpointAddressProcessor.cs
- QueryAsyncResult.cs
- QilScopedVisitor.cs
- Image.cs
- RectIndependentAnimationStorage.cs
- RenderContext.cs
- OdbcConnectionStringbuilder.cs
- EventLogHandle.cs
- OdbcEnvironment.cs
- NativeWindow.cs
- CompilerGeneratedAttribute.cs
- BitHelper.cs
- ArcSegment.cs
- CachedPathData.cs
- ArgumentFixer.cs
- login.cs
- XmlSchemaElement.cs
- TypeSystemProvider.cs
- TemplateColumn.cs
- OracleException.cs
- CompilerParameters.cs
- OverrideMode.cs
- DisplayNameAttribute.cs
- DataSpaceManager.cs
- SqlCommand.cs
- ToolStripHighContrastRenderer.cs
- BamlRecordHelper.cs
- TextClipboardData.cs
- XmlSchemaExternal.cs
- SqlCacheDependencyDatabase.cs
- DataGridViewHitTestInfo.cs
- DataControlImageButton.cs
- TemplateBindingExtensionConverter.cs
- HitTestWithGeometryDrawingContextWalker.cs
- ResXBuildProvider.cs
- CollectionViewGroupRoot.cs
- ByteRangeDownloader.cs
- DynamicPropertyReader.cs
- ShapingEngine.cs
- SQLDateTime.cs
- InputReferenceExpression.cs
- IDataContractSurrogate.cs
- LookupBindingPropertiesAttribute.cs
- InfoCardAsymmetricCrypto.cs
- SqlWebEventProvider.cs
- ThicknessConverter.cs
- SHA1Managed.cs
- DataRowView.cs
- AtomEntry.cs
- SoapHeaders.cs
- DiscoveryOperationContext.cs
- ArcSegment.cs
- Roles.cs
- AllMembershipCondition.cs
- KeyFrames.cs
- XPathDocument.cs
- TextElementEnumerator.cs
- SqlRowUpdatedEvent.cs
- DependencyProperty.cs
- Style.cs
- SpecialTypeDataContract.cs
- TriState.cs
- Set.cs
- AttributeQuery.cs
- DragStartedEventArgs.cs
- AmbiguousMatchException.cs
- CodeGotoStatement.cs
- DataServiceRequest.cs
- DateTimeUtil.cs