namespace GameLibrary.Framework{
using System;
using Caliburn.PresentationFramework;
using Caliburn.PresentationFramework.ApplicationModel;
using Microsoft.Practices.ServiceLocation;
public class ShowScreenResult<T> : IResult
where T : IPresenter
{
private Action<T> _configruation;
public void Execute(IRoutedMessageWithOutcome message, IInteractionNode handlingNode)
{
var shell = ServiceLocator.Current.GetInstance<IShell>();
var screen = ServiceLocator.Current.GetInstance<T>();
if(_configruation != null)
_configruation(screen);
shell.Open(screen);
Completed(this, null);
}
public event Action<IResult, Exception> Completed = delegate { };
public ShowScreenResult<T> Configured(Action<T> configuration)
{
_configruation = configuration;
return this;
}
}
}
|