private async void button_order_Click(object sender, EventArgs e) { if (listView_warenkorb.Items.Count > 0) //Wenn mindestens ein Item im Warenkorb sind kann Bestellt werden { string mail; if (radioButton_defaultmail.Checked) { mail = Settings.Default.Mail; } else { mail = textBox_othermail.Text; } Orders b = new Orders(); //Letzte Bestellnummer aus der Liste lesen int lastId = b.Bestellblatt[b.Bestellblatt.Count - 1].Number + 1; _m = new Mail(mail); MailStructure str = new MailStructure { Ordernumber = lastId, Body = Orders.BuildMail(_w, GetLocation()), Location = GetLocation(), MailPassword = Configuration.GetRegistryPassword(_login) }; pictureBox_bottom.Enabled = true; pictureBox_bottom.Visible = true; await Task.Factory.StartNew(() => { _m.Send(str); }); if (_m.Sent) { b.WriteOrdersToFile(_w, lastId); _w = new Cart(); UpdateGoodslist(); } pictureBox_bottom.Visible = false; pictureBox_bottom.Enabled = false; } }