Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / System / Windows / RoutedEventHandlerInfo.cs / 1 / 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
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- QuaternionRotation3D.cs
- DataMisalignedException.cs
- ArrangedElementCollection.cs
- EntityCommand.cs
- XsltCompileContext.cs
- HtmlDocument.cs
- SafeIUnknown.cs
- AncestorChangedEventArgs.cs
- IndentTextWriter.cs
- BaseCollection.cs
- FormView.cs
- BamlCollectionHolder.cs
- FrameDimension.cs
- ObjectMemberMapping.cs
- XPathMultyIterator.cs
- KnownTypeHelper.cs
- RepeatInfo.cs
- GenericTypeParameterBuilder.cs
- CollaborationHelperFunctions.cs
- securestring.cs
- MinimizableAttributeTypeConverter.cs
- QilLiteral.cs
- SqlWorkflowPersistenceService.cs
- DurableOperationContext.cs
- ToolTipService.cs
- SecurityAlgorithmSuiteConverter.cs
- IconHelper.cs
- PageAsyncTask.cs
- VerticalAlignConverter.cs
- ASCIIEncoding.cs
- VisualStyleElement.cs
- Container.cs
- CacheSection.cs
- ObjectStorage.cs
- ObjectDisposedException.cs
- DataGridHeaderBorder.cs
- Single.cs
- FloaterParagraph.cs
- EventTask.cs
- SafeHandles.cs
- tooltip.cs
- X509CertificateClaimSet.cs
- EdmEntityTypeAttribute.cs
- ColumnBinding.cs
- XamlPointCollectionSerializer.cs
- Guid.cs
- SHA384Cng.cs
- Win32Exception.cs
- ControlSerializer.cs
- NetworkInformationPermission.cs
- Parser.cs
- Overlapped.cs
- Int32AnimationBase.cs
- SamlAction.cs
- CustomErrorCollection.cs
- SpecialTypeDataContract.cs
- ObjectSpanRewriter.cs
- SafeEventHandle.cs
- WizardPanel.cs
- SettingsPropertyWrongTypeException.cs
- ProxyHwnd.cs
- InternalResources.cs
- ValidatorCollection.cs
- InstancePersistence.cs
- UserControlDocumentDesigner.cs
- StrongName.cs
- DeviceSpecificChoiceCollection.cs
- PathSegmentCollection.cs
- SmiMetaDataProperty.cs
- DrawingVisualDrawingContext.cs
- dbenumerator.cs
- SqlDataSourceSelectingEventArgs.cs
- InternalResources.cs
- _DomainName.cs
- MetadataExchangeBindings.cs
- CompoundFileReference.cs
- BrowserCapabilitiesCompiler.cs
- VersionedStream.cs
- Translator.cs
- LayoutEngine.cs
- Buffer.cs
- WorkflowInstanceUnhandledExceptionRecord.cs
- NativeMethods.cs
- BuildManagerHost.cs
- RadioButtonPopupAdapter.cs
- ProfileGroupSettingsCollection.cs
- ConfigurationException.cs
- SymmetricKey.cs
- NullToBooleanConverter.cs
- OrderedDictionary.cs
- XmlNavigatorFilter.cs
- PixelFormatConverter.cs
- CompilerParameters.cs
- CustomErrorsSectionWrapper.cs
- HttpModuleAction.cs
- XmlNamespaceMappingCollection.cs
- AddInSegmentDirectoryNotFoundException.cs
- EventToken.cs
- Popup.cs
- IssuanceLicense.cs