Когда я изменил мою цель .net от рамки 4.5 до фреймворка 4.0. Я получаю сообщение об ошибке в одной строке RUN
>>>System.Threading.Tasks.Task.Run(() => { PrintFactory.sendTextToLPT1(strPrint); });
Ошибка при вызове конструктора устарела
В чем может быть причина этого?
Мой фрагмент кода:
private void button4_Click(object sender, EventArgs e)
{
//string filePath = image_print();
// MessageBox.Show(filePath, "path");
string newFilePath = image_print();
string strText = string.Empty;
using (StreamReader stream = new StreamReader(newFilePath))
{
strText = stream.ReadToEnd();
stream.Close();
}
string strPrint = strText + Print_image();
if (String.IsNullOrEmpty(strPrint) || String.IsNullOrEmpty(img_path.Text))
{
return;
}
else
{
sendfile.Image splash = new sendfile.Image();
this.Hide();
splash.Show();
System.Threading.Tasks.Task.Run(() => {
PrintFactory.sendTextToLPT1(strPrint);
}); //<<< here i am getting error in RUN
splash.FormClosed += delegate {
System.IO.File.Delete(newFilePath);
this.Show();
};
}
}
Опубликовать сообщение об ошибке. –
http://msdn.microsoft.com/de-de/library/system.threading.tasks.task.run(v=vs.110).aspx только Net4.5 – blindmeis