コード例 #1
0
ファイル: PluginRunContext.cs プロジェクト: nateliu/StarSharp
        public static PluginRunContext Parse(PluginConfigItem configItem, IPluginContext context)
        {
            string runContext = configItem.RunContext;
            if (string.IsNullOrEmpty(runContext))
                runContext = MainThread;
            // on the same current thread
            if (runContext == MainThread)
            {
                if (!Contexts.ContainsKey(runContext))
                    Contexts[runContext] = new PluginRunContext(configItem, context);
            }
            else if (runContext == NewThread)
            {
                if (!Contexts.ContainsKey(runContext))
                    // get a new thread
                    Contexts[runContext] = new MultiThreadPluginRunContext(configItem, context);
            }
            else if (runContext == NewProcess)
            {
                if (!Contexts.ContainsKey(runContext))
                    // get a new process
                    Contexts[runContext] = new MultiProcessPluginRunContext(configItem, context);
            }
            else if (runContext == NewAppDomain)
            {
                if (!Contexts.ContainsKey(runContext))
                    // get a new AppDomain
                    Contexts[runContext] = new MultiAppDomainPuginRunContext(configItem, context);
            }
            Contexts[runContext].ConfigItem = configItem;
            Contexts[runContext].Context = context;
            configItem.PluginRunContext = Contexts[runContext];

            return Contexts[runContext];
        }
コード例 #2
0
 public ThreadRun(PluginConfigItem ConfigItem, IPluginContext Context, AutoResetEvent theSignal, Dictionary <string, IPlugin> plugins, MultiThreadPluginRunContext parent)
 {
     this.ConfigItem = ConfigItem;
     this.Context    = Context;
     this.theSignal  = theSignal;
     this.thePlugins = plugins;
     this.parent     = parent;
 }
コード例 #3
0
        public static PluginRunContext Parse(PluginConfigItem configItem, IPluginContext context)
        {
            string runContext = configItem.RunContext;

            if (string.IsNullOrEmpty(runContext))
            {
                runContext = MainThread;
            }
            // on the same current thread
            if (runContext == MainThread)
            {
                if (!Contexts.ContainsKey(runContext))
                {
                    Contexts[runContext] = new PluginRunContext(configItem, context);
                }
            }
            else if (runContext == NewThread)
            {
                if (!Contexts.ContainsKey(runContext))
                {
                    // get a new thread
                    Contexts[runContext] = new MultiThreadPluginRunContext(configItem, context);
                }
            }
            else if (runContext == NewProcess)
            {
                if (!Contexts.ContainsKey(runContext))
                {
                    // get a new process
                    Contexts[runContext] = new MultiProcessPluginRunContext(configItem, context);
                }
            }
            else if (runContext == NewAppDomain)
            {
                if (!Contexts.ContainsKey(runContext))
                {
                    // get a new AppDomain
                    Contexts[runContext] = new MultiAppDomainPuginRunContext(configItem, context);
                }
            }
            Contexts[runContext].ConfigItem = configItem;
            Contexts[runContext].Context    = context;
            configItem.PluginRunContext     = Contexts[runContext];

            return(Contexts[runContext]);
        }
コード例 #4
0
 public ThreadRun(PluginConfigItem ConfigItem, IPluginContext Context, AutoResetEvent theSignal, Dictionary<string, IPlugin> plugins, MultiThreadPluginRunContext parent)
 {
     this.ConfigItem = ConfigItem;
     this.Context = Context;
     this.theSignal = theSignal;
     this.thePlugins = plugins;
     this.parent = parent;
 }