为实现良好的实践或编码习惯,是否应该采用不同的实施方式?
using System;
using MugenMvvmToolkit;
namespace My.App.Forms
{
public class EventAggregator : My.NotificationSystem.IEventAggregator
{
private readonly MugenMvvmToolkit.Interfaces.IEventAggregator _eventAggregator;
public EventAggregator()
{
_eventAggregator = ServiceProvider.Get<MugenMvvmToolkit.Interfaces.IEventAggregator>();
}
void IEventAggregator.Publish(object sender, object message)
{
_eventAggregator.Publish(sender, message);
}
bool IEventAggregator.Subscribe<TMessage>(Action<object, TMessage> action)
{
return _eventAggregator.Subscribe(action) != null;
}
bool IEventAggregator.Unsubscribe<TMessage>(Action<object, TMessage> action)
{
return _eventAggregator.Unsubscribe(action);
}
}
}
非常感谢您的投入。