@@ -67,6 +67,7 @@ public class MainWindowViewModel : ViewModelBase
67
67
68
68
public ReactiveCommand < Unit , Unit > DownloadCommand { get ; private set ; } = null ! ;
69
69
public ReactiveCommand < Unit , Unit > DownloadLogCommand { get ; private set ; } = null ! ;
70
+ public ReactiveCommand < Unit , Unit > RefreshCommand { get ; private set ; } = null ! ;
70
71
public ReactiveCommand < Unit , Unit > ParentCommand { get ; private set ; } = null ! ;
71
72
public ReactiveCommand < Unit , Unit > OpenCommand { get ; private set ; } = null ! ;
72
73
private ReactiveCommand < Namespace , IEnumerable < Pod > > GetPodsForNamespace { get ; set ; } = null ! ;
@@ -82,6 +83,7 @@ public MainWindowViewModel()
82
83
// commands
83
84
ConfigureOpenDirectoryCommand ( ) ;
84
85
ConfigureDownloadFileCommand ( kubernetesService ) ;
86
+ ConfigureRefreshCommand ( kubernetesService ) ;
85
87
ConfigureDownloadLogCommand ( kubernetesService ) ;
86
88
ConfigureParentDirectoryCommand ( ) ;
87
89
ConfigureGetPodsForNamespaceCommand ( kubernetesService ) ;
@@ -248,6 +250,24 @@ await Observable.StartAsync(async () =>
248
250
DownloadLogCommand . ThrownExceptions . ObserveOn ( RxApp . MainThreadScheduler )
249
251
. Subscribe ( ShowErrorMessage ) ;
250
252
}
253
+
254
+ private void ConfigureRefreshCommand ( IKubernetesService kubernetesService )
255
+ {
256
+ var isSelectedContainer = this
257
+ . WhenAnyValue ( x => x . SelectedContainer )
258
+ . Select ( x => x != null ) ;
259
+
260
+ RefreshCommand = ReactiveCommand . CreateFromTask ( async ( ) =>
261
+ {
262
+ await Observable . Start ( ( ) =>
263
+ {
264
+ FileInformation = GetFileInformation ( kubernetesService , SelectedPath ! , SelectedPod ! , SelectedNamespace ! , SelectedContainer ! ) ;
265
+ } , RxApp . TaskpoolScheduler ) ;
266
+ } , isSelectedContainer , RxApp . MainThreadScheduler ) ;
267
+
268
+ RefreshCommand . ThrownExceptions . ObserveOn ( RxApp . MainThreadScheduler )
269
+ . Subscribe ( ShowErrorMessage ) ;
270
+ }
251
271
252
272
private void ConfigureDownloadFileCommand ( IKubernetesService kubernetesService )
253
273
{
0 commit comments