public Task <IUICommand> ShowAsync(MessageDialog dialog, TimeSpan?timeout = null, CancellationToken?token = null) { if (_tokenSource is null) { _tokenSource = new CancellationTokenSource(); } CancellationToken tk = token ?? _tokenSource.Token; return(PrismDialogManager.OneAtATimeAsync(async() => await dialog.ShowAsync().AsTask(tk), timeout, tk)); }
//void ConfigureDialogWindowContent(string dialogName, IDialogWindow window, IDialogParameters parameters) //{ // var content = _containerProvider.Resolve<object>(dialogName); // if (!(content is FrameworkElement dialogContent)) // { // throw new NullReferenceException("A dialog's content must be a FrameworkElement"); // } // MvvmHelpers.AutowireViewModel(content); // if (!(dialogContent.DataContext is IDialogAware viewModel)) // { // throw new NullReferenceException($"A dialog's ViewModel must implement the IDialogAware interface ({dialogContent.DataContext})"); // } // ConfigureDialogWindowProperties(window, dialogContent, viewModel); // MvvmHelpers.ViewAndViewModelAction<IDialogAware>(viewModel, d => d.OnDialogOpened(parameters)); //} public Task <ContentDialogResult> ShowAsync(ContentDialog dialog, TimeSpan?timeout = null, CancellationToken?token = null) { if (_tokenSource is null) { _tokenSource = new CancellationTokenSource(); } var tk = token ?? _tokenSource.Token; return(PrismDialogManager.OneAtATimeAsync(async() => await dialog.ShowAsync(tk), timeout, tk)); }