public ErrorDialogViewModel(BaseViewModel parentViewModel, ErrorDialogModel dataModel)
     : base(parentViewModel)
 {
     _dataModel = dataModel;
     // Will bubble property change events from the Model to the ViewModel.
     _dataModel.PropertyChanged += (sender, e) => OnPropertyChanged(e.PropertyName);
 }
Ejemplo n.º 2
0
        public static bool?ShowErrorDialog(this IDialogService dialogService, BaseViewModel parentViewModel, string errorTitle, string errorInformation, bool canContinue)
        {
            var model = new ErrorDialogModel();

            model.Load(errorTitle, errorInformation, canContinue);
            var loadVm = new ErrorDialogViewModel(parentViewModel, model);

            return(dialogService.ShowDialog <WindowErrorDialog>(parentViewModel, loadVm));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Asynchronously executes the <see cref="T:Microsoft.AspNetCore.Razor.TagHelpers.TagHelper" /> with the given <paramref name="context" /> and
        /// <paramref name="output" />.
        /// </summary>
        /// <param name="context">Contains information associated with the current HTML tag.</param>
        /// <param name="output">A stateful HTML element used to generate an HTML tag.</param>
        /// <returns>
        /// A <see cref="T:System.Threading.Tasks.Task" /> that on completion updates the <paramref name="output" />.
        /// </returns>
        /// <remarks>
        /// By default this calls into <see cref="M:Microsoft.AspNetCore.Razor.TagHelpers.TagHelper.Process(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext,Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput)" />.
        /// </remarks>
        /// .
        public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            (_htmlHelper as IViewContextAware).Contextualize(ViewContext);

            output.TagName = "ErrorDialog";
            output.TagMode = TagMode.StartTagAndEndTag;

            var model = new ErrorDialogModel(Id);

            var partial = await _htmlHelper.PartialAsync("_ErrorDialog", model);

            var writer = new StringWriter();

            partial.WriteTo(writer, _htmlEncoder);

            output.PreContent.SetHtmlContent(writer.ToString());
        }