aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Insights/DefaultInsightsService.cs45
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Insights/IInsightsService.cs13
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj8
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs3
4 files changed, 68 insertions, 1 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
+ {
+
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj
index b15ca60bd..08e49621c 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj
@@ -163,6 +163,8 @@
<Compile Include="Helpers\LogsHelper.cs" />
<Compile Include="HotSpot\DefaultHotSpotProvider.cs" />
<Compile Include="HotSpot\IHotSpotProvider.cs" />
+ <Compile Include="Insights\DefaultInsightsService.cs" />
+ <Compile Include="Insights\IInsightsService.cs" />
<Compile Include="IPPCView.cs" />
<Compile Include="IPPCService.cs" />
<Compile Include="MachineSetup\IMachineSetupManager.cs" />
@@ -389,6 +391,10 @@
<Project>{c6ebbbbe-2123-44dc-aef7-a0d47d736ac0}</Project>
<Name>Tango.FileSystem</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\Tango.Insights\Tango.Insights.csproj">
+ <Project>{4a55c185-3f8d-41b0-8815-c15f6213a14a}</Project>
+ <Name>Tango.Insights</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Tango.Integration\Tango.Integration.csproj">
<Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project>
<Name>Tango.Integration</Name>
@@ -477,7 +483,7 @@
</Target>
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
+ <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs
index 05d844782..b5da9f066 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs
@@ -15,6 +15,7 @@ using Tango.PPC.Common.EventLogging;
using Tango.PPC.Common.ExternalBridge;
using Tango.PPC.Common.FileSystem;
using Tango.PPC.Common.HotSpot;
+using Tango.PPC.Common.Insights;
using Tango.PPC.Common.MachineSetup;
using Tango.PPC.Common.MachineUpdate;
using Tango.PPC.Common.Modules;
@@ -92,6 +93,7 @@ namespace Tango.PPC.UI
TangoIOC.Default.Unregister<IFileSystemService>();
TangoIOC.Default.Unregister<IRemoteJobService>();
TangoIOC.Default.Unregister<IRemoteSqlService>();
+ TangoIOC.Default.Unregister<IInsightsService>();
if (App.StartupArgs != null && App.StartupArgs.Contains("-webDebug"))
{
@@ -132,6 +134,7 @@ namespace Tango.PPC.UI
TangoIOC.Default.Register<IRemoteDesktopService, DefaultRemoteDesktopService>();
TangoIOC.Default.Register<IRemoteJobService, DefaultRemoteJobService>();
TangoIOC.Default.Register<IRemoteSqlService, DefaultRemoteSqlService>();
+ TangoIOC.Default.Register<IInsightsService, DefaultInsightsService>();
TangoIOC.Default.Register<LoadingViewVM>();
TangoIOC.Default.Register<MainViewVM>();