diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-12 14:03:47 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-12 14:03:47 +0300 |
| commit | 856a23723afcc9d48c0f019dc33a259ac6c279ed (patch) | |
| tree | 6cc82030ee2d9c74bd7f841bfdc6a0c163def97d /Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging | |
| parent | 70fe7f13b519df86420f8c2b97cf8eb3ab67e9a5 (diff) | |
| download | Tango-856a23723afcc9d48c0f019dc33a259ac6c279ed.tar.gz Tango-856a23723afcc9d48c0f019dc33a259ac6c279ed.zip | |
Implemented continuous request timeouts.
Implemented continuous request abort exception.
Added log object for real time logs.
Some work on PPC & Machine Studio.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs index 2675fa1fa..8fa0ec05f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs @@ -15,6 +15,7 @@ using Tango.PMR.Diagnostics; using Tango.Integration.Operation; using Tango.PPC.Common.Application; using Tango.PPC.Common.Authentication; +using Tango.PPC.Common.Connection; namespace Tango.PPC.Common.EventLogging { @@ -27,7 +28,7 @@ namespace Tango.PPC.Common.EventLogging private ObservablesContext _db; private Thread _logThread; private ConcurrentQueue<MachinesEvent> _events; - private IPPCApplicationManager _application; + private IMachineProvider _machineProvider; private IAuthenticationProvider _authentication; private Dictionary<EventTypes, BL.Entities.EventType> _eventTypesGuids; private String _hostName; @@ -48,9 +49,9 @@ namespace Tango.PPC.Common.EventLogging /// <summary> /// Initializes a new instance of the <see cref="DefaultEventLogger"/> class. /// </summary> - /// <param name="applicationManager">The application manager.</param> + /// <param name="machineProvider">The application manager.</param> /// <param name="authenticationProvider">The authentication provider.</param> - public DefaultEventLogger(IPPCApplicationManager applicationManager, IAuthenticationProvider authenticationProvider) + public DefaultEventLogger(IMachineProvider machineProvider, IAuthenticationProvider authenticationProvider) { _hostName = Environment.MachineName; @@ -59,13 +60,13 @@ namespace Tango.PPC.Common.EventLogging _eventTypesGuids = new Dictionary<EventTypes, BL.Entities.EventType>(); - _application = applicationManager; + _machineProvider = machineProvider; _authentication = authenticationProvider; _logThread = new Thread(LogThreadMethod); _logThread.IsBackground = true; _logThread.Start(); - _application.ConnectedMachineChanged += _application_ConnectedMachineChanged; + _machineProvider.MachineOperatorChanged += _machineProvider_MachineOperatorChanged; } #endregion @@ -105,13 +106,10 @@ namespace Tango.PPC.Common.EventLogging #region Event Handlers - /// <summary> - /// Handle the application manager connected machine changed event. - /// </summary> - /// <param name="sender">The sender.</param> - /// <param name="machine">The machine.</param> - private void _application_ConnectedMachineChanged(object sender, IMachineOperator machine) + private void _machineProvider_MachineOperatorChanged(object sender, MachineOperatorChangedEventArgs e) { + var machine = e.NewMachineOperator; + if (machine != null) { if (machine.MachineEventsStateProvider != null) @@ -201,7 +199,7 @@ namespace Tango.PPC.Common.EventLogging machineEvent.HostName = _hostName; machineEvent.EventType = _eventTypesGuids[machineEvent.Type]; - if (_application.ConnectedMachine == null || _authentication.CurrentUser == null) + if (_machineProvider.MachineOperator == null || _authentication.CurrentUser == null) { _pendingEvents.Add(machineEvent); } @@ -219,7 +217,7 @@ namespace Tango.PPC.Common.EventLogging } LogManager.Log("Logging event " + machineEvent.EventType.Name + " - " + machineEvent.Description); - machineEvent.MachineGuid = _application.ConnectedMachine.Machine.Guid; + machineEvent.MachineGuid = _machineProvider.MachineOperator.Machine.Guid; machineEvent.UserGuid = _authentication.CurrentUser.Guid; machineEvent.User = _authentication.CurrentUser; _events.Enqueue(machineEvent); |
