Exemple #1
0
        public void OnOK(object sender, System.EventArgs e)
        {
            this.DialogResult = DialogResult.None;
            TCPTerminalParam param = ValidateContent();

            if (param == null)
            {
                return;                          //パラメータに誤りがあれば即脱出
            }
            _loginButton.Enabled  = false;
            _cancelButton.Enabled = false;
            this.Cursor           = Cursors.WaitCursor;
            this.Text             = GApp.Strings.GetString("Caption.LoginDialog.Connecting");
            _savedHWND            = this.Handle;

            HostKeyCheckCallback checker = null;

            if (param.IsSSH)
            {
                checker = new HostKeyCheckCallback(new HostKeyChecker(this, (SSHTerminalParam)param).CheckHostKeyCallback);
            }

            _connector = CommunicationUtil.StartNewConnection(this, param, _passphraseBox.Text, checker);
            if (_connector == null)
            {
                ClearConnectingState();
            }
        }
        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);
            }
        }
Exemple #3
0
        private void OnOK(object sender, EventArgs args)
        {
            _result           = null;
            this.DialogResult = DialogResult.None;

            SerialTerminalParam param = ValidateParam();

            if (param == null)
            {
                return;
            }

            try {
                _result = CommunicationUtil.CreateNewSerialConnection(this, param);
                if (_result != null)
                {
                    this.DialogResult = DialogResult.OK;
                }
            }
            catch (Exception ex) {
                GUtil.Warning(this, ex.Message);
            }
        }
        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);
        }