From 54dc6596f4a32fa11f64cf4dac0beb01b0eae804 Mon Sep 17 00:00:00 2001 From: komaruchan Date: Tue, 5 Jan 2016 19:11:34 +0800 Subject: [PATCH] show confirm dialog box when click abort button in WorkingForm. --- mp4box/MainForm.cs | 16 ++++++++-------- mp4box/WorkingForm.cs | 8 ++++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/mp4box/MainForm.cs b/mp4box/MainForm.cs index c8e04d6..b510bca 100644 --- a/mp4box/MainForm.cs +++ b/mp4box/MainForm.cs @@ -4596,42 +4596,42 @@ namespace mp4box #region Form - protected String GetCurrentDirectory() + public String GetCurrentDirectory() { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); } - protected void ShowErrorMessage(String argMessage) + public static void ShowErrorMessage(String argMessage) { MessageBox.Show(argMessage, "错误!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } - protected void ShowErrorMessage(String argMessage, String argTitle) + public static void ShowErrorMessage(String argMessage, String argTitle) { MessageBox.Show(argMessage, argTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); } - protected void ShowWarningMessage(String argMessage) + public static void ShowWarningMessage(String argMessage) { MessageBox.Show(argMessage, "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } - protected void ShowWarningMessage(String argMessage, String argTitle) + public static void ShowWarningMessage(String argMessage, String argTitle) { MessageBox.Show(argMessage, argTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); } - protected void ShowInfoMessage(String argMessage) + public static void ShowInfoMessage(String argMessage) { MessageBox.Show(argMessage, "提示!", MessageBoxButtons.OK, MessageBoxIcon.Information); } - protected void ShowInfoMessage(String argMessage, String argTitle) + public static void ShowInfoMessage(String argMessage, String argTitle) { MessageBox.Show(argMessage, argTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } - protected DialogResult ShowQuestion(String argQuestion, String argTitle) + public static DialogResult ShowQuestion(String argQuestion, String argTitle) { return MessageBox.Show(argQuestion, argTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question); } diff --git a/mp4box/WorkingForm.cs b/mp4box/WorkingForm.cs index 6937f6e..0ae152b 100644 --- a/mp4box/WorkingForm.cs +++ b/mp4box/WorkingForm.cs @@ -318,8 +318,12 @@ namespace mp4box private void buttonAbort_Click(object sender, EventArgs e) { - bgworker.CancelAsync(); - ProcAbort(); + DialogResult dgs = MainForm.ShowQuestion("是否放弃压制?", "提示"); + if (dgs == DialogResult.Yes) + { + bgworker.CancelAsync(); + ProcAbort(); + } } private void buttonSave_Click(object sender, EventArgs e) -- 2.11.4.GIT