public void AddPageSafe(ToolPage page) { if (!HasPage(page.PageName)) { AddPage(page); } }
public void RemovePage(string name) { ToolPage currentpage = GetPage(name); MainPanel.Controls.Remove(currentpage); Pages.Remove(currentpage); currentpage.Dispose(); }
public void AddPageForce(ToolPage page) { if (!HasPage(page.PageName)) { RemovePage(page.PageName); } AddPage(page); }
public void SetPage(string name) { ToolPage currentpage = GetPage(name); foreach (ToolPage page in Pages) { page.Visible = false; } currentpage.Visible = true; PageNameBackground.Visible = (bool)(currentpage.PageTitle != ""); PageName.Text = currentpage.PageTitle; currentpage.Reload(); }
private void MainForm_Load(object sender, EventArgs e) { UpdateGUIColors(); AddPageSafe(new HomePage()); SetPage("pages:home"); AddPageSafe(new SettingsPage()); if (Program.Arguments.Source != "pages:home") { ToolPage redirect = Tools.PageFromType(Program.Arguments.Source); AddPageSafe(redirect); SetPage(redirect.PageName); } Globals.Colors.UpdateColors(); }
public static ToolPage PageFromType(string id) { List <Type> pagetypes = VType.GetDerivedTypes(typeof(ToolPage), Assembly.GetExecutingAssembly()); foreach (Type pagetype in pagetypes) { ToolPage instance = Activator.CreateInstance(pagetype) as ToolPage; if (instance.PageName == id) { return(instance); } instance.Dispose(); } return(null); }
protected override void OnNavigatedTo(NavigationEventArgs e) { rootPage = ToolPage.Current; rootPage.SetPageTitle(PAGE_TITLE); }
public void AddPage(ToolPage page) { Pages.Add(page); MainPanel.Controls.Add(Pages.Last()); page.Dock = DockStyle.Fill; }