Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / MS / Internal / Data / XmlNodeChangedEventManager.cs / 1 / XmlNodeChangedEventManager.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: Manager for the XmlNodeChanged event in the "weak event listener" // pattern. See WeakEventTable.cs for an overview. // //--------------------------------------------------------------------------- using System; using System.Xml; using System.Windows; // WeakEventManager namespace MS.Internal.Data { ////// Manager for the XmlDocument.XmlNodeChanged event. /// internal class XmlNodeChangedEventManager : WeakEventManager { #region Constructors // // Constructors // private XmlNodeChangedEventManager() { } #endregion Constructors #region Public Methods // // Public Methods // ////// Add a listener to the given source's event. /// public static void AddListener(XmlDocument source, IWeakEventListener listener) { CurrentManager.ProtectedAddListener(source, listener); } ////// Remove a listener to the given source's event. /// public static void RemoveListener(XmlDocument 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) { XmlNodeChangedEventHandler handler = new XmlNodeChangedEventHandler(OnXmlNodeChanged); XmlDocument doc = (XmlDocument)source; doc.NodeInserted += handler; doc.NodeRemoved += handler; doc.NodeChanged += handler; } ////// Stop listening to the given source for the event. /// protected override void StopListening(object source) { XmlNodeChangedEventHandler handler = new XmlNodeChangedEventHandler(OnXmlNodeChanged); XmlDocument doc = (XmlDocument)source; doc.NodeInserted -= handler; doc.NodeRemoved -= handler; doc.NodeChanged -= handler; } #endregion Protected Methods #region Private Properties // // Private Properties // // get the event manager for the current thread private static XmlNodeChangedEventManager CurrentManager { get { Type managerType = typeof(XmlNodeChangedEventManager); XmlNodeChangedEventManager manager = (XmlNodeChangedEventManager)GetCurrentManager(managerType); // at first use, create and register a new manager if (manager == null) { manager = new XmlNodeChangedEventManager(); SetCurrentManager(managerType, manager); } return manager; } } #endregion Private Properties #region Private Methods // // Private Methods // // event handler for XmlNodeChanged event private void OnXmlNodeChanged(object sender, XmlNodeChangedEventArgs 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
- TransformationRules.cs
- Expressions.cs
- InvalidDataException.cs
- CodeMethodInvokeExpression.cs
- __TransparentProxy.cs
- ThemeDictionaryExtension.cs
- EntityParameterCollection.cs
- SqlConnection.cs
- TextAutomationPeer.cs
- ImageButton.cs
- DurableRuntimeValidator.cs
- ContentOperations.cs
- MenuItem.cs
- FacetChecker.cs
- AttachedPropertyMethodSelector.cs
- Graph.cs
- RunWorkerCompletedEventArgs.cs
- SrgsElementFactoryCompiler.cs
- ColumnResizeUndoUnit.cs
- DropShadowEffect.cs
- GetImportedCardRequest.cs
- PaperSize.cs
- ValidatedControlConverter.cs
- XMLUtil.cs
- ObjectPropertyMapping.cs
- DataGridItem.cs
- XpsThumbnail.cs
- DbParameterHelper.cs
- DrawingState.cs
- OrderedDictionary.cs
- IpcChannel.cs
- ListViewSelectEventArgs.cs
- ForeignConstraint.cs
- HttpWriter.cs
- TrackingServices.cs
- BitmapEffectState.cs
- NestedContainer.cs
- LineSegment.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- CommonXSendMessage.cs
- DocumentOrderComparer.cs
- SqlConnectionManager.cs
- dbdatarecord.cs
- CheckableControlBaseAdapter.cs
- ResourceBinder.cs
- UserValidatedEventArgs.cs
- LocalFileSettingsProvider.cs
- WaitHandleCannotBeOpenedException.cs
- ConversionContext.cs
- _Win32.cs
- PublishLicense.cs
- PerformanceCounterLib.cs
- DynamicDocumentPaginator.cs
- Operator.cs
- Pens.cs
- HandleRef.cs
- TabPage.cs
- ApplicationFileParser.cs
- BlockUIContainer.cs
- UriExt.cs
- DataGridViewRowCollection.cs
- BulletDecorator.cs
- TaiwanLunisolarCalendar.cs
- SettingsAttributes.cs
- BitmapDecoder.cs
- SurrogateSelector.cs
- OwnerDrawPropertyBag.cs
- DataGridViewButtonCell.cs
- DataGridItemEventArgs.cs
- HostingEnvironmentSection.cs
- XsltContext.cs
- ProgressBar.cs
- XmlSchemaDocumentation.cs
- IsolatedStorageException.cs
- FlowchartDesignerCommands.cs
- CompositeCollectionView.cs
- UnmanagedMemoryStream.cs
- XmlElementList.cs
- WindowsFormsHostAutomationPeer.cs
- AutomationPattern.cs
- XmlSerializer.cs
- XmlSchemaSimpleTypeRestriction.cs
- Pair.cs
- WindowsStatusBar.cs
- PathFigureCollectionConverter.cs
- BindingEntityInfo.cs
- URIFormatException.cs
- GeneralTransform3DGroup.cs
- DirectoryNotFoundException.cs
- DiscoveryClientChannelFactory.cs
- NativeMethods.cs
- LinkButton.cs
- BaseServiceProvider.cs
- AttributeProviderAttribute.cs
- SortedSetDebugView.cs
- InheritanceAttribute.cs
- TraceEventCache.cs
- XmlSchemaAttribute.cs
- FileIOPermission.cs
- XmlDataSourceView.cs