public void RefreshInfo()
{
if (objDownloads.SelectedIndex == -1)
{
labStatus.Text = string.Empty;
labWorkStatus.Text = string.Empty;
labSize.Text = string.Empty;
labFile.Text = string.Empty;
labFormat.Text = string.Empty;
labQuality.Text = string.Empty;
labProgress.Text = string.Empty;
labSubtitles.Text = string.Empty;
labPlugin.Text = string.Empty;
butChange.Visible = false;
butDownload.Visible = false;
butRemoveSelected.Visible = false;
}
else
{
DownloadItem d = (DownloadItem)objDownloads.SelectedObject;
labFile.Text = d.DownloadInfo.FileName;
labProgress.Text = d.DownloadInfo.Percent.ToString("N2") + " %";
labStatus.Text = d.Status.ToString();
if (!string.IsNullOrEmpty(d.DownloadError))
{
labWorkStatus.Text=d.DownloadError;
labWorkStatus.ForeColor = Color.Red;
}
else
{
labWorkStatus.Text = d.DownloadInfo.Status;
labWorkStatus.ForeColor = SystemColors.ControlText;
}
if (d.DownloadInfo.Languages != null && d.DownloadInfo.Languages.Count > 0)
{
labSubtitles.Text = string.Join(", ", d.DownloadInfo.Languages);
}
else
{
labSubtitles.Text = "Not yet know";
}
labFormat.Text = d.DownloadInfo.Format.ToText();
labQuality.Text = d.DownloadInfo.Quality.ToText();
labPlugin.Text = d.Episode.PluginName;
labSize.Text = string.IsNullOrEmpty(d.DownloadInfo.Size) ? "Not yet know" : d.DownloadInfo.Size;
if ((d.Status == DownloadStatus.Cancelled) || (d.Status == DownloadStatus.Error) ||
(d.Status == DownloadStatus.Queue))
{
butChange.Visible = true;
}
else
{
butChange.Visible = false;
}
if ((d.Status == DownloadStatus.Cancelled) || (d.Status == DownloadStatus.Error))
{
butDownload.Text = "Download Selected";
butDownload.Visible = true;
butDownload.Tag = true;
}
else if ((d.Status == DownloadStatus.Queue) || (d.Status == DownloadStatus.Downloading))
{
butDownload.Text = "Cancel Selected";
butDownload.Visible = true;
butDownload.Tag = false;
}
else
{
butDownload.Visible = false;
}
butRemoveSelected.Visible = true;
}
bool remd = false;
bool remc = false;
bool rema = objDownloads.Items.Count>0;
foreach (DownloadItem d in objDownloads.Objects)
{
if (d.Status == DownloadStatus.Cancelled)
remc = true;
if (d.Status == DownloadStatus.Complete)
remd = true;
}
butRemoveCanceled.Visible = remc;
butRemoveDownloaded.Visible = remd;
butRemoveAll.Visible = rema;
}