public void Init() { int line = 3; p1 = new TestNavigationPoint("test1.cs", line); p2 = new TestNavigationPoint("test2.cs", line + 2); }
public void Init() { int line = 3; p1 = new TestNavigationPoint("test1.cs", line); p2 = new TestNavigationPoint("test2.cs", line+2); }
/// <summary> /// Adds an <see cref="INavigationPoint"/> to the history. /// </summary> /// <param name="pointToLog">The point to store.</param> public static void Log(INavigationPoint pointToLog) { if (loggingSuspendedCount > 0) { return; } LogInternal(pointToLog); }
public void NavHistoryChanged(object sender, EventArgs e) { INavigationPoint p = NavigationService.CurrentPosition; // LoggingService.DebugFormatted("NavHistoryChanged ({0}): {1}", // NavigationService.Count, // (p==null?"null":p.ToString())); UpdateEnabledState(); }
public void Init() { p = new TestNavigationPoint("p.cs"); p_5 = new TestNavigationPoint("p.cs", 5); p_6 = new TestNavigationPoint("p.cs", 6); p_37 = new TestNavigationPoint("p.cs", 37); q = new TestNavigationPoint("q.cs"); r = new TestNavigationPoint("r.cs"); s = new TestNavigationPoint("s.cs"); t = new TestNavigationPoint("t.cs"); }
/// <summary> /// Clears the navigation history and optionally clears the current position. /// </summary> /// <param name="clearCurrentPosition">Do we clear the current position as well as the rest of the history?</param> /// <remarks> /// <para>The current position is often used to "seed" the next history to ensure /// that the first significant movement after clearing the history allows /// us to jump "back" immediately.</para> /// <para>Remembering the current position across requests to clear the history /// does not always make sense, however, such as when a solution is closing, /// hence the ability to explicitly control it's retention.</para> /// </remarks> public static void ClearHistory(bool clearCurrentPosition) { INavigationPoint currentPosition = CurrentPosition; history.Clear(); currentNode = null; if (!clearCurrentPosition) { LogInternal(currentPosition); } OnHistoryChanged(); }
/// <summary> /// Jump to a specific <see cref="INavigationPoint"/> in the history; /// if the point is not in the history, we log it internally, regardless /// of whether logging is currently suspended or not. /// </summary> /// <param name="target">The <see cref="INavigationPoint"/> to jump</param> public static void Go(INavigationPoint target) { if (target == null) { return; } LinkedListNode <INavigationPoint> targetNode; targetNode = history.Find(target); if (targetNode != null) { currentNode = targetNode; } else { LoggingService.ErrorFormatted("Logging additional point: {0}", target); LogInternal(target); } SyncViewWithModel(); }
// TODO: refactor BuildSubmenu to add a choice between flat and perfile, eventually per class/method sorting of the list ToolStripItem[] BuildMenuFlat(ICollection <INavigationPoint> points, int additionalItems) { ToolStripItem[] items = new ToolStripItem[points.Count + additionalItems]; MenuCommand cmd = null; INavigationPoint p = null; List <INavigationPoint> list = new List <INavigationPoint>(points); int n = points.Count - 1; // the last point int i = 0; while (i < points.Count) { p = list[n - i]; cmd = new MenuCommand(p.Description, new EventHandler(NavigateTo)); cmd.Tag = p; // if (p == NavigationService.CurrentPosition) { // cmd.Text = "*** "+cmd.Text; // } items[i++] = cmd; } return(items); }
/// <summary> /// Adds an <see cref="INavigationPoint"/> to the history. /// </summary> /// <param name="p">The <see cref="INavigationPoint"/> to add.</param> /// <remarks> /// Refactoring this out of Log() allows the NavigationService /// to call this and ensure it will work regardless of the /// requested state of loggingSuspended, as in /// <see cref="ClearHistory()"/> where we want to log /// the current position after clearing the /// history. /// </remarks> private static void LogInternal(INavigationPoint p) { if (p == null || String.IsNullOrEmpty(p.FileName) ) { return; } if (currentNode == null) { currentNode = history.AddFirst(p); } else if (p.Equals(currentNode.Value)) { // replace it currentNode.Value = p; } else { currentNode = history.AddAfter(currentNode, p); } OnHistoryChanged(); }
// refactoring this out of Log() allows the NavigationService // to call this and ensure it will work regardless of the // requested state of loggingSuspended private static void LogInternal(INavigationPoint p) { if (p == null || p.FileName == null || // HACK: why/how do we get here? p.FileName == String.Empty) // HACK: why/how do we get here? { return; } if (currentNode == null) { currentNode = history.AddFirst(p); } else if (p.Equals(currentNode.Value)) { // replace it currentNode.Value = p; } else { currentNode = history.AddAfter(currentNode, p); } OnHistoryChanged(); }
// refactoring this out of Log() allows the NavigationService // to call this and ensure it will work regardless of the // requested state of loggingSuspended private static void LogInternal(INavigationPoint p) { if (p == null || p.FileName==null // HACK: why/how do we get here? || p.FileName==String.Empty) { // HACK: why/how do we get here? return; } if (currentNode==null) { currentNode = history.AddFirst(p); } else if (p.Equals(currentNode.Value)) { // replace it currentNode.Value = p; } else { currentNode = history.AddAfter(currentNode, p); } OnHistoryChanged(); }
/// <summary> /// Jump to a specific <see cref="INavigationPoint"/> in the history; /// if the point is not in the history, we log it internally, regardless /// of whether logging is currently suspended or not. /// </summary> /// <param name="target">The <see cref="INavigationPoint"/> to jump</param> public static void Go(INavigationPoint target) { if (target==null) { return; } LinkedListNode<INavigationPoint> targetNode; targetNode = history.Find(target); if (targetNode!=null) { currentNode = targetNode; } else { LoggingService.ErrorFormatted("Logging additional point: {0}", target); LogInternal(target); } SyncViewWithModel(); }
/// <summary> /// Adds an <see cref="INavigationPoint"/> to the history. /// </summary> /// <param name="p">The <see cref="INavigationPoint"/> to add.</param> /// <remarks> /// Refactoring this out of Log() allows the NavigationService /// to call this and ensure it will work regardless of the /// requested state of loggingSuspended, as in /// <see cref="ClearHistory()"/> where we want to log /// the current position after clearing the /// history. /// </remarks> private static void LogInternal(INavigationPoint p) { if (p == null || String.IsNullOrEmpty(p.FileName) ) { return; } if (currentNode==null) { currentNode = history.AddFirst(p); } else if (p.Equals(currentNode.Value)) { // replace it currentNode.Value = p; } else { currentNode = history.AddAfter(currentNode, p); } OnHistoryChanged(); }
/// <summary>activates a nav point type <string> attached to a team anchored to an object with a vertical offset <real>. If the player is not local to the machine, this will fail</summary> public void activate_team_nav_point_object(INavigationPoint navpoint, ITeam team, IGameObject entity, float real) { }
/// <summary> /// The <see cref="NavigationService"/> must /// expose a method to generate an /// <see cref="INavigationPoint"/> from a /// given window. /// </summary> public void GenerateCurrentPositionTest() { INavigationPoint p = NavigationService.Log(); }
/// <summary>activates a nav point type <string> attached to a team anchored to a flag with a vertical offset <real>. If the player is not local to the machine, this will fail</summary> public void activate_team_nav_point_flag(INavigationPoint navpoint, ITeam team, ILocationFlag cutscene_flag, float real) { }
public override void JumpTo() { // simulate the case where jumping triggers a call to log an intermediate position NavigationService.Log(new TestNavigationPoint(this.FileName, -500)); // simulate changing something outside the NavigationService's model CurrentTestPosition = this; }