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
- SchemaAttDef.cs
- HtmlTextBoxAdapter.cs
- SqlRewriteScalarSubqueries.cs
- BinaryObjectReader.cs
- ProxyWebPartConnectionCollection.cs
- PopOutPanel.cs
- CacheDependency.cs
- MetadataExporter.cs
- ScrollChrome.cs
- SecurityManager.cs
- APCustomTypeDescriptor.cs
- MouseButton.cs
- elementinformation.cs
- CollectionViewSource.cs
- Help.cs
- BaseTemplateParser.cs
- TraceHandlerErrorFormatter.cs
- ObsoleteAttribute.cs
- ReferenceEqualityComparer.cs
- DataGridViewCellLinkedList.cs
- ValueOfAction.cs
- ServiceOperationDetailViewControl.cs
- ValidationContext.cs
- Opcode.cs
- EventDescriptorCollection.cs
- GridViewCellAutomationPeer.cs
- FlowNode.cs
- XmlSchemaProviderAttribute.cs
- ConfigurationCollectionAttribute.cs
- SubstitutionResponseElement.cs
- TableStyle.cs
- DynamicRenderer.cs
- GeneralTransform2DTo3D.cs
- GlyphRunDrawing.cs
- backend.cs
- CodeVariableReferenceExpression.cs
- FileReader.cs
- FileDialog.cs
- GradientSpreadMethodValidation.cs
- webbrowsersite.cs
- EncoderBestFitFallback.cs
- RestClientProxyHandler.cs
- CheckBox.cs
- RetrieveVirtualItemEventArgs.cs
- AttributeAction.cs
- SafeNativeMethodsOther.cs
- BinaryFormatterWriter.cs
- PerformanceCounterManager.cs
- PeerNearMe.cs
- CodeTypeMemberCollection.cs
- FormViewPagerRow.cs
- ScrollBarRenderer.cs
- EdmScalarPropertyAttribute.cs
- WsatConfiguration.cs
- OdbcConnectionString.cs
- NativeMethods.cs
- ConstantExpression.cs
- DesignerTransaction.cs
- UIPropertyMetadata.cs
- EventLogPropertySelector.cs
- SelectedDatesCollection.cs
- BoolExpression.cs
- PaperSize.cs
- Point3DCollection.cs
- RuleSetDialog.cs
- HtmlInputReset.cs
- DoubleKeyFrameCollection.cs
- SqlAggregateChecker.cs
- DropShadowEffect.cs
- CaseInsensitiveHashCodeProvider.cs
- Enum.cs
- DefaultValueConverter.cs
- Dispatcher.cs
- AuthorizationSection.cs
- Label.cs
- DesignerRegionCollection.cs
- UiaCoreProviderApi.cs
- AesManaged.cs
- Sentence.cs
- PointValueSerializer.cs
- XsdDuration.cs
- FactoryRecord.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- ConvertTextFrag.cs
- XmlCompatibilityReader.cs
- ResourceKey.cs
- WebPartCollection.cs
- BufferedWebEventProvider.cs
- ThreadPool.cs
- Emitter.cs
- CacheMode.cs
- PropertyInformationCollection.cs
- SoapException.cs
- WebBrowserContainer.cs
- AuthenticationSection.cs
- MLangCodePageEncoding.cs
- Baml6ConstructorInfo.cs
- WorkflowInstanceProxy.cs
- Item.cs
- CssTextWriter.cs