diff --git a/MainForm.cs b/MainForm.cs index e312250..956b192 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -49,14 +49,14 @@ namespace ScreenCaptureApp { using (ResultForm resultForm = new ResultForm(captureForm.CapturedImage)) { - if (resultForm.ShowDialog() == DialogResult.OK) + DialogResult dlgResult = resultForm.ShowDialog(); + if (dlgResult == DialogResult.OK) { using (SaveFileDialog sfd = new SaveFileDialog()) { sfd.Title = "Сохранить скриншот"; sfd.Filter = "PNG Image|*.png|JPEG Image|*.jpg|Bitmap Image|*.bmp"; sfd.FileName = $"screenshot_{DateTime.Now:dd-MM-yyyy_HH.mm.ss}"; - if (sfd.ShowDialog() == DialogResult.OK) { captureForm.CapturedImage.Save(sfd.FileName, GetImageFormat(sfd.FileName)); @@ -64,7 +64,7 @@ namespace ScreenCaptureApp } } } - else if (resultForm.DialogResult == DialogResult.Yes) + else if (dlgResult == DialogResult.Yes) { try {