/// <param name="force">if true - don't ask user, remove it quietly</param> public void RemoveServer(TreeNode serverNode, bool force = false) { bool remove; if (force) { remove = true; } else { string msg = "Настройки подключения к серверу и его базам данных будут удалены.{0}{0}Продолжить?"; var res = MessageBox.Show( String.Format(msg, Environment.NewLine), "Удаление подключения к серверу", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); remove = res == DialogResult.Yes; } if (remove) { Server server = (Server)serverNode.Tag; SuspendLayout(); CloseDatabasesOfServer(serverNode); universe.Servers.Remove(server); ConnectionService.CloseSshTunnel(server); ConnectionService.Save(universe); serverNode.Remove(); ResumeLayout(); } }
private void Shutdown() { if (universe != null) { foreach (var server in universe.Servers) { ConnectionService.CloseSshTunnel(server); } } }
private void btnTestSshConnection_Click(object sender, EventArgs e) { if (ValidateSshSettings()) { try { ConnectionService.CreateSSHTunnel(server); ConnectionService.CloseSshTunnel(server); ctrlSshConnectionStatus.BackColor = COLOR_SUCCESS; } catch (Exception ex) { MessageBox.Show(ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Information); ctrlSshConnectionStatus.BackColor = COLOR_FAIL; } } }