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
- VBIdentifierTrimConverter.cs
- PropertyValueUIItem.cs
- ResourceManagerWrapper.cs
- FrameworkName.cs
- BufferedWebEventProvider.cs
- Quaternion.cs
- HandledEventArgs.cs
- UdpDiscoveryEndpoint.cs
- OneOfTypeConst.cs
- XmlDocumentFragment.cs
- VisualTransition.cs
- TypeConverters.cs
- DesignTimeVisibleAttribute.cs
- IndexingContentUnit.cs
- CryptoKeySecurity.cs
- HttpHandlerActionCollection.cs
- AsymmetricSignatureDeformatter.cs
- SmtpMail.cs
- GridViewItemAutomationPeer.cs
- Image.cs
- RequestQueryProcessor.cs
- SudsCommon.cs
- PerformanceCounterLib.cs
- ToolStripSplitStackLayout.cs
- XsdDuration.cs
- MenuItem.cs
- ContentElement.cs
- PathSegment.cs
- DependencyPropertyHelper.cs
- PackagePartCollection.cs
- UnauthorizedAccessException.cs
- KoreanCalendar.cs
- LOSFormatter.cs
- AssemblyAssociatedContentFileAttribute.cs
- DataObject.cs
- GroupStyle.cs
- PersistenceProviderDirectory.cs
- SelectorItemAutomationPeer.cs
- SecurityContext.cs
- DataGridCellsPresenter.cs
- JsonXmlDataContract.cs
- SoapExtensionTypeElementCollection.cs
- FileResponseElement.cs
- GeometryModel3D.cs
- SecurityStandardsManager.cs
- ExtendedPropertyCollection.cs
- WindowsTokenRoleProvider.cs
- CompModSwitches.cs
- Point3DConverter.cs
- OciEnlistContext.cs
- DESCryptoServiceProvider.cs
- SafeProcessHandle.cs
- FrameworkReadOnlyPropertyMetadata.cs
- LineInfo.cs
- ServiceModelActivationSectionGroup.cs
- COM2FontConverter.cs
- AnonymousIdentificationModule.cs
- FrameworkContentElement.cs
- TaiwanLunisolarCalendar.cs
- SqlParameter.cs
- __Error.cs
- DataGridViewCheckBoxCell.cs
- XPathBinder.cs
- CacheMemory.cs
- HTTPNotFoundHandler.cs
- Vector3DKeyFrameCollection.cs
- ToolStripContainer.cs
- OdbcReferenceCollection.cs
- GrabHandleGlyph.cs
- PersonalizationProvider.cs
- InvalidCastException.cs
- Encoder.cs
- TimeSpanSecondsConverter.cs
- View.cs
- HtmlShim.cs
- RequestCacheEntry.cs
- Hyperlink.cs
- PropertyGridCommands.cs
- SafeEventLogReadHandle.cs
- Int16Storage.cs
- FailedToStartupUIException.cs
- exports.cs
- Parameter.cs
- DesignColumnCollection.cs
- graph.cs
- SoapElementAttribute.cs
- UncommonField.cs
- TargetInvocationException.cs
- StylusButtonEventArgs.cs
- HtmlEncodedRawTextWriter.cs
- TimeoutHelper.cs
- CompatibleIComparer.cs
- XmlArrayAttribute.cs
- VideoDrawing.cs
- RuleRef.cs
- MultipartContentParser.cs
- UrlMappingsModule.cs
- ZoneLinkButton.cs
- DetailsViewInsertEventArgs.cs
- TextBox.cs