39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Security.Policy;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Remontor.Picter
|
|
{
|
|
internal class PicLoaderTask
|
|
{
|
|
private string Name;
|
|
private WebClient Client;
|
|
private Image Img;
|
|
private PictureBox ImagePanel;
|
|
public PicLoaderTask(string name, PictureBox imagePanel)
|
|
{
|
|
ImagePanel = imagePanel;
|
|
this.Name = name;
|
|
Client = new WebClient();
|
|
Client.DownloadDataCompleted += Client_DownloadDataCompleted;
|
|
Uri url = new Uri("http://localhost/Photo/titov.png");
|
|
Client.DownloadDataAsync(url);
|
|
}
|
|
|
|
private void Client_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
|
|
{
|
|
|
|
Img = new Bitmap(new MemoryStream(e.Result));
|
|
ImagePanel.Image = Img;
|
|
// throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|