Exemple #1
0
 //----------------------------------------//
 //----------Methods-----------------------//
 //----------------------------------------//
 //create and add a new page to the history given an url
 //only adds it if it's not the current loaded page
 public bool addPage(string url)
 {
     Page s = new Page(url);
     if (current.Value != null && !(current.Value.url.Equals(url)))
     {
         tabHistory.AddAfter(current, s);
         current = current.Next;
         //resets tab history to only contain previous pages from the new current node
         //removes forward history
         while(!tabHistory.Last.Equals(current))
         {
             tabHistory.RemoveLast();
         }
         return true;
     }
     else
     {
         if(current.Value == null)
         {
             tabHistory.AddFirst(s);
             current = tabHistory.First;
             return true;
         }
     }
     return false;
 }
 //add a page to the XElement and save it to file
 private void addPageToHistory(Page p)
 {
     xmlElem.Add(new XElement("Page", new XElement("Url", p.url)));
     xmlElem.Save(fileName);
 }
 //create a page and add it to browser history given an url
 public void addToBrowserHistory(string url)
 {
     Page p = new Page(url);
     browserHistory.Push(p);
     addPageToHistory(p);
 }
Exemple #4
0
 //dynamically add an item to the history drop down menu
 //given a page
 private void addPageToHistoryMenu(Page p)
 {
     ContainerControl cc = new ContainerControl();
     cc.BackColor = Color.White;
     ToolStripControlHost c = new ToolStripControlHost(cc);
     Button temp = new Button();
     temp.Text = p.url;
     temp.Click += (s, e) => { initNewTab();};
     temp.Parent = cc;
     initMenuButton(temp);
     historyMenu.DropDownItems.Add(c);
 }