Esempio n. 1
0
            /// <summary>
            /// 创建事件代理对象
            /// </summary>
            /// <param name="argsType">事件数据类型</param>
            /// <returns>代理对象实例</returns>
            public IEventChannel GetEventChannel(Type argsType)
            {
                if (argsType == null)
                {
                    return(null);
                }
                var rval = EventChannels.GetOrAdd(
                    argsType,
                    t =>
                {
                    try
                    {
                        var t2 = typeof(EventChannel <>).MakeGenericType(t);
                        return(Activator.CreateInstance(t2, this) as IEventChannel);
                    }
                    catch (Exception ex)
                    {
                        EventRouter.RaiseErrorEvent(this, ex);
                    }
                    return(null);
                }
                    );



                return(rval);
            }