Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Framework / System / Windows / EventSetter.cs / 1 / EventSetter.cs
/****************************************************************************\ * * File: SetterBase.cs * * TargetType event setting class. * * Copyright (C) 2004 by Microsoft Corporation. All rights reserved. * \***************************************************************************/ using System; using System.ComponentModel; // EditorBrowsableAttribute namespace System.Windows { ////// TargetType event setting class. /// public class EventSetter : SetterBase { ////// EventSetter construction /// public EventSetter() { } ////// EventSetter construction /// public EventSetter(RoutedEvent routedEvent, Delegate handler) { if (routedEvent == null) { throw new ArgumentNullException("routedEvent"); } if (handler == null) { throw new ArgumentNullException("handler"); } _event = routedEvent; _handler = handler; } ////// Event that is being set by this setter /// public RoutedEvent Event { get { return _event; } set { if (value == null) { throw new ArgumentNullException("value"); } CheckSealed(); _event = value; } } ////// Handler delegate that is being set by this setter /// public Delegate Handler { get { return _handler; } set { if (value == null) { throw new ArgumentNullException("value"); } CheckSealed(); _handler = value; } } ////// HandledEventsToo flag that is being set by this setter /// [EditorBrowsable(EditorBrowsableState.Never)] public bool HandledEventsToo { get { return _handledEventsToo; } set { CheckSealed(); _handledEventsToo = value; } } // // Do the error checking that we can only do once all of the properties have been // set, then call up to base. // internal override void Seal() { if (_event == null) { throw new ArgumentException(SR.Get(SRID.NullPropertyIllegal, "EventSetter.Event")); } if (_handler == null) { throw new ArgumentException(SR.Get(SRID.NullPropertyIllegal, "EventSetter.Handler")); } if (_handler.GetType() != _event.HandlerType) { throw new ArgumentException(SR.Get(SRID.HandlerTypeIllegal)); } base.Seal(); } private RoutedEvent _event; private Delegate _handler; private bool _handledEventsToo; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. /****************************************************************************\ * * File: SetterBase.cs * * TargetType event setting class. * * Copyright (C) 2004 by Microsoft Corporation. All rights reserved. * \***************************************************************************/ using System; using System.ComponentModel; // EditorBrowsableAttribute namespace System.Windows { ////// TargetType event setting class. /// public class EventSetter : SetterBase { ////// EventSetter construction /// public EventSetter() { } ////// EventSetter construction /// public EventSetter(RoutedEvent routedEvent, Delegate handler) { if (routedEvent == null) { throw new ArgumentNullException("routedEvent"); } if (handler == null) { throw new ArgumentNullException("handler"); } _event = routedEvent; _handler = handler; } ////// Event that is being set by this setter /// public RoutedEvent Event { get { return _event; } set { if (value == null) { throw new ArgumentNullException("value"); } CheckSealed(); _event = value; } } ////// Handler delegate that is being set by this setter /// public Delegate Handler { get { return _handler; } set { if (value == null) { throw new ArgumentNullException("value"); } CheckSealed(); _handler = value; } } ////// HandledEventsToo flag that is being set by this setter /// [EditorBrowsable(EditorBrowsableState.Never)] public bool HandledEventsToo { get { return _handledEventsToo; } set { CheckSealed(); _handledEventsToo = value; } } // // Do the error checking that we can only do once all of the properties have been // set, then call up to base. // internal override void Seal() { if (_event == null) { throw new ArgumentException(SR.Get(SRID.NullPropertyIllegal, "EventSetter.Event")); } if (_handler == null) { throw new ArgumentException(SR.Get(SRID.NullPropertyIllegal, "EventSetter.Handler")); } if (_handler.GetType() != _event.HandlerType) { throw new ArgumentException(SR.Get(SRID.HandlerTypeIllegal)); } base.Seal(); } private RoutedEvent _event; private Delegate _handler; private bool _handledEventsToo; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SqlRetyper.cs
- XmlDigitalSignatureProcessor.cs
- DataGridViewCellStyleConverter.cs
- XPathNodeList.cs
- CqlGenerator.cs
- CodeAttributeDeclarationCollection.cs
- ActivationServices.cs
- DataGridAutoFormat.cs
- SequenceFullException.cs
- ScrollPattern.cs
- DefaultValueTypeConverter.cs
- ToolboxItemFilterAttribute.cs
- LocatorBase.cs
- InvokeGenerator.cs
- BoundField.cs
- SqlReferenceCollection.cs
- BuildResultCache.cs
- DropShadowBitmapEffect.cs
- PageOrientation.cs
- CodeDomSerializer.cs
- ModifiableIteratorCollection.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- UnsafeNativeMethodsMilCoreApi.cs
- XmlJsonWriter.cs
- FormsAuthenticationTicket.cs
- Span.cs
- CollectionDataContract.cs
- ProfileSettings.cs
- FeatureSupport.cs
- OutputCacheSettingsSection.cs
- ArrangedElement.cs
- UnsafeNativeMethodsMilCoreApi.cs
- EventLogPermissionAttribute.cs
- WebServiceAttribute.cs
- FileLogRecord.cs
- PasswordRecoveryAutoFormat.cs
- ResourcePermissionBaseEntry.cs
- FlowDocumentPageViewerAutomationPeer.cs
- ThousandthOfEmRealPoints.cs
- DurableDispatcherAddressingFault.cs
- LexicalChunk.cs
- Int64Converter.cs
- OleDbDataReader.cs
- TypeBuilder.cs
- WebBrowserHelper.cs
- GacUtil.cs
- ExpressionBinding.cs
- MaskedTextBoxTextEditor.cs
- UnaryQueryOperator.cs
- DataListItemEventArgs.cs
- PerfService.cs
- HandleExceptionArgs.cs
- ExpressionStringBuilder.cs
- arabicshape.cs
- ModelUIElement3D.cs
- DataGridDesigner.cs
- DependencyObjectPropertyDescriptor.cs
- DataGridTextBox.cs
- SecurityException.cs
- Win32SafeHandles.cs
- SessionSymmetricMessageSecurityProtocolFactory.cs
- WebConfigurationHost.cs
- BinaryObjectInfo.cs
- IteratorAsyncResult.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- Operand.cs
- TemplateControlCodeDomTreeGenerator.cs
- C14NUtil.cs
- SHA256Managed.cs
- MetadataStore.cs
- SortDescription.cs
- ZipIOLocalFileHeader.cs
- HandlerWithFactory.cs
- SmtpDateTime.cs
- XmlTextWriter.cs
- Polyline.cs
- SQLBytesStorage.cs
- DataSourceControl.cs
- Brushes.cs
- SamlAuthorizationDecisionStatement.cs
- WebPartCatalogAddVerb.cs
- DateTimeConverter.cs
- GridViewSortEventArgs.cs
- ResourceDisplayNameAttribute.cs
- ProcessHostConfigUtils.cs
- ToolStripItemDesigner.cs
- CodeExpressionCollection.cs
- PEFileReader.cs
- RepeaterItem.cs
- TableSectionStyle.cs
- ProfileBuildProvider.cs
- RectangleGeometry.cs
- TrustManagerPromptUI.cs
- FSWPathEditor.cs
- TextEffect.cs
- SoapCodeExporter.cs
- SchemaMerger.cs
- HierarchicalDataSourceControl.cs
- _NetRes.cs
- HotSpot.cs