Пример #1
0
 public ProcessingManager(IFunctionExecutor functionExecutor)
 {
     this.functionExecutor = functionExecutor;
     applicationSequence   = 0;
     transportSequence     = 0;
     dom     = new DomServiceProxy(ConfigurationManager.AppSettings["Dom"]);
     log     = new LogServiceProxy(ConfigurationManager.AppSettings["Log"]);
     storage = new SF.Common.Proxies.ScadaStorageProxy(ConfigurationManager.AppSettings["Storage"]);
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Acquisitor"/> class.
 /// </summary>
 /// <param name="acquisitionTrigger">The acquisition trigger.</param>
 /// <param name="processingManager">The processing manager.</param>
 /// <param name="stateUpdater">The state updater.</param>
 public Acquisitor(IProcessingManager processingManager)
 {
     this.processingManager = processingManager;
     log = new LogServiceProxy(ConfigurationManager.AppSettings["Log"]);
     if (!Int32.TryParse(ConfigurationManager.AppSettings["AcquisitionInterval"], out acquisitionInterval))
     {
         acquisitionInterval = 1000;
     }
     this.InitializeAcquisitionThread();
     this.StartAcquisitionThread();
 }
Пример #3
0
 /// <summary>
 /// This is the main entry point for your service instance.
 /// </summary>
 /// <param name="cancellationToken">Canceled when Service Fabric needs to shut down this service instance.</param>
 protected override async Task RunAsync(CancellationToken cancellationToken)
 {
     while (true)
     {
         ServiceEventSource.Current.ServiceMessage(Context, "WORKING!!!");
         try
         {
             //cancellationToken.ThrowIfCancellationRequested();
             Update();
         }
         catch (Exception ex)
         {
             var log = new LogServiceProxy(ConfigurationReader.ReadValue(Context, "Settings", "Log"));
             await log.Log(new SCADA.Common.Logging.LogEventModel()
             {
                 EventType = SCADA.Common.Logging.LogEventType.ERROR,
                 Message   = $"Message:{ex.Message}\nStackTrace:{ex.StackTrace}"
             });
         }
         await Task.Delay(TimeSpan.FromSeconds(5), CancellationToken.None);
     }
 }