Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / ConsoleCancelEventArgs.cs / 1305376 / 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; using System.Diagnostics.Contracts; 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 (SpecialKey == ConsoleSpecialKey.ControlBreak && value == true) throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CantCancelCtrlBreak")); Contract.EndContractBlock(); _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; using System.Diagnostics.Contracts; 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 (SpecialKey == ConsoleSpecialKey.ControlBreak && value == true) throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CantCancelCtrlBreak")); Contract.EndContractBlock(); _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
- HttpCacheVaryByContentEncodings.cs
- XamlWriter.cs
- XmlSchemaSimpleTypeList.cs
- WorkflowOperationBehavior.cs
- EntryIndex.cs
- ParagraphVisual.cs
- AssemblyCache.cs
- BaseConfigurationRecord.cs
- Hashtable.cs
- BitmapDownload.cs
- EpmAttributeNameBuilder.cs
- ProfileProvider.cs
- ViewPort3D.cs
- XmlCharacterData.cs
- TextSchema.cs
- ExecutionContext.cs
- UriParserTemplates.cs
- ButtonBaseAutomationPeer.cs
- ObjectDataSourceChooseTypePanel.cs
- XmlAttributeCache.cs
- DateTimeAutomationPeer.cs
- XmlSchemaComplexContentRestriction.cs
- TextEditorTables.cs
- AdornerDecorator.cs
- WebPartManager.cs
- WebPartChrome.cs
- CompilationUtil.cs
- DataTemplateSelector.cs
- ColumnMapCopier.cs
- AppendHelper.cs
- DataGridViewButtonCell.cs
- TextOnlyOutput.cs
- BridgeDataRecord.cs
- Root.cs
- SchemaDeclBase.cs
- EdmTypeAttribute.cs
- IgnorePropertiesAttribute.cs
- SQLBytesStorage.cs
- SequentialUshortCollection.cs
- ProxyManager.cs
- HttpRuntimeSection.cs
- SecondaryIndexList.cs
- Point4D.cs
- MemberExpressionHelper.cs
- BulletChrome.cs
- OutputCacheProfile.cs
- TablePatternIdentifiers.cs
- ObjectHandle.cs
- FieldBuilder.cs
- ToolStripPanelSelectionGlyph.cs
- LabelEditEvent.cs
- BezierSegment.cs
- Soap.cs
- ApplicationSecurityInfo.cs
- WebReferenceCollection.cs
- Boolean.cs
- SettingsPropertyNotFoundException.cs
- MulticastNotSupportedException.cs
- SessionParameter.cs
- ElementUtil.cs
- WebPermission.cs
- WindowsFormsDesignerOptionService.cs
- SchemaSetCompiler.cs
- VisualStateChangedEventArgs.cs
- NativeMethods.cs
- WebCodeGenerator.cs
- Label.cs
- HttpFileCollection.cs
- WindowsListViewGroupHelper.cs
- JoinGraph.cs
- BindingExpressionUncommonField.cs
- WebControl.cs
- HttpDebugHandler.cs
- CSharpCodeProvider.cs
- DataTemplateKey.cs
- QuaternionValueSerializer.cs
- Overlapped.cs
- MembershipSection.cs
- PropertyMapper.cs
- ChannelListenerBase.cs
- XmlSchemaSubstitutionGroup.cs
- RuntimeCompatibilityAttribute.cs
- EncryptedKey.cs
- TextEditorTables.cs
- TypeNameHelper.cs
- DependencyObjectProvider.cs
- InfoCardTraceRecord.cs
- WindowsAuthenticationEventArgs.cs
- Screen.cs
- SortQuery.cs
- EventLogPermissionEntryCollection.cs
- ServiceDeploymentInfo.cs
- HtmlAnchor.cs
- SqlDataSourceCustomCommandEditor.cs
- RegexCharClass.cs
- ThreadNeutralSemaphore.cs
- X509CertificateRecipientClientCredential.cs
- FileEnumerator.cs
- RightsManagementInformation.cs
- FacetEnabledSchemaElement.cs