Beispiel #1
0
        public Task GoForwardAsync()
        {
            Page page = ForwardHistory.Pop();

            BackHistory.Push(page);
            return(NavigateAsync(page));
        }
Beispiel #2
0
        private void NavigateForward(string s)
        {
            BackHistory.Push(CurrentDirectory);
            var nextDirectory = ForwardHistory.Pop();

            Navigate(nextDirectory.Path);
        }
Beispiel #3
0
        private void NavigateBack(string s)
        {
            ForwardHistory.Push(CurrentDirectory);
            var previousDirectory = BackHistory.Pop();

            Navigate(previousDirectory.Path);
        }
Beispiel #4
0
 public void Forward()
 {
     if (ForwardHistory.Count > 0)
     {
         Current.Dispose();
         BackHistory.Push(Current);
         Current = ForwardHistory.Pop();
         LoadPageControl();
     }
 }
        /// <inheritdoc/>
        public IDocument Back(bool useCache)
        {
            ForwardHistory.Push(History.Pop());
            if (useCache)
            {
                return(History.Last());
            }
            IDocument oldDocument = History.Pop();

            return(oldDocument);
        }
Beispiel #6
0
 public void NewPageControl(PageControl pageControl)
 {
     ForwardHistory.Clear();
     if (Current != null)
     {
         Current.Dispose();
         BackHistory.Push(Current);
     }
     Current = pageControl;
     LoadPageControl();
 }
        /// <summary>
        /// Clears both Forward and History Stacks.
        /// </summary>
        public void ClearHistory()
        {
            foreach (var item in History.Reverse())
            {
                _History.Remove(item);
            }

            foreach (var item in ForwardHistory.Reverse())
            {
                _ForwardHistory.Remove(item);
            }
        }
 /// <summary>
 /// Navigates up the Forward Stack, if possible.
 /// </summary>
 /// <param name="Steps">How many Pages forward to go.</param>
 /// <exception cref="MechanizeBrowserStateException">Can't go Forward any further</exception>
 /// <returns>Forward Page</returns>
 public WebPage GoForward(int Steps = 1)
 {
     while (Steps > 0 || CurrentPage == null)
     {
         try
         {
             CurrentPage = ForwardHistory.Last();
             _ForwardHistory.Remove(CurrentPage);
             _History.Add(CurrentPage);
         }
         catch (InvalidOperationException)
         {
             throw new MechanizeBrowserStateException("Can't go Forward any further");
         }
     }
     return(CurrentPage);
 }