diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-08-16 17:05:56 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-08-16 17:05:56 +0300 |
| commit | e47e602cd61bcca8eb7fbef40dc4aa8798510ccc (patch) | |
| tree | aed51794566ba837dcfcfb673e5d67b4ab716884 /Software/Visual_Studio/PPC/Tango.PPC.Common/Insights | |
| parent | f809df07060dc3a27167f68027eb03bdbc89221a (diff) | |
| download | Tango-e47e602cd61bcca8eb7fbef40dc4aa8798510ccc.tar.gz Tango-e47e602cd61bcca8eb7fbef40dc4aa8798510ccc.zip | |
Working on insights...
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/Insights')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/Insights/DefaultInsightsService.cs | 45 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/Insights/IInsightsService.cs | 13 |
2 files changed, 58 insertions, 0 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Insights/DefaultInsightsService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Insights/DefaultInsightsService.cs new file mode 100644 index 000000000..e5148cfe5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Insights/DefaultInsightsService.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.Core.DI; +using Tango.Insights; +using Tango.PPC.Common.Application; +using Tango.PPC.Common.Connection; + +namespace Tango.PPC.Common.Insights +{ + [TangoCreateWhenRegistered] + public class DefaultInsightsService : ExtendedObject, IInsightsService + { + private InsightsListener _listener; + public bool Enabled { get; set; } + + private IMachineProvider MachineProvider { get; set; } + + public DefaultInsightsService(IMachineProvider machineProvider, IPPCApplicationManager applicationManager) + { + MachineProvider = machineProvider; + + applicationManager.ApplicationStarted += ApplicationManager_ApplicationStarted; + } + + private void ApplicationManager_ApplicationStarted(object sender, EventArgs e) + { + Task.Factory.StartNew(() => + { + try + { + _listener = new InsightsListener(MachineProvider.MachineOperator); + _listener.Start(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error initializing insights listener."); + } + }); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Insights/IInsightsService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Insights/IInsightsService.cs new file mode 100644 index 000000000..d7c5497d6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Insights/IInsightsService.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Common.Insights +{ + public interface IInsightsService: IPPCService + { + + } +} |
