Allowed the picker to be closed by keyboard, e.g. ESC / Alt+F4 (F10?)

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1914 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-06-08 13:57:57 +00:00
commit fcd993ce27

View file

@ -62,9 +62,15 @@ namespace Greenshot.Destinations {
ContextMenuStrip menu = new ContextMenuStrip();
menu.Closing += delegate(object source, ToolStripDropDownClosingEventArgs eventArgs) {
LOG.DebugFormat("Close reason: {0}", eventArgs.CloseReason);
if (eventArgs.CloseReason != ToolStripDropDownCloseReason.ItemClicked && eventArgs.CloseReason != ToolStripDropDownCloseReason.CloseCalled) {
eventArgs.Cancel = true;
}
switch (eventArgs.CloseReason) {
case ToolStripDropDownCloseReason.ItemClicked:
case ToolStripDropDownCloseReason.CloseCalled:
case ToolStripDropDownCloseReason.Keyboard:
break;
default:
eventArgs.Cancel = true;
break;
}
};
foreach (IDestination destination in destinations) {
// Fix foreach loop variable for the delegate