I try to call ShowDialogAsync in a synchron code. I'm not very familiar with async programming. If I run this code, I end up in a deadlock. If I change Command to TaskCommand, it will work, but I have to change all Code to async.
public MainWindow()
{
InitializeComponent();
Abc = new Command(() => Asd());
}
public Command Abc { get; set; }
private void Asd()
{
var b = StartDialog(true).GetAwaiter().GetResult();
}
private async Task<bool> StartDialog(bool isMultiple)
{
await ServiceLocator.Default.ResolveType<IUIVisualizerService>().ShowDialogAsync<PersonVm>(new PersonM());
return true;
}
Here I have used the answer from here. Could someone help me please?