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
- RangeValueProviderWrapper.cs
- EdgeProfileValidation.cs
- ScrollPatternIdentifiers.cs
- StylusOverProperty.cs
- SiteMapSection.cs
- DynamicValueConverter.cs
- Environment.cs
- WorkflowApplicationException.cs
- TrackBarRenderer.cs
- TreeNodeBindingCollection.cs
- KernelTypeValidation.cs
- OdbcTransaction.cs
- OutputScopeManager.cs
- DescendentsWalker.cs
- DataGridLinkButton.cs
- SymbolTable.cs
- FlowDocumentView.cs
- FontCollection.cs
- StickyNote.cs
- HtmlHead.cs
- SiteMapPath.cs
- SimpleWebHandlerParser.cs
- StringUtil.cs
- XamlSerializerUtil.cs
- ParallelTimeline.cs
- CategoryGridEntry.cs
- FieldToken.cs
- AliasGenerator.cs
- mactripleDES.cs
- EnumBuilder.cs
- TokenFactoryBase.cs
- XmlSchemaCompilationSettings.cs
- ExceptionUtil.cs
- GridLength.cs
- TextOutput.cs
- Int32CollectionConverter.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- PointConverter.cs
- RenameRuleObjectDialog.cs
- SID.cs
- IdentityModelDictionary.cs
- smtppermission.cs
- XmlSchemaAnnotated.cs
- Token.cs
- PropertyCollection.cs
- PriorityQueue.cs
- WebServiceClientProxyGenerator.cs
- Win32PrintDialog.cs
- TableItemPattern.cs
- RightsManagementEncryptionTransform.cs
- XmlBinaryReader.cs
- COAUTHINFO.cs
- SerialPort.cs
- WebPartsSection.cs
- EncryptedKeyIdentifierClause.cs
- ListArgumentProvider.cs
- EndPoint.cs
- FunctionImportMapping.cs
- ExpressionBuilderContext.cs
- DataGridViewImageColumn.cs
- BindStream.cs
- _NetworkingPerfCounters.cs
- XNodeValidator.cs
- WCFServiceClientProxyGenerator.cs
- MimeMapping.cs
- SecUtil.cs
- MulticastIPAddressInformationCollection.cs
- EncoderFallback.cs
- RowParagraph.cs
- Model3DGroup.cs
- ServiceObjectContainer.cs
- SettingsBase.cs
- EntryWrittenEventArgs.cs
- AssertUtility.cs
- SystemIPAddressInformation.cs
- AddInDeploymentState.cs
- BindingContext.cs
- PopOutPanel.cs
- Stackframe.cs
- GridViewRowCollection.cs
- TextEditorLists.cs
- WebPartPersonalization.cs
- BindableAttribute.cs
- KeySplineConverter.cs
- TextViewDesigner.cs
- ServiceMetadataContractBehavior.cs
- ResourcesChangeInfo.cs
- UncommonField.cs
- PropertyManager.cs
- DrawingContextWalker.cs
- RTTrackingProfile.cs
- XmlILTrace.cs
- SqlGenerator.cs
- PassportAuthenticationEventArgs.cs
- EtwTrackingBehavior.cs
- WebPartsPersonalization.cs
- MenuCommand.cs
- RowSpanVector.cs
- Literal.cs
- XPathItem.cs