Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- ProbeMatchesApril2005.cs
- IdnMapping.cs
- DbCommandDefinition.cs
- BitSet.cs
- SqlConnectionFactory.cs
- RectangleConverter.cs
- HandlerFactoryWrapper.cs
- TimelineCollection.cs
- ProtectedConfigurationProviderCollection.cs
- WebPartZoneBase.cs
- ThemeDictionaryExtension.cs
- Misc.cs
- EncoderExceptionFallback.cs
- storepermission.cs
- CollectionViewGroupRoot.cs
- AppDomainAttributes.cs
- DrawingAttributeSerializer.cs
- Lasso.cs
- WindowsFormsLinkLabel.cs
- GeneralTransform3D.cs
- DemultiplexingClientMessageFormatter.cs
- SyndicationSerializer.cs
- HtmlInputFile.cs
- ArgumentOutOfRangeException.cs
- SamlAttributeStatement.cs
- RenderTargetBitmap.cs
- SQLDateTime.cs
- DragEventArgs.cs
- EntityRecordInfo.cs
- DefaultTextStoreTextComposition.cs
- WorkflowItemsPresenter.cs
- DetailsViewInsertedEventArgs.cs
- BitConverter.cs
- TextCompositionEventArgs.cs
- EntityDataSourceDataSelection.cs
- FontStretch.cs
- CodeAccessPermission.cs
- MachineKeyConverter.cs
- DoubleConverter.cs
- Stylesheet.cs
- KeyEvent.cs
- CommandBinding.cs
- InvalidEnumArgumentException.cs
- Debug.cs
- DetailsViewPageEventArgs.cs
- Input.cs
- XPathNodeIterator.cs
- VirtualStackFrame.cs
- PersonalizationStateInfoCollection.cs
- columnmapfactory.cs
- ForeignKeyConstraint.cs
- VectorConverter.cs
- FlowDocumentPage.cs
- TdsParser.cs
- MatchingStyle.cs
- CodeIterationStatement.cs
- WmfPlaceableFileHeader.cs
- Version.cs
- ItemCollection.cs
- XPathBinder.cs
- NamespaceQuery.cs
- BindingSource.cs
- NativeWindow.cs
- BitmapCodecInfo.cs
- FtpCachePolicyElement.cs
- StylusOverProperty.cs
- WebPartMovingEventArgs.cs
- EventHandlerList.cs
- Binding.cs
- XmlSchemaSimpleTypeList.cs
- DataGridColumn.cs
- WebBrowsableAttribute.cs
- ApplicationServicesHostFactory.cs
- ApplicationDirectoryMembershipCondition.cs
- WindowsBrush.cs
- _LocalDataStoreMgr.cs
- AuthenticationServiceManager.cs
- XappLauncher.cs
- ImmutableAssemblyCacheEntry.cs
- TileBrush.cs
- SecurityCriticalDataForSet.cs
- Metadata.cs
- OwnerDrawPropertyBag.cs
- SoapRpcMethodAttribute.cs
- Encoding.cs
- TimerElapsedEvenArgs.cs
- BinaryOperationBinder.cs
- DummyDataSource.cs
- AuditLog.cs
- DbMetaDataColumnNames.cs
- Emitter.cs
- RootAction.cs
- CustomActivityDesigner.cs
- LookupBindingPropertiesAttribute.cs
- WebPartExportVerb.cs
- objectresult_tresulttype.cs
- WebPartEventArgs.cs
- GorillaCodec.cs
- MissingFieldException.cs
- IdentityHolder.cs