예제 #1
0
        static private bool ConfigurarComponentes()
        {
            try
            {
                Builder.Output("Creando componentes.");
                // Crear referencias
                _clientManager = new ClientManager();
                _notifier      = new Notifier();
                _zyanServer    = new ZyanServer();

                Builder.Output("Configurando componentes.");
                //  ClientManager -> all Config
                MessageBus.Register <SendSystemConfig>(_clientManager.ReceiveSystemConfig);
                MessageBus.Register <SendClientConfig>(_clientManager.ReceiveClientConfig);

                // Notifier y ZyanServer -> system config
                MessageBus.Register <SendSystemConfig>(_notifier.ReceiveSystemConfig);
                MessageBus.Register <SendSystemConfig>(_zyanServer.ReceiveSystemConfig);

                // Enviando config
                MessageBus.Send(new SendClientConfig(_dbHandler.ClientList));
                MessageBus.Send(new SendSystemConfig(_dbHandler.SystemData));

                // Pausa para que los request handlers de los componentes terminen
                System.Threading.Thread.Sleep(100);

                return(true);
            }
            catch (Exception ex)
            {
                Builder.Output(string.Format("{0}.ConfigurarComponentes: ocurrio una excepcion: {1}", ClassName, ex.Message), System.Diagnostics.TraceEventType.Error);
                return(false);
            }
        }
예제 #2
0
        private void Build()
        {
            try
            {
                _clientManager = new ClientManager();
                _dbHandler     = new DbHandler();
                _zyanServer    = new ZyanServer();
                _notifier      = new Notifier();

                Builder.Output("All Builded");
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
                throw;
            }
        }
예제 #3
0
        internal void DetenerServicio()
        {
            Builder.Output("Stopping Monitor");

            StopModules();

            // Going down anyway

            try
            {
                _clientManager = null;
                _dbHandler     = null;
                _zyanServer    = null;
                _notifier      = null;
                _editForm      = null;
            }
            catch (Exception)
            {
                // ignorar excepciones  en terminacion
            }
        }