Beispiel #1
0
        public void AddRow(BeatInfo info)
        {
            Main frmMain = (Main)Parent.Parent.Parent;

            // find beat
            for (int i = 0; i < dgvDownload.Rows.Count; i++)
            {
                if (dgvDownload.Rows[i].Cells[3].Value.ToString() == info.Link)
                {
                    return;
                }
            }

            object[] row = new object[] {
                IconList.GetIcon(IconList.GetIconIndex(info.Site)),
                info.Title,
                info.Artist,
                info.Link,
                "",
                "Not started"
            };

            dgvDownload.Rows.Add(row);

            dgvDownload.Rows[dgvDownload.Rows.Count - 1].Cells[0].Tag = info.Site;
            dgvDownload.Rows[dgvDownload.Rows.Count - 1].Cells[5].Tag = DownloaderState.NotStarted;
        }
Beispiel #2
0
        // add search tab
        private void AddSearchTab(string query, string site)
        {
            // convert query to lower string
            query = query.ToLower();

            int foundIndex   = -1;
            int tabIconIndex = IconList.GetIconIndex(site);

            // find tab
            for (int i = 1; i < tabContainer.TabPages.Count; i++)
            {
                if (tabContainer.TabPages[i].Tag.ToString() == query && tabContainer.TabPages[i].ImageIndex == tabIconIndex)
                {
                    foundIndex = i;
                    break;
                }
            }

            if (foundIndex == -1)
            {
                SearchTab st  = new SearchTab(query, site);
                TabPage   tab = new TabPage(query);

                tab.ImageIndex = tabIconIndex;

                tab.Controls.Add(st);
                // add tab
                tabContainer.Controls.Add(tab);

                // focus tab
                tabContainer.SelectTab(tab);

                // resize
                tabContainer.TabPages[tabContainer.SelectedIndex].Controls[0].Size = tabContainer.TabPages[tabContainer.SelectedIndex].Size;
                // set header text
                tabContainer.TabPages[tabContainer.SelectedIndex].Tag = query;
            }
            else
            {
                // focus tab
                tabContainer.SelectedIndex = foundIndex;
            }
        }