예제 #1
0
        public static IPT GetPT(YUEnums.PTEnum type, params object[] args)
        {
            lock (thisLock)
            {
                if (notRegistered)
                {
                    RegisterPT();
                }
            }
            IPT instance = null;

            if (_mapServer.ContainsKey(type))
            {
                instance = TypesContainer.CreateInstance <IPT>(_mapServer[type], args);
            }
            else
            {
                var argList = args.ToList();
                argList.Add(type);
                instance = TypesContainer.CreateInstance <IPT>("YU.PT.ExtendPT,YU.PT", argList.ToArray());
            }
            if (instance == null)
            {
                throw new Exception("instance==null");
            }
            return(instance);
        }
예제 #2
0
        protected void InvokeMethod(IBillBenchPlugInEventArgs e, Action <IBillBenchPlugIn> action)
        {
            var formId = e.Rule.TargetFormId;

            if (!this.PlugIns.Any(p => p.Item1.EqualsIgnoreCase(formId)) && this.Registration.Any(reg => reg.Key.EqualsIgnoreCase(formId)))
            {
                var className = this.Registration[formId];
                this.RegisterPlugIn(new Tuple <string, IBillBenchPlugIn>(formId, TypesContainer.CreateInstance <IBillBenchPlugIn>(className)));
            }//end if

            var billView = this.View.AsType <IBillView>();

            foreach (var plugin in this.PlugIns)
            {
                plugin.Item2.SetContext(billView);
                if (action != null)
                {
                    action.Invoke(plugin.Item2);
                }
            }
        }
예제 #3
0
        public static IPT GetPT(YUEnums.PTEnum type, params object[] args)
        {
            lock (thisLock)
            {
                if (notRegistered)
                {
                    RegisterPT();
                }
            }
            IPT instance = null;

            if (_mapServer.ContainsKey(type))
            {
                instance = TypesContainer.CreateInstance <IPT>(_mapServer[type], args);
            }
            if (instance == null)
            {
                throw new Exception("instance==null");
            }
            return(instance);
        }