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
- HtmlInputReset.cs
- ToolStripContainer.cs
- BindingContext.cs
- CodeChecksumPragma.cs
- DeclarativeCatalogPart.cs
- PropertyEmitterBase.cs
- NameValuePair.cs
- HtmlHead.cs
- FormClosedEvent.cs
- TypeResolver.cs
- DataGridViewCellStyleChangedEventArgs.cs
- ConnectionStringsExpressionBuilder.cs
- HttpCachePolicyElement.cs
- PeerTransportSecuritySettings.cs
- JapaneseCalendar.cs
- XmlSerializationGeneratedCode.cs
- List.cs
- ScrollChangedEventArgs.cs
- ComponentEvent.cs
- OleDbDataReader.cs
- Parser.cs
- XsltArgumentList.cs
- XmlUrlResolver.cs
- WhitespaceRule.cs
- TypedReference.cs
- ImageListImageEditor.cs
- GridViewUpdatedEventArgs.cs
- GeometryGroup.cs
- AuthorizationSection.cs
- _FixedSizeReader.cs
- ScrollBar.cs
- TimeSpan.cs
- WebBrowserEvent.cs
- HtmlInputRadioButton.cs
- ForeignKeyFactory.cs
- AdCreatedEventArgs.cs
- PermissionToken.cs
- ClientSideProviderDescription.cs
- FaultContext.cs
- CriticalFinalizerObject.cs
- DataGridColumn.cs
- StatusBarItem.cs
- SqlDataReader.cs
- ConfigDefinitionUpdates.cs
- DbProviderServices.cs
- OdbcParameter.cs
- MediaSystem.cs
- MeasureItemEvent.cs
- ExeConfigurationFileMap.cs
- HtmlMeta.cs
- StackBuilderSink.cs
- MultiBindingExpression.cs
- ParameterElement.cs
- TabItemAutomationPeer.cs
- CodeTryCatchFinallyStatement.cs
- validationstate.cs
- ErrorTableItemStyle.cs
- ExecutedRoutedEventArgs.cs
- WebConfigurationFileMap.cs
- DBParameter.cs
- BevelBitmapEffect.cs
- Main.cs
- ImportFileRequest.cs
- WebCategoryAttribute.cs
- WebBrowserNavigatedEventHandler.cs
- EntityContainerRelationshipSet.cs
- PointValueSerializer.cs
- SqlClientPermission.cs
- ScrollChrome.cs
- Storyboard.cs
- AppDomain.cs
- BamlMapTable.cs
- ExpressionConverter.cs
- DockPanel.cs
- CrossSiteScriptingValidation.cs
- DataChangedEventManager.cs
- XmlArrayItemAttribute.cs
- CapacityStreamGeometryContext.cs
- PreservationFileWriter.cs
- COM2Enum.cs
- CodeDelegateInvokeExpression.cs
- HttpException.cs
- SizeValueSerializer.cs
- PEFileReader.cs
- ProtocolsConfigurationHandler.cs
- MessageQueuePermissionEntryCollection.cs
- ChannelTokenTypeConverter.cs
- LayoutTable.cs
- ScriptManagerProxy.cs
- _FtpDataStream.cs
- MessageRpc.cs
- HttpCookie.cs
- XPathDocumentBuilder.cs
- DataGridViewTopLeftHeaderCell.cs
- Conditional.cs
- BufferedOutputStream.cs
- PropertyPathWorker.cs
- HierarchicalDataSourceControl.cs
- Drawing.cs
- WebPartChrome.cs