Working with Windows Forms, Visual Studio 2015, Message.Hub
I have time working with this event subscribe without problems, now I have the need to subscribe an event and it is executed before the Load event but it is not happening that, on the contrary the event is never executed.
I show the code that I occupy.
private readonly ISaUsuario _saUsuario = CompositionRoot.Resolve<SaUsuario>();
private readonly MessageHub _hub = MessageHub.Instance;
public MDI()
{
_hub.Subscribe<BusquedaSelected>(OnUsuarioSelected);
InitializeComponent();
}
private void OnUsuarioSelected(BusquedaSelected obj)
{
if (!String.IsNullOrEmpty(obj.Valor))
{
var entity = _saUsuario.Single(x => x.User == obj.Valor);
if (entity != null)
{
picFoto.Image = entity.Foto == null
? ImageHelper.ObtenerImagenNoDisponible(AsignacionTablasType.Usuario)
: ImageHelper.ByteArrayToImage(entity.Foto);
lblUsuario.Text = entity.Nombre;
}
}
}
private void MDI_Load(object sender, EventArgs e)
{
}
I hope you can help me. I need the event OnUsuarioSelected
to be executed before the Load ()