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
- DataGridViewColumnEventArgs.cs
- DataException.cs
- PageBuildProvider.cs
- ProjectionQueryOptionExpression.cs
- DataListItem.cs
- UnmanagedHandle.cs
- Int32CAMarshaler.cs
- XmlTypeAttribute.cs
- DataGridCell.cs
- ImmutableDispatchRuntime.cs
- QuaternionConverter.cs
- HyperlinkAutomationPeer.cs
- BinaryObjectReader.cs
- TransactedReceiveScope.cs
- SafeViewOfFileHandle.cs
- DefaultExpressionVisitor.cs
- UserControlDocumentDesigner.cs
- HyperLink.cs
- newinstructionaction.cs
- DataGridDesigner.cs
- WorkflowElementDialogWindow.xaml.cs
- DetailsViewInsertEventArgs.cs
- XmlWellformedWriterHelpers.cs
- XsltContext.cs
- AuthorizationRule.cs
- SemanticTag.cs
- CustomAssemblyResolver.cs
- ImageCodecInfo.cs
- WorkflowRuntimeServiceElement.cs
- TableHeaderCell.cs
- RsaKeyIdentifierClause.cs
- CheckBox.cs
- MediaEntryAttribute.cs
- TextPenaltyModule.cs
- CopyOnWriteList.cs
- XNameConverter.cs
- PenContext.cs
- TriState.cs
- Tablet.cs
- FileDetails.cs
- StrongTypingException.cs
- CompositeScriptReference.cs
- RawStylusActions.cs
- SessionStateSection.cs
- FileSecurity.cs
- CompilationUnit.cs
- AutomationPatternInfo.cs
- Filter.cs
- CacheChildrenQuery.cs
- ellipse.cs
- TimeZoneInfo.cs
- EventLogConfiguration.cs
- PackageRelationshipSelector.cs
- SoapExtensionTypeElementCollection.cs
- ActionFrame.cs
- VisualStyleElement.cs
- Converter.cs
- ServiceErrorHandler.cs
- ToolStripDropDownDesigner.cs
- StrongNameSignatureInformation.cs
- XmlAnyElementAttribute.cs
- WebPartConnectionsCancelVerb.cs
- Int64.cs
- FrameworkTextComposition.cs
- MDIWindowDialog.cs
- HttpInputStream.cs
- GradientBrush.cs
- HttpModule.cs
- MsmqInputChannelListenerBase.cs
- TrustManagerPromptUI.cs
- ConditionCollection.cs
- AddressingProperty.cs
- WebPartEditorOkVerb.cs
- URLIdentityPermission.cs
- DetailsViewPageEventArgs.cs
- XmlCompatibilityReader.cs
- CaseCqlBlock.cs
- ArithmeticException.cs
- HostedElements.cs
- StringFreezingAttribute.cs
- XamlGridLengthSerializer.cs
- SessionEndingEventArgs.cs
- SQLBytes.cs
- XmlDocumentType.cs
- UiaCoreTypesApi.cs
- WindowsFont.cs
- SynchronizedChannelCollection.cs
- WebPartHeaderCloseVerb.cs
- ComponentEditorForm.cs
- NativeObjectSecurity.cs
- ValueTypeFixupInfo.cs
- FontFamily.cs
- XmlSchemaIdentityConstraint.cs
- SqlDependencyUtils.cs
- Unit.cs
- LoadRetryHandler.cs
- GrammarBuilderBase.cs
- GlobalEventManager.cs
- AssemblyCache.cs
- TableChangeProcessor.cs