Exemple #1
0
        public bool Start()
        {
            using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "Start"))
            {
                bool result = default(bool);

                try
                {
                    ExCommsHostingModuleTypeHelper moduleType = ExCommsHostingModuleTypeHelper.Current;
                    Array values = Enum.GetValues(typeof(ExCommsHostingModuleType));

                    foreach (var activator in _activators)
                    {
                        using (ExCommsHostingModuleTypeHelper moduleType2 =
                                   new ExCommsHostingModuleTypeHelper(activator.SupportedModuleTypes))
                        {
                            if (!moduleType2.Equals(moduleType))
                            {
                                continue;
                            }

                            var host = activator.Create(this.ExecutorService);
                            if (host != null)
                            {
                                _hosts.Add(host);
                                result |= host.Start();

                                if (host.SingletonInstance is IExCommsServerImpl)
                                {
                                    this.CommunicationServer = host.SingletonInstance as IExCommsServerImpl;
                                }
                                if (host.SingletonInstance is IExMonitorServerImpl)
                                {
                                    this.MonitorServer = host.SingletonInstance as IExMonitorServerImpl;
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    method.Exception(ex);
                }

                return(result);
            }
        }
        public bool Start()
        {
            using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "Start"))
            {
                bool result = default(bool);

                try
                {
                    ExCommsHostingModuleTypeHelper moduleType = ExCommsHostingModuleTypeHelper.Current;
                    Array values = Enum.GetValues(typeof(ExCommsHostingModuleType));

                    foreach (var activator in _activators)
                    {
                        using (ExCommsHostingModuleTypeHelper moduleType2 =
                                new ExCommsHostingModuleTypeHelper(activator.SupportedModuleTypes))
                        {
                            if (!moduleType2.Equals(moduleType)) continue;

                            var host = activator.Create(this.ExecutorService);
                            if (host != null)
                            {
                                _hosts.Add(host);
                                result |= host.Start();

                                if (host.SingletonInstance is IExCommsServerImpl)
                                    this.CommunicationServer = host.SingletonInstance as IExCommsServerImpl;
                                if (host.SingletonInstance is IExMonitorServerImpl)
                                    this.MonitorServer = host.SingletonInstance as IExMonitorServerImpl;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    method.Exception(ex);
                }

                return result;
            }
        }