BackGroundWorker не вызывается с Form.OnShow - C#
Формулировка задачи:
private void Form1_Shown(object sender, EventArgs e)
{
backgroundWorker1.RunWorkerAsync();
}
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
...
}Решение задачи: «BackGroundWorker не вызывается с Form.OnShow»
textual
Листинг программы
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
namespace ConsoleApplication21
{
class Program
{
static void Main(string[] args)
{
WebClient wc = new WebClient();
wc.DownloadStringCompleted += (sender, e) =>
{
string result = e.Result;
Console.WriteLine(result);
};
wc.DownloadStringAsync(new Uri("http://www.yandex.ru"));
Console.ReadLine();
}
}
}