Example #1
0
        public void LoadTabs()
        {
            // Clear out any previous web tabs
            ClearWebTabs();

            MOG_PropertiesIni project = MOG_ControllerProject.GetProject().GetConfigFile();

            if (project.SectionExist("WebTabs"))
            {
                SortedList <int, webtab> list = new SortedList <int, webtab>();
                for (int i = 0; i < project.CountKeys("WebTabs"); i++)
                {
                    string section = "WebTab_" + project.GetKeyNameByIndexSLOW("WebTabs", i);

                    // Upgrade old tabs to new format
                    if (project.SectionExist(section) == false &&
                        project.SectionExist(project.GetKeyNameByIndexSLOW("WebTabs", i)) == true &&
                        string.Compare(project.GetKeyNameByIndexSLOW("WebTabs", i), "Project", true) != 0)
                    {
                        project.RenameSection(project.GetKeyNameByIndexSLOW("WebTabs", i), section);
                    }

                    // Load Tab information
                    if (project.SectionExist(section))
                    {
                        webtab tab = new webtab();
                        tab.title    = "WebTab";
                        tab.url      = "http://www.mogware.com";
                        tab.position = 0;

                        // Get custom title
                        if (project.KeyExist(section, "TITLE"))
                        {
                            tab.title = project.GetString(section, "TITLE");
                        }

                        // Get custom url
                        if (project.KeyExist(section, "URL"))
                        {
                            tab.url = project.GetString(section, "URL");
                        }

                        // Get position
                        if (project.KeyExist(section, "POSITION"))
                        {
                            tab.position = Convert.ToInt32(project.GetString(section, "POSITION"));
                        }

                        list.Add(tab.position, tab);
                    }
                }

                foreach (webtab newtab in list.Values)
                {
                    // Create the tab
                    TabPage tab = CreateWebTab(newtab.title, newtab.url);

                    // Add it to our main tab control
                    mainForm.MOGTabControl.TabPages.Add(tab);
                }
            }
        }
Example #2
0
        public void InitializeListView()
        {
            WebTabTabsListView.Items.Clear();

            MOG_PropertiesIni project = MOG_ControllerProject.GetProject().GetConfigFile();

            if (project.SectionExist("WebTabs"))
            {
                SortedList <int, webtab> list = new SortedList <int, webtab>();
                for (int i = 0; i < project.CountKeys("WebTabs"); i++)
                {
                    string section = "WebTab_" + project.GetKeyNameByIndexSLOW("WebTabs", i);

                    // Upgrade old tabs to new format
                    if (project.SectionExist(section) == false &&
                        project.SectionExist(project.GetKeyNameByIndexSLOW("WebTabs", i)) == true &&
                        string.Compare(project.GetKeyNameByIndexSLOW("WebTabs", i), "Project", true) != 0)
                    {
                        project.RenameSection(project.GetKeyNameByIndexSLOW("WebTabs", i), section);
                    }

                    // Load Tab information
                    if (project.SectionExist(section))
                    {
                        webtab tab = new webtab();
                        tab.title    = "WebTab";
                        tab.url      = "http://www.mogware.com";
                        tab.position = 0;

                        // Get custom title
                        if (project.KeyExist(section, "TITLE"))
                        {
                            tab.title = project.GetString(section, "TITLE");
                        }

                        // Get custom url
                        if (project.KeyExist(section, "URL"))
                        {
                            tab.url = project.GetString(section, "URL");
                        }

                        // Get position
                        if (project.KeyExist(section, "POSITION"))
                        {
                            tab.position = Convert.ToInt32(project.GetString(section, "POSITION"));
                        }

                        list.Add(tab.position, tab);
                    }
                }

                foreach (webtab newtab in list.Values)
                {
                    ListViewItem item = new ListViewItem(newtab.title);
                    item.SubItems.Add(newtab.url);
                    item.SubItems.Add(newtab.position.ToString());

                    WebTabTabsListView.Items.Add(item);
                }
            }
        }