mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Merge branch 'develop' into 929_server_name_in_notification
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Tree;
|
||||
using NUnit.Framework;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
namespace mRemoteNGTests.Tree
|
||||
@@ -30,12 +30,12 @@ namespace mRemoteNGTests.Tree
|
||||
Assert.That(deletionConfirmer.Confirm(_testConnectionInfo), Is.False);
|
||||
}
|
||||
|
||||
private DialogResult MockClickYes(string promptMessage, string title, MessageBoxButtons buttons, MessageBoxIcon icon)
|
||||
private DialogResult MockClickYes(string promptMessage)
|
||||
{
|
||||
return DialogResult.Yes;
|
||||
}
|
||||
|
||||
private DialogResult MockClickNo(string promptMessage, string title, MessageBoxButtons buttons, MessageBoxIcon icon)
|
||||
private DialogResult MockClickNo(string promptMessage)
|
||||
{
|
||||
return DialogResult.No;
|
||||
}
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.UI.TaskDialog;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
namespace mRemoteNG.Tree
|
||||
{
|
||||
public class SelectedConnectionDeletionConfirmer : IConfirm<ConnectionInfo>
|
||||
public class SelectedConnectionDeletionConfirmer : IConfirm<ConnectionInfo>
|
||||
{
|
||||
private readonly Func<string, string, MessageBoxButtons, MessageBoxIcon, DialogResult> _confirmationFunc;
|
||||
private readonly Func<string, DialogResult> _confirmationFunc;
|
||||
|
||||
public SelectedConnectionDeletionConfirmer(Func<string, string, MessageBoxButtons, MessageBoxIcon, DialogResult> confirmationFunc)
|
||||
public SelectedConnectionDeletionConfirmer(Func<string, DialogResult> confirmationFunc)
|
||||
{
|
||||
_confirmationFunc = confirmationFunc;
|
||||
}
|
||||
@@ -49,7 +48,7 @@ namespace mRemoteNG.Tree
|
||||
|
||||
private bool PromptUser(string promptMessage)
|
||||
{
|
||||
var msgBoxResponse = CTaskDialog.MessageBox(Application.ProductName, promptMessage, "", ETaskDialogButtons.YesNo, ESysIcons.Question);
|
||||
var msgBoxResponse = _confirmationFunc(promptMessage);
|
||||
return msgBoxResponse == DialogResult.Yes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using mRemoteNG.Themes;
|
||||
using mRemoteNG.Tree;
|
||||
using mRemoteNG.Tree.Root;
|
||||
using mRemoteNG.UI.Controls;
|
||||
using mRemoteNG.UI.TaskDialog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -104,7 +105,8 @@ namespace mRemoteNG.UI.Window
|
||||
#region ConnectionTree
|
||||
private void SetConnectionTreeEventHandlers()
|
||||
{
|
||||
olvConnections.NodeDeletionConfirmer = new SelectedConnectionDeletionConfirmer(MessageBox.Show);
|
||||
olvConnections.NodeDeletionConfirmer = new SelectedConnectionDeletionConfirmer(prompt =>
|
||||
CTaskDialog.MessageBox(Application.ProductName, prompt, "", ETaskDialogButtons.YesNo, ESysIcons.Question));
|
||||
olvConnections.KeyDown += tvConnections_KeyDown;
|
||||
olvConnections.KeyPress += tvConnections_KeyPress;
|
||||
SetTreePostSetupActions();
|
||||
|
||||
Reference in New Issue
Block a user