private void button4_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog() { Filter = "Файл заказа|*.fd" }; var result = ofd.ShowDialog(this); if (result == DialogResult.OK) { var dto = FoodDeliveryHelper.LoadFromFile(ofd.FileName); SetModelToUI(dto); } }
private void button3_Click(object sender, EventArgs e) { var sfd = new SaveFileDialog() { Filter = "Файлы заказов|*.fd" }; var result = sfd.ShowDialog(this); if (result == DialogResult.OK) { var dto = GetModelFromUI(); FoodDeliveryHelper.WriteToFile(sfd.FileName, dto); } }