//Checks if the user modified the history and if so send mofidications to the ManageHistory class private void History_FormClosing(object sender, FormClosingEventArgs e) { if (historyModified) { int i = 0; while (i < listBoxTitle.Items.Count) { listBoxFinal.Items.Add(listBoxUrl.Items[i]); listBoxFinal.Items.Add(listBoxTitle.Items[i]); i++; } ManageHistory.Actualizehistory(listBoxFinal.Items); } }
private void InitializeBrowser() { ManageFavorites.Initialize(); ManageHistory.Initialize(); ManageSettings.Initialize(); SetFavoritesBar(); browserName = ManageSettings.GetBrowserName(); this.Text = browserName; homeUrl = ManageSettings.GetHomeURL(); withHistory = ManageSettings.GetHistoryBoolean(); webBrowser.Navigate(homeUrl); actualUrl = homeUrl; urlTextEdit.Text = homeUrl; tabControl.TabPages[0].Text = webBrowser.DocumentTitle; webBrowser.ScriptErrorsSuppressed = true; webBrowser.IsWebBrowserContextMenuEnabled = false; }
//Actualize the URL at the top of the web browser when a new page is visited //If the history option has been checked, it adds a new element to the history //Actualize the name of the actual tab with the current document title private void DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { WebBrowser web = tabControl.SelectedTab.Controls[0] as WebBrowser; if (web != null) { urlTextEdit.Text = web.Url.ToString(); if (withHistory) { ManageHistory.InsertNewUrl(web.DocumentTitle + Environment.NewLine, true); ManageHistory.InsertNewUrl(web.Url.ToString() + Environment.NewLine, true); } previousUrl = actualUrl; actualUrl = web.Url.ToString(); tabControl.SelectedTab.Text = web.DocumentTitle; } }
//Fill history in two lists so the user only sees the document title of each website he visited private void FillListBoxes() { string[] fullHistory = ManageHistory.GetFullHistory(); int i = 0; foreach (string str in fullHistory) { if (i % 2 == 0) { listBoxUrl.Items.Add(str); } else { listBoxTitle.Items.Add(str); } i++; } }