Skip to content

Commit e8d3bf2

Browse files
authored
Refactor OpenThePodBayDoors command implementation
I think it is more of the Community Toolkit way of programming
1 parent 748ca64 commit e8d3bf2

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/Avalonia.Samples/MVVM/CommandSample/ViewModels/CommunityToolkitCommandsViewModel.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ public CommunityToolkitCommandsViewModel()
2727
/// </summary>
2828
/// <remarks>
2929
/// Note: We use the interface ICommand here because this makes things more flexible.
30-
/// </remarks>
31-
public ICommand OpenThePodBayDoorsDirectCommand { get; }
32-
33-
// The method that will be executed when the command is invoked
34-
private void OpenThePodBayDoors()
30+
/// </remarks>
31+
[RelayCommand]
32+
private void OpenThePodBayDoorsDirect()
3533
{
3634
ConversationLog.Clear();
3735
AddToConvo("I'm sorry, Dave, I'm afraid I can't do that.");
@@ -104,4 +102,4 @@ private void AddToConvo(string content)
104102
{
105103
ConversationLog.Add(content);
106104
}
107-
}
105+
}

0 commit comments

Comments
 (0)