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
- Propagator.ExtentPlaceholderCreator.cs
- HttpProfileBase.cs
- IteratorFilter.cs
- DbConnectionFactory.cs
- IgnoreDeviceFilterElement.cs
- SecurityCookieModeValidator.cs
- _LoggingObject.cs
- PerfCounters.cs
- SelectionItemPattern.cs
- GeneralTransform3DGroup.cs
- DataGridViewRowHeaderCell.cs
- Security.cs
- PointUtil.cs
- keycontainerpermission.cs
- DesignerTransactionCloseEvent.cs
- ConditionalAttribute.cs
- LineUtil.cs
- TreeNodeStyleCollection.cs
- XmlnsCompatibleWithAttribute.cs
- MarkupWriter.cs
- PropertyValidationContext.cs
- WeakRefEnumerator.cs
- counter.cs
- FamilyMapCollection.cs
- CheckBox.cs
- DataServiceQueryException.cs
- TrackingWorkflowEventArgs.cs
- MouseActionValueSerializer.cs
- XmlUtilWriter.cs
- HighlightVisual.cs
- DataGridTable.cs
- WebScriptMetadataMessageEncodingBindingElement.cs
- NameTable.cs
- ListViewGroupItemCollection.cs
- ClientTargetCollection.cs
- MethodImplAttribute.cs
- ActiveXContainer.cs
- FieldBuilder.cs
- ColumnClickEvent.cs
- SizeF.cs
- XamlStyleSerializer.cs
- CodeTypeDeclarationCollection.cs
- DataGrid.cs
- ValueType.cs
- PluralizationService.cs
- VisualStateManager.cs
- ToolStripOverflowButton.cs
- X509AsymmetricSecurityKey.cs
- DetailsViewCommandEventArgs.cs
- WindowsGraphicsCacheManager.cs
- LinkArea.cs
- SinglePageViewer.cs
- DynamicField.cs
- CachedBitmap.cs
- CacheMode.cs
- DataErrorValidationRule.cs
- RoleManagerEventArgs.cs
- OdbcConnectionPoolProviderInfo.cs
- MethodCallConverter.cs
- DecimalMinMaxAggregationOperator.cs
- _CommandStream.cs
- Config.cs
- DragDropHelper.cs
- EdmPropertyAttribute.cs
- EventHandlerService.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- XmlBinaryReaderSession.cs
- DbException.cs
- ISAPIApplicationHost.cs
- ButtonBase.cs
- MenuTracker.cs
- OdbcInfoMessageEvent.cs
- TextEditorThreadLocalStore.cs
- FlagsAttribute.cs
- Profiler.cs
- DependencyPropertyChangedEventArgs.cs
- ProfileParameter.cs
- ListDictionaryInternal.cs
- ConfigXmlCDataSection.cs
- DrawingGroup.cs
- ExceptQueryOperator.cs
- HttpException.cs
- LazyTextWriterCreator.cs
- ToolStripSplitButton.cs
- WindowCollection.cs
- InternalEnumValidatorAttribute.cs
- StaticResourceExtension.cs
- SourceInterpreter.cs
- TextServicesProperty.cs
- OdbcRowUpdatingEvent.cs
- ForEachAction.cs
- RightsManagementPermission.cs
- TimelineGroup.cs
- UnsafeNativeMethodsTablet.cs
- RelatedCurrencyManager.cs
- XmlSchemaCompilationSettings.cs
- FigureParaClient.cs
- CodeTypeParameter.cs
- EntityProxyTypeInfo.cs
- TreeViewImageKeyConverter.cs