Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- Stylesheet.cs
- XpsResourcePolicy.cs
- InputBinder.cs
- SystemResources.cs
- BatchStream.cs
- DetailsViewInsertedEventArgs.cs
- CodeSubDirectory.cs
- SplitterEvent.cs
- ScriptingAuthenticationServiceSection.cs
- WebPartEditVerb.cs
- HttpCapabilitiesSectionHandler.cs
- WebContext.cs
- UpdateCompiler.cs
- ContractDescription.cs
- DataMemberListEditor.cs
- ResourceDisplayNameAttribute.cs
- TextTreeObjectNode.cs
- QueryCursorEventArgs.cs
- SmtpAuthenticationManager.cs
- DBDataPermissionAttribute.cs
- TemplateXamlParser.cs
- MsmqBindingElementBase.cs
- FocusChangedEventArgs.cs
- XmlSchemaSimpleContentRestriction.cs
- DynamicMetaObjectBinder.cs
- ValidatingReaderNodeData.cs
- InternalPermissions.cs
- ISFTagAndGuidCache.cs
- TableDetailsCollection.cs
- AppDomainFactory.cs
- RtfControlWordInfo.cs
- TemplateField.cs
- XNodeValidator.cs
- Stroke2.cs
- TemplateGroupCollection.cs
- SymbolEqualComparer.cs
- KoreanLunisolarCalendar.cs
- BoolExpression.cs
- StrokeFIndices.cs
- SubpageParagraph.cs
- JulianCalendar.cs
- BinaryObjectReader.cs
- StaticSiteMapProvider.cs
- StreamedWorkflowDefinitionContext.cs
- PipeStream.cs
- SimpleHandlerFactory.cs
- CategoryAttribute.cs
- MetadataArtifactLoaderCompositeResource.cs
- Sentence.cs
- UpdatableWrapper.cs
- SortDescriptionCollection.cs
- Matrix3DStack.cs
- DefaultShape.cs
- BinaryVersion.cs
- BitmapFrame.cs
- HelpEvent.cs
- DataGridToolTip.cs
- PolyLineSegmentFigureLogic.cs
- XmlDomTextWriter.cs
- NumberSubstitution.cs
- FilterException.cs
- ColumnClickEvent.cs
- DetailsView.cs
- WsdlBuildProvider.cs
- ConfigurationPropertyAttribute.cs
- MissingMemberException.cs
- MdiWindowListItemConverter.cs
- TextTreeObjectNode.cs
- CacheAxisQuery.cs
- ApplicationInfo.cs
- KeyGestureConverter.cs
- BufferedStream.cs
- Utils.cs
- FileRecordSequence.cs
- ParameterModifier.cs
- QueryResponse.cs
- HttpApplicationFactory.cs
- EncoderReplacementFallback.cs
- SafeNativeMethodsMilCoreApi.cs
- RijndaelManagedTransform.cs
- InnerItemCollectionView.cs
- LingerOption.cs
- WebSysDisplayNameAttribute.cs
- LineGeometry.cs
- IndicFontClient.cs
- BasicHttpSecurityMode.cs
- ArrangedElementCollection.cs
- ExtractedStateEntry.cs
- PathTooLongException.cs
- PhoneCallDesigner.cs
- CheckBox.cs
- MemberMaps.cs
- WindowsServiceCredential.cs
- AppDomainProtocolHandler.cs
- SQLChars.cs
- TaskForm.cs
- DefaultMemberAttribute.cs
- ProjectionCamera.cs
- WindowsFormsSectionHandler.cs
- InvalidBodyAccessException.cs