Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / clr / src / BCL / System / ConsoleCancelEventArgs.cs / 2 / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PlatformNotSupportedException.cs
- XamlToRtfParser.cs
- PreviewKeyDownEventArgs.cs
- XmlSerializerAssemblyAttribute.cs
- WebPartMenuStyle.cs
- SQLGuidStorage.cs
- DataBindingCollection.cs
- SocketStream.cs
- EncodingTable.cs
- OdbcError.cs
- StringValueSerializer.cs
- ConfigXmlWhitespace.cs
- TextServicesProperty.cs
- HtmlElementErrorEventArgs.cs
- Lease.cs
- XslNumber.cs
- ObjectItemCollection.cs
- AtomServiceDocumentSerializer.cs
- Compiler.cs
- DataSetUtil.cs
- MultiPageTextView.cs
- RelatedImageListAttribute.cs
- WsatServiceCertificate.cs
- FontStretch.cs
- ProcessModelInfo.cs
- AppDomainUnloadedException.cs
- ImageClickEventArgs.cs
- Window.cs
- ClassDataContract.cs
- Clock.cs
- CompositeControl.cs
- PagedDataSource.cs
- XmlDomTextWriter.cs
- PassportAuthenticationEventArgs.cs
- RoutingChannelExtension.cs
- ToolStripContentPanelRenderEventArgs.cs
- ExeContext.cs
- TimeoutValidationAttribute.cs
- ByeMessageCD1.cs
- LineBreakRecord.cs
- CompositeFontInfo.cs
- Argument.cs
- ConfigurationPropertyAttribute.cs
- HierarchicalDataBoundControlAdapter.cs
- StringFormat.cs
- PolicyStatement.cs
- ProcessActivityTreeOptions.cs
- ZoneLinkButton.cs
- SafeLibraryHandle.cs
- RowUpdatedEventArgs.cs
- EventSinkHelperWriter.cs
- Walker.cs
- TableCell.cs
- ReflectEventDescriptor.cs
- PointF.cs
- LinqDataSourceView.cs
- AttachedPropertyMethodSelector.cs
- OleDbDataReader.cs
- BuilderInfo.cs
- ZoneMembershipCondition.cs
- SkinIDTypeConverter.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- QueryProcessor.cs
- NetTcpSectionData.cs
- ReadWriteSpinLock.cs
- ClipboardProcessor.cs
- FormsAuthentication.cs
- ThicknessAnimation.cs
- ValidationService.cs
- XNodeNavigator.cs
- FigureHelper.cs
- DocumentViewerBase.cs
- _NetRes.cs
- ProviderException.cs
- SuppressMessageAttribute.cs
- WebPartConnectVerb.cs
- EnumerableCollectionView.cs
- QualifiedCellIdBoolean.cs
- XmlSchemaValidationException.cs
- SafeLocalMemHandle.cs
- NegotiationTokenAuthenticator.cs
- ServerType.cs
- SortFieldComparer.cs
- DbConnectionPoolGroup.cs
- ConnectionConsumerAttribute.cs
- SiteMapProvider.cs
- Vector3DConverter.cs
- ToolStripTextBox.cs
- HttpGetClientProtocol.cs
- ControlUtil.cs
- DeviceContext.cs
- AnnotationAuthorChangedEventArgs.cs
- BounceEase.cs
- PageHandlerFactory.cs
- TypedElement.cs
- ResourcePool.cs
- RequestStatusBarUpdateEventArgs.cs
- ToolBar.cs
- CharEntityEncoderFallback.cs
- BackgroundWorker.cs