Beispiel #1
0
        protected override void OnStart(string[] args)
        {
            base.OnStart(args);
            log.Info("Service starting");
            try
            {
                subscribers    = new SubscriberGroup();
                scanner        = new MMMSwipeReader();
                scanStoreCloud = new ScanStoreCloud(_configFileName);
                serviceHost    = RemoteFactory.CreateServiceHost(this);
                BindScanSourceToScanStore(scanner, scanStoreCloud);

                serviceHost.Open();
                scanner.Activate();
                log.InfoFormat("Service started and listening at ", RemoteFactory.PipeLocation);
            }
            catch (Exception e)
            {
                log.ErrorFormat("Service exception while starting [{0}]", e);
                EventLog.WriteEntry(this.ServiceName, e.Message,
                                    System.Diagnostics.EventLogEntryType.Warning);
                EventLog.WriteEntry(this.ServiceName, e.StackTrace,
                                    System.Diagnostics.EventLogEntryType.Warning);
                OnStop();
                throw e;
            }
        }
Beispiel #2
0
 public void Activate()
 {
     log.Info("Activating connection to local 3M Scanner and remote web service for delivery");
     scanner      = new MMMSwipeReader();
     documentSink = new ScanStoreCloud(_configFileName);
     try
     {
         documentSink.OnScanStoreEvent += HandleScanSinkEvent;
         scanner.OnScanSourceEvent     += HandleScanSourceEvent;
         scanner.OnCodeLineScanEvent   += HandleCodeLineScanEvent;
         scanner.Activate();
     }
     catch (PosHardwareException e)
     {
         Console.WriteLine(e.Message);
     }
 }