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
- basecomparevalidator.cs
- BitmapFrameDecode.cs
- XhtmlBasicObjectListAdapter.cs
- PhysicalAddress.cs
- BuilderPropertyEntry.cs
- BrowserCapabilitiesFactory.cs
- RichListBox.cs
- DotNetATv1WindowsLogEntrySerializer.cs
- RankException.cs
- ArgumentOutOfRangeException.cs
- ScriptingAuthenticationServiceSection.cs
- WebBrowserDocumentCompletedEventHandler.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- GlobalItem.cs
- MatrixIndependentAnimationStorage.cs
- EmbossBitmapEffect.cs
- CapabilitiesSection.cs
- JavaScriptString.cs
- NodeFunctions.cs
- Transform3DGroup.cs
- ServiceBusyException.cs
- PreProcessInputEventArgs.cs
- IApplicationTrustManager.cs
- SelectionHighlightInfo.cs
- HwndSourceParameters.cs
- NotImplementedException.cs
- AsyncDataRequest.cs
- MimeTextImporter.cs
- CryptographicAttribute.cs
- Win32MouseDevice.cs
- XmlDocumentSerializer.cs
- Facet.cs
- SQLDouble.cs
- ManagedWndProcTracker.cs
- TextRangeSerialization.cs
- X509Utils.cs
- UnmanagedMemoryStreamWrapper.cs
- DefaultEventAttribute.cs
- TypeConverterAttribute.cs
- PackageDigitalSignature.cs
- XmlUtilWriter.cs
- ValueOfAction.cs
- Package.cs
- TreeViewHitTestInfo.cs
- FrameworkElementAutomationPeer.cs
- TrackingRecordPreFilter.cs
- SchemaDeclBase.cs
- EncodingInfo.cs
- SqlTopReducer.cs
- CacheMode.cs
- ExpressionVisitor.cs
- PagerSettings.cs
- EventHandlerList.cs
- SpecularMaterial.cs
- DataGridViewCellParsingEventArgs.cs
- MatrixValueSerializer.cs
- NameValueSectionHandler.cs
- unsafenativemethodstextservices.cs
- QilVisitor.cs
- CannotUnloadAppDomainException.cs
- ZoomPercentageConverter.cs
- EventProxy.cs
- Int32RectValueSerializer.cs
- transactioncontext.cs
- ISSmlParser.cs
- ISessionStateStore.cs
- IsolatedStoragePermission.cs
- TreeViewBindingsEditorForm.cs
- ListParagraph.cs
- ColorAnimation.cs
- DiscoveryClientReferences.cs
- Nullable.cs
- TemplateInstanceAttribute.cs
- COSERVERINFO.cs
- RolePrincipal.cs
- DataGridViewSortCompareEventArgs.cs
- FieldDescriptor.cs
- ConfigurationException.cs
- GetBrowserTokenRequest.cs
- MapPathBasedVirtualPathProvider.cs
- FrameworkReadOnlyPropertyMetadata.cs
- IdleTimeoutMonitor.cs
- ConnectionModeReader.cs
- SoapProcessingBehavior.cs
- CaseCqlBlock.cs
- DbgCompiler.cs
- WebEncodingValidatorAttribute.cs
- XmlDataContract.cs
- SynchronizationScope.cs
- SqlMethodAttribute.cs
- SchemaNames.cs
- safesecurityhelperavalon.cs
- ReferentialConstraint.cs
- CommonServiceBehaviorElement.cs
- TextProperties.cs
- ValueUnavailableException.cs
- RoleManagerSection.cs
- TrustManagerMoreInformation.cs
- GeneralTransform.cs
- path.cs