This class is designed to be used in the worker thread.
Each method blocks thread while transmitting the files.
/// <summary> /// Constructor /// </summary> /// <param name="ownerForm">Owner form</param> /// <param name="scp">SCP client</param> /// <param name="connectionName">Connection name</param> public SCPForm(Form ownerForm, SCPClient scp, string connectionName) { InitializeComponent(); if (!this.DesignMode) { this._scp = scp; this._ownerForm = ownerForm; this.Text = "SCP - " + connectionName; this.progressBar.Maximum = PROGRESSBAR_MAX; this.checkRecursive.Checked = true; SetIcon(); SetText(); ChangeExecutingState(false); ClearProgressBar(); } }
public CommandResult InternalExecute(ICommandTarget target, params IAdaptable[] args) { ISSHConnection sshConnection = GetSSHConnection(target); // Note: Currently, SCPClient supports only SSH2. if (sshConnection == null || sshConnection.SSHProtocol != SSHProtocol.SSH2) return CommandResult.Ignored; string connectionName = GetTerminalName(target); if (connectionName == null) connectionName = SFTPPlugin.Instance.StringResource.GetString("Common.UnknownPeer"); Form ownerForm = GetForm(target); SCPClient scp = new SCPClient(sshConnection); SCPForm form = new SCPForm(ownerForm, scp, connectionName); form.Show(); // Note: don't specify owner to avoid fixed z-order. return CommandResult.Succeeded; }
private void SCPForm_FormClosed(object sender, FormClosedEventArgs e) { if (_ownerForm != null) { _ownerForm.FormClosed -= new FormClosedEventHandler(_ownerForm_FormClosed); _ownerForm = null; _scp = null; } }