/**
  * initialize all classes.
  */
 public void initilaizeClasses()
 {
     modal = new ImageServiceModal(this.outputDir, this.thumbnailSize);
     eventLog1.WriteEntry("initilaizeClasses: " + this.outputDir);
     controller    = new ImageController(modal);
     m_imageServer = new ImageServer(this.controller, this.logging);
     m_imageServer.Start();
     logging.MessageRecieved += Logging_MessageRecieved;// (this,eventArgs) ;
 }
Пример #2
0
 /**
  * initialize all classes.
  */
 public void initilaizeClasses()
 {
     modal = new ImageServiceModal(this.outputDir, this.thumbnailSize);
     eventLog1.WriteEntry("initilaizeClasses: " + this.outputDir);
     controller    = new ImageController(modal, logging);
     m_imageServer = new ImageServer(this.controller, this.logging, PORT_NUM);
     m_imageServer.Start();
     //logging.MessageRecieved += Logging_MessageRecieved;// (this,eventArgs) ;
     UpdateLogMessage += m_imageServer.sendClients;
     //logging.MessageRecieved += logging.newLog;
 }
Пример #3
0
        /// <summary>
        /// the function that runs when the service starts
        /// </summary>
        protected override void OnStart(string[] args)
        {
            // service info class (singelton)
            ServiceInfo info = ServiceInfo.CreateServiceInfo();

            // log history class (singelton)
            history = LogHistory.CreateLogHistory();
            // create the service model
            IImageServiceModal model = new ImageServiceModal(info.OutputDir, info.ThumbnailSize);
            // create the services servers
            ImageController controller = new ImageController(model);

            // create image server
            server = new ImageServer(controller, logger);
            // create tcp server
            //tcpServer = new TcpServer(controller, logger);
            // create TcpApplicationServer
            tcpApplicationServer = new TcpApplicationServer(logger);
            // start the tcp server
            string[] str = { };
            //tcpServer.Start(str);
            // start the image server
            server.Start(info.Handlers.ToArray());
            // start the application server
            tcpApplicationServer.Start(str);
            controller.HandlerClosedEvent += server.CloseHandler;
            //logger.NotifyClients += tcpServer.NotifyClients;
            //server.NotifyClients += tcpServer.NotifyClients;
            //tcpServer.CommandRecieved += server.NewCommand;
            logger.MessageRecieved += ImageServiceMessage;
            logger.MessageRecieved += history.UpdateLog;
            //logger.MessageRecieved += tcpServer.NewLog;


            // Update the service state to Start Pending.
            ServiceStatus serviceStatus = new ServiceStatus();

            serviceStatus.dwCurrentState = ServiceState.SERVICE_START_PENDING;
            serviceStatus.dwWaitHint     = 100000;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);

            logger.Log("In OnStart", MessageTypeEnum.INFO);
            // Set up a timer to trigger every minute.
            System.Timers.Timer timer = new System.Timers.Timer();
            timer.Interval = 60000; // 60 seconds
            timer.Elapsed += new System.Timers.ElapsedEventHandler(this.OnTimer);
            timer.Start();

            // Update the service state to Running.
            serviceStatus.dwCurrentState = ServiceState.SERVICE_RUNNING;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);
        }
Пример #4
0
        /// <summary>
        /// Creates auxiliary LoggingService and ImageServer
        /// </summary>
        /// <param name="args"></param>
        protected override void OnStart(string[] args)
        {
            // Update the service state to Start Pending.
            Status = new ServiceStatus
            {
                dwCurrentState = ServiceState.SERVICE_START_PENDING,
                dwWaitHint     = 100000
            };
            SetServiceStatus(this.ServiceHandle, ref Status);
            LogStatus();

            Logging = new LoggingService();
            Logging.MessageReceived += OnMessage;
            ImageServer              = new ImageServer(Logging);

            // Update the service state to Running.
            Status.dwCurrentState = ServiceState.SERVICE_RUNNING;
            SetServiceStatus(this.ServiceHandle, ref Status);
            LogStatus();

            // Start Server
            ImageServer.Start();
        }
Пример #5
0
        /// <summary>
        /// OnStart function.
        /// responsible what happen when the service will start
        /// </summary>
        /// <param name="args">command line args</param>
        protected override void OnStart(string[] args)
        {
            logging.Log("In OnStart", MessageTypeEnum.INFO);
            // Set up a timer to trigger every minute.

            // Update the service state to Start Pending.
            ServiceStatus serviceStatus = new ServiceStatus();

            serviceStatus.dwCurrentState = ServiceState.SERVICE_START_PENDING;
            serviceStatus.dwWaitHint     = 100000;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);

            //Run the image server, so it will listen for income-clients
            m_imageServer = new ImageServer(controller, logging, m_currentLog);
            m_imageServer.Start();

            System.Timers.Timer timer = new System.Timers.Timer();
            timer.Interval = 60000; // 60 seconds
            timer.Elapsed += new System.Timers.ElapsedEventHandler(this.OnTimer);
            timer.Start();
            // Update the service state to Running.
            serviceStatus.dwCurrentState = ServiceState.SERVICE_RUNNING;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);
        }