using DTS.Common.Utilities.Logging;
using Prism.Events;
using Prism.Ioc;
using System;
namespace DTS.Common.Events
{
///
/// Event to inform app that it should mark itself busy or available
///
///
///
///
public class PageErrorEvent : PubSubEvent
{
///
/// surfaces an error to the application, if applicable
/// http://manuscript.dts.local/f/cases/28312/Surface-Read-does-not-match-write-to-user
///
///
public static void SurfaceApplicationError(string msg)
{
try
{
var eventAggregator = ContainerLocator.Container.Resolve();
eventAggregator.GetEvent().Publish(new PageErrorArg(new[] { msg }, null));
}
catch (Exception ex)
{
APILogger.Log(ex);
}
}
}
public class PageErrorArg
{
public string[] Errors { get; }
public object Page { get; }
public bool Handled { get; set; }
public PageErrorArg(string[] errors, object page)
{
Errors = errors;
Page = page;
}
}
}