Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Base / System / ComponentModel / CurrentChangedEventManager.cs / 1 / CurrentChangedEventManager.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: Manager for the CurrentChanged event in the "weak event listener" // pattern. See WeakEventTable.cs for an overview. // //--------------------------------------------------------------------------- using System; using System.Windows; // WeakEventManager namespace System.ComponentModel { ////// Manager for the ICollectionView.CurrentChanged event. /// public class CurrentChangedEventManager : WeakEventManager { #region Constructors // // Constructors // private CurrentChangedEventManager() { } #endregion Constructors #region Public Methods // // Public Methods // ////// Add a listener to the given source's event. /// public static void AddListener(ICollectionView source, IWeakEventListener listener) { CurrentManager.ProtectedAddListener(source, listener); } ////// Remove a listener to the given source's event. /// public static void RemoveListener(ICollectionView source, IWeakEventListener listener) { CurrentManager.ProtectedRemoveListener(source, listener); } #endregion Public Methods #region Protected Methods // // Protected Methods // ////// Listen to the given source for the event. /// protected override void StartListening(object source) { ICollectionView typedSource = (ICollectionView)source; typedSource.CurrentChanged += new EventHandler(OnCurrentChanged); } ////// Stop listening to the given source for the event. /// protected override void StopListening(object source) { ICollectionView typedSource = (ICollectionView)source; typedSource.CurrentChanged -= new EventHandler(OnCurrentChanged); } #endregion Protected Methods #region Private Properties // // Private Properties // // get the event manager for the current thread private static CurrentChangedEventManager CurrentManager { get { Type managerType = typeof(CurrentChangedEventManager); CurrentChangedEventManager manager = (CurrentChangedEventManager)GetCurrentManager(managerType); // at first use, create and register a new manager if (manager == null) { manager = new CurrentChangedEventManager(); SetCurrentManager(managerType, manager); } return manager; } } #endregion Private Properties #region Private Methods // // Private Methods // // event handler for CurrentChanged event private void OnCurrentChanged(object sender, EventArgs args) { DeliverEvent(sender, args); } #endregion Private Methods } } // 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
- PopupControlService.cs
- ListViewCommandEventArgs.cs
- SafeLocalAllocation.cs
- DispatchChannelSink.cs
- UIElementHelper.cs
- SkipStoryboardToFill.cs
- TransformerTypeCollection.cs
- DataChangedEventManager.cs
- RefreshEventArgs.cs
- ErrorHandler.cs
- ReadOnlyMetadataCollection.cs
- controlskin.cs
- SimpleHandlerFactory.cs
- cookieexception.cs
- IHttpResponseInternal.cs
- DataRelationPropertyDescriptor.cs
- WindowsGraphicsWrapper.cs
- ApplicationSecurityManager.cs
- BackgroundWorker.cs
- PrintController.cs
- SafeProcessHandle.cs
- PermissionListSet.cs
- CreateUserWizard.cs
- DocumentOrderComparer.cs
- LoaderAllocator.cs
- HtmlControl.cs
- ToolStripItemClickedEventArgs.cs
- NegotiateStream.cs
- WindowsUserNameCachingSecurityTokenAuthenticator.cs
- BinHexEncoder.cs
- Win32.cs
- ClientSession.cs
- ControlTemplate.cs
- coordinatorfactory.cs
- isolationinterop.cs
- StorageFunctionMapping.cs
- ParentUndoUnit.cs
- CookieProtection.cs
- TextEffect.cs
- DocumentCollection.cs
- XmlSerializerVersionAttribute.cs
- ExpandCollapsePattern.cs
- brushes.cs
- SqlNode.cs
- TypedTableHandler.cs
- DivideByZeroException.cs
- CheckBoxStandardAdapter.cs
- Logging.cs
- WebPartZone.cs
- WebCategoryAttribute.cs
- ObjectItemCollection.cs
- LogStore.cs
- IERequestCache.cs
- StringBlob.cs
- GregorianCalendar.cs
- NaturalLanguageHyphenator.cs
- COAUTHINFO.cs
- GenericIdentity.cs
- WebHttpSecurity.cs
- ApplicationCommands.cs
- PermissionSet.cs
- PerfProviderCollection.cs
- milexports.cs
- BatchServiceHost.cs
- HashCodeCombiner.cs
- ContainerSelectorGlyph.cs
- MenuCommandsChangedEventArgs.cs
- KeyGestureConverter.cs
- ElementAction.cs
- XmlDictionaryString.cs
- _ListenerResponseStream.cs
- ToolstripProfessionalRenderer.cs
- BitmapEffectRenderDataResource.cs
- ExpressionDumper.cs
- PublisherMembershipCondition.cs
- InvokeMemberBinder.cs
- sqlmetadatafactory.cs
- XPathNavigator.cs
- UiaCoreApi.cs
- ZoneMembershipCondition.cs
- DateTimeParse.cs
- AxHost.cs
- DurationConverter.cs
- DetailsViewPagerRow.cs
- PropertyContainer.cs
- FontStretch.cs
- AnimationException.cs
- DocumentPage.cs
- SecureUICommand.cs
- ServiceHttpHandlerFactory.cs
- Visual3D.cs
- InputBuffer.cs
- ContextBase.cs
- AstTree.cs
- PagesSection.cs
- diagnosticsswitches.cs
- XmlDataProvider.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- TrackBarRenderer.cs
- ModelTreeEnumerator.cs