Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / 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. //---------------------------------------------------------------------------- // //// 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
- WebPartEditorApplyVerb.cs
- FlowPanelDesigner.cs
- FtpCachePolicyElement.cs
- Cursor.cs
- Queue.cs
- DragCompletedEventArgs.cs
- SmuggledIUnknown.cs
- DataGridViewRowPostPaintEventArgs.cs
- ProjectedWrapper.cs
- AnnotationHighlightLayer.cs
- IgnoreDataMemberAttribute.cs
- ProxyOperationRuntime.cs
- ReadOnlyState.cs
- EndpointConfigContainer.cs
- GridErrorDlg.cs
- TextBox.cs
- IndexingContentUnit.cs
- CharConverter.cs
- MdiWindowListStrip.cs
- DetailsViewDeleteEventArgs.cs
- WindowsStatic.cs
- StringCollectionEditor.cs
- BinaryFormatterSinks.cs
- UInt16.cs
- BufferAllocator.cs
- TypedReference.cs
- BreakRecordTable.cs
- InsufficientMemoryException.cs
- ConsumerConnectionPointCollection.cs
- XmlDataCollection.cs
- MarshalByValueComponent.cs
- Rss20ItemFormatter.cs
- FactorySettingsElement.cs
- HealthMonitoringSection.cs
- Substitution.cs
- httpserverutility.cs
- SByte.cs
- Focus.cs
- CaseInsensitiveHashCodeProvider.cs
- EventTrigger.cs
- ToolStripOverflow.cs
- ToolStripSeparator.cs
- TypeConverter.cs
- PathParser.cs
- QuaternionValueSerializer.cs
- PersonalizablePropertyEntry.cs
- RelationshipSet.cs
- HwndSource.cs
- TimeoutValidationAttribute.cs
- ScalarOps.cs
- RadioButtonFlatAdapter.cs
- CompileLiteralTextParser.cs
- FontFamily.cs
- Double.cs
- RunInstallerAttribute.cs
- CodeSubDirectoriesCollection.cs
- ParallelTimeline.cs
- Vector3D.cs
- ExecutionEngineException.cs
- InfoCardCryptoHelper.cs
- DisplayClaim.cs
- FormatConvertedBitmap.cs
- ApplicationInterop.cs
- CalendarDateRange.cs
- DataComponentMethodGenerator.cs
- UserPreference.cs
- HttpCookiesSection.cs
- LogRestartAreaEnumerator.cs
- SynchronizationScope.cs
- QuaternionKeyFrameCollection.cs
- StringResourceManager.cs
- ExtensionDataObject.cs
- MsmqBindingElementBase.cs
- WindowsNonControl.cs
- WebServiceTypeData.cs
- HostUtils.cs
- RawUIStateInputReport.cs
- UTF8Encoding.cs
- PathFigureCollection.cs
- RichTextBoxAutomationPeer.cs
- CollectionViewProxy.cs
- QueryResponse.cs
- ElementFactory.cs
- ProfileEventArgs.cs
- CSharpCodeProvider.cs
- mediaclock.cs
- ContentElementAutomationPeer.cs
- ComboBoxAutomationPeer.cs
- SamlAuthorizationDecisionStatement.cs
- SimpleBitVector32.cs
- PersonalizationProviderCollection.cs
- NonceCache.cs
- LineSegment.cs
- BindValidator.cs
- PasswordTextNavigator.cs
- FontStyle.cs
- EntityContainerRelationshipSet.cs
- X509Certificate.cs
- SafeEventLogReadHandle.cs
- Imaging.cs