WIP
Added new library with maintenances counters Added maintenances thread
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user