mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 21:43:24 -07:00
add click method for discard button, verifying the user intent, deleting the screenshot and closing the editor.
This commit is contained in:
parent
369679e605
commit
e6efc03177
1 changed files with 38 additions and 0 deletions
|
@ -867,6 +867,41 @@ namespace Greenshot.Editor.Forms
|
||||||
HelpToolStripMenuItem1Click(sender, e);
|
HelpToolStripMenuItem1Click(sender, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void BtnDiscardClick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// Make sure the editor is visible
|
||||||
|
WindowDetails.ToForeground(Handle);
|
||||||
|
|
||||||
|
DialogResult result = MessageBox.Show(Language.GetString(LangKey.editor_discard), Language.GetString(LangKey.editor_discard_title), MessageBoxButtons.YesNo,
|
||||||
|
MessageBoxIcon.Question);
|
||||||
|
if (result.Equals(DialogResult.No))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.Equals(DialogResult.Yes))
|
||||||
|
{
|
||||||
|
_surface.Modified = false;
|
||||||
|
|
||||||
|
if (_surface.LastSaveFullPath != null)
|
||||||
|
{
|
||||||
|
if (File.Exists(_surface.LastSaveFullPath))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.Delete(_surface.LastSaveFullPath);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// Do nothing.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ImageEditorFormActivated(object sender, EventArgs e)
|
private void ImageEditorFormActivated(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
UpdateClipboardSurfaceDependencies();
|
UpdateClipboardSurfaceDependencies();
|
||||||
|
@ -935,6 +970,9 @@ namespace Greenshot.Editor.Forms
|
||||||
case Keys.Escape:
|
case Keys.Escape:
|
||||||
BtnCursorClick(sender, e);
|
BtnCursorClick(sender, e);
|
||||||
break;
|
break;
|
||||||
|
case Keys.Delete: // Discard changes, delete file and close.
|
||||||
|
BtnDiscardClick(sender, e);
|
||||||
|
break;
|
||||||
case Keys.R:
|
case Keys.R:
|
||||||
BtnRectClick(sender, e);
|
BtnRectClick(sender, e);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue