Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / UIAutomation / UIAutomationClient / System / Windows / Automation / TreeWalker.cs / 1 / TreeWalker.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // // Description: TreeWalker class, allows client to walk custom views of // UIAutomation tree. // // History: // 02/05/2004 : BrendanM Created // //--------------------------------------------------------------------------- using System; using System.Windows.Automation.Provider; using MS.Internal.Automation; namespace System.Windows.Automation { ////// TreeWalker - used to walk over a view of the UIAutomation tree /// #if (INTERNAL_COMPILE) internal sealed class TreeWalker #else public sealed class TreeWalker #endif { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors ////// Create a tree walker that can be used to walk a specified /// view of the UIAutomation tree. /// /// Condition defining the view - nodes that do not satisfy this condition are skipped over public TreeWalker(Condition condition) { Misc.ValidateArgumentNonNull(condition, "condition"); _condition = condition; } #endregion Constructors //------------------------------------------------------ // // Public Constants / Readonly Fields // //----------------------------------------------------- #region Public Constants and Readonly Fields ////// Predefined TreeWalker for walking the Raw view of the UIAutomation tree /// public static readonly TreeWalker RawViewWalker = new TreeWalker(Automation.RawViewCondition); ////// Predefined TreeWalker for walking the Control view of the UIAutomation tree /// public static readonly TreeWalker ControlViewWalker = new TreeWalker(Automation.ControlViewCondition); ////// Predefined TreeWalker for walking the Content view of the UIAutomation tree /// public static readonly TreeWalker ContentViewWalker = new TreeWalker(Automation.ContentViewCondition); #endregion Public Constants and Readonly Fields //------------------------------------------------------ // // Public Methods // //------------------------------------------------------ #region Public Methods ////// Get the parent of the specified element, in the current view /// /// element to get the parent of ///The parent of the specified element; can be null if /// specified element was the root element ///The view used is determined by the condition passed to /// the constructor - elements that do not satisfy that condition /// are skipped over public AutomationElement GetParent(AutomationElement element) { Misc.ValidateArgumentNonNull(element, "element"); return element.Navigate(NavigateDirection.Parent, _condition, null); } ////// Get the first child of the specified element, in the current view /// /// element to get the first child of ///The frst child of the specified element - or null if /// the specified element has no children ///The view used is determined by the condition passed to /// the constructor - elements that do not satisfy that condition /// are skipped over public AutomationElement GetFirstChild(AutomationElement element) { Misc.ValidateArgumentNonNull(element, "element"); return element.Navigate(NavigateDirection.FirstChild, _condition, null); } ////// Get the last child of the specified element, in the current view /// /// element to get the last child of ///The last child of the specified element - or null if /// the specified element has no children ///The view used is determined by the condition passed to /// the constructor - elements that do not satisfy that condition /// are skipped over public AutomationElement GetLastChild(AutomationElement element) { Misc.ValidateArgumentNonNull(element, "element"); return element.Navigate(NavigateDirection.LastChild, _condition, null); } ////// Get the next sibling of the specified element, in the current view /// /// element to get the next sibling of ///The next sibling of the specified element - or null if the /// specified element has no next sibling ///The view used is determined by the condition passed to /// the constructor - elements that do not satisfy that condition /// are skipped over public AutomationElement GetNextSibling(AutomationElement element) { Misc.ValidateArgumentNonNull(element, "element"); return element.Navigate(NavigateDirection.NextSibling, _condition, null); } ////// Get the previous sibling of the specified element, in the current view /// /// element to get the previous sibling of ///The previous sibling of the specified element - or null if the /// specified element has no previous sibling ///The view used is determined by the condition passed to /// the constructor - elements that do not satisfy that condition /// are skipped over public AutomationElement GetPreviousSibling(AutomationElement element) { Misc.ValidateArgumentNonNull(element, "element"); return element.Navigate(NavigateDirection.PreviousSibling, _condition, null); } ////// Return the element or the nearest ancestor which is present in /// the view of the tree used by this treewalker /// /// element to normalize ///The element or the nearest ancestor which satisfies the /// condition used by this TreeWalker ////// This method starts at the specified element and walks up the /// tree until it finds an element that satisfies the TreeWalker's /// condition. /// /// If the passed-in element itself satsifies the condition, it is /// returned as-is. /// /// If the process of walking up the tree hits the root node, then /// the root node is returned, regardless of whether it satisfies /// the condition or not. /// public AutomationElement Normalize(AutomationElement element) { Misc.ValidateArgumentNonNull(element, "element"); return element.Normalize(_condition, null); } ////// Get the parent of the specified element, in the current view, /// prefetching properties /// /// element to get the parent of /// CacheRequest specifying information to be prefetched ///The parent of the specified element; can be null if /// specified element was the root element ///The view used is determined by the condition passed to /// the constructor - elements that do not satisfy that condition /// are skipped over public AutomationElement GetParent(AutomationElement element, CacheRequest request) { Misc.ValidateArgumentNonNull(element, "element"); Misc.ValidateArgumentNonNull(request, "request"); return element.Navigate(NavigateDirection.Parent, _condition, request); } ////// Get the first child of the specified element, in the current view, /// prefetching properties /// /// element to get the first child of /// CacheRequest specifying information to be prefetched ///The frst child of the specified element - or null if /// the specified element has no children ///The view used is determined by the condition passed to /// the constructor - elements that do not satisfy that condition /// are skipped over public AutomationElement GetFirstChild(AutomationElement element, CacheRequest request) { Misc.ValidateArgumentNonNull(element, "element"); Misc.ValidateArgumentNonNull(request, "request"); return element.Navigate(NavigateDirection.FirstChild, _condition, request); } ////// Get the last child of the specified element, in the current view, /// prefetching properties /// /// element to get the last child of /// CacheRequest specifying information to be prefetched ///The last child of the specified element - or null if /// the specified element has no children ///The view used is determined by the condition passed to /// the constructor - elements that do not satisfy that condition /// are skipped over public AutomationElement GetLastChild(AutomationElement element, CacheRequest request) { Misc.ValidateArgumentNonNull(element, "element"); Misc.ValidateArgumentNonNull(request, "request"); return element.Navigate(NavigateDirection.LastChild, _condition, request); } ////// Get the next sibling of the specified element, in the current view, /// prefetching properties /// /// element to get the next sibling of /// CacheRequest specifying information to be prefetched ///The next sibling of the specified element - or null if the /// specified element has no next sibling ///The view used is determined by the condition passed to /// the constructor - elements that do not satisfy that condition /// are skipped over public AutomationElement GetNextSibling(AutomationElement element, CacheRequest request) { Misc.ValidateArgumentNonNull(element, "element"); Misc.ValidateArgumentNonNull(request, "request"); return element.Navigate(NavigateDirection.NextSibling, _condition, request); } ////// Get the previous sibling of the specified element, in the current view, /// prefetching properties /// /// element to get the previous sibling of /// CacheRequest specifying information to be prefetched ///The previous sibling of the specified element - or null if the /// specified element has no previous sibling ///The view used is determined by the condition passed to /// the constructor - elements that do not satisfy that condition /// are skipped over public AutomationElement GetPreviousSibling(AutomationElement element, CacheRequest request) { Misc.ValidateArgumentNonNull(element, "element"); Misc.ValidateArgumentNonNull(request, "request"); return element.Navigate(NavigateDirection.PreviousSibling, _condition, request); } ////// Return the element or the nearest ancestor which is present in /// the view of the tree used by this treewalker, prefetching properties /// for the returned node /// /// element to normalize /// CacheRequest specifying information to be prefetched ///The element or the nearest ancestor which satisfies the /// condition used by this TreeWalker ////// This method starts at the specified element and walks up the /// tree until it finds an element that satisfies the TreeWalker's /// condition. /// /// If the passed-in element itself satsifies the condition, it is /// returned as-is. /// /// If the process of walking up the tree hits the root node, then /// the root node is returned, regardless of whether it satisfies /// the condition or not. /// public AutomationElement Normalize(AutomationElement element, CacheRequest request) { Misc.ValidateArgumentNonNull(element, "element"); Misc.ValidateArgumentNonNull(request, "request"); return element.Normalize(_condition, request); } #endregion Public Methods //----------------------------------------------------- // // Public Properties // //------------------------------------------------------ #region Public Properties ////// Returns the condition used by this TreeWalker. The TreeWalker /// skips over nodes that do not satisfy the condition. /// public Condition Condition { get { return _condition; } } #endregion Public Properties //----------------------------------------------------- // // Private Fields // //----------------------------------------------------- #region Private Fields private Condition _condition; #endregion Private Fields } } // 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: TreeWalker class, allows client to walk custom views of // UIAutomation tree. // // History: // 02/05/2004 : BrendanM Created // //--------------------------------------------------------------------------- using System; using System.Windows.Automation.Provider; using MS.Internal.Automation; namespace System.Windows.Automation { ////// TreeWalker - used to walk over a view of the UIAutomation tree /// #if (INTERNAL_COMPILE) internal sealed class TreeWalker #else public sealed class TreeWalker #endif { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors ////// Create a tree walker that can be used to walk a specified /// view of the UIAutomation tree. /// /// Condition defining the view - nodes that do not satisfy this condition are skipped over public TreeWalker(Condition condition) { Misc.ValidateArgumentNonNull(condition, "condition"); _condition = condition; } #endregion Constructors //------------------------------------------------------ // // Public Constants / Readonly Fields // //----------------------------------------------------- #region Public Constants and Readonly Fields ////// Predefined TreeWalker for walking the Raw view of the UIAutomation tree /// public static readonly TreeWalker RawViewWalker = new TreeWalker(Automation.RawViewCondition); ////// Predefined TreeWalker for walking the Control view of the UIAutomation tree /// public static readonly TreeWalker ControlViewWalker = new TreeWalker(Automation.ControlViewCondition); ////// Predefined TreeWalker for walking the Content view of the UIAutomation tree /// public static readonly TreeWalker ContentViewWalker = new TreeWalker(Automation.ContentViewCondition); #endregion Public Constants and Readonly Fields //------------------------------------------------------ // // Public Methods // //------------------------------------------------------ #region Public Methods ////// Get the parent of the specified element, in the current view /// /// element to get the parent of ///The parent of the specified element; can be null if /// specified element was the root element ///The view used is determined by the condition passed to /// the constructor - elements that do not satisfy that condition /// are skipped over public AutomationElement GetParent(AutomationElement element) { Misc.ValidateArgumentNonNull(element, "element"); return element.Navigate(NavigateDirection.Parent, _condition, null); } ////// Get the first child of the specified element, in the current view /// /// element to get the first child of ///The frst child of the specified element - or null if /// the specified element has no children ///The view used is determined by the condition passed to /// the constructor - elements that do not satisfy that condition /// are skipped over public AutomationElement GetFirstChild(AutomationElement element) { Misc.ValidateArgumentNonNull(element, "element"); return element.Navigate(NavigateDirection.FirstChild, _condition, null); } ////// Get the last child of the specified element, in the current view /// /// element to get the last child of ///The last child of the specified element - or null if /// the specified element has no children ///The view used is determined by the condition passed to /// the constructor - elements that do not satisfy that condition /// are skipped over public AutomationElement GetLastChild(AutomationElement element) { Misc.ValidateArgumentNonNull(element, "element"); return element.Navigate(NavigateDirection.LastChild, _condition, null); } ////// Get the next sibling of the specified element, in the current view /// /// element to get the next sibling of ///The next sibling of the specified element - or null if the /// specified element has no next sibling ///The view used is determined by the condition passed to /// the constructor - elements that do not satisfy that condition /// are skipped over public AutomationElement GetNextSibling(AutomationElement element) { Misc.ValidateArgumentNonNull(element, "element"); return element.Navigate(NavigateDirection.NextSibling, _condition, null); } ////// Get the previous sibling of the specified element, in the current view /// /// element to get the previous sibling of ///The previous sibling of the specified element - or null if the /// specified element has no previous sibling ///The view used is determined by the condition passed to /// the constructor - elements that do not satisfy that condition /// are skipped over public AutomationElement GetPreviousSibling(AutomationElement element) { Misc.ValidateArgumentNonNull(element, "element"); return element.Navigate(NavigateDirection.PreviousSibling, _condition, null); } ////// Return the element or the nearest ancestor which is present in /// the view of the tree used by this treewalker /// /// element to normalize ///The element or the nearest ancestor which satisfies the /// condition used by this TreeWalker ////// This method starts at the specified element and walks up the /// tree until it finds an element that satisfies the TreeWalker's /// condition. /// /// If the passed-in element itself satsifies the condition, it is /// returned as-is. /// /// If the process of walking up the tree hits the root node, then /// the root node is returned, regardless of whether it satisfies /// the condition or not. /// public AutomationElement Normalize(AutomationElement element) { Misc.ValidateArgumentNonNull(element, "element"); return element.Normalize(_condition, null); } ////// Get the parent of the specified element, in the current view, /// prefetching properties /// /// element to get the parent of /// CacheRequest specifying information to be prefetched ///The parent of the specified element; can be null if /// specified element was the root element ///The view used is determined by the condition passed to /// the constructor - elements that do not satisfy that condition /// are skipped over public AutomationElement GetParent(AutomationElement element, CacheRequest request) { Misc.ValidateArgumentNonNull(element, "element"); Misc.ValidateArgumentNonNull(request, "request"); return element.Navigate(NavigateDirection.Parent, _condition, request); } ////// Get the first child of the specified element, in the current view, /// prefetching properties /// /// element to get the first child of /// CacheRequest specifying information to be prefetched ///The frst child of the specified element - or null if /// the specified element has no children ///The view used is determined by the condition passed to /// the constructor - elements that do not satisfy that condition /// are skipped over public AutomationElement GetFirstChild(AutomationElement element, CacheRequest request) { Misc.ValidateArgumentNonNull(element, "element"); Misc.ValidateArgumentNonNull(request, "request"); return element.Navigate(NavigateDirection.FirstChild, _condition, request); } ////// Get the last child of the specified element, in the current view, /// prefetching properties /// /// element to get the last child of /// CacheRequest specifying information to be prefetched ///The last child of the specified element - or null if /// the specified element has no children ///The view used is determined by the condition passed to /// the constructor - elements that do not satisfy that condition /// are skipped over public AutomationElement GetLastChild(AutomationElement element, CacheRequest request) { Misc.ValidateArgumentNonNull(element, "element"); Misc.ValidateArgumentNonNull(request, "request"); return element.Navigate(NavigateDirection.LastChild, _condition, request); } ////// Get the next sibling of the specified element, in the current view, /// prefetching properties /// /// element to get the next sibling of /// CacheRequest specifying information to be prefetched ///The next sibling of the specified element - or null if the /// specified element has no next sibling ///The view used is determined by the condition passed to /// the constructor - elements that do not satisfy that condition /// are skipped over public AutomationElement GetNextSibling(AutomationElement element, CacheRequest request) { Misc.ValidateArgumentNonNull(element, "element"); Misc.ValidateArgumentNonNull(request, "request"); return element.Navigate(NavigateDirection.NextSibling, _condition, request); } ////// Get the previous sibling of the specified element, in the current view, /// prefetching properties /// /// element to get the previous sibling of /// CacheRequest specifying information to be prefetched ///The previous sibling of the specified element - or null if the /// specified element has no previous sibling ///The view used is determined by the condition passed to /// the constructor - elements that do not satisfy that condition /// are skipped over public AutomationElement GetPreviousSibling(AutomationElement element, CacheRequest request) { Misc.ValidateArgumentNonNull(element, "element"); Misc.ValidateArgumentNonNull(request, "request"); return element.Navigate(NavigateDirection.PreviousSibling, _condition, request); } ////// Return the element or the nearest ancestor which is present in /// the view of the tree used by this treewalker, prefetching properties /// for the returned node /// /// element to normalize /// CacheRequest specifying information to be prefetched ///The element or the nearest ancestor which satisfies the /// condition used by this TreeWalker ////// This method starts at the specified element and walks up the /// tree until it finds an element that satisfies the TreeWalker's /// condition. /// /// If the passed-in element itself satsifies the condition, it is /// returned as-is. /// /// If the process of walking up the tree hits the root node, then /// the root node is returned, regardless of whether it satisfies /// the condition or not. /// public AutomationElement Normalize(AutomationElement element, CacheRequest request) { Misc.ValidateArgumentNonNull(element, "element"); Misc.ValidateArgumentNonNull(request, "request"); return element.Normalize(_condition, request); } #endregion Public Methods //----------------------------------------------------- // // Public Properties // //------------------------------------------------------ #region Public Properties ////// Returns the condition used by this TreeWalker. The TreeWalker /// skips over nodes that do not satisfy the condition. /// public Condition Condition { get { return _condition; } } #endregion Public Properties //----------------------------------------------------- // // Private Fields // //----------------------------------------------------- #region Private Fields private Condition _condition; #endregion Private Fields } } // 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
- ExtensionDataReader.cs
- PersonalizationDictionary.cs
- SafeEventLogWriteHandle.cs
- FileNotFoundException.cs
- MouseGestureConverter.cs
- XmlSchemaAll.cs
- BaseCodePageEncoding.cs
- DiscoveryRequestHandler.cs
- XmlSerializer.cs
- ColumnClickEvent.cs
- SiteMapSection.cs
- BamlTreeUpdater.cs
- VSWCFServiceContractGenerator.cs
- DataGridViewRowPrePaintEventArgs.cs
- ApplicationHost.cs
- ResolvedKeyFrameEntry.cs
- CopyNodeSetAction.cs
- XmlSchemaCompilationSettings.cs
- ContainerSelectorBehavior.cs
- FilteredSchemaElementLookUpTable.cs
- NCryptSafeHandles.cs
- MemoryRecordBuffer.cs
- ReadOnlyCollectionBase.cs
- IntegerCollectionEditor.cs
- IntMinMaxAggregationOperator.cs
- AppDomainFactory.cs
- TcpConnectionPool.cs
- TextEditorTables.cs
- QuaternionKeyFrameCollection.cs
- ColumnBinding.cs
- PeerNameRecord.cs
- tooltip.cs
- StorageSetMapping.cs
- DebugHandleTracker.cs
- Volatile.cs
- LabelDesigner.cs
- GridErrorDlg.cs
- PersonalizationStateInfo.cs
- HttpCachePolicy.cs
- HtmlSelect.cs
- XmlSchemaSimpleTypeRestriction.cs
- DynamicUpdateCommand.cs
- ConfigXmlWhitespace.cs
- xml.cs
- Currency.cs
- InvalidCastException.cs
- SerializationSectionGroup.cs
- FamilyTypeface.cs
- DesignerVerbCollection.cs
- JsonQNameDataContract.cs
- FaultHandlingFilter.cs
- CodeDomConfigurationHandler.cs
- MatrixStack.cs
- CompositeDesignerAccessibleObject.cs
- MemberInfoSerializationHolder.cs
- RestHandler.cs
- StateRuntime.cs
- WebPartEditorCancelVerb.cs
- RegexCode.cs
- InstanceCompleteException.cs
- ServicePointManagerElement.cs
- UInt32Storage.cs
- StrongNamePublicKeyBlob.cs
- SystemIcmpV6Statistics.cs
- WmpBitmapEncoder.cs
- OdbcConnectionHandle.cs
- QualifiedId.cs
- IncrementalHitTester.cs
- StringBuilder.cs
- RC2CryptoServiceProvider.cs
- SmiEventSink_Default.cs
- CapabilitiesAssignment.cs
- InkCanvasSelection.cs
- DataViewManagerListItemTypeDescriptor.cs
- ElementUtil.cs
- WindowsRichEdit.cs
- ADConnectionHelper.cs
- VisualTarget.cs
- XPathArrayIterator.cs
- CodeEventReferenceExpression.cs
- DomNameTable.cs
- Drawing.cs
- ToolStripControlHost.cs
- ObjectKeyFrameCollection.cs
- DictionaryItemsCollection.cs
- ConfigurationManagerHelper.cs
- ProviderSettings.cs
- HostedNamedPipeTransportManager.cs
- PointCollection.cs
- ParameterBuilder.cs
- BaseProcessor.cs
- RightsManagementResourceHelper.cs
- FrameDimension.cs
- SystemIcmpV4Statistics.cs
- MethodBuilder.cs
- DocumentViewerConstants.cs
- AsyncDataRequest.cs
- WpfXamlMember.cs
- DocumentViewer.cs
- SchemaElementDecl.cs