public CommandResult NewConnection(TerminalParam p)
        {
            if (!CheckPaneCount())
            {
                return(CommandResult.Denied);
            }

            ConnectionTag con = null;

            if (p is TCPTerminalParam)
            {
                TCPTerminalParam param = (TCPTerminalParam)p;
                if (param.IsSSH)
                {
                    SSHShortcutLoginDialog dlg = new SSHShortcutLoginDialog((SSHTerminalParam)param);
                    if (GCUtil.ShowModalDialog(_frame, dlg) == DialogResult.OK)
                    {
                        con = dlg.Result;
                    }
                }
                else
                {
                    con = CommunicationUtil.CreateNewConnection(param);
                }
            }
            else if (p is SerialTerminalParam)
            {
                SerialTerminalParam param = (SerialTerminalParam)p;
                con = CommunicationUtil.CreateNewSerialConnection(_frame, param);
            }
            else if (p is LocalShellTerminalParam)
            {
                LocalShellTerminalParam param = (LocalShellTerminalParam)p;
                con = CommunicationUtil.CreateNewLocalShellConnection(_frame, param);
            }

            if (con != null)
            {
                AddNewTerminal(con);
                return(CommandResult.Success);
            }
            else
            {
                return(CommandResult.Cancelled);
            }
        }
        public ConnectionTag SilentNewConnection(TerminalParam p)
        {
            if (!CheckPaneCount())
            {
                return(null);
            }

            ConnectionTag con = null;

            if (p is SSHTerminalParam)
            {
                SSHTerminalParam tp = (SSHTerminalParam)p;
                con = CommunicationUtil.CreateNewConnection(tp, null);
            }
            else if (p is TelnetTerminalParam)
            {
                TelnetTerminalParam tp = (TelnetTerminalParam)p;
                con = CommunicationUtil.CreateNewConnection(tp);
            }
            else if (p is SerialTerminalParam)
            {
                SerialTerminalParam tp = (SerialTerminalParam)p;
                con = CommunicationUtil.CreateNewSerialConnection(_frame, tp);
            }
            else if (p is LocalShellTerminalParam)
            {
                LocalShellTerminalParam tp = (LocalShellTerminalParam)p;
                con = CommunicationUtil.CreateNewLocalShellConnection(_frame, tp);
            }

            if (con != null)
            {
                AddNewTerminal(con);
            }
            return(con);
        }