示例#1
0
        //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));
        }
示例#2
0
        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));
        }
示例#3
0
 /// <summary>
 /// calls up whether dialogs are currently active through the service
 /// </summary>
 /// <returns></returns>
 public Task <bool> IsDialogRunning()
 {
     return(PrismDialogManager.IsDialogRunning());
 }