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
- _TimerThread.cs
- SQLBinary.cs
- TriState.cs
- HScrollProperties.cs
- XmlCharCheckingWriter.cs
- Exception.cs
- RuleInfoComparer.cs
- IPAddress.cs
- ProviderCommandInfoUtils.cs
- UnsettableComboBox.cs
- TextRunTypographyProperties.cs
- EntityClientCacheKey.cs
- DataRecordInternal.cs
- Equal.cs
- InvalidCastException.cs
- ColumnMapTranslator.cs
- SqlDataAdapter.cs
- WebBrowserNavigatedEventHandler.cs
- LabelEditEvent.cs
- SplineKeyFrames.cs
- ProxyManager.cs
- DefaultMemberAttribute.cs
- HttpServerVarsCollection.cs
- ScriptMethodAttribute.cs
- Int64AnimationUsingKeyFrames.cs
- COM2IPerPropertyBrowsingHandler.cs
- WebUtil.cs
- UnsafeNetInfoNativeMethods.cs
- FloatSumAggregationOperator.cs
- TableTextElementCollectionInternal.cs
- basecomparevalidator.cs
- DesignerLoader.cs
- Transactions.cs
- DataGridViewRowPostPaintEventArgs.cs
- Drawing.cs
- CssStyleCollection.cs
- CharacterMetricsDictionary.cs
- RegexWorker.cs
- MetadataCacheItem.cs
- GeneralTransform3DTo2D.cs
- ContentHostHelper.cs
- ProfileEventArgs.cs
- XmlSchemaGroup.cs
- MissingManifestResourceException.cs
- DataStorage.cs
- StateDesigner.Helpers.cs
- MSG.cs
- ResourceBinder.cs
- UnlockCardRequest.cs
- Timer.cs
- QuaternionAnimationBase.cs
- Button.cs
- MethodExpr.cs
- EdmTypeAttribute.cs
- MetadataCache.cs
- TextReader.cs
- FlowLayoutPanel.cs
- SafeNativeMethods.cs
- TrustLevelCollection.cs
- _Connection.cs
- ConnectionsZone.cs
- CqlLexer.cs
- SendContent.cs
- HttpCapabilitiesBase.cs
- ReliabilityContractAttribute.cs
- ViewEvent.cs
- StreamWithDictionary.cs
- SqlError.cs
- ViewPort3D.cs
- GenerateHelper.cs
- XmlSchemaChoice.cs
- AnimatedTypeHelpers.cs
- Floater.cs
- basenumberconverter.cs
- StylusCaptureWithinProperty.cs
- ContextMenu.cs
- WindowsRichEdit.cs
- ActivityCodeDomSerializationManager.cs
- ForceCopyBuildProvider.cs
- GACIdentityPermission.cs
- UserPersonalizationStateInfo.cs
- ListViewVirtualItemsSelectionRangeChangedEvent.cs
- DataColumn.cs
- CorrelationResolver.cs
- ShapeTypeface.cs
- IisNotInstalledException.cs
- codemethodreferenceexpression.cs
- StylusPlugInCollection.cs
- TrackingStringDictionary.cs
- HitTestParameters.cs
- SafeNativeMethodsMilCoreApi.cs
- SystemWebExtensionsSectionGroup.cs
- EntityDataSourceChangedEventArgs.cs
- DiscoveryInnerClientManaged11.cs
- COM2ComponentEditor.cs
- Constant.cs
- Clock.cs
- CommandDevice.cs
- ScriptControlDescriptor.cs
- SessionStateModule.cs