From 9d25ac394b9a4d8465e716fff564d3bf6be581b4 Mon Sep 17 00:00:00 2001 From: DucDangAnh Date: Mon, 13 Jul 2020 15:11:18 +0700 Subject: [PATCH] AIParkingApplicationForm - Closing Form Show Confirmation Dialog --- .../AIParkingApplicationForm.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/AIParkingApplication/AIParkingApplicationForm.cs b/AIParkingApplication/AIParkingApplicationForm.cs index 956191c..a924504 100644 --- a/AIParkingApplication/AIParkingApplicationForm.cs +++ b/AIParkingApplication/AIParkingApplicationForm.cs @@ -209,14 +209,22 @@ namespace AIParkingApplication } } - private void AIParkingApplicationForm_FormClosing(object sender, FormClosingEventArgs e) - { - Application.Exit(); - } - private void AIParkingApplicationForm_Load(object sender, EventArgs e) { InitAllLanes(); } + + private void AIParkingApplicationForm_FormClosing(object sender, FormClosingEventArgs e) + { + DialogResult closeAppDialog = MessageBox.Show("Bạn chắc chắn thoát phần mềm quản lý bãi xe?", "Cảnh báo đóng ứng dụng: AIParking - Hệ thống quản lý bãi đỗ xe", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); + if (closeAppDialog == DialogResult.OK) + { + Environment.Exit(0); + } + else + { + e.Cancel = true; + } + } } }