void PopulateGroups() { iMutex.WaitOne(); iPanel.StopBusy(); Visible = true; iListView.BeginUpdate(); iListView.Items.Clear(); ResizeControls(); foreach (Group g in iGroups) { ListViewKinsky.Item item = new ListViewKinsky.Item(); item.Text = g.Title; item.Icon = iLogo; item.IconSelected = iLogo; ListViewItem.ListViewSubItem subitem; subitem = new ListViewItem.ListViewSubItem(); subitem.Name = "Title"; subitem.Text = g.Title; item.SubItems.Add(subitem); subitem = new ListViewItem.ListViewSubItem(); subitem.Name = "Items"; subitem.Text = "4"; item.SubItems.Add(subitem); if (g == iGroup) { item.Selected = true; } iListView.Items.Add(item); } iListView.Columns[0].Width = iListView.SmallIconSize.Width + 8; iListView.AutoResizeColumn(1, ColumnHeaderAutoResizeStyle.ColumnContent); iListView.AutoResizeColumn(2, ColumnHeaderAutoResizeStyle.ColumnContent); iListView.EndUpdate(); iMutex.ReleaseMutex(); }
void Populate() { iMutex.WaitOne(); iListView.Visible = false; iListView.BeginUpdate(); iListView.Items.Clear(); ResizeControls(); foreach (ISource s in iDirectSound.SourceList) { ListViewKinsky.Item item = new ListViewKinsky.Item(); item.Text = s.Name; item.Icon = OssKinskyMppSoundcard.Properties.Resources.Soundcard; item.IconSelected = item.Icon; ListViewItem.ListViewSubItem subitem; subitem = new ListViewItem.ListViewSubItem(); subitem.Name = "Title"; subitem.Text = s.Name; item.SubItems.Add(subitem); iListView.Items.Add(item); } iListView.Columns[0].Width = iListView.SmallIconSize.Width + 8; iListView.AutoResizeColumn(1, ColumnHeaderAutoResizeStyle.ColumnContent); iListView.EndUpdate(); iMutex.ReleaseMutex(); iListView.Visible = true; if (iListView.SelectedIndices.Count > 0) { iListView.EnsureVisible(iListView.SelectedIndices[0]); } else if (iListView.Items.Count > 0) { iListView.EnsureVisible(0); } }
void PopulateEntries() { iMutex.WaitOne(); iListView.BeginUpdate(); iListView.Items.Clear(); ResizeControls(); if (iFeed.Downloaded) { iPanel.StopBusy(); Visible = true; foreach (IEntry e in iFeed.EntryList) { ListViewKinsky.Item item = new ListViewKinsky.Item(); item.Text = e.Title; item.Icon = e.Logo; item.IconSelected = e.Logo; ListViewItem.ListViewSubItem subitem; subitem = new ListViewItem.ListViewSubItem(); subitem.Name = "Title"; subitem.Text = e.Title; item.SubItems.Add(subitem); subitem = new ListViewItem.ListViewSubItem(); subitem.Name = "Country"; subitem.Text = e.Location.Country; item.SubItems.Add(subitem); subitem = new ListViewItem.ListViewSubItem(); subitem.Name = "Region"; subitem.Text = e.Location.Region; item.SubItems.Add(subitem); subitem = new ListViewItem.ListViewSubItem(); subitem.Name = "Bitrate"; subitem.Text = e.Audio.Bitrate + "kbps"; item.SubItems.Add(subitem); if (e == iEntry) { item.Selected = true; } iListView.Items.Add(item); } } else { iPanel.StartBusy(); Visible = false; } iListView.Columns[0].Width = iListView.SmallIconSize.Width + 8; iListView.AutoResizeColumn(1, ColumnHeaderAutoResizeStyle.ColumnContent); iListView.AutoResizeColumn(2, ColumnHeaderAutoResizeStyle.ColumnContent); iListView.EndUpdate(); iMutex.ReleaseMutex(); }
void PopulateFeeds() { iMutex.WaitOne(); iPanel.StopBusy(); Visible = true; iListView.BeginUpdate(); iListView.Items.Clear(); ResizeControls(); foreach (IFeed f in iFeedList) { ListViewKinsky.Item item = new ListViewKinsky.Item(); item.Text = f.Title; if (f.Downloaded) { item.Icon = f.Logo; } else { item.Icon = OssKinskyMppRadio.Properties.Resources.Radio; } item.IconSelected = item.Icon; ListViewItem.ListViewSubItem subitem; subitem = new ListViewItem.ListViewSubItem(); subitem.Name = "Title"; subitem.Text = f.Title; item.SubItems.Add(subitem); subitem = new ListViewItem.ListViewSubItem(); subitem.Name = "Items"; if (f.Downloaded) { subitem.Text = f.EntryList.Count.ToString(); } else { subitem.Text = "Downloading"; } item.SubItems.Add(subitem); if (f == iFeed) { item.Selected = true; } iListView.Items.Add(item); } iListView.Columns[0].Width = iListView.SmallIconSize.Width + 8; iListView.AutoResizeColumn(1, ColumnHeaderAutoResizeStyle.ColumnContent); iListView.AutoResizeColumn(2, ColumnHeaderAutoResizeStyle.ColumnContent); iListView.EndUpdate(); iMutex.ReleaseMutex(); }