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
- HttpException.cs
- DynamicDiscoveryDocument.cs
- SamlAuthorizationDecisionClaimResource.cs
- SourceFileBuildProvider.cs
- QilReplaceVisitor.cs
- CalendarDay.cs
- TextRangeBase.cs
- MultiTrigger.cs
- Version.cs
- WMIGenerator.cs
- RegularExpressionValidator.cs
- WmpBitmapDecoder.cs
- BigInt.cs
- versioninfo.cs
- SHA512Managed.cs
- PathFigureCollection.cs
- GenericTextProperties.cs
- WebPartExportVerb.cs
- ComponentGuaranteesAttribute.cs
- FixedPage.cs
- RelationshipDetailsCollection.cs
- BindingListCollectionView.cs
- PageCatalogPart.cs
- ScrollChrome.cs
- SystemIPGlobalProperties.cs
- WebPartDescription.cs
- LicenseProviderAttribute.cs
- IisTraceWebEventProvider.cs
- OrthographicCamera.cs
- TimerElapsedEvenArgs.cs
- AutomationElementIdentifiers.cs
- EventLogEntry.cs
- UniqueTransportManagerRegistration.cs
- HtmlEncodedRawTextWriter.cs
- ComPlusInstanceContextInitializer.cs
- PropertyTabChangedEvent.cs
- TextContainer.cs
- ChangePassword.cs
- FormView.cs
- EntityDataSourceQueryBuilder.cs
- BrushConverter.cs
- Messages.cs
- PermissionRequestEvidence.cs
- DashStyles.cs
- BitmapEffectInputData.cs
- DataBindingCollection.cs
- MenuCommand.cs
- EditorZoneBase.cs
- NonParentingControl.cs
- SymbolPair.cs
- DataBoundControlAdapter.cs
- Function.cs
- ExpressionPrinter.cs
- ScrollChrome.cs
- CodeTypeDelegate.cs
- SmtpDigestAuthenticationModule.cs
- EventLogEntryCollection.cs
- IPAddress.cs
- _LocalDataStoreMgr.cs
- ExtenderHelpers.cs
- CompoundFileStreamReference.cs
- SettingsAttributeDictionary.cs
- XamlSerializationHelper.cs
- PersonalizationEntry.cs
- TabItemAutomationPeer.cs
- XmlSchemaRedefine.cs
- OlePropertyStructs.cs
- RegexCaptureCollection.cs
- DocumentOrderQuery.cs
- Function.cs
- TextServicesLoader.cs
- EdmToObjectNamespaceMap.cs
- LineMetrics.cs
- SchemaMapping.cs
- DataSvcMapFileSerializer.cs
- TimeZoneNotFoundException.cs
- InstanceData.cs
- PersonalizationStateInfo.cs
- ArrayTypeMismatchException.cs
- ListItemConverter.cs
- CompensationDesigner.cs
- ReflectionTypeLoadException.cs
- SmiTypedGetterSetter.cs
- CursorConverter.cs
- KeyValuePair.cs
- LinqDataSource.cs
- HttpListenerRequestUriBuilder.cs
- PageAdapter.cs
- UserControlCodeDomTreeGenerator.cs
- EventSourceCreationData.cs
- GridSplitter.cs
- Context.cs
- SubstitutionList.cs
- TextPointer.cs
- SecurityState.cs
- XmlName.cs
- OperandQuery.cs
- ColorPalette.cs
- MetabaseServerConfig.cs
- AuthenticationSection.cs