Пример #1
0
        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);
		}
Пример #3
0
 /// <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);
 }
Пример #4
0
        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");
 }
Пример #6
0
        /// <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();
        }
Пример #7
0
        /// <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();
        }
Пример #8
0
        // 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);
        }
Пример #9
0
 /// <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();
 }
Пример #10
0
 // 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();
 }
Пример #11
0
		// 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();
		}
Пример #12
0
		/// <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();
		}
Пример #13
0
		/// <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();
		}
Пример #14
0
		/// <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);
		}
Пример #15
0
 /// <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)
 {
 }
Пример #16
0
		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");
		}
Пример #17
0
 /// <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();
 }
Пример #18
0
 /// <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)
 {
 }
Пример #19
0
        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;
        }