Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- TrackingRecord.cs
- DataRowExtensions.cs
- AutomationPattern.cs
- EntityDataSourceReferenceGroup.cs
- BrowserDefinitionCollection.cs
- RemoteWebConfigurationHostStream.cs
- Empty.cs
- NamespaceInfo.cs
- ChannelManager.cs
- PageSettings.cs
- DataGridViewElement.cs
- XmlUtil.cs
- Constants.cs
- RadioButton.cs
- DataRow.cs
- SurrogateSelector.cs
- WeakRefEnumerator.cs
- NameValueFileSectionHandler.cs
- ProfilePropertyMetadata.cs
- TableItemStyle.cs
- SRef.cs
- Journaling.cs
- ListViewDeleteEventArgs.cs
- AsymmetricSignatureFormatter.cs
- Avt.cs
- CompilationLock.cs
- SQLDecimalStorage.cs
- shaperfactory.cs
- DataShape.cs
- ClientBuildManager.cs
- MatrixTransform.cs
- SvcMapFileSerializer.cs
- IfElseDesigner.xaml.cs
- PackageFilter.cs
- Directory.cs
- SqlCacheDependency.cs
- SortKey.cs
- PageAsyncTaskManager.cs
- VirtualDirectoryMappingCollection.cs
- QilReference.cs
- PersonalizationDictionary.cs
- InstanceLockQueryResult.cs
- MasterPageCodeDomTreeGenerator.cs
- _ContextAwareResult.cs
- RotateTransform3D.cs
- EncodingDataItem.cs
- WeakReadOnlyCollection.cs
- ColumnTypeConverter.cs
- TextTrailingWordEllipsis.cs
- NamespaceDecl.cs
- XamlParser.cs
- SqlUdtInfo.cs
- IDReferencePropertyAttribute.cs
- RunClient.cs
- Header.cs
- SqlDataSourceFilteringEventArgs.cs
- QualifiedId.cs
- TextBoxDesigner.cs
- DictionaryCustomTypeDescriptor.cs
- XamlFilter.cs
- ThreadNeutralSemaphore.cs
- PlatformNotSupportedException.cs
- DataMember.cs
- NavigationExpr.cs
- EnumValidator.cs
- SpnEndpointIdentityExtension.cs
- RequestSecurityTokenForRemoteTokenFactory.cs
- HttpRequest.cs
- Point3DAnimationBase.cs
- SHA512.cs
- FixedDSBuilder.cs
- Error.cs
- ImageIndexConverter.cs
- BitmapSourceSafeMILHandle.cs
- ConstraintEnumerator.cs
- DeviceFilterDictionary.cs
- CryptoApi.cs
- FamilyMapCollection.cs
- XmlUnspecifiedAttribute.cs
- BCryptNative.cs
- DialogResultConverter.cs
- DetailsViewDeleteEventArgs.cs
- AssemblyBuilder.cs
- ProtocolsConfiguration.cs
- AsmxEndpointPickerExtension.cs
- __ComObject.cs
- UpdateTracker.cs
- TreeViewAutomationPeer.cs
- DataGridViewRowsRemovedEventArgs.cs
- ExtenderControl.cs
- InheritanceAttribute.cs
- StyleHelper.cs
- Emitter.cs
- WebPartDesigner.cs
- SystemException.cs
- HttpFileCollection.cs
- MenuItemCollection.cs
- InternalSafeNativeMethods.cs
- DictationGrammar.cs
- FormsAuthenticationUserCollection.cs