private void DataSearch_DownloadUpdated(int epid)
{
if (this.IsDisposed)
{
return;
}
if (this.InvokeRequired)
{
this.Invoke((MethodInvoker)(() => { this.DataSearch_DownloadUpdated(epid); }));
return;
}
Model.Download info = new Model.Download(epid);
ListViewItem item = this.ListDownloads.Items[epid.ToString(CultureInfo.InvariantCulture)];
item = this.DownloadListItem(info, item);
if (this.downloadColOrder.Contains(Model.Download.DownloadCols.Progress))
{
this.ListDownloads.HideProgress(item);
}
// Update the downloads list sorting, as the order may now have changed
this.ListDownloads.Sort();
if (this.view.CurrentView == ViewState.View.Downloads)
{
if (item.Selected)
{
this.ShowDownloadInfo(epid);
}
else if (this.ListDownloads.SelectedItems.Count == 0)
{
// Update the displayed statistics
this.SetViewDefaults();
}
}
}