Exemplo n.º 1
0
        private void loginSSh()
        {
            FormSshLogin formSshLogin = new FormSshLogin();

            loginIndex++;

            if (loginIndex > 4)
            {
                this.Close();
            }
            formSshLogin.ShowDialog();
            if (formSshLogin.dialogResult != DialogResult.OK)
            {
                this.Close();
                return;
            }
            this.sshShellControl = new SshShellControl();
            bool blResult = this.sshShellControl.OpenConnect(formSshLogin.txtHost.Text.Trim(), formSshLogin.txtUserName.Text.Trim()
                                                             , formSshLogin.txtPassword.Text.Trim(), Convert.ToInt32(formSshLogin.txtPort.Text.Trim()), 120, (uint)this.Width, (uint)this.Height);

            if (!blResult)
            {
                loginSSh();
            }
            this.sshShellControl.SetReveiverDataEvent(receiverData);
        }
Exemplo n.º 2
0
 //close form, close ssh session
 private void FormSSHMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     try
     {
         if (this.sshShellControl != null)
         {
             this.sshShellControl.Close();
             this.sshShellControl = null;
         }
     }
     catch (Exception exp)
     {
         Console.WriteLine(exp.Message);
     }
 }