Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- PersistenceMetadataNamespace.cs
- TypeConverterHelper.cs
- SynchronizingStream.cs
- EventLogPermission.cs
- Triplet.cs
- TimeSpanConverter.cs
- StateManagedCollection.cs
- SignalGate.cs
- LateBoundBitmapDecoder.cs
- QueryStatement.cs
- QuaternionAnimation.cs
- TableColumn.cs
- XmlDocumentSerializer.cs
- LayoutTableCell.cs
- SmtpDigestAuthenticationModule.cs
- XmlIncludeAttribute.cs
- HeaderCollection.cs
- SQLConvert.cs
- AtlasWeb.Designer.cs
- DataKey.cs
- SoapRpcServiceAttribute.cs
- SerializationUtility.cs
- TextHidden.cs
- PermissionRequestEvidence.cs
- GeometryValueSerializer.cs
- WebChannelFactory.cs
- TextClipboardData.cs
- RMEnrollmentPage1.cs
- RequestChannel.cs
- HostedHttpContext.cs
- coordinator.cs
- ConfigXmlText.cs
- ConfigXmlReader.cs
- Style.cs
- ByteRangeDownloader.cs
- MonitorWrapper.cs
- SpeechRecognizer.cs
- HostExecutionContextManager.cs
- ImageAnimator.cs
- CodeCatchClause.cs
- CodeAttributeArgumentCollection.cs
- MenuItemBinding.cs
- TextDocumentView.cs
- ExecutedRoutedEventArgs.cs
- MenuItemStyle.cs
- MetadataCache.cs
- ApplicationFileParser.cs
- PagesChangedEventArgs.cs
- ClassData.cs
- RightsManagementErrorHandler.cs
- ParallelEnumerable.cs
- FaultHandlingFilter.cs
- FileSystemEventArgs.cs
- ExtendedProperty.cs
- WebPartConnectionsCancelEventArgs.cs
- WebPartVerb.cs
- DefaultValueMapping.cs
- StrongNameUtility.cs
- FormatterServices.cs
- DesignTimeVisibleAttribute.cs
- Privilege.cs
- SessionStateContainer.cs
- ServiceThrottle.cs
- GlyphInfoList.cs
- Hash.cs
- MarkupExtensionParser.cs
- IIS7WorkerRequest.cs
- JavaScriptSerializer.cs
- PropertySet.cs
- RTTypeWrapper.cs
- HwndSourceParameters.cs
- ReceiveErrorHandling.cs
- ConfigurationErrorsException.cs
- WebCodeGenerator.cs
- DefaultTraceListener.cs
- AssemblyResolver.cs
- XmlSchemaDatatype.cs
- EntitySqlQueryBuilder.cs
- Expressions.cs
- QueryRelOp.cs
- ActivationArguments.cs
- Int16AnimationBase.cs
- RootProjectionNode.cs
- Error.cs
- FormViewInsertedEventArgs.cs
- WebPartPersonalization.cs
- WebFaultClientMessageInspector.cs
- DictionaryBase.cs
- DatagridviewDisplayedBandsData.cs
- CodeStatementCollection.cs
- DispatcherOperation.cs
- MethodCallConverter.cs
- GridViewRow.cs
- SettingsProperty.cs
- OptionalRstParameters.cs
- ImageAutomationPeer.cs
- NameTable.cs
- NumericExpr.cs
- FacetDescriptionElement.cs
- externdll.cs