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
- HelpInfo.cs
- CriticalHandle.cs
- versioninfo.cs
- ImpersonationContext.cs
- ManagementInstaller.cs
- QilReference.cs
- CacheDependency.cs
- TextServicesContext.cs
- StdValidatorsAndConverters.cs
- EventlogProvider.cs
- ToolStripStatusLabel.cs
- DataGridViewCell.cs
- RIPEMD160Managed.cs
- ChangePassword.cs
- JsonGlobals.cs
- SettingsProviderCollection.cs
- SessionStateSection.cs
- DataGridTable.cs
- GridLengthConverter.cs
- GlobalAllocSafeHandle.cs
- HttpRuntime.cs
- SqlProvider.cs
- NameValueCollection.cs
- ZoneMembershipCondition.cs
- XsltQilFactory.cs
- SerialStream.cs
- DataAdapter.cs
- DbSource.cs
- CacheHelper.cs
- Error.cs
- MailSettingsSection.cs
- EmptyReadOnlyDictionaryInternal.cs
- ReaderWriterLock.cs
- AuthenticationModuleElementCollection.cs
- CodeTypeConstructor.cs
- DynamicFilterExpression.cs
- IPipelineRuntime.cs
- WebReferencesBuildProvider.cs
- StringFreezingAttribute.cs
- User.cs
- CornerRadius.cs
- ResourceManager.cs
- Keyboard.cs
- ForEachAction.cs
- Binding.cs
- NumberSubstitution.cs
- ImageSource.cs
- DllNotFoundException.cs
- XslAst.cs
- GenericXmlSecurityTokenAuthenticator.cs
- CroppedBitmap.cs
- SAPICategories.cs
- HitTestDrawingContextWalker.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- ToolStripDropDownItem.cs
- CompleteWizardStep.cs
- unitconverter.cs
- UnsafeNativeMethods.cs
- GeneratedView.cs
- SortDescription.cs
- TextParagraph.cs
- TypedTableGenerator.cs
- HttpRequestMessageProperty.cs
- EventBuilder.cs
- ImageField.cs
- Stack.cs
- HtmlInputRadioButton.cs
- SystemKeyConverter.cs
- EntityModelBuildProvider.cs
- OdbcCommandBuilder.cs
- SoapEnumAttribute.cs
- UriTemplateTable.cs
- FloaterParagraph.cs
- SynchronizedKeyedCollection.cs
- DescendentsWalkerBase.cs
- InternalSafeNativeMethods.cs
- IndexedGlyphRun.cs
- NetworkCredential.cs
- SspiHelper.cs
- WebPartEditorApplyVerb.cs
- SafeArrayRankMismatchException.cs
- TextFormatterContext.cs
- metadatamappinghashervisitor.cs
- OleStrCAMarshaler.cs
- DetailsView.cs
- MimeBasePart.cs
- TypeUnloadedException.cs
- PageFunction.cs
- ConsoleTraceListener.cs
- CmsUtils.cs
- WebServiceBindingAttribute.cs
- FastPropertyAccessor.cs
- ChtmlSelectionListAdapter.cs
- SmiContext.cs
- XmlSchemaDocumentation.cs
- HashSetEqualityComparer.cs
- DynamicResourceExtensionConverter.cs
- RootAction.cs
- RepeatInfo.cs
- CorrelationService.cs