Exemple #1
0
 public void AddPageSafe(ToolPage page)
 {
     if (!HasPage(page.PageName))
     {
         AddPage(page);
     }
 }
Exemple #2
0
        public void RemovePage(string name)
        {
            ToolPage currentpage = GetPage(name);

            MainPanel.Controls.Remove(currentpage);
            Pages.Remove(currentpage);
            currentpage.Dispose();
        }
Exemple #3
0
 public void AddPageForce(ToolPage page)
 {
     if (!HasPage(page.PageName))
     {
         RemovePage(page.PageName);
     }
     AddPage(page);
 }
Exemple #4
0
        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();
        }
Exemple #5
0
        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();
        }
Exemple #6
0
        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);
 }
Exemple #8
0
 public void AddPage(ToolPage page)
 {
     Pages.Add(page);
     MainPanel.Controls.Add(Pages.Last());
     page.Dock = DockStyle.Fill;
 }