private void ViewProductForm_FormClosing(object sender, FormClosingEventArgs e) { if (_isModified) { var acceptForm = new AcceptForm("Закрыть без сохранения изменений?"); acceptForm.ShowDialog(); e.Cancel = !acceptForm.Accepted; } }
private void buttonClose_Click(object sender, EventArgs e) { var acceptForm = new AcceptForm("Закрыть без сохранения изменений?"); acceptForm.ShowDialog(); if (acceptForm.Accepted) { Close(); } }
private void buttonClose_Click(object sender, EventArgs e) { var acceptForm = new AcceptForm("Закрыть без сохранения изменений?"); acceptForm.ShowDialog(); if (acceptForm.Accepted) { _cartService.Delete(_shoppingCart); Close(); } }
private void buttonDelete_Click(object sender, EventArgs e) { var acceptForm = new AcceptForm("Удалить клиента?"); acceptForm.ShowDialog(); if (acceptForm.Accepted) { var parentNode = treeViewClients.SelectedNode.Parent; _clientService.Delete(_clientService.GetByName(treeViewClients.SelectedNode.Text)); if (parentNode != null) { MainFormUtils.Reload(parentNode); } else { MainFormUtils.SetRoot(treeViewClients, _clientService.GetRootClients()); } } }