相关疑难解决方法(0)

使用SSH.NET在ProgressBar中显示文件下载的进度

我想在我的网站上显示下载过程的进度ProgressBar.我尝试过这样的代码来上传,但我失败了.这是我尝试失败的一个例子

private void button5_Click(object sender, EventArgs e)
{
    Task.Run(() => Download());
}

private void Download()
{
    try
    {
        int Port = (int)numericUpDown1.Value;
        string Host = comboBox1.Text;
        string Username = textBox3.Text;
        string Password = textBox4.Text;
        string SourcePath = textBox5.Text;
        string RemotePath = textBox6.Text;
        string FileName = textBox7.Text;

        using (var file = File.OpenWrite(SourcePath + FileName))
        using (var Stream = new FileStream(SourcePath + FileName, FileMode.Open))
        using (var Client = new SftpClient(Host, Port, Username, Password))
        {
            Client.Connect();
            progressBar1.Invoke((MethodInvoker)
            delegate
            { …
Run Code Online (Sandbox Code Playgroud)

.net c# sftp winforms ssh.net

2
推荐指数
1
解决办法
3859
查看次数

标签 统计

.net ×1

c# ×1

sftp ×1

ssh.net ×1

winforms ×1