private IMarker GetTargetMarker(NavDestination destination) { if (destination == NavDestination.None || CodeRush.Documents.ActiveTextDocument == null) { return(null); } TextView activeView = CodeRush.Documents.ActiveTextDocument.ActiveView; if (activeView == null) { return(null); } if (destination == NavDestination.Top) { return(CodeRush.Markers.Top); } else { List <IMarker> markers = new List <IMarker>(); LoadOrderedMarkerList(markers); return(FindClosestMarker(markers, destination, activeView.Caret.Line, activeView.Caret.ViewColumn)); } }
protected virtual void OnDestinationChanged(NavController navController, NavDestination navDestination, Bundle bundle) { if (CurrentPage is ITitledElement titledElement) { Toolbar.Title = titledElement.Title; } }
protected override void OnDestinationChanged(NavController navController, NavDestination navDestination, Bundle bundle) { base.OnDestinationChanged(navController, navDestination, bundle); if (ToolbarTracker != null) { ToolbarTracker.Target = CurrentPage; } }
public void OnDestinationChanged(NavController p0, NavDestination p1, Bundle p2) { int navDestinationId = p1.Id; string destination; try { destination = Resources.GetResourceName(navDestinationId); } catch (Android.Content.Res.Resources.NotFoundException) { destination = Convert.ToString(navDestinationId); } Toast.MakeText(this, "Navigated to " + destination, ToastLength.Short).Show(); }
private IMarker FindClosestMarker( List<IMarker> markers, NavDestination destination, int caretLine, int caretColumn ) { IMarker closestMarker = null; if ( markers != null && markers.Count > 0 && destination != NavDestination.None ) { IMarker firstMarker = markers[0]; IMarker lastMarker = markers[markers.Count - 1]; switch ( destination ) { case NavDestination.First: closestMarker = firstMarker; break; case NavDestination.Prev: case NavDestination.Next: if ( destination == NavDestination.Prev ) closestMarker = markers.FindLast( marker => marker.Line < caretLine || (marker.Line == caretLine && marker.Column < caretColumn) ); else closestMarker = markers.Find( marker => marker.Line > caretLine || (marker.Line == caretLine && marker.Column > caretColumn) ); // if no target found and we have only a single marker, that's the new target if ( closestMarker == null && markers.Count == 1 ) { IMarker marker = firstMarker; if ( marker.Line == caretLine && marker.Column == caretColumn ) closestMarker = marker; } // if we allow "rolling over" on prev/next, do so if ( _settings.RollOverOnPrevNext && closestMarker == null ) { if ( destination == NavDestination.Prev ) closestMarker = lastMarker; else if ( destination == NavDestination.Next ) closestMarker = firstMarker; } break; case NavDestination.Last: closestMarker = lastMarker; break; case NavDestination.Top: closestMarker = CodeRush.Markers.Top; break; } } return closestMarker; }
private void GetMarkerActionProperties(DevExpress.CodeRush.Core.Action action, out NavDestination destination, out bool collect) { if ( action == MarkerFirstAction || action == MarkerCollectFirstAction ) destination = NavDestination.First; else if ( action == MarkerPrevAction || action == MarkerCollectPrevAction ) destination = NavDestination.Prev; else if ( action == MarkerNextAction || action == MarkerCollectNextAction ) destination = NavDestination.Next; else if ( action == MarkerLastAction || action == MarkerCollectLastAction ) destination = NavDestination.Last; else if ( action == MarkerCollectAtCaretAction ) destination = NavDestination.AtCaret; else if ( action == MarkerStackTopAction ) destination = NavDestination.StackTop; else if ( action == MarkerStackBottomAction ) destination = NavDestination.StackBottom; else destination = NavDestination.None; collect = action == MarkerCollectFirstAction || action == MarkerCollectPrevAction || action == MarkerCollectNextAction || action == MarkerCollectLastAction || action == MarkerCollectAtCaretAction; }
void NavController.IOnDestinationChangedListener.OnDestinationChanged( NavController p0, NavDestination p1, Bundle p2) { _stackNavigationManager.OnDestinationChanged(p0, p1, p2); }
protected virtual void OnDestinationChanged(NavController navController, NavDestination navDestination, Bundle bundle) { }
private IMarker GetTargetMarker(NavDestination destination) { if ( destination == NavDestination.None || CodeRush.Documents.ActiveTextDocument == null ) return null; TextView activeView = CodeRush.Documents.ActiveTextDocument.ActiveView; if ( activeView == null ) return null; var markers = new List<IMarker>(); LoadMarkerList(markers, _settings.SkipSelectionMarkers); if ( markers.Count == 0 ) return null; // all non-stack operations require the marker list to be in document order if ( destination != NavDestination.StackTop && destination != NavDestination.StackBottom ) SortMarkerListInDocumentOrder(markers); IMarker closestMarker = null; IMarker firstMarker = markers[0]; IMarker lastMarker = markers[markers.Count - 1]; int caretLine = activeView.Caret.Line; int caretColumn = activeView.Caret.ViewColumn; switch ( destination ) { case NavDestination.First: case NavDestination.StackBottom: closestMarker = firstMarker; break; case NavDestination.Prev: case NavDestination.Next: if ( destination == NavDestination.Prev ) closestMarker = markers.FindLast(marker => marker.Line < caretLine || (marker.Line == caretLine && marker.Column < caretColumn)); else closestMarker = markers.Find(marker => marker.Line > caretLine || (marker.Line == caretLine && marker.Column > caretColumn)); // if no target found and we have only a single marker, that's the new target if ( closestMarker == null && markers.Count == 1 ) { IMarker marker = firstMarker; if ( marker.Line == caretLine && marker.Column == caretColumn ) closestMarker = marker; } // if we allow "rolling over" on prev/next, do so if ( _settings.RollOverOnPrevNext && closestMarker == null ) { if ( destination == NavDestination.Prev ) closestMarker = lastMarker; else if ( destination == NavDestination.Next ) closestMarker = firstMarker; } break; case NavDestination.Last: case NavDestination.StackTop: closestMarker = lastMarker; break; case NavDestination.AtCaret: closestMarker = markers.FindLast(marker => marker.Line == caretLine && marker.Column == caretColumn); break; } return closestMarker; }
private void GetMarkerActionProperties(DevExpress.CodeRush.Core.Action action, out NavDestination destination, out bool collect) { if (action == MarkerFirstAction || action == MarkerCollectFirstAction) { destination = NavDestination.First; } else if (action == MarkerPrevAction || action == MarkerCollectPrevAction) { destination = NavDestination.Prev; } else if (action == MarkerNextAction || action == MarkerCollectNextAction) { destination = NavDestination.Next; } else if (action == MarkerLastAction || action == MarkerCollectLastAction) { destination = NavDestination.Last; } else if (action == MarkerCollectAtCaretAction) { destination = NavDestination.AtCaret; } else if (action == MarkerStackTopAction) { destination = NavDestination.StackTop; } else if (action == MarkerStackBottomAction) { destination = NavDestination.StackBottom; } else { destination = NavDestination.None; } collect = action == MarkerCollectFirstAction || action == MarkerCollectPrevAction || action == MarkerCollectNextAction || action == MarkerCollectLastAction || action == MarkerCollectAtCaretAction; }
private IMarker GetTargetMarker(NavDestination destination) { if (destination == NavDestination.None || CodeRush.Documents.ActiveTextDocument == null) { return(null); } TextView activeView = CodeRush.Documents.ActiveTextDocument.ActiveView; if (activeView == null) { return(null); } var markers = new List <IMarker>(); LoadMarkerList(markers, _settings.SkipSelectionMarkers); if (markers.Count == 0) { return(null); } // all non-stack operations require the marker list to be in document order if (destination != NavDestination.StackTop && destination != NavDestination.StackBottom) { SortMarkerListInDocumentOrder(markers); } IMarker closestMarker = null; IMarker firstMarker = markers[0]; IMarker lastMarker = markers[markers.Count - 1]; int caretLine = activeView.Caret.Line; int caretColumn = activeView.Caret.ViewColumn; switch (destination) { case NavDestination.First: case NavDestination.StackBottom: closestMarker = firstMarker; break; case NavDestination.Prev: case NavDestination.Next: if (destination == NavDestination.Prev) { closestMarker = markers.FindLast(marker => marker.Line < caretLine || (marker.Line == caretLine && marker.Column < caretColumn)); } else { closestMarker = markers.Find(marker => marker.Line > caretLine || (marker.Line == caretLine && marker.Column > caretColumn)); } // if no target found and we have only a single marker, that's the new target if (closestMarker == null && markers.Count == 1) { IMarker marker = firstMarker; if (marker.Line == caretLine && marker.Column == caretColumn) { closestMarker = marker; } } // if we allow "rolling over" on prev/next, do so if (_settings.RollOverOnPrevNext && closestMarker == null) { if (destination == NavDestination.Prev) { closestMarker = lastMarker; } else if (destination == NavDestination.Next) { closestMarker = firstMarker; } } break; case NavDestination.Last: case NavDestination.StackTop: closestMarker = lastMarker; break; case NavDestination.AtCaret: closestMarker = markers.FindLast(marker => marker.Line == caretLine && marker.Column == caretColumn); break; } return(closestMarker); }
private IMarker GetTargetMarker( NavDestination destination ) { if ( destination == NavDestination.None || CodeRush.Documents.ActiveTextDocument == null ) return null; TextView activeView = CodeRush.Documents.ActiveTextDocument.ActiveView; if ( activeView == null ) return null; if ( destination == NavDestination.Top ) return CodeRush.Markers.Top; else { List<IMarker> markers = new List<IMarker>(); LoadOrderedMarkerList( markers ); return FindClosestMarker( markers, destination, activeView.Caret.Line, activeView.Caret.ViewColumn ); } }
private IMarker FindClosestMarker(List <IMarker> markers, NavDestination destination, int caretLine, int caretColumn) { IMarker closestMarker = null; if (markers != null && markers.Count > 0 && destination != NavDestination.None) { IMarker firstMarker = markers[0]; IMarker lastMarker = markers[markers.Count - 1]; switch (destination) { case NavDestination.First: closestMarker = firstMarker; break; case NavDestination.Prev: case NavDestination.Next: if (destination == NavDestination.Prev) { closestMarker = markers.FindLast(marker => marker.Line < caretLine || (marker.Line == caretLine && marker.Column < caretColumn)); } else { closestMarker = markers.Find(marker => marker.Line > caretLine || (marker.Line == caretLine && marker.Column > caretColumn)); } // if no target found and we have only a single marker, that's the new target if (closestMarker == null && markers.Count == 1) { IMarker marker = firstMarker; if (marker.Line == caretLine && marker.Column == caretColumn) { closestMarker = marker; } } // if we allow "rolling over" on prev/next, do so if (_settings.RollOverOnPrevNext && closestMarker == null) { if (destination == NavDestination.Prev) { closestMarker = lastMarker; } else if (destination == NavDestination.Next) { closestMarker = firstMarker; } } break; case NavDestination.Last: closestMarker = lastMarker; break; case NavDestination.Top: closestMarker = CodeRush.Markers.Top; break; } } return(closestMarker); }