Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- ControlBuilder.cs
- NetworkCredential.cs
- Vector.cs
- InkCanvasInnerCanvas.cs
- SoapSchemaImporter.cs
- VersionPair.cs
- ReadContentAsBinaryHelper.cs
- NativeObjectSecurity.cs
- ContentPropertyAttribute.cs
- webbrowsersite.cs
- PenContexts.cs
- NumberSubstitution.cs
- FederatedMessageSecurityOverHttp.cs
- ObjectStateEntryDbDataRecord.cs
- List.cs
- SqlComparer.cs
- UserControlFileEditor.cs
- ProfileSettingsCollection.cs
- ToolStripItemTextRenderEventArgs.cs
- unsafenativemethodstextservices.cs
- FormView.cs
- XmlEnumAttribute.cs
- XmlWriter.cs
- RunInstallerAttribute.cs
- ShapeTypeface.cs
- StringFunctions.cs
- DataGridViewCellCollection.cs
- XmlAttributeAttribute.cs
- TimeoutValidationAttribute.cs
- HealthMonitoringSectionHelper.cs
- DynamicDocumentPaginator.cs
- DebugView.cs
- LongValidatorAttribute.cs
- KerberosRequestorSecurityTokenAuthenticator.cs
- ForeignKeyFactory.cs
- MethodRental.cs
- EntryIndex.cs
- EventSourceCreationData.cs
- SingleConverter.cs
- TreeViewItemAutomationPeer.cs
- TextRangeEdit.cs
- PermissionSet.cs
- SqlDataSourceCustomCommandPanel.cs
- NumericExpr.cs
- EDesignUtil.cs
- SettingsAttributes.cs
- ValueQuery.cs
- InvalidOperationException.cs
- XLinq.cs
- RNGCryptoServiceProvider.cs
- AttributeUsageAttribute.cs
- DWriteFactory.cs
- DefaultTextStoreTextComposition.cs
- MenuItemStyleCollection.cs
- EventItfInfo.cs
- DiscardableAttribute.cs
- ListCommandEventArgs.cs
- ModifiableIteratorCollection.cs
- SynchronousChannelMergeEnumerator.cs
- EntityClientCacheKey.cs
- SpellerStatusTable.cs
- StreamAsIStream.cs
- DbQueryCommandTree.cs
- AuthenticationService.cs
- unsafenativemethodsother.cs
- ProviderMetadataCachedInformation.cs
- FormViewPagerRow.cs
- RoleGroup.cs
- AppModelKnownContentFactory.cs
- WhiteSpaceTrimStringConverter.cs
- SecurityPermission.cs
- Parameter.cs
- WebPartMinimizeVerb.cs
- _WebProxyDataBuilder.cs
- DataGridViewSelectedCellCollection.cs
- __FastResourceComparer.cs
- Queue.cs
- XmlNodeWriter.cs
- documentsequencetextcontainer.cs
- HostUtils.cs
- Point3D.cs
- FolderBrowserDialog.cs
- Repeater.cs
- LogRecordSequence.cs
- RIPEMD160Managed.cs
- ClaimTypes.cs
- SQLDecimalStorage.cs
- Range.cs
- KeyPullup.cs
- listitem.cs
- ManagementOptions.cs
- ControlAdapter.cs
- RouteValueDictionary.cs
- COSERVERINFO.cs
- PhysicalAddress.cs
- PageFunction.cs
- FormCollection.cs
- XmlCompatibilityReader.cs
- TreeView.cs
- WebScriptMetadataMessageEncoderFactory.cs