示例#1
0
		public void SetHistoryStep(NavigationHistoryStep step)
		{
			if (step == null)
				throw new ArgumentNullException(nameof(step));

			if (_current != null)
				_backPath.Insert(0, _current);
			_forwardPath.Clear();

			_current = step;

			_changed.OnNext(EventArgs.Empty);
		}
        public void SetHistoryStep(NavigationHistoryStep step)
        {
            if (step == null)
            {
                throw new ArgumentNullException("step");
            }

            if (_current != null)
            {
                _backPath.Insert(0, _current);
            }
            _forwardPath.Clear();

            _current = step;

            _changed.OnNext(EventArgs.Empty);
        }
        public void Back(int stepsCount)
        {
            if (stepsCount < 1 || stepsCount > _backPath.Count)
                throw new ArgumentOutOfRangeException("stepsCount");

            _forwardPath.Insert(0, _current);
            if (stepsCount > 1)
                _forwardPath.InsertRange(0, _backPath.GetRange(0, stepsCount - 1));

            _current = _backPath[stepsCount - 1];

            _backPath.RemoveRange(0, stepsCount);

            _current.Navigate();

            _changed.OnNext(EventArgs.Empty);
        }
        public void Forward(int stepsCount)
        {
            if (stepsCount < 1 || stepsCount > _forwardPath.Count)
            {
                throw new ArgumentOutOfRangeException("stepsCount");
            }

            _backPath.Insert(0, _current);
            if (stepsCount > 1)
            {
                _backPath.InsertRange(0, _forwardPath.GetRange(0, stepsCount - 1));
            }

            _current = _forwardPath[stepsCount - 1];

            _forwardPath.RemoveRange(0, stepsCount);

            _current.Navigate();

            _changed.OnNext(EventArgs.Empty);
        }