Skip to content

Commit

Permalink
Added topmost and focus options for the default confirmation window
Browse files Browse the repository at this point in the history
  • Loading branch information
KuttKatrea authored and dlech committed Jan 19, 2017
1 parent 2317168 commit 844b487
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Ui/WinForms/Default.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ namespace dlech.SshAgentLib.WinForms
/// </summary>
public static class Default
{
/**
* MessageBox options for topmost and focus from:
* https://msdn.microsoft.com/en-us/library/windows/desktop/ms645505(v=vs.85).aspx
*/
const MessageBoxOptions TopMost = (MessageBoxOptions)0x00040000;
const MessageBoxOptions SetForeground = (MessageBoxOptions)0x00010000;
const MessageBoxOptions SystemModal = (MessageBoxOptions)0x00001000;

public static bool ConfirmCallback(ISshKey key, Process process)
{
var programName = Strings.askConfirmKeyUnknownProcess;
Expand All @@ -44,7 +52,7 @@ public static bool ConfirmCallback(ISshKey key, Process process)
string.Format(Strings.askConfirmKey, programName, key.Comment,
key.GetMD5Fingerprint().ToHexString()), Util.AssemblyTitle,
MessageBoxButtons.YesNo, MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2
MessageBoxDefaultButton.Button2, TopMost | SetForeground | SystemModal
);
return (result == DialogResult.Yes);
}
Expand Down

0 comments on commit 844b487

Please sign in to comment.