init
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
using DTS.Common.Utilities.Logging;
|
||||
using Microsoft.Practices.Prism.Events;
|
||||
using Microsoft.Practices.ServiceLocation;
|
||||
using System;
|
||||
|
||||
namespace DTS.Common.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Event to inform app that it should mark itself busy or available
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
public class PageErrorEvent : CompositePresentationEvent<PageErrorArg>
|
||||
{
|
||||
/// <summary>
|
||||
/// surfaces an error to the application, if applicable
|
||||
/// http://manuscript.dts.local/f/cases/28312/Surface-Read-does-not-match-write-to-user
|
||||
/// </summary>
|
||||
/// <param name="msg"></param>
|
||||
public static void SurfaceApplicationError(string msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
var eventAggregator = ServiceLocator.Current.GetInstance<IEventAggregator>();
|
||||
eventAggregator.GetEvent<PageErrorEvent>().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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user