/// <summary> /// Initializes the browser by loading the objects from the file as /// well as adding some elemtns to the different lists so no problem occurs /// when displaying the UI. /// </summary> public void InitializeBrowser() { mb = new MiniBowser.MiniBowser(); // if the urlList is empty, fills it with empty strings (for display purposes) if (mb.History.UrlList.Count <= 8) { List <string> emptyUrlList = new List <string> { "", "", "", "", "", "", "", "" }; mb.History.UrlList.AddRange(emptyUrlList); } // if the bookmark list is empty, fills it with empty bookmarks (for display purposes) if (mb.BookmarkList.Count <= 8) { List <MiniBowser.Bookmark> emptyBookmarkList = new List <MiniBowser.Bookmark> { new MiniBowser.Bookmark("", ""), new MiniBowser.Bookmark("", ""), new MiniBowser.Bookmark("", ""), new MiniBowser.Bookmark("", ""), new MiniBowser.Bookmark("", ""), new MiniBowser.Bookmark("", ""), new MiniBowser.Bookmark("", ""), new MiniBowser.Bookmark("", "") }; mb.BookmarkList.AddRange(emptyBookmarkList); } // store the initial state mb.Store(); // loads the homepage urlEntry.Text = mb.Homepage; mb.CurrentSite = mb.Homepage; // http load homepage // display html content(tostring) htmlTextView.Buffer.Text = mb.RequestResult(mb.Homepage); CheckButtonsStatus(); }
protected void HomeButtonClicked(object sender, EventArgs e) { // url set homepage urlEntry.Text = mb.Homepage; // add the previous site to the history if different from the homepage if (mb.CurrentSite != mb.Homepage) { mb.History.AddNewSite(mb.CurrentSite); mb.CurrentSite = mb.Homepage; } // http load homepage // display html content(tostring) htmlTextView.Buffer.Text = mb.RequestResult(mb.Homepage); // check button status CheckButtonsStatus(); }