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
- PerfCounterSection.cs
- TagPrefixInfo.cs
- FrugalMap.cs
- EntityObject.cs
- ScrollBar.cs
- DataPagerFieldCommandEventArgs.cs
- ObjectDataSourceView.cs
- CngKeyBlobFormat.cs
- XmlUtil.cs
- WSFederationHttpBinding.cs
- ApplicationDirectoryMembershipCondition.cs
- RegistryPermission.cs
- DocumentReference.cs
- RangeBase.cs
- EntityDataSourceReferenceGroup.cs
- SpeechRecognitionEngine.cs
- AutomationAttributeInfo.cs
- _LazyAsyncResult.cs
- TrackBarDesigner.cs
- ClientSideProviderDescription.cs
- RemotingServices.cs
- DescendantOverDescendantQuery.cs
- SetterBaseCollection.cs
- HybridObjectCache.cs
- LongCountAggregationOperator.cs
- DataObjectMethodAttribute.cs
- RawKeyboardInputReport.cs
- NullableConverter.cs
- ProtocolViolationException.cs
- EngineSiteSapi.cs
- DbConnectionHelper.cs
- SharedUtils.cs
- BaseTemplateCodeDomTreeGenerator.cs
- MouseDevice.cs
- XmlElementAttribute.cs
- ISFTagAndGuidCache.cs
- ExpressionPrinter.cs
- CodeTypeOfExpression.cs
- ConstraintEnumerator.cs
- StringSorter.cs
- PointIndependentAnimationStorage.cs
- EventWaitHandleSecurity.cs
- LogManagementAsyncResult.cs
- UnmanagedMemoryStreamWrapper.cs
- EnumType.cs
- AutoResizedEvent.cs
- HttpTransportElement.cs
- FrameworkReadOnlyPropertyMetadata.cs
- ConfigurationPropertyAttribute.cs
- WindowsScrollBarBits.cs
- precedingquery.cs
- MonitoringDescriptionAttribute.cs
- SqlCharStream.cs
- FixedSOMTextRun.cs
- PolygonHotSpot.cs
- Condition.cs
- SoapAttributes.cs
- ChangeBlockUndoRecord.cs
- DataTemplateKey.cs
- TranslateTransform3D.cs
- JournalEntryStack.cs
- DeclaredTypeValidatorAttribute.cs
- MaskedTextBoxTextEditorDropDown.cs
- InternalConfigRoot.cs
- DesignerTransaction.cs
- ToolstripProfessionalRenderer.cs
- configsystem.cs
- EventProviderTraceListener.cs
- SiteIdentityPermission.cs
- HttpException.cs
- DateTimePicker.cs
- EntityModelBuildProvider.cs
- PointAnimationUsingKeyFrames.cs
- IRCollection.cs
- TemplateNameScope.cs
- MimeImporter.cs
- PropertyNames.cs
- ButtonField.cs
- TreeViewImageKeyConverter.cs
- XmlIlGenerator.cs
- Console.cs
- NodeInfo.cs
- MappedMetaModel.cs
- InternalControlCollection.cs
- XmlStringTable.cs
- DoubleAnimationUsingPath.cs
- DesignerLoader.cs
- TextEncodedRawTextWriter.cs
- SchemaCollectionCompiler.cs
- RemotingConfiguration.cs
- URLMembershipCondition.cs
- MessageProperties.cs
- WindowsUpDown.cs
- AmbientValueAttribute.cs
- Label.cs
- NavigationService.cs
- PropertyValueChangedEvent.cs
- WebPartCatalogAddVerb.cs
- RunInstallerAttribute.cs
- ColorTransformHelper.cs