Example #1
0
        public IProxy executeProxy(string proxyName, string eventType, object data = null)
        {
            IProxy proxy = getProxy(proxyName);

            if (proxy == null)
            {
                return(null);
            }

            if (proxy is IAsync)
            {
                IAsync async = proxy as IAsync;
                if (!async.isReady)
                {
                    async.addReayHandle(delegate(EventX msg)
                    {
                        executeProxy(proxyName, eventType, data);
                    });
                    async.startSync();
                    return(proxy);
                }
            }

            MethodInfo handle;

            if (ReflectionAccessor.TryGetMethod(proxy, eventType, out handle))
            {
                handle.Invoke(proxy, new object[] { data });
                return(proxy);
            }

            proxy.execute(eventType, data);
            return(proxy);
        }
Example #2
0
        public IMediator executeMediator(string mediatorName, string eventType, object data = null, int type = 1)
        {
            IMediator mediator = getMediator(mediatorName);

            if (mediator == null)
            {
                return(null);
            }
            if (mediator is IAsync)
            {
                IAsync async = mediator as IAsync;
                if (!async.isReady)
                {
                    async.addReayHandle(delegate(EventX msg)
                    {
                        executeMediator(mediatorName, eventType, data, type);
                    });
                    async.startSync();
                    return(mediator);
                }
            }

            if (type == 1)
            {
                IPanel view = mediator.getView(); //调用这种打开方式直接给予view打开处理,ayy改动
                view.show();
            }

            MethodInfo handle;

            if (ReflectionAccessor.TryGetMethod(mediator, eventType, out handle))
            {
                handle.Invoke(mediator, new object[] { data });
                return(mediator);
            }

            mediator.execute(eventType, data);
            return(mediator);
        }