Déclaration

   1:     Protected
   2:   function chargeimg(img : System.String):array of Byte;async;

 

code

   1:   function MainForm.chargeimg(img : System.String):array of Byte;
   2:   begin
   3:   var strDownloadURL: System.String := System.String.Empty;
   4:   var strUser: System.String := '######';
   5:   var strPWD: System.String := '#######';
   6:   var req: WebClient := new WebClient();
   7:   var cache: CredentialCache := new CredentialCache();
   8:       strDownloadURL := img;   
   9:       cache.Add(new Uri(strDownloadURL), 'Basic', new NetworkCredential(strUser, strPWD));
  10:       req.Credentials := cache;
  11:   try
  12:         exit req.DownloadData(strDownloadURL);
  13:   except
  14:         on e:Exception do listBox1.Items.Add(img +' - '+e.Message) ;
  15:   end;
  16:  end;

Appel

   1:  File.WriteAllBytes(dirfile+'\img\'+ st2+'.jpg', (await chargeimg(dataGridView1.Rows[i].Cells[10].Value.ToString.Trim)));
View User Profile for Norbert Saint Georges
Envoié par Norbert Saint Georges vendredi 4 juillet 2014 08:31:00 Categories: Oxygene (RemObjects)
Tetrasys Oy
Évaluer ce contenu Voix 0

Commentaires

Les commentaires sont fermés pour ce message.