Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / EventSetter.cs / 1305600 / 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 /// [TypeConverter(typeof(System.Windows.Markup.EventSetterHandlerConverter))] 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 /// [TypeConverter(typeof(System.Windows.Markup.EventSetterHandlerConverter))] 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
- TextReturnReader.cs
- HtmlImage.cs
- TableLayoutPanel.cs
- HtmlElementEventArgs.cs
- ValueProviderWrapper.cs
- MethodBuilderInstantiation.cs
- HttpValueCollection.cs
- HttpListenerException.cs
- GenericAuthenticationEventArgs.cs
- BuiltInExpr.cs
- ProtocolsConfigurationHandler.cs
- RtfControls.cs
- XmlSchemaSimpleContentRestriction.cs
- SafeProcessHandle.cs
- EmptyCollection.cs
- CacheMode.cs
- WebPartEditorApplyVerb.cs
- ChangePasswordDesigner.cs
- ToolStripItemTextRenderEventArgs.cs
- dataprotectionpermissionattribute.cs
- FirstMatchCodeGroup.cs
- SafeFileMapViewHandle.cs
- InheritedPropertyDescriptor.cs
- WebControlsSection.cs
- PageAsyncTask.cs
- Filter.cs
- EarlyBoundInfo.cs
- LinkConverter.cs
- ScrollBar.cs
- NamespaceDecl.cs
- SmiSettersStream.cs
- IndexingContentUnit.cs
- XXXInfos.cs
- PkcsUtils.cs
- WebPermission.cs
- RawStylusInput.cs
- GroupItem.cs
- ReachObjectContext.cs
- CoreSwitches.cs
- IPGlobalProperties.cs
- TextEditorThreadLocalStore.cs
- LicenseProviderAttribute.cs
- documentsequencetextcontainer.cs
- SqlProfileProvider.cs
- VirtualPathUtility.cs
- CodeDOMUtility.cs
- DataTableClearEvent.cs
- BigIntegerStorage.cs
- SparseMemoryStream.cs
- DoubleUtil.cs
- AttributeProviderAttribute.cs
- AmbiguousMatchException.cs
- XmlUTF8TextWriter.cs
- TemplateBindingExtension.cs
- ExecutionEngineException.cs
- QuaternionAnimationUsingKeyFrames.cs
- PerformanceCounterNameAttribute.cs
- SafeSystemMetrics.cs
- Manipulation.cs
- AppSettingsExpressionBuilder.cs
- AnyAllSearchOperator.cs
- InputChannelBinder.cs
- AdPostCacheSubstitution.cs
- ParameterReplacerVisitor.cs
- DescendantOverDescendantQuery.cs
- XmlSchemaDocumentation.cs
- UInt32Converter.cs
- VirtualPathProvider.cs
- DiscoveryClientChannelFactory.cs
- TextElementEditingBehaviorAttribute.cs
- BitStack.cs
- LoadGrammarCompletedEventArgs.cs
- RoutedEvent.cs
- FieldBuilder.cs
- ArglessEventHandlerProxy.cs
- SecurityPolicySection.cs
- FaultCode.cs
- Executor.cs
- ColorMatrix.cs
- TextProviderWrapper.cs
- QueryOpcode.cs
- CompositeFontInfo.cs
- EventMappingSettings.cs
- Drawing.cs
- GridViewRowPresenterBase.cs
- PropertyReferenceExtension.cs
- DrawingBrush.cs
- QueryCursorEventArgs.cs
- ChangeNode.cs
- XappLauncher.cs
- webeventbuffer.cs
- TextInfo.cs
- RemoteWebConfigurationHost.cs
- TextReader.cs
- ReferentialConstraint.cs
- TouchFrameEventArgs.cs
- ADMembershipProvider.cs
- SqlErrorCollection.cs
- TypeSystemProvider.cs
- XPathNodePointer.cs