Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / RoutedEventHandlerInfo.cs / 1305600 / RoutedEventHandlerInfo.cs
using System; namespace System.Windows { ////// Container for handler instance and other /// invocation preferences for this handler /// instance /// ////// RoutedEventHandlerInfo constitutes the /// handler instance and flag that indicates if /// or not this handler must be invoked for /// already handled events //CASRemoval:[StrongNameIdentityPermission(SecurityAction.LinkDemand, PublicKey = Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_STRING)] public struct RoutedEventHandlerInfo { #region Construction ////// /// /// This class needs to be public because it is /// used by ContentElement in the Framework /// to store Instance EventHandlers /// /// Construtor for RoutedEventHandlerInfo /// /// /// Non-null handler /// /// /// Flag that indicates if or not the handler must /// be invoked for already handled events /// internal RoutedEventHandlerInfo(Delegate handler, bool handledEventsToo) { _handler = handler; _handledEventsToo = handledEventsToo; } #endregion Construction #region Operations ////// Returns associated handler instance /// public Delegate Handler { get {return _handler;} } ////// Returns HandledEventsToo Flag /// public bool InvokeHandledEventsToo { get {return _handledEventsToo;} } // Invokes handler instance as per specified // invocation preferences internal void InvokeHandler(object target, RoutedEventArgs routedEventArgs) { if ((routedEventArgs.Handled == false) || (_handledEventsToo == true)) { if (_handler is RoutedEventHandler) { // Generic RoutedEventHandler is called directly here since // we don't need the InvokeEventHandler override to cast to // the proper type - we know what it is. ((RoutedEventHandler)_handler)(target, routedEventArgs); } else { // NOTE: Cannot call protected method InvokeEventHandler directly routedEventArgs.InvokeHandler(_handler, target); } } } ////// Is the given object equivalent to the current one /// public override bool Equals(object obj) { if (obj == null || !(obj is RoutedEventHandlerInfo)) return false; return Equals((RoutedEventHandlerInfo)obj); } ////// Is the given RoutedEventHandlerInfo equals the current /// public bool Equals(RoutedEventHandlerInfo handlerInfo) { return _handler == handlerInfo._handler && _handledEventsToo == handlerInfo._handledEventsToo; } ////// Serves as a hash function for a particular type, suitable for use in /// hashing algorithms and data structures like a hash table /// public override int GetHashCode() { return base.GetHashCode(); } ////// Equals operator overload /// public static bool operator== (RoutedEventHandlerInfo handlerInfo1, RoutedEventHandlerInfo handlerInfo2) { return handlerInfo1.Equals(handlerInfo2); } ////// NotEquals operator overload /// public static bool operator!= (RoutedEventHandlerInfo handlerInfo1, RoutedEventHandlerInfo handlerInfo2) { return !handlerInfo1.Equals(handlerInfo2); } ////// Cleanup all the references within the data /// /* Commented out to avoid "uncalled private code" fxcop violation internal void Clear() { _handler = null; _handledEventsToo = false; } */ #endregion Operations #region Data private Delegate _handler; private bool _handledEventsToo; #endregion Data } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AbstractSvcMapFileLoader.cs
- Memoizer.cs
- XPathDescendantIterator.cs
- KeyPullup.cs
- ClockController.cs
- PackagePart.cs
- CodeSnippetStatement.cs
- WindowPattern.cs
- UnhandledExceptionEventArgs.cs
- RecognizedAudio.cs
- CheckPair.cs
- ExpressionEditorAttribute.cs
- Helper.cs
- SafeFileHandle.cs
- ObjectPersistData.cs
- ElementProxy.cs
- EntryIndex.cs
- JsonXmlDataContract.cs
- TreeWalkHelper.cs
- InvalidOleVariantTypeException.cs
- CreateSequence.cs
- odbcmetadatacollectionnames.cs
- TypeDescriptionProvider.cs
- DataGridViewRowCancelEventArgs.cs
- QilGeneratorEnv.cs
- AttachInfo.cs
- SchemaImporterExtensionElement.cs
- Nodes.cs
- HtmlContainerControl.cs
- SchemaDeclBase.cs
- KeyValuePairs.cs
- DriveInfo.cs
- TypeLibConverter.cs
- SoapCodeExporter.cs
- WebPartDisplayModeCancelEventArgs.cs
- RuleRef.cs
- DataGridViewButtonCell.cs
- XmlSerializerVersionAttribute.cs
- FormatSettings.cs
- ObjectDataSourceStatusEventArgs.cs
- CharEntityEncoderFallback.cs
- CheckableControlBaseAdapter.cs
- InvokePatternIdentifiers.cs
- UserControl.cs
- DataGridViewHitTestInfo.cs
- OracleInfoMessageEventArgs.cs
- StructuredProperty.cs
- ArrayWithOffset.cs
- NoClickablePointException.cs
- IncrementalCompileAnalyzer.cs
- DelegatingTypeDescriptionProvider.cs
- HTTPNotFoundHandler.cs
- InertiaRotationBehavior.cs
- GlyphRunDrawing.cs
- ExpressionBuilder.cs
- CurrentTimeZone.cs
- WizardForm.cs
- EmptyReadOnlyDictionaryInternal.cs
- FontStretchConverter.cs
- ServiceModelActivationSectionGroup.cs
- UnknownBitmapEncoder.cs
- FontUnitConverter.cs
- ObjectToIdCache.cs
- NamespaceList.cs
- SqlDataSourceConfigureFilterForm.cs
- Debugger.cs
- figurelength.cs
- ProcessInputEventArgs.cs
- PerformanceCounterLib.cs
- SmiEventStream.cs
- InstancePersistenceException.cs
- VersionValidator.cs
- ObfuscateAssemblyAttribute.cs
- LogLogRecordHeader.cs
- StrongTypingException.cs
- PageCatalogPartDesigner.cs
- FormViewDeletedEventArgs.cs
- SectionRecord.cs
- CreateUserWizard.cs
- EndpointDispatcher.cs
- SQLGuidStorage.cs
- DataListGeneralPage.cs
- Visual3DCollection.cs
- ProcessHostServerConfig.cs
- TypeNameHelper.cs
- ConnectAlgorithms.cs
- WorkflowServiceNamespace.cs
- SafeEventLogReadHandle.cs
- UserControl.cs
- DesignerGenericWebPart.cs
- InternalTypeHelper.cs
- PostBackOptions.cs
- Query.cs
- Types.cs
- DayRenderEvent.cs
- HyperLinkColumn.cs
- DefinitionBase.cs
- DataGridViewCellLinkedList.cs
- DotNetATv1WindowsLogEntrySerializer.cs
- UdpTransportSettings.cs