private void button3_Click(object sender, EventArgs e) { login login_form = new login(); login_form.ShowDialog(); this.Text = "SSH Frontend (connecting)"; user = login_form.GetUser(); pass = login_form.GetPass(); try { ssh_client = new SshClient(host, user, pass); ssh_client.Connect(); } catch (Exception exception) { if (exception is SshAuthenticationException || exception is ArgumentException) { alert_form alert = new alert_form("Wrong username or password!"); alert.ShowDialog(); } return; } ssh_cmd = ssh_client.CreateCommand(""); this.Text = "SSH Frontend (connected)"; r_explorer = new remote_explorer(host, listBox4, listBox3, ssh_cmd); listBox3.MouseDoubleClick += r_explorer.virtual_dir_double_click; listBox4.MouseDoubleClick += r_explorer.remote_dir_double_click; exchanger = new explorer_exchange(host, user, pass, l_explorer, r_explorer); button1.Click += exchanger.upload_button_pressed; button2.Click += exchanger.download_button_pressed; }
public explorer_exchange(string host, string user, string pass, locale_explorer l_explorer, remote_explorer r_explorer) { this.host = host; this.user = user; this.l_explorer = l_explorer; this.r_explorer = r_explorer; this.scp_client = new ScpClient(host, user, pass); this.scp_client.Connect(); }