/// <remarks>from another grid</remarks> public void Navigate(NavigateDirection direction, int elementLineIndex) { //Console.WriteLine("Navigating to {0} with line index {1}", direction, elementLineIndex); int nextElementIndex; switch (direction) { case NavigateDirection.Left: nextElementIndex = elementLineIndex * 3 + 2; break; case NavigateDirection.Right: nextElementIndex = elementLineIndex * 3; break; case NavigateDirection.Up: nextElementIndex = 6 + elementLineIndex; break; case NavigateDirection.Down: nextElementIndex = elementLineIndex; break; default: throw new NotImplementedException(); } //Console.WriteLine("Next element index: {0}", nextElementIndex); var elementNavigation = this.elementNavigations[nextElementIndex]; elementNavigation.Navigate(); this.elementIndex = nextElementIndex; }
/// <summary> /// check whether next element is within current grid. /// </summary> /// <remarks>from self</remarks> public bool CanNavigate(NavigateDirection direction) { var elementIndex = this.elementIndex; if (elementIndex == 4) { return(true); } switch (direction) { case NavigateDirection.Left: return(elementIndex % 3 != 0); case NavigateDirection.Right: return(elementIndex % 3 != 2); case NavigateDirection.Up: return(elementIndex / 3 != 0); case NavigateDirection.Down: return(elementIndex / 3 != 2); default: throw new NotImplementedException(); } }
// </Snippet101> // <Snippet103> /// <summary> /// Navigate to adjacent elements in the automation tree. /// </summary> /// <param name="direction">Direction to navigate.</param> /// <returns>The element in that direction, or null.</returns> /// <remarks> /// parentControl is the provider for the list box. /// parentItems is the collection of list item providers. /// </remarks> public IRawElementProviderFragment Navigate(NavigateDirection direction) { int myIndex = parentItems.IndexOf(this); if (direction == NavigateDirection.Parent) { return((IRawElementProviderFragment)parentControl); } else if (direction == NavigateDirection.NextSibling) { if (myIndex < parentItems.Count - 1) { return((IRawElementProviderFragment)parentItems[myIndex + 1]); } else { return(null); } } else if (direction == NavigateDirection.PreviousSibling) { if (myIndex > 0) { return((IRawElementProviderFragment)parentItems[myIndex - 1]); } else { return(null); } } else { return(null); } }
public IRawElementProviderFragment Navigate(NavigateDirection direction) { // The GardenThings have no child UIA elements. if (direction == NavigateDirection.Parent) { return(this.parent); } else if (direction == NavigateDirection.PreviousSibling) { if (this.subItemIndex > 0) { return(this.parent.GardenThings[this.subItemIndex - 1]); } } else if (direction == NavigateDirection.NextSibling) { if (this.subItemIndex < this.parent.GardenThings.Count - 1) { return(this.parent.GardenThings[this.subItemIndex + 1]); } } return(null); }
public void Navigate(NavigateDirection direction) { var currentGridIndex = this.currentGridIndex; //Console.WriteLine("Current Grid Index: {0}", currentGridIndex); var currentGridNavigation = gridNavigations[currentGridIndex]; //Console.WriteLine("Navigating to {0} test", direction, currentGridIndex); if (currentGridNavigation.CanNavigate(direction)) { //Console.WriteLine("Passed"); currentGridNavigation.Navigate(direction); } else { var currentElementIndex = currentGridNavigation.CurrentElementIndex; //Console.WriteLine("Failed"); currentGridNavigation.Leave(); var gridIndex = currentGridIndex; var elementLineIndex = getElementLineIndex(currentElementIndex, direction); //gridIndex -> nextGirdIndex, elementLineIndex -> nextElementLineIndex getNextPosition81(ref gridIndex, ref elementLineIndex, direction); var nextGridNavigation = gridNavigations[gridIndex]; //Console.WriteLine("Navigating to grid {0}", gridIndex); nextGridNavigation.Navigate(direction, elementLineIndex); this.currentGridIndex = gridIndex; } }
public static void MoveTrackBall(ChartTrackBallBehavior behav, NavigateDirection direction) { var chart = (RadCartesianChart)behav.Chart; object currentXCategory = null; if (chart.PlotAreaClip.X <= behav.Position.X && behav.Position.X <= chart.PlotAreaClip.Right) { currentXCategory = chart.ConvertPointToData(behav.Position).FirstValue; } Func <int, int> next = GetPositionXFunction(direction); object adjacentXCategory = null; int startX = GetCoercedPositionX(behav); for (int x = startX; chart.PlotAreaClip.X <= x && x <= chart.PlotAreaClip.Right; x = next(x)) { DataTuple tuple = chart.ConvertPointToData(new Point(x, 0)); if (!object.Equals(currentXCategory, tuple.FirstValue)) { adjacentXCategory = tuple.FirstValue; break; } } var adjacentPosition = chart.ConvertDataToPoint(new DataTuple(adjacentXCategory, null)); adjacentPosition.Y = behav.Chart.ActualHeight / 2; behav.Position = adjacentPosition; }
public override IRawElementProviderFragment Navigate (NavigateDirection direction) { if (direction == NavigateDirection.Parent) { // TODO: Review this // "Fragment roots do not enable navigation to // a parent or siblings; navigation among fragment // roots is handled by the default window providers." // Source: http://msdn.microsoft.com/en-us/library/system.windows.automation.provider.irawelementproviderfragment.navigate.aspx // if (Provider is FragmentRootControlProvider) // return Provider.FragmentRoot; if (parentNavigation == null) return Provider.FragmentRoot; else return parentNavigation.Provider; } else if (direction == NavigateDirection.FirstChild) return chain.First == null ? null : chain.First.Value.Provider; else if (direction == NavigateDirection.LastChild) return chain.Last == null ? null : chain.Last.Value.Provider; else if (direction == NavigateDirection.NextSibling && parentNavigation != null) return parentNavigation.GetNextExplicitSiblingProvider (this); else if (direction == NavigateDirection.PreviousSibling && parentNavigation != null) return parentNavigation.GetPreviousExplicitSiblingProvider (this); else return null; }
public static void MoveTrackBall(ChartTrackBallBehavior behav, NavigateDirection direction) { var chart = (RadCartesianChart)behav.Chart; object currentXCategory = null; if (chart.PlotAreaClip.X <= behav.Position.X && behav.Position.X <= chart.PlotAreaClip.Right) { currentXCategory = chart.ConvertPointToData(behav.Position).FirstValue; } Func<int, int> next = GetPositionXFunction(direction); object adjacentXCategory = null; int startX = GetCoercedPositionX(behav); for (int x = startX; chart.PlotAreaClip.X <= x && x <= chart.PlotAreaClip.Right; x = next(x)) { DataTuple tuple = chart.ConvertPointToData(new Point(x, 0)); if (!object.Equals(currentXCategory, tuple.FirstValue)) { adjacentXCategory = tuple.FirstValue; break; } } var adjacentPosition = chart.ConvertDataToPoint(new DataTuple(adjacentXCategory, null)); adjacentPosition.Y = behav.Chart.ActualHeight / 2; behav.Position = adjacentPosition; }
public IRawElementProviderFragment Navigate(NavigateDirection direction) { switch (direction) { case NavigateDirection.Parent: // TODO: Review this // "Fragment roots do not enable navigation to // a parent or siblings; navigation among fragment // roots is handled by the default window providers." // Source: http://msdn.microsoft.com/en-us/library/system.windows.automation.provider.irawelementproviderfragment.navigate.aspx return(((IRawElementProviderFragment)Parent) ?? Provider.FragmentRoot); case NavigateDirection.FirstChild: return(_firstChild); case NavigateDirection.LastChild: return(_lastChild); case NavigateDirection.NextSibling: return(_nextProvider); case NavigateDirection.PreviousSibling: return(_previousProvider); default: return(null); } }
public void ItIsAwareOfItsSurroundings(NavigateDirection whichWay) { var expectedSurrounding = GetMockChild(); _automationProvider.Set(whichWay, expectedSurrounding.Object); _automationProvider.Navigate(whichWay) .Should().BeSameAs(expectedSurrounding.Object); }
public override IRawElementProviderFragment Navigate(NavigateDirection direction) { if (direction == NavigateDirection.FirstChild || direction == NavigateDirection.LastChild) { UpdateCustomProvidersChildrenStructure(); } return(base.Navigate(direction)); }
public virtual void OnNavigationRequested(NavigateDirection direction) { var navigationRequested = this.NavigationRequested; if (navigationRequested != null) { navigationRequested(this, direction); } }
public virtual void OnDeleteRequested(NavigateDirection direction) { var deleteRequested = this.DeleteRequested; if (deleteRequested != null) { deleteRequested(this, direction); } }
IRawElementProviderFragment IRawElementProviderFragment.Navigate(NavigateDirection direction) { if (direction == NavigateDirection.Parent) { return((IRawElementProviderFragment)_parent.ProviderFromPeer(_parent)); } return(null); }
protected override void OnNavigatedTo(NavigateDirection direction, object parameter) { base.OnNavigatedTo(direction, parameter); WaitingForAgent = false; // reset status to false however we get here Error = string.Empty; MeetingJoined = false; RequestInProgress = false; ConnectedToMeeting = false; }
public NavigateToHighlightedReferenceCommandArgs(ITextView textView, ITextBuffer subjectBuffer, NavigateDirection direction) : base(textView, subjectBuffer) { if (!Enum.IsDefined(typeof(NavigateDirection), direction)) { throw new ArgumentException("direction"); } _direction = direction; }
protected override void OnNavigatedTo(NavigateDirection direction, object parameter) { base.OnNavigatedTo(direction, parameter); if (direction == NavigateDirection.Forward) { Meeting = (MeetingViewModel)parameter; Meeting.Annotations = new ClientAnnotationViewModel(_sharedDataService, Meeting); } }
// IRawElementProviderFragment methods... public IRawElementProviderFragment Navigate(NavigateDirection direction) { AutomationPeer peer = Peer; if (peer == null) { return(null); } return((IRawElementProviderFragment)ElementUtil.Invoke(peer, new DispatcherOperationCallback(InContextNavigate), direction)); }
public IRawElementProviderFragment Navigate(NavigateDirection direction) { IRawElementProviderFragment connection = null; if (connections.TryGetValue(direction, out connection)) { return(connection); } return(null); }
// Return proxy representing element in specified direction (parent/next/firstchild/etc.) private object InContextNavigate(object arg) { NavigateDirection direction = (NavigateDirection)arg; AutomationPeer dest; AutomationPeer peer = Peer; if (peer == null) { return(null); } switch (direction) { case NavigateDirection.Parent: dest = peer.GetParent(); break; case NavigateDirection.FirstChild: if (!peer.IsInteropPeer) { dest = peer.GetFirstChild(); } else { return(peer.GetInteropChild()); } break; case NavigateDirection.LastChild: if (!peer.IsInteropPeer) { dest = peer.GetLastChild(); } else { return(peer.GetInteropChild()); } break; case NavigateDirection.NextSibling: dest = peer.GetNextSibling(); break; case NavigateDirection.PreviousSibling: dest = peer.GetPreviousSibling(); break; default: dest = null; break; } return(StaticWrap(dest, peer)); }
protected override void OnNavigatedTo(NavigateDirection direction, object parameter) { if (direction == NavigateDirection.Forward) { Meeting = (MeetingViewModel)parameter; Meeting.Annotations = new AgentAnnotationViewModel(_sharedDataService, Meeting); _agentConnection.ObserveRoom(Meeting.Id); } NavigationPane.IsToolLibraryButtonHidden = false; NavigationPane.IsUpcomingMeetingsButtonHidden = false; }
public virtual IRawElementProviderFragment Navigate(NavigateDirection direction) { if (direction == NavigateDirection.Parent) { return(Root); } else { return(null); } }
public override IRawElementProviderFragment Navigate(NavigateDirection direction) { if (direction == NavigateDirection.FirstChild || direction == NavigateDirection.LastChild) { return(Child); } else { return(null); } }
private async Task AssertPosition(string fileContent, NavigateDirection navigateDirection) { var fileContentNoPercentMarker = TestHelpers.RemovePercentMarker(fileContent); var workspace = await TestHelpers.CreateSimpleWorkspace(fileContentNoPercentMarker, "test.cs"); var finalCursorLineColumn = TestHelpers.GetLineAndColumnFromPercent(TestHelpers.RemoveDollarMarker(fileContent)); var response = await SendRequest(workspace, "test.cs", fileContentNoPercentMarker, navigateDirection); Assert.Equal(finalCursorLineColumn.Line, response.Line); Assert.Equal(finalCursorLineColumn.Column, response.Column); }
IRawElementProviderFragment IRawElementProviderFragment.Navigate(NavigateDirection direction) { if (direction == NavigateDirection.Parent) { return((IRawElementProviderFragment)ItemContainingGrid); } else { return(null); }; }
/// <summary> /// Navigates to adjacent elements in the UI Automation tree. /// </summary> /// <param name="direction">Direction of navigation.</param> /// <returns>The element in that direction, or null.</returns> /// <remarks>The provider only returns directions that it is responsible for. /// UI Automation knows how to navigate between HWNDs, so only the custom item /// navigation needs to be provided. ///</remarks> IRawElementProviderFragment IRawElementProviderFragment.Navigate(NavigateDirection direction) { if (direction == NavigateDirection.FirstChild) { return(GetProviderForIndex(0)); } else if (direction == NavigateDirection.LastChild) { return(GetProviderForIndex(OwnerListControl.ItemCount - 1)); } return(null); }
private void OnNavigate(NavigateDirection obj) { if (_navigationEnabled) { Selectable newObj = FindSelectableInDirection(dir: obj); if (newObj) { _currentlySelected.targetGraphic.color = _currentlySelected.colors.normalColor; Select(obj: newObj); } } }
// Routing function for going to neighboring elements. We implemented // this to delegate to other virtual functions, so don't override it. public IRawElementProviderFragment Navigate(NavigateDirection direction) { switch (direction) { case NavigateDirection.NavigateDirection_Parent: return parent; case NavigateDirection.NavigateDirection_FirstChild: return GetFirstChild(); case NavigateDirection.NavigateDirection_LastChild: return GetLastChild(); case NavigateDirection.NavigateDirection_NextSibling: return GetNextSibling(); case NavigateDirection.NavigateDirection_PreviousSibling: return GetPreviousSibling(); } return null; }
internal override IRawElementProviderFragment?FragmentNavigate(NavigateDirection direction) { if (!_owningTabControl.IsHandleCreated) { return(null); } return(direction switch { NavigateDirection.FirstChild => _owningTabControl.SelectedTab?.AccessibilityObject, NavigateDirection.LastChild => _owningTabControl.TabPages.Count > 0 ? _owningTabControl.TabPages[^ 1].TabAccessibilityObject
public static AutomationPeer Navigate(this AutomationPeer peer, NavigateDirection direction) { List <AutomationPeer> children = null; if (direction == NavigateDirection.FirstChild || direction == NavigateDirection.LastChild) { children = peer.GetChildren(); if (children == null || children.Count == 0) { return(null); } if (direction == NavigateDirection.FirstChild) { return(children [0]); } return(children [children.Count - 1]); } var parent = peer.GetParent(); if (direction == NavigateDirection.Parent || parent == null) { return(parent); } children = parent.GetChildren(); if (children == null) { return(null); } AutomationPeer previous = null; AutomationPeer current = null; foreach (AutomationPeer child in children) { previous = current; current = child; if (child == peer && direction == NavigateDirection.PreviousSibling) { return(previous); } if (previous == peer && direction == NavigateDirection.NextSibling) { return(current); } } return(null); }
IRawElementProviderFragment IRawElementProviderFragment.Navigate(NavigateDirection direction) { if (direction == NavigateDirection.FirstChild) { // Return the provider that is the sole child of this one. return((IRawElementProviderFragment)gridItems[0, 0]); } else { return(null); }; }
// <Snippet105> IRawElementProviderFragment IRawElementProviderFragment.Navigate(NavigateDirection direction) { if ((direction == NavigateDirection.FirstChild) || (direction == NavigateDirection.LastChild)) { // Return the provider that is the sole child of this one. return((IRawElementProviderFragment)ChildControl); } else { return(null); }; }
internal override IRawElementProviderFragment?FragmentNavigate(NavigateDirection direction) { if (!OwningScrollBar.IsHandleCreated) { return(null); } return(direction switch { NavigateDirection.PreviousSibling => IsDisplayed ? ParentInternal.ThumbAccessibleObject: null, NavigateDirection.NextSibling => IsDisplayed ? ParentInternal.LastLineButtonAccessibleObject : null, _ => base.FragmentNavigate(direction) });
public static AutomationPeer Navigate (this AutomationPeer peer, NavigateDirection direction) { List<AutomationPeer> children = null; if (direction == NavigateDirection.FirstChild || direction == NavigateDirection.LastChild) { children = peer.GetChildren (); if (children == null || children.Count == 0) return null; if (direction == NavigateDirection.FirstChild) return children [0]; return children [children.Count - 1]; } var parent = peer.GetParent (); if (direction == NavigateDirection.Parent || parent == null) return parent; children = parent.GetChildren (); if (children == null) return null; AutomationPeer previous = null; AutomationPeer current = null; foreach (AutomationPeer child in children) { previous = current; current = child; if (child == peer && direction == NavigateDirection.PreviousSibling) return previous; if (previous == peer && direction == NavigateDirection.NextSibling) return current; } return null; }
private async Task AssertPosition(string fileContent, NavigateDirection navigateDirection) { var fileContentNoPercentMarker = TestHelpers.RemovePercentMarker(fileContent); var workspace = TestHelpers.CreateSimpleWorkspace(fileContentNoPercentMarker, "test.cs"); var response = await SendRequest(workspace, "test.cs", fileContentNoPercentMarker, navigateDirection); var finalCursorLineColumn = TestHelpers.GetLineAndColumnFromPercent(TestHelpers.RemoveDollarMarker(fileContent)); Assert.Equal(finalCursorLineColumn.Line, response.Line); Assert.Equal(finalCursorLineColumn.Column, response.Column); }
void IScreenViewModel.OnNavigatedTo(NavigateDirection direction, object parameter) { IsActive = true; OnNavigatedTo(direction, parameter); }
IRawElementProviderFragment IRawElementProviderFragment.Navigate(NavigateDirection direction) { switch (direction) { case NavigateDirection.FirstChild: return _controls[0].AutomationPeer; case NavigateDirection.LastChild: return _controls[_controls.Count - 1].AutomationPeer; } return null; }
/// <summary> /// Retrieves the UI Automation element in a specified direction within the tree. /// </summary> /// <param name="direction">The direction in which to navigate.</param> /// <returns> /// The element in the specified direction, or null if there is no element in that direction /// </returns> IRawElementProviderFragment IRawElementProviderFragment.Navigate(NavigateDirection direction) { switch (direction) { case NavigateDirection.FirstChild: if (_row.HeaderCell.Visible) return new AutomationDataGridViewHeaderCell(_grid, this, _row.HeaderCell); else return new AutomationDataGridViewCell(_grid, this, _row.Cells.OfType<DataGridViewCell>().Where(o => o.Visible).OrderBy(o => o.OwningColumn.DisplayIndex).First()); case NavigateDirection.LastChild: return new AutomationDataGridViewCell(_grid, this, _row.Cells.OfType<DataGridViewCell>().Where(o => o.Visible).OrderByDescending(o => o.OwningColumn.DisplayIndex).First()); case NavigateDirection.NextSibling: if (_row.Index < _grid.Rows.Count - 1) { return new AutomationDataGridViewRow(_grid, _grid.Rows[_row.Index + 1]); } break; case NavigateDirection.PreviousSibling: if (_row.Index > 0) { return new AutomationDataGridViewRow(_grid, _grid.Rows[_row.Index - 1]); } break; case NavigateDirection.Parent: return _grid; } return null; }
public IRawElementProviderFragment Navigate(NavigateDirection direction) { switch (direction) { case NavigateDirection.NextSibling: return nextHeaderCell(); case NavigateDirection.PreviousSibling: return previousHeaderCell(); case NavigateDirection.Parent: return _parent; } return null; }
/// <summary> /// Navigates the browser the specified direction. /// </summary> /// <param name="navigationDirection">The navigation direction.</param> public abstract void Navigate(NavigateDirection navigationDirection);
IRawElementProviderFragment IRawElementProviderFragment.Navigate(NavigateDirection direction) { HwndProxyElementProvider dest = null; switch (direction) { case NavigateDirection.Parent: dest = GetParent(); break; case NavigateDirection.FirstChild: dest = GetFirstChild(); break; case NavigateDirection.LastChild: dest = GetLastChild(); break; case NavigateDirection.NextSibling: dest = GetNextSibling(); break; case NavigateDirection.PreviousSibling: dest = GetPreviousSibling(); break; } return dest; }
/// <SecurityNote> /// TreatAsSafe - The reason this method can be treated as safe is because it yeilds information /// about the parent provider which can even otherwise be obtained by using public APIs such /// as UIElement.OnCreateAutomationPeer and AutomationProvider.ProviderFromPeer. /// </SecurityNote> IRawElementProviderFragment IRawElementProviderFragment.Navigate(NavigateDirection direction) { if (direction == NavigateDirection.Parent) { return (IRawElementProviderFragment)_parent.ProviderFromPeer(_parent); } return null; }
public void SetConnection (IRawElementProviderFragment provider, NavigateDirection direction) { connections [direction] = provider; }
public IRawElementProviderFragment Navigate (NavigateDirection direction) { IRawElementProviderFragment connection = null; if (connections.TryGetValue (direction, out connection)) return connection; return null; }
// IRawElementProviderFragment methods... public IRawElementProviderFragment Navigate( NavigateDirection direction ) { AutomationPeer peer = Peer; if (peer == null) { return null; } return (IRawElementProviderFragment)ElementUtil.Invoke(peer, new DispatcherOperationCallback(InContextNavigate), direction); }
public IRawElementProviderFragment Navigate(NavigateDirection direction) { return null; }
// Request to return the element in the specified direction // ProxySimple object are leaf so it returns null except for the parent IRawElementProviderFragment IRawElementProviderFragment.Navigate(NavigateDirection direction) { System.Diagnostics.Debug.Assert(_parent != null, "Navigate: Leaf element does not have parent"); switch (direction) { case NavigateDirection.Parent: { return GetParent(); } case NavigateDirection.NextSibling: { // NOTE: Do not use GetParent(), call _parent explicitly return _parent.GetNextSibling(this); } case NavigateDirection.PreviousSibling: { // NOTE: Do not use GetParent(), call _parent explicitly return _parent.GetPreviousSibling(this); } } return null; }
private async Task<NavigateResponse> SendRequest(OmnisharpWorkspace workspace, string fileName, string fileContent, NavigateDirection upOrDown) { var initialCursorLineColumn = TestHelpers.GetLineAndColumnFromDollar(TestHelpers.RemovePercentMarker(fileContent)); var fileContentNoDollarMarker = TestHelpers.RemoveDollarMarker(fileContent); var naviagteUpService = new NavigateUpService(workspace); var navigateDownService = new NavigateDownService(workspace); if (upOrDown == NavigateDirection.UP) { var request = new NavigateUpRequest { Line = initialCursorLineColumn.Line, Column = initialCursorLineColumn.Column, FileName = fileName, Buffer = fileContentNoDollarMarker }; return await naviagteUpService.Handle(request); } else { var request = new NavigateDownRequest { Line = initialCursorLineColumn.Line, Column = initialCursorLineColumn.Column, FileName = fileName, Buffer = fileContentNoDollarMarker }; return await navigateDownService.Handle(request); } }
/// <summary> /// Retrieves the UI Automation element in a specified direction within the tree. /// </summary> /// <param name="direction">The direction in which to navigate.</param> /// <returns> /// The element in the specified direction, or null if there is no element in that direction /// </returns> IRawElementProviderFragment IRawElementProviderFragment.Navigate(NavigateDirection direction) { switch (direction) { case NavigateDirection.FirstChild: return new AutomationDataGridViewHeaderCell(_grid, this, _grid.Columns.OfType<DataGridViewColumn>().Where(o => o.Visible).OrderBy(o => o.DisplayIndex).First().HeaderCell); case NavigateDirection.LastChild: return new AutomationDataGridViewHeaderCell(_grid, this, _grid.Columns.OfType<DataGridViewColumn>().Where(o => o.Visible).OrderByDescending(o => o.DisplayIndex).First().HeaderCell); case NavigateDirection.NextSibling: if (_grid.RowCount > 0) return new AutomationDataGridViewRow(_grid, _grid.Rows[0]); break; case NavigateDirection.Parent: return _grid; } return null; }
public GoToAdjacentMemberCommandArgs(ITextView textView, ITextBuffer subjectBuffer, NavigateDirection direction) : base(textView, subjectBuffer) { Direction = direction; }
/// <summary> /// Retrieves the UI Automation element in a specified direction within the tree. /// </summary> /// <param name="direction">The direction in which to navigate.</param> /// <returns> /// The element in the specified direction, or null if there is no element in that direction /// </returns> IRawElementProviderFragment IRawElementProviderFragment.Navigate(NavigateDirection direction) { if (this.Rows.Count > 0) { switch (direction) { case NavigateDirection.FirstChild: return new AutomationDataGridViewHeaderRow(this); case NavigateDirection.LastChild: return new AutomationDataGridViewRow(this, Rows[Rows.Count - 1]); } } return null; }
// Request to return the element in the specified direction IRawElementProviderFragment IRawElementProviderFragment.Navigate(NavigateDirection direction) { switch (direction) { case NavigateDirection.NextSibling : { // NOTE: Do not use GetParent(), call _parent explicitly return _fSubTree ? _parent.GetNextSibling (this) : null; } case NavigateDirection.PreviousSibling : { // NOTE: Do not use GetParent(), call _parent explicitly return _fSubTree ? _parent.GetPreviousSibling (this) : null; } case NavigateDirection.FirstChild : { return GetFirstChild (); } case NavigateDirection.LastChild : { return GetLastChild (); } case NavigateDirection.Parent : { return GetParent (); } default : { return null; } } }
/// <summary> /// Retrieves the UI Automation element in a specified direction within the tree. /// </summary> /// <param name="direction">The direction in which to navigate.</param> /// <returns> /// The element in the specified direction, or null if there is no element in that direction /// </returns> IRawElementProviderFragment IRawElementProviderFragment.Navigate(NavigateDirection direction) { switch (direction) { case NavigateDirection.NextSibling: return nextCell(); case NavigateDirection.PreviousSibling: return previousCell(); case NavigateDirection.Parent: return _row; } return null; }
IRawElementProviderFragment IRawElementProviderFragment.Navigate(NavigateDirection direction) { if (NavigateHandler != null) { var peer = NavigateHandler(direction); if (peer != null) return peer; if (direction == NavigateDirection.Parent && GetFragmentRoot != null) { return GetFragmentRoot(); } } return null; }
// Called by the treewalker classes to navigate - we call through to the // provider wrapper, which gets the navigator code to do its stuff internal AutomationElement Navigate(NavigateDirection direction, Condition condition, CacheRequest request) { CheckElement(); UiaCoreApi.UiaCacheRequest cacheRequest; if (request == null) cacheRequest = CacheRequest.DefaultUiaCacheRequest; else cacheRequest = request.GetUiaCacheRequest(); UiaCoreApi.UiaCacheResponse response = UiaCoreApi.UiaNavigate(_hnode, direction, condition, cacheRequest); return CacheHelper.BuildAutomationElementsFromResponse(cacheRequest, response); }
//------------------------------------------------------ // // Interface IRawElementProviderFragment // //------------------------------------------------------ #region IRawElementProviderFragment IRawElementProviderFragment IRawElementProviderFragment.Navigate(NavigateDirection direction) { //Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "{0} IRawElementProviderFragment.Navigate {1}", this, direction)); MsaaNativeProvider rval = null; switch (direction) { case NavigateDirection.NextSibling: rval = GetNextSibling(); break; case NavigateDirection.PreviousSibling: rval = GetPreviousSibling(); break; case NavigateDirection.FirstChild: rval = GetFirstChild(); break; case NavigateDirection.LastChild: rval = GetLastChild(); break; case NavigateDirection.Parent: rval = IsRoot ? null : Parent; break; default: Debug.Assert(false); break; } return rval; }
private async Task<NavigateResponse> SendRequest(OmnisharpWorkspace workspace, string fileName, string fileContent, NavigateDirection upOrDown) { var initialCursorLineColumn = TestHelpers.GetLineAndColumnFromDollar(TestHelpers.RemovePercentMarker(fileContent)); var fileContentNoDollarMarker = TestHelpers.RemoveDollarMarker(fileContent); var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions()); var request = new Request { Line = initialCursorLineColumn.Line, Column = initialCursorLineColumn.Column, FileName = fileName, Buffer = fileContentNoDollarMarker }; if (upOrDown == NavigateDirection.UP) { return await controller.NavigateUp(request); } else { return await controller.NavigateDown(request); } }