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
- HtmlInputImage.cs
- XamlStyleSerializer.cs
- ToReply.cs
- MergeFilterQuery.cs
- GlyphRun.cs
- GridViewDeletedEventArgs.cs
- MergablePropertyAttribute.cs
- IISMapPath.cs
- SyndicationItemFormatter.cs
- StyleXamlTreeBuilder.cs
- DataControlFieldTypeEditor.cs
- TemplateKeyConverter.cs
- Message.cs
- SizeConverter.cs
- _RequestCacheProtocol.cs
- ControlAdapter.cs
- ConfigXmlText.cs
- ISO2022Encoding.cs
- CurrentChangingEventManager.cs
- XmlAttributeCollection.cs
- ComboBoxHelper.cs
- DbXmlEnabledProviderManifest.cs
- PeerContact.cs
- ExpressionBinding.cs
- RandomNumberGenerator.cs
- FastPropertyAccessor.cs
- LinqDataSourceSelectEventArgs.cs
- Avt.cs
- HttpModuleActionCollection.cs
- SchemaNames.cs
- SslStream.cs
- DurableDispatcherAddressingFault.cs
- SmtpTransport.cs
- Location.cs
- httpstaticobjectscollection.cs
- SafeReversePInvokeHandle.cs
- DateTimeConverter.cs
- XmlEncodedRawTextWriter.cs
- MessageQueuePermissionEntry.cs
- ClientFormsIdentity.cs
- TypeDependencyAttribute.cs
- IndexerNameAttribute.cs
- xml.cs
- ControlAdapter.cs
- WebSysDisplayNameAttribute.cs
- QfeChecker.cs
- DataGridViewCellStyleChangedEventArgs.cs
- Blend.cs
- Attributes.cs
- TabPanel.cs
- Positioning.cs
- ClientSession.cs
- PropertyCollection.cs
- SuppressIldasmAttribute.cs
- DocumentDesigner.cs
- __ConsoleStream.cs
- Matrix3D.cs
- RemotingConfiguration.cs
- TemplatePagerField.cs
- TaskFormBase.cs
- WhileDesigner.cs
- Propagator.ExtentPlaceholderCreator.cs
- JsonClassDataContract.cs
- IdentitySection.cs
- MailBnfHelper.cs
- RegexStringValidator.cs
- ExpressionCopier.cs
- Odbc32.cs
- RoleManagerEventArgs.cs
- SqlUdtInfo.cs
- EntityException.cs
- CharStorage.cs
- PropertyValueUIItem.cs
- SystemBrushes.cs
- PerformanceCounterNameAttribute.cs
- BlobPersonalizationState.cs
- ProfileInfo.cs
- Int64.cs
- PageSettings.cs
- Style.cs
- DataBindingCollectionConverter.cs
- MenuItemBindingCollection.cs
- CatalogPartChrome.cs
- ConsumerConnectionPointCollection.cs
- TrustLevel.cs
- ListViewItemMouseHoverEvent.cs
- CompleteWizardStep.cs
- ThemeInfoAttribute.cs
- DesignerVerbToolStripMenuItem.cs
- Transform.cs
- LazyTextWriterCreator.cs
- Translator.cs
- XappLauncher.cs
- ProcessRequestArgs.cs
- BitmapDownload.cs
- Collection.cs
- DateTimeConstantAttribute.cs
- TextParentUndoUnit.cs
- Soap12FormatExtensions.cs
- PointAnimationUsingKeyFrames.cs