Skip to content

Commit a537a62

Browse files
committed
adjust RelayCommand
1 parent d9e3cd6 commit a537a62

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

MainWindowViewModel.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public MainWindowViewModel()
1515
GenerateDocumentCommand = new RelayCommand(GenerateDocument);
1616
}
1717

18-
public void GenerateDocument(object _)
18+
public void GenerateDocument()
1919
{
2020
Console.WriteLine(Invoice.Name);
2121
}

RelayCommand.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ namespace InvoiceApp
55
{
66
public class RelayCommand : ICommand
77
{
8-
private readonly Action<object> _execute;
8+
private readonly Action _execute;
99
private readonly Predicate<object> _canExecute;
1010

11-
public RelayCommand(Action<object> execute, Predicate<object> canExecute = null)
11+
public RelayCommand(Action execute, Predicate<object> canExecute = null)
1212
{
1313
_execute = execute ?? throw new ArgumentNullException(nameof(execute));
1414
_canExecute = canExecute;
@@ -25,9 +25,9 @@ public bool CanExecute(object? parameter)
2525
return _canExecute == null || _canExecute(parameter);
2626
}
2727

28-
public void Execute(object? parameter)
28+
public void Execute(object? _)
2929
{
30-
_execute(parameter);
30+
_execute();
3131
}
3232
}
3333
}

0 commit comments

Comments
 (0)