Below is piece of code from codeplex's Scavenger project. Also on the other hand, in some different class/project, from where, after some complex operations,i am getting a custom list of FileInfo
. Now I want to pass that FileInfo
list to the HttpDownload
below. For that, I am thinking of using Adapter pattern, so that I can plug FileInfo to HttpDownload with minimal changes. Am i going in right direction ??? Or is there any easy way? Kindly note both are two different projects. I need to make then compatible..
private void cmdStart_Click(object sender, EventArgs e)
{
Cursor.Current = Cursors.WaitCursor;
//TODO: Validation
if (optSchedule.Checked)
{
if (scheduleDate.Value < DateTime.Now)
{
MessageBox.Show("Scheduled time is less than current time.",Application.ProductName,MessageBoxButtons.OK,MessageBoxIcon.Information);
return;
}
}
Uri url = new Uri(txtUrl.Text);
HttpDownload download = new HttpDownload(url, txtLocalPath.Text + lblFileName.Text);//Adding url to download
MainForm.HttpDownloads.Add(download);
download.CryptoAlgo = CryptoAlgoEnum.None;
if (chkVerify.Checked)
{
download.CryptoAlgo= (CryptoAlgoEnum)Enum.Parse(typeof(CryptoAlgoEnum), cmbVerify.Text);
}
else {
}
download.CryptoKey = txtVerify.Text;
//download.OnProgress += MainForm.OnProgress;
if (optSchedule.Checked)
download.Schedule(scheduleDate.Value);
else
download.Start();
if (SettingsManager.settings["proxy_server"].value.Length > 0)
{
download.UseProxy = true;
download.ProxyServer = SettingsManager.settings["proxy_server"].value;
download.ProxyServer = SettingsManager.settings["proxy_port"].value;
download.ProxyServer = SettingsManager.settings["proxy_username"].value;
download.ProxyServer = SettingsManager.settings["proxy_password"].value;
}
this.Close();
Cursor.Current = Cursors.Default;
}
Aucun commentaire:
Enregistrer un commentaire