private void buttonAddService_Click(object sender, EventArgs e) { ServiceWindow serviceWindow = new ServiceWindow(); DialogResult okFlag = serviceWindow.ShowDialog(); if (okFlag == DialogResult.OK) { serviceList.Add(serviceWindow.GetLine()); dataGridView1.DataSource = PrintOnTable(); } serviceWindow.Dispose(); }
public bool EditServiceLine(string selectName) { bool flag = false; int numberLine = SearchService(selectName); ; if (numberLine >= 0) { ServiceWindow serviceWindow = new ServiceWindow(serviceList[numberLine]); DialogResult okFlag = serviceWindow.ShowDialog(); if (okFlag == DialogResult.OK) { serviceList[numberLine] = serviceWindow.GetLine(); //записать изменения в файл? flag = true; } else { if (okFlag == DialogResult.Abort) { serviceList.RemoveAt(numberLine); flag = true; } } serviceWindow.Dispose(); } return flag; }