我用的WinSCP为文件传输,并得到详细信息文件中像下面链接传输进度,下面取消文件传输,同时传送文件到目标
https://winscp.net/eng/docs/library
File transfer details binding continuously until file transfered in window using WPF
和转让代码链接
但我需要取消文件传输。请给出你的建议。
我用的WinSCP为文件传输,并得到详细信息文件中像下面链接传输进度,下面取消文件传输,同时传送文件到目标
https://winscp.net/eng/docs/library
File transfer details binding continuously until file transfered in window using WPF
和转让代码链接
但我需要取消文件传输。请给出你的建议。
根据我的理解,实现此目的的唯一方法是中止当前会话。
由于WinSCP赋予5.10测试版,您可以使用FileTransferProgressEventArgs.Cancel
:
bool cancel = false; // set to true to cancel the transfer
session.FileTransferProgress +=
(sender, e) =>
{
if (cancel)
{
e.Cancel = true;
}
};
session.PutFiles(localPath, remotePath).Check();
如何界定中止方法? @William Cross –
如果您按照以下getfiles示例进行操作: https://winscp.net/eng/docs/library_session_getfiles - 您将看到getfiles方法在新会话(本例中为命名会话)内被调用。如果要中止包含getfile的会话,则会中断文件传输。 –
我已经取消了Abort()帮助下的文件传输;谢谢@William Cross –