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
- XmlDataDocument.cs
- HtmlTableCell.cs
- RequestCachePolicy.cs
- Native.cs
- DataGridViewDesigner.cs
- SortAction.cs
- StorageAssociationSetMapping.cs
- UnmanagedMarshal.cs
- UserInitiatedRoutedEventPermissionAttribute.cs
- Activation.cs
- QualifiedCellIdBoolean.cs
- PartManifestEntry.cs
- StructuredTypeInfo.cs
- ISAPIWorkerRequest.cs
- QilExpression.cs
- SimpleExpression.cs
- PrivacyNoticeElement.cs
- AdPostCacheSubstitution.cs
- ChtmlTextWriter.cs
- XmlSiteMapProvider.cs
- BaseParaClient.cs
- DragStartedEventArgs.cs
- LinkButton.cs
- DSASignatureDeformatter.cs
- AccessDataSource.cs
- PermissionSetTriple.cs
- Grant.cs
- glyphs.cs
- DbParameterCollection.cs
- IncomingWebResponseContext.cs
- ClientSideQueueItem.cs
- EventlogProvider.cs
- SeverityFilter.cs
- TextDecorationCollectionConverter.cs
- ModelUIElement3D.cs
- MsmqOutputSessionChannel.cs
- ToolboxDataAttribute.cs
- ParallelEnumerable.cs
- ImageCodecInfo.cs
- VisualBrush.cs
- TextOnlyOutput.cs
- AdministrationHelpers.cs
- Font.cs
- BinHexEncoding.cs
- CompiledQuery.cs
- AmbientValueAttribute.cs
- DataGridViewImageColumn.cs
- ScriptBehaviorDescriptor.cs
- WorkflowApplicationUnhandledExceptionEventArgs.cs
- BuildProvidersCompiler.cs
- CngKey.cs
- BrowserCapabilitiesCodeGenerator.cs
- Viewport3DVisual.cs
- CompensationHandlingFilter.cs
- ButtonFieldBase.cs
- ISO2022Encoding.cs
- MediaElement.cs
- Config.cs
- TextAction.cs
- TypeBuilder.cs
- SafeEventHandle.cs
- TypeUsageBuilder.cs
- PersonalizationAdministration.cs
- SqlInternalConnection.cs
- BitmapFrame.cs
- DesignerActionPanel.cs
- LiteralControl.cs
- AvtEvent.cs
- InputManager.cs
- ResXResourceSet.cs
- UIntPtr.cs
- TargetInvocationException.cs
- SplayTreeNode.cs
- WindowsListViewGroup.cs
- Rectangle.cs
- WeakRefEnumerator.cs
- MailHeaderInfo.cs
- PropertyDescriptor.cs
- FixUpCollection.cs
- Utils.cs
- LocalValueEnumerator.cs
- ScriptReferenceBase.cs
- TypeConverterHelper.cs
- AsynchronousChannelMergeEnumerator.cs
- ACE.cs
- ThemeableAttribute.cs
- WindowsRichEditRange.cs
- Stack.cs
- fixedPageContentExtractor.cs
- SqlRecordBuffer.cs
- ClientCultureInfo.cs
- cookiecontainer.cs
- PriorityRange.cs
- XmlHelper.cs
- GlyphCollection.cs
- HostingEnvironmentException.cs
- TypeInitializationException.cs
- XmlSchemaRedefine.cs
- SHA1.cs
- PreProcessor.cs