Merge branch 'release/fixLogQueue'

This commit is contained in:
Samuele Locatelli
2023-01-25 08:50:13 +01:00
+7 -4
View File
@@ -3,6 +3,7 @@ using MapoSDK;
using Newtonsoft.Json;
using NLog;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
@@ -465,11 +466,13 @@ namespace IOB_WIN_NEXT
try
{
// aggiungo in testa la NUOVA stringa (eventualmente multiline)
logWatchString.Insert(0, value);
logWatchString.Enqueue(value);
// se supero limite --> trim!
if (logWatchString.Count > nLine2show)
string sTemp = "";
while (logWatchString.Count > nLine2show)
{
logWatchString = logWatchString.Take(nLine2show).ToList();
logWatchString.TryDequeue(out sTemp);
//logWatchString = logWatchString.Take(nLine2show).ToList();
}
DateTime adesso = DateTime.Now;
if (logWatchWriteVeto < adesso)
@@ -1031,7 +1034,7 @@ namespace IOB_WIN_NEXT
/// <summary>
/// Lista String da mostrare quale WatchLog corrente...
/// </summary>
protected List<string> logWatchString { get; set; } = new List<string>();
protected ConcurrentQueue<string> logWatchString { get; set; } = new ConcurrentQueue<string>();
/// <summary>
/// Veto a NUOVE scritture in logWatch...