title: Display progress of asynchronous SSH.NET SFTP upload (BeginUploadFile) on progress bar
body: <p>I'm using Renci SSH.NET as SFTP client in C#.<br>
  Now I'm making a progress bar with this API. I tried with async and await, but I could not find the solution for getting downloaded bytes. I tried this way:</p>
  
  <ol>
  <li><p>Could you let me know problem with my code?</p></li>
  <li><p>Is there any way to try using async, await with Renci SSH.NET? And get some downloaded or uploaded bytes from API.</p></li>
  </ol>
  
  
  
  <pre><code>IAsyncResult UploadResult = sftp.BeginUploadFile(stream, remotepath + "/" + 
  Path.GetFileName(localpath));
  
  SftpUploadAsyncResult UploadProgress = new SftpUploadAsyncResult(null, UploadResult.AsyncState);
  
  Window_Progress wp = new Window_Progress();
  Point _pt = MainWindow.current.PointToScreen(new 
  Point((MainWindow.current.Width - wp.Width) / 2,
  (MainWindow.current.Height - wp.Height) / 2));
  wp.Left = _pt.X;
  wp.Top = _pt.Y;
  
  while (!UploadProgress.IsCompleted)
  {
      UploadProgress = new SftpUploadAsyncResult(null,UploadResult.AsyncState);
      Thread.Sleep(10);
      wp.PartialProgressBar.Value = (UploadProgress.UploadedBytes / 
      FilesAndDirectory.GetSize(localpath) * 100);
  }
  
  UploadProgress.AsyncWaitHandle.WaitOne();
  wp.Close();
  </code></pre>