MugenMVVM之上的抽象。可以吗

时间:2019-05-28 06:43:14

标签: c# .net unit-testing solid-principles mugenmvvmtoolkit

为实现良好的实践或编码习惯,是否应该采用不同的实施方式?

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);
        }
    }
}

非常感谢您的投入。

0 个答案:

没有答案