Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added async

...

Then, add this code to the OnAddFamilyExecute function:

Code Block
private async void OnAddFamilyExecute()
{
    var family = new Family();

    // Note that we use the type factory here because it will automatically take care of any dependencies
    // that the FamilyWindowViewModel will add in the future
    var typeFactory = this.GetTypeFactory();
    var familyWindowViewModel = typeFactory.CreateInstanceWithParametersAndAutoCompletion<FamilyWindowViewModel>(family);
    if (await _uiVisualizerService.ShowDialog(familyWindowViewModel) ?? false)
    {
        Families.Add(family);
        UpdateSearchFilter();
    }
}

...

Code Block
protected override async voidTask Initialize()
{
    var families = _familyService.LoadFamilies();
    Families = new ObservableCollection<Family>(families);

    UpdateSearchFilter();
}

...