Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- TimelineGroup.cs
- WorkflowExecutor.cs
- MetafileHeaderWmf.cs
- ResXResourceWriter.cs
- SystemIPAddressInformation.cs
- DeflateEmulationStream.cs
- NullRuntimeConfig.cs
- PositiveTimeSpanValidatorAttribute.cs
- RemoteWebConfigurationHost.cs
- ResolveDuplexCD1AsyncResult.cs
- QueryOutputWriter.cs
- ScriptModule.cs
- RawAppCommandInputReport.cs
- ObjectHelper.cs
- SiteMapDataSource.cs
- BinaryKeyIdentifierClause.cs
- PrePostDescendentsWalker.cs
- HeaderedContentControl.cs
- SmtpAuthenticationManager.cs
- UserMapPath.cs
- BaseTemplateBuildProvider.cs
- BuildManager.cs
- Crypto.cs
- CustomCategoryAttribute.cs
- TextSearch.cs
- CompoundFileStreamReference.cs
- HelpProvider.cs
- contentDescriptor.cs
- QueryOutputWriter.cs
- PermissionSetEnumerator.cs
- RoleManagerEventArgs.cs
- ReverseComparer.cs
- XsltQilFactory.cs
- OpCopier.cs
- GreenMethods.cs
- SqlProviderServices.cs
- RetrieveVirtualItemEventArgs.cs
- ValueSerializerAttribute.cs
- KeyFrames.cs
- WindowsListViewItemStartMenu.cs
- QueryRewriter.cs
- BufferedStream.cs
- DurableInstancingOptions.cs
- ResizingMessageFilter.cs
- ListViewItemSelectionChangedEvent.cs
- Table.cs
- DataGridAddNewRow.cs
- Buffer.cs
- WindowsGrip.cs
- ClientCredentialsElement.cs
- ChannelManager.cs
- DispatchWrapper.cs
- QilLiteral.cs
- WebEventTraceProvider.cs
- Array.cs
- AccessKeyManager.cs
- DataBindEngine.cs
- FormViewDeletedEventArgs.cs
- SingleAnimationBase.cs
- ControlBuilderAttribute.cs
- mil_commands.cs
- XmlQueryStaticData.cs
- SimpleExpression.cs
- DataGridViewCheckBoxCell.cs
- PointAnimation.cs
- VectorCollectionValueSerializer.cs
- ListViewPagedDataSource.cs
- BindingGroup.cs
- X509Certificate.cs
- ImplicitInputBrush.cs
- AndCondition.cs
- Context.cs
- TextViewElement.cs
- TimeIntervalCollection.cs
- Point.cs
- EntityViewGenerationAttribute.cs
- WebEvents.cs
- DataGridPagerStyle.cs
- BooleanFunctions.cs
- WebColorConverter.cs
- ListenerSessionConnectionReader.cs
- PersonalizationEntry.cs
- SqlAggregateChecker.cs
- TransportContext.cs
- ResourcePermissionBaseEntry.cs
- Walker.cs
- CompositeFontFamily.cs
- CreateRefExpr.cs
- ProcessThread.cs
- CompilationLock.cs
- HttpRuntimeSection.cs
- WebBrowserPermission.cs
- MouseDevice.cs
- ParameterCollection.cs
- BooleanAnimationUsingKeyFrames.cs
- SQLBytesStorage.cs
- ServicePointManager.cs
- DataAccessor.cs
- MissingManifestResourceException.cs
- DefaultSection.cs