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
- XmlSerializerNamespaces.cs
- NativeWindow.cs
- SourceCollection.cs
- ThreadAttributes.cs
- OleDbDataReader.cs
- DataControlFieldHeaderCell.cs
- QilExpression.cs
- itemelement.cs
- TextTreeFixupNode.cs
- Speller.cs
- SiteIdentityPermission.cs
- LessThanOrEqual.cs
- FontInfo.cs
- ThicknessAnimation.cs
- ArraySortHelper.cs
- PageRequestManager.cs
- CdpEqualityComparer.cs
- ActivityWithResultWrapper.cs
- UsernameTokenFactoryCredential.cs
- SchemaCollectionPreprocessor.cs
- HMACSHA384.cs
- VisemeEventArgs.cs
- ObjectHandle.cs
- XomlCompiler.cs
- OdbcUtils.cs
- PageParserFilter.cs
- AdCreatedEventArgs.cs
- XomlCompilerParameters.cs
- ObjectSecurity.cs
- DataSourceProvider.cs
- XmlSortKeyAccumulator.cs
- CodeBlockBuilder.cs
- TransformConverter.cs
- SQLDecimalStorage.cs
- DataControlImageButton.cs
- XmlEncodedRawTextWriter.cs
- DataGridPageChangedEventArgs.cs
- TreeWalker.cs
- WebPartTransformer.cs
- ListItem.cs
- DocumentViewer.cs
- ChameleonKey.cs
- FilteredDataSetHelper.cs
- HttpResponse.cs
- ViewBox.cs
- ApplicationSecurityInfo.cs
- wgx_render.cs
- CapacityStreamGeometryContext.cs
- RoutingUtilities.cs
- NumericUpDownAcceleration.cs
- ParameterReplacerVisitor.cs
- BuilderInfo.cs
- Translator.cs
- SiteMapSection.cs
- DiagnosticTraceSchemas.cs
- TextModifierScope.cs
- InkPresenter.cs
- EnumerableCollectionView.cs
- CodeExporter.cs
- ContextMarshalException.cs
- TypeProvider.cs
- DbReferenceCollection.cs
- ListDictionaryInternal.cs
- MD5.cs
- Helper.cs
- BrowserCapabilitiesCodeGenerator.cs
- HttpMethodAttribute.cs
- AssociationSet.cs
- ParameterElement.cs
- ChtmlTextWriter.cs
- Table.cs
- ComplexBindingPropertiesAttribute.cs
- ControlValuePropertyAttribute.cs
- WebSysDescriptionAttribute.cs
- CryptoStream.cs
- SettingsSection.cs
- Bezier.cs
- StandardBindingElementCollection.cs
- ToolStripControlHost.cs
- ErrorHandlingAcceptor.cs
- datacache.cs
- Certificate.cs
- Triplet.cs
- __TransparentProxy.cs
- IdentityNotMappedException.cs
- DoubleLink.cs
- DocumentXmlWriter.cs
- InternalSafeNativeMethods.cs
- HttpApplicationFactory.cs
- nulltextcontainer.cs
- AnimatedTypeHelpers.cs
- SqlTransaction.cs
- ConfigurationLockCollection.cs
- DirectoryObjectSecurity.cs
- SpeechRecognitionEngine.cs
- ETagAttribute.cs
- TextLineResult.cs
- DataGridViewImageColumn.cs
- WorkflowMarkupElementEventArgs.cs
- IsolatedStorageException.cs