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
- RelationshipNavigation.cs
- XamlSerializer.cs
- WebBrowserBase.cs
- UIElementParagraph.cs
- BitmapData.cs
- NameValueCollection.cs
- InlineCollection.cs
- XmlnsDictionary.cs
- BitmapFrame.cs
- MetadataReference.cs
- DefaultValueConverter.cs
- GridViewPageEventArgs.cs
- CultureInfoConverter.cs
- PerformanceCounterPermission.cs
- AssemblySettingAttributes.cs
- RSAPKCS1SignatureFormatter.cs
- DoubleAnimationBase.cs
- SetUserPreferenceRequest.cs
- DataGridViewRowConverter.cs
- CompareValidator.cs
- RegularExpressionValidator.cs
- PropertyValue.cs
- RegexMatchCollection.cs
- UIElementIsland.cs
- WorkflowRuntimeServiceElement.cs
- OfTypeExpression.cs
- QilInvoke.cs
- Rss20FeedFormatter.cs
- DiagnosticTrace.cs
- FastPropertyAccessor.cs
- WebOperationContext.cs
- ObjectRef.cs
- SafeCoTaskMem.cs
- formatter.cs
- PolicyLevel.cs
- TextBox.cs
- PeerCollaborationPermission.cs
- RoleGroup.cs
- FaultCallbackWrapper.cs
- DrawingContext.cs
- SupportsEventValidationAttribute.cs
- SmtpFailedRecipientException.cs
- SoapTransportImporter.cs
- BezierSegment.cs
- Queue.cs
- EditorZone.cs
- ListQueryResults.cs
- WinCategoryAttribute.cs
- EventOpcode.cs
- StorageBasedPackageProperties.cs
- ValueType.cs
- LineSegment.cs
- GetWinFXPath.cs
- DictionaryTraceRecord.cs
- ListViewDeletedEventArgs.cs
- DrawingCollection.cs
- ProcessThreadDesigner.cs
- CodeDefaultValueExpression.cs
- InvokePatternIdentifiers.cs
- PasswordPropertyTextAttribute.cs
- DispatcherEventArgs.cs
- MultiBindingExpression.cs
- CodeTypeMemberCollection.cs
- OledbConnectionStringbuilder.cs
- ServiceHostingEnvironmentSection.cs
- WebSysDisplayNameAttribute.cs
- CodeComment.cs
- ZipIOExtraFieldZip64Element.cs
- EntitySqlQueryCacheEntry.cs
- SessionStateContainer.cs
- DataGridViewBindingCompleteEventArgs.cs
- PolyQuadraticBezierSegment.cs
- DataGridViewRowPostPaintEventArgs.cs
- DataServiceEntityAttribute.cs
- ScrollChangedEventArgs.cs
- COM2PictureConverter.cs
- LocatorBase.cs
- SuppressIldasmAttribute.cs
- PowerModeChangedEventArgs.cs
- SByte.cs
- FilteredReadOnlyMetadataCollection.cs
- IdentityValidationException.cs
- BlockUIContainer.cs
- EncoderNLS.cs
- ToolStripRenderEventArgs.cs
- WebPartConnectionsCancelEventArgs.cs
- ConstructorBuilder.cs
- AutomationPropertyInfo.cs
- BitmapMetadataEnumerator.cs
- HashHelper.cs
- XmlSchemaSimpleTypeUnion.cs
- TextCompositionManager.cs
- XsdValidatingReader.cs
- IntegerValidatorAttribute.cs
- SafeIUnknown.cs
- TrackBar.cs
- SecurityBindingElement.cs
- OdbcEnvironment.cs
- EntityDataSourceStatementEditorForm.cs
- ConsoleCancelEventArgs.cs