小编Yox*_*Yox的帖子

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

我想在我的上传过程中显示上传过程的进度ProgressBar,这是我的按钮"上传"的代码:

private void button2_Click(object sender, EventArgs e)
{
    int Port = int.Parse(textBox2.Text);
    string Host = textBox1.Text;
    string Username = textBox3.Text;
    string Password = textBox4.Text;
    string WorkingDirectory = textBox6.Text;
    string UploadDirectory = textBox5.Text;

    FileInfo FI = new FileInfo(UploadDirectory);
    string UploadFile = FI.FullName;
    Console.WriteLine(FI.Name);
    Console.WriteLine("UploadFile" + UploadFile);

    var Client = new SftpClient(Host, Port, Username, Password);
    Client.Connect();
    if (Client.IsConnected)
    {
        var FS = new FileStream(UploadFile, FileMode.Open);
        if (FS != null)
        {
            Client.UploadFile(FS, WorkingDirectory + FI.Name, null);
            Client.Disconnect();
            Client.Dispose();
            MessageBox.Show(
                "Upload complete", …
Run Code Online (Sandbox Code Playgroud)

.net c# sftp winforms ssh.net

3
推荐指数
1
解决办法
4713
查看次数

如何在 UWP 中的最小化按钮旁边的标题栏中添加新按钮?

我想在 UWP 应用程序的标题栏中添加一个新按钮,如下所示:

示例

我已经看到了一些“类似”的帖子,但答案并不明确,而且缺乏细节,我很难理解他们做了什么。

c# xaml titlebar button uwp

3
推荐指数
1
解决办法
3296
查看次数

使用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
查看次数

标签 统计

c# ×3

.net ×2

sftp ×2

ssh.net ×2

winforms ×2

button ×1

titlebar ×1

uwp ×1

xaml ×1