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
- AttachedPropertyMethodSelector.cs
- TagMapInfo.cs
- PersonalizationProvider.cs
- X509CertificateChain.cs
- UriExt.cs
- UniqueIdentifierService.cs
- GPRECT.cs
- GridViewCommandEventArgs.cs
- Vector3DIndependentAnimationStorage.cs
- TransformerInfoCollection.cs
- ZipIOModeEnforcingStream.cs
- _SslState.cs
- ELinqQueryState.cs
- DataGridCell.cs
- TextServicesDisplayAttributePropertyRanges.cs
- CryptoSession.cs
- WSSecurityOneDotOneReceiveSecurityHeader.cs
- AdapterUtil.cs
- ColumnMapTranslator.cs
- UserNameServiceElement.cs
- DependencyObjectType.cs
- EntityCommand.cs
- X509Certificate.cs
- Rule.cs
- ReferenceTypeElement.cs
- IntegerValidator.cs
- Hash.cs
- mediapermission.cs
- WebPartConnectionsEventArgs.cs
- DropShadowBitmapEffect.cs
- WebServicesDescriptionAttribute.cs
- HttpCachePolicy.cs
- ZipPackage.cs
- StylusShape.cs
- CustomAssemblyResolver.cs
- DynamicDiscoveryDocument.cs
- WebReferencesBuildProvider.cs
- GridToolTip.cs
- Parallel.cs
- Enlistment.cs
- DebugInfoGenerator.cs
- TextTreeTextNode.cs
- ProgressiveCrcCalculatingStream.cs
- VirtualDirectoryMappingCollection.cs
- LineServicesCallbacks.cs
- XmlSerializerSection.cs
- ValidationErrorEventArgs.cs
- OpenTypeLayout.cs
- DataServiceClientException.cs
- TogglePatternIdentifiers.cs
- TextServicesLoader.cs
- PopupControlService.cs
- Separator.cs
- TracedNativeMethods.cs
- ConsoleKeyInfo.cs
- LinkUtilities.cs
- WebZone.cs
- GroupItemAutomationPeer.cs
- TreeSet.cs
- SystemIcmpV4Statistics.cs
- Soap12ProtocolReflector.cs
- ToolStripSplitButton.cs
- TransportSecurityProtocolFactory.cs
- MimeAnyImporter.cs
- BuildProvider.cs
- PostBackOptions.cs
- UnsafeNativeMethods.cs
- ResourcePool.cs
- TemplateLookupAction.cs
- GenericEnumConverter.cs
- TextEditorDragDrop.cs
- CheckBoxPopupAdapter.cs
- ItemsControlAutomationPeer.cs
- StringFreezingAttribute.cs
- DispatchWrapper.cs
- DrawToolTipEventArgs.cs
- ProgressBarBrushConverter.cs
- Signature.cs
- UserControlBuildProvider.cs
- SqlUserDefinedTypeAttribute.cs
- BitmapEffectDrawingContextWalker.cs
- HierarchicalDataSourceControl.cs
- TypedTableBaseExtensions.cs
- DataGridHeaderBorder.cs
- ToolStripSettings.cs
- ClientEventManager.cs
- SqlClientFactory.cs
- isolationinterop.cs
- ByteAnimationBase.cs
- Fonts.cs
- StructuralCache.cs
- ExpressionParser.cs
- Visual.cs
- DataServiceContext.cs
- PageBreakRecord.cs
- CharacterMetricsDictionary.cs
- Int32RectConverter.cs
- ApplyHostConfigurationBehavior.cs
- PackageFilter.cs
- DataGridViewRowCollection.cs