Skip to content

Commit

Permalink
Merge pull request #100 from thomasclaudiushuber/issue/98
Browse files Browse the repository at this point in the history
Adjust readme for nuget package to include new code for command gener…
  • Loading branch information
thomasclaudiushuber authored Dec 12, 2023
2 parents 528fd15 + 01e5fa4 commit d53206e
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions src/MvvmGen/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,24 +195,42 @@ namespace MyWpfApp.ViewModel
{
partial class EmployeeViewModel : global::MvvmGen.ViewModels.ViewModelBase
{
private IDelegateCommand? _saveCommand;
public EmployeeViewModel()
{
this.InitializeCommands();
this.OnInitialize();
}
partial void OnInitialize();
private void InitializeCommands()
public IDelegateCommand SaveCommand => _saveCommand ??= new DelegateCommand(_ => Save(), _ => CanSave());
public string FirstName
{
SaveCommand = new DelegateCommand(_ => Save(), _ => CanSave());
get => _firstName;
set
{
if (_firstName != value)
{
_firstName = value;
OnPropertyChanged("FirstName");
}
}
}
public DelegateCommand SaveCommand { get; private set; }
public string FirstName { ... }
public string LastName { ... }
public string LastName
{
get => _lastName;
set
{
if (_lastName != value)
{
_lastName = value;
OnPropertyChanged("LastName");
}
}
}
protected override void InvalidateCommands(string? propertyName)
{
Expand Down Expand Up @@ -276,10 +294,11 @@ namespace MyWpfApp.ViewModel
{
partial class EmployeeViewModel : global::MvvmGen.ViewModels.ViewModelBase
{
private IDelegateCommand? _saveCommand;
public EmployeeViewModel(MvvmGen.Events.IEventAggregator eventAggregator)
{
this.EventAggregator = eventAggregator;
this.InitializeCommands();
this.OnInitialize();
}
Expand Down

0 comments on commit d53206e

Please sign in to comment.