ADD signalr + filtro SIM troppo verboso

This commit is contained in:
Samuele Locatelli
2020-07-10 15:04:34 +02:00
parent 7c0d9595cd
commit f7c3a7158b
9 changed files with 69 additions and 10 deletions
+42
View File
@@ -670,6 +670,48 @@ public static class ThreadsFunctions
ncAdapter.Dispose();
}
}
public static void ReadProdPanelData()
{
NcAdapter ncAdapter = new NcAdapter();
Stopwatch sw = new Stopwatch();
try
{
// Try connection
CmsError libraryError = ncAdapter.Connect();
if (libraryError.errorCode != 0)
ManageLibraryError(libraryError);
while (true)
{
sw.Restart();
// Check if client is connected
if (ncAdapter.numericalControl.NC_IsConnected())
{
// Get new data from PLC (and log if changed...)
libraryError = ncAdapter.ReadProdPanel(out DTOThermoPanelProd currentProdPanel);
if (libraryError.IsError())
ManageLibraryError(libraryError);
MessageServices.Current.Publish(SEND_THERMO_PROD_PANEL_DATA, null, currentProdPanel);
}
else
RestoreConnection();
sw.Stop();
//Update thread timer
UpdateStat(MethodBase.GetCurrentMethod().Name, sw.ElapsedMilliseconds);
// Wait 500 ms
Thread.Sleep(CalcSleepTime(500, (int)sw.ElapsedMilliseconds));
}
}
catch (ThreadAbortException)
{
ncAdapter.Dispose();
}
}
public static void ReadProdInfoData()
{
NcAdapter ncAdapter = new NcAdapter();