@@ -183,13 +183,15 @@ private void btnUpload_Click(object sender, EventArgs e)
183183
184184 if ( dlgOpen . ShowDialog ( ) != DialogResult . OK ) return ;
185185
186+
187+ var btnUploadText = btnUpload . Text ;
186188 try
187189 {
188190 Cursor = Cursors . WaitCursor ;
189191
190192 if ( dlgOpen . FileNames . Length > 1 )
191193 {
192- _robot . Ftp . DirectFileHandling . UploadFilesToController ( dlgOpen . FileNames , GetPath ( ) ) ;
194+ _robot . Ftp . DirectFileHandling . UploadFilesToController ( dlgOpen . FileNames , GetPath ( ) , progress : progress => OnProgress ( progress , btnUploadText , btnUpload ) ) ;
193195
194196 }
195197 else
@@ -207,6 +209,7 @@ private void btnUpload_Click(object sender, EventArgs e)
207209 finally
208210 {
209211 Cursor = Cursors . Default ;
212+ btnUpload . Text = btnUploadText ;
210213 }
211214 }
212215
@@ -233,6 +236,8 @@ private void btnDownload_Click(object sender, EventArgs e)
233236
234237 if ( files is null || files . Count ( ) == 0 ) return ;
235238
239+ var btnDownloadText = btnDownload . Text ; ;
240+
236241 try
237242 {
238243
@@ -253,17 +258,25 @@ private void btnDownload_Click(object sender, EventArgs e)
253258 if ( dlgFolder . ShowDialog ( ) != DialogResult . OK ) return ;
254259 Cursor = Cursors . WaitCursor ;
255260
256- _robot . Ftp . DirectFileHandling . DownloadFilesFromController ( dlgFolder . SelectedPath , files . Select ( file => file . FullName ) . ToArray ( ) ) ;
261+ _robot . Ftp . DirectFileHandling . DownloadFilesFromController ( dlgFolder . SelectedPath , files . Select ( file => file . FullName ) . ToArray ( ) , progress => OnProgress ( progress , btnDownloadText , btnDownload ) ) ;
257262
258263 Explorer . OpenDirectory ( dlgFolder . SelectedPath ) ;
259264 }
260265 }
261266 finally
262267 {
263268 Cursor = Cursors . Default ;
269+ btnDownload . Text = btnDownloadText ;
264270 }
265271 }
266272
273+ private void OnProgress ( double progress , string ? text , ToolStripButton button )
274+ {
275+ button . Text = $ "{ text } ({ ( int ) progress } %)";
276+ Application . DoEvents ( ) ;
277+ }
278+
279+
267280 // Perform renaming or directory creation
268281 private void lstFolder_AfterLabelEdit ( object sender , LabelEditEventArgs e )
269282 {
0 commit comments