1
1
using CommunityToolkit . Mvvm . ComponentModel ;
2
- using CommunityToolkit . Mvvm . Input ;
3
2
using Files . App . Actions ;
4
3
using Files . App . Actions . Content . Archives ;
5
4
using Files . App . Actions . Content . Background ;
16
15
using System . Diagnostics ;
17
16
using System . Linq ;
18
17
using System . Threading . Tasks ;
19
- using System . Windows . Input ;
20
18
21
19
namespace Files . App . Commands
22
20
{
@@ -252,7 +250,6 @@ private class ActionCommand : ObservableObject, IRichCommand
252
250
public event EventHandler ? CanExecuteChanged ;
253
251
254
252
private readonly IAction action ;
255
- private readonly ICommand command ;
256
253
257
254
public CommandCodes Code { get ; }
258
255
@@ -279,7 +276,7 @@ public bool IsOn
279
276
set
280
277
{
281
278
if ( action is IToggleAction toggleAction && toggleAction . IsOn != value )
282
- command . Execute ( null ) ;
279
+ Execute ( null ) ;
283
280
}
284
281
}
285
282
@@ -294,7 +291,6 @@ public ActionCommand(CommandCodes code, IAction action)
294
291
OpacityStyle = action . Glyph . ToOpacityStyle ( ) ;
295
292
HotKeyText = GetHotKeyText ( ) ;
296
293
LabelWithHotKey = HotKeyText is null ? Label : $ "{ Label } ({ HotKeyText } )";
297
- command = new AsyncRelayCommand ( ExecuteAsync ) ;
298
294
299
295
if ( action is INotifyPropertyChanging notifyPropertyChanging )
300
296
notifyPropertyChanging . PropertyChanging += Action_PropertyChanging ;
@@ -303,15 +299,15 @@ public ActionCommand(CommandCodes code, IAction action)
303
299
}
304
300
305
301
public bool CanExecute ( object ? parameter ) => action . IsExecutable ;
306
- public void Execute ( object ? parameter ) => command . Execute ( parameter ) ;
302
+ public async void Execute ( object ? parameter ) => await ExecuteAsync ( ) ;
307
303
308
304
public async Task ExecuteAsync ( )
309
305
{
310
306
if ( IsExecutable )
311
307
await action . ExecuteAsync ( ) ;
312
308
}
313
309
314
- public async void ExecuteTapped ( object sender , TappedRoutedEventArgs e ) => await action . ExecuteAsync ( ) ;
310
+ public async void ExecuteTapped ( object sender , TappedRoutedEventArgs e ) => await ExecuteAsync ( ) ;
315
311
316
312
private void Action_PropertyChanging ( object ? sender , PropertyChangingEventArgs e )
317
313
{
0 commit comments