Added new library with maintenances counters
Added maintenances thread
This commit is contained in:
Lucio Maranta
2018-02-14 17:33:05 +01:00
parent ff11711599
commit ac91aa08aa
19 changed files with 586 additions and 114 deletions
+44
View File
@@ -281,6 +281,50 @@ public static class ThreadsFunctions
}
}
public static void ReadExpiredMaintenances()
{
NcHandler ncHandler = new NcHandler();
Stopwatch sw = new Stopwatch();
try
{
// Try connection
CmsError libraryError = ncHandler.Connect();
if (libraryError.errorCode != 0)
ManageLibraryError(libraryError);
while (true)
{
sw.Restart();
if (ncHandler.numericalControl.NC_IsConnected())
{
// Get Data from database and PLC
libraryError = ncHandler.GetExpiredMaintenances();
if (libraryError.errorCode != 0)
ManageLibraryError(libraryError);
//else
// Send through signalR
// MessageServices.Current.Publish(SEND_FUNCTIONALITY_DATA, null, functionsAccessList);
}
else
TryNcConnection();
sw.Stop();
//Send to the UI the time
ReadFunctionTimer += sw.ElapsedMilliseconds;
ReadFunctionTimes++;
// Wait
Thread.Sleep(200);
}
}
catch (ThreadAbortException)
{
ncHandler.Dispose();
}
}
#endregion Nc Threads
#region SupportFunctions