public MainWindow(FileLogger logger)
        {
            Logger = logger;
            InitializeComponent();
            ShutDownButton.IsEnabled = false;

            EventProcessor.OnUpdatedInfo += HandleEventProcessorInfo;
            App.Engine.OnStateChanged    += HandleEngineStateChange;
            App.Engine.OnNewAnalyzerInfo += HandleAnalyzerInfo;


            Task.Run(() =>
            {
                while (true)
                {
                    MessageAggregator.Collection.Clear();
                    for (var i = 0; i < 50; ++i)
                    {
                        if (App.Engine.EngineMessages.TryDequeue(out var msg))
                        {
                            MessageAggregator.AddMessage(msg, msg.Message.GenerateMessageIdentifierFromString());
                        }
                    }
                    foreach (var messageTracker in MessageAggregator.Collection)
                    {
                        MesseageOutputQueue.Enqueue($"{messageTracker.Value.Message} | {messageTracker.Value.AmountCounter} times from {messageTracker.Value.FirstOccurrence} to {messageTracker.Value.LastOccurrence}");
                    }
                    for (int i = 1; i <= 14; ++i)
                    {
                        if (MesseageOutputQueue.TryDequeue(out string message))
                        {
                            //UpdateMessageBox($"{DateTime.UtcNow}\t{message}{Environment.NewLine}");
                            Logger.AddRow(message);
                            SnapShotGenerator.AddMessageToSnapShot(DateTime.UtcNow, message);
                        }
                    }
                }
            });

            Task.Run(() =>
            {
                while (true)
                {
                    UpdateSnapshotAnalyzerInfo();
                    Task.Delay(4000).Wait();
                }
            });
            StartUpdateSelectedAnalyzerTask();
        }
Exemple #2
0
 public StatusSnapShotGenerator(string fileSavePath, FileLogger logger, int fileGenerationIntervalSeconds = 5)
 {
     Logger = logger;
     try
     {
         if (!fileSavePath.EndsWith(@"\"))
         {
             fileSavePath += @"\";
         }
         LogFileFolder = new DirectoryInfo(fileSavePath);
         if (!LogFileFolder.Exists)
         {
             throw new DirectoryNotFoundException("Can not find " + fileSavePath);
         }
         FileGenerationIntervalSeconds = fileGenerationIntervalSeconds;
     }
     catch (Exception e)
     {
         Logger.AddRow($"Exception in {nameof(StatusSnapShotGenerator)} constructor. {e}");
     }
 }