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
- AccessDataSourceView.cs
- TextDecoration.cs
- TrustManager.cs
- ClientApiGenerator.cs
- EnumerableValidator.cs
- ListBoxChrome.cs
- Wildcard.cs
- ClientConvert.cs
- FormsAuthenticationUserCollection.cs
- BindingSource.cs
- EventBookmark.cs
- ProcessModelInfo.cs
- WsatTransactionFormatter.cs
- LinkedList.cs
- TypeBuilderInstantiation.cs
- ApplicationGesture.cs
- ToolStripItemTextRenderEventArgs.cs
- TimeZone.cs
- DataGridViewHitTestInfo.cs
- AnimationTimeline.cs
- ComponentDispatcherThread.cs
- SystemGatewayIPAddressInformation.cs
- QueryHandler.cs
- TargetConverter.cs
- PropertyValidationContext.cs
- SqlTrackingWorkflowInstance.cs
- FontStretches.cs
- dataSvcMapFileLoader.cs
- QilPatternFactory.cs
- ButtonFieldBase.cs
- StrokeFIndices.cs
- PolicyVersionConverter.cs
- PointF.cs
- ConfigXmlText.cs
- HtmlSelect.cs
- RemoteWebConfigurationHostStream.cs
- ObjRef.cs
- NamespaceQuery.cs
- DataListItemCollection.cs
- DataControlImageButton.cs
- ColumnResizeAdorner.cs
- SimpleType.cs
- ChannelBinding.cs
- Assert.cs
- DataControlFieldHeaderCell.cs
- PropertyDescriptorCollection.cs
- BordersPage.cs
- RowUpdatedEventArgs.cs
- ProviderSettingsCollection.cs
- ConsoleTraceListener.cs
- MsmqUri.cs
- ToolStripActionList.cs
- SymbolUsageManager.cs
- TreeNode.cs
- NamespaceInfo.cs
- IssuedTokenClientCredential.cs
- SuppressIldasmAttribute.cs
- ExtentJoinTreeNode.cs
- OleDbException.cs
- XmlSchemaAnnotation.cs
- TextSelectionProcessor.cs
- BamlLocalizationDictionary.cs
- Scalars.cs
- AccessDataSource.cs
- UnSafeCharBuffer.cs
- remotingproxy.cs
- CodeExporter.cs
- MaterialGroup.cs
- OdbcDataReader.cs
- HostSecurityManager.cs
- DefaultValueTypeConverter.cs
- DataRecordInfo.cs
- CodeVariableDeclarationStatement.cs
- SByteConverter.cs
- SubqueryTrackingVisitor.cs
- TextBoxAutomationPeer.cs
- PropertyDescriptorCollection.cs
- MsmqIntegrationReceiveParameters.cs
- AncestorChangedEventArgs.cs
- CompilationLock.cs
- HtmlInputHidden.cs
- FileAuthorizationModule.cs
- TabControlAutomationPeer.cs
- SByteConverter.cs
- XmlElementAttributes.cs
- ValidationSummaryDesigner.cs
- ProfileSettings.cs
- ObjectSpanRewriter.cs
- BoolLiteral.cs
- _TLSstream.cs
- SQLBoolean.cs
- MetadataSerializer.cs
- MasterPageParser.cs
- ControlFilterExpression.cs
- CaseInsensitiveHashCodeProvider.cs
- DetailsViewDeletedEventArgs.cs
- XmlCharacterData.cs
- Panel.cs
- AsyncResult.cs
- OutArgumentConverter.cs