public async Task <TResult> ShowModalDialogAsync <TViewModel, TResult>(object args) where TViewModel : IResultDialogViewModel <TResult> { IResultDialogViewModel <TResult> vm = GetViewModel <TViewModel, TResult>(args); LcarsModalDialog dialog = ResolveModalDialogForViewModel(vm); _semaphore.Wait(); await dialog.OpenAsync(); _semaphore.Release(); return(vm.Result); }
private static LcarsModalDialog ResolveModalDialogForViewModel <T>(IResultDialogViewModel <T> vm) { if (vm is AddToInventoryViewModel) { return(new AddToInventoryModalDialog((AddToInventoryViewModel)vm)); } else if (vm is AddGroceryItemTypeViewModel) { return(new AddGroceryItemTypeModalDialog((AddGroceryItemTypeViewModel)vm)); } else { return(new LcarsModalDialog()); } }