diff options
| author | Roy <Roy.mail.net@gmail.com> | 2022-11-04 21:35:07 +0200 |
|---|---|---|
| committer | Roy <Roy.mail.net@gmail.com> | 2022-11-04 21:35:07 +0200 |
| commit | 8431040bf909ba65d5ce242b5fd2cc91005ba679 (patch) | |
| tree | d6d60f676426d291cbb848b01a1245c1bc7f1348 /Software/Visual_Studio/FSE/Tango.FSE.UI | |
| parent | 7722d51930bcc1240b0c5e3ad54c9be7da73309d (diff) | |
| download | Tango-8431040bf909ba65d5ce242b5fd2cc91005ba679.tar.gz Tango-8431040bf909ba65d5ce242b5fd2cc91005ba679.zip | |
Statistics Provider & Service Communication.
Diffstat (limited to 'Software/Visual_Studio/FSE/Tango.FSE.UI')
3 files changed, 61 insertions, 0 deletions
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Statistics/DefaultStatisticsProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Statistics/DefaultStatisticsProvider.cs new file mode 100644 index 000000000..f5b44b25d --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Statistics/DefaultStatisticsProvider.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; +using Tango.FSE.Common; +using Tango.FSE.Common.Connection; +using Tango.FSE.Common.Statistics; +using Tango.PPC.Shared.Statistics; +using Tango.Transport; + +namespace Tango.FSE.UI.Statistics +{ + public class DefaultStatisticsProvider : FSEExtendedObject, IStatisticsProvider + { + [TangoInject] + public IMachineProvider MachineProvider { get; set; } + + public async Task<RequiredFiltersData> GetRequiredFiltersData() + { + try + { + LogManager.Log("Retrieving remote machine statistics required filters data..."); + + var response = await MachineProvider.MachineOperator.SendGenericRequest<GetStatisticsRequiredFiltersRequest, GetStatisticsRequiredFiltersResponse>(new GetStatisticsRequiredFiltersRequest()); + return response.FiltersData; + } + catch (Exception ex) + { + throw LogManager.Log(ex, "Error retrieving remote machine statistics required filters data."); + } + } + + public async Task<StatisticsModel> GetStatistics(Filters filters) + { + try + { + LogManager.Log("Retrieving remote machine statistics data..."); + + var response = await MachineProvider.MachineOperator.SendGenericRequest<GetStatisticsRequest, GetStatisticsResponse>( + new GetStatisticsRequest() { Filters = filters }, + new TransportRequestConfig() { Timeout = TimeSpan.FromSeconds(60) }); + + StatisticsModel model = new StatisticsModel(); + model.StatisticsResult = response.Result; + + return model; + } + catch (Exception ex) + { + throw LogManager.Log(ex, "Error retrieving remote machine statistics data."); + } + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj index 4147629ab..12b2ffc5a 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj @@ -383,6 +383,7 @@ <Compile Include="Resolution\DefaultResolutionService.cs" /> <Compile Include="RemoteJob\DefaultRemoteJobProvider.cs" /> <Compile Include="SQL\DefaultRemoteSqlProvider.cs" /> + <Compile Include="Statistics\DefaultStatisticsProvider.cs" /> <Compile Include="Storage\DefaultStorageProvider.cs" /> <Compile Include="Storage\ExplorerControlDialog.xaml.cs"> <DependentUpon>ExplorerControlDialog.xaml</DependentUpon> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs index f439a90aa..9345af720 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs @@ -80,6 +80,8 @@ using Tango.FSE.Common.RemoteJobUpload; using Tango.FSE.UI.RemoteJobUpload; using Tango.FSE.Common.HotFolder; using Tango.FSE.UI.HotFolder; +using Tango.FSE.Common.Statistics; +using Tango.FSE.UI.Statistics; namespace Tango.FSE.UI { @@ -127,6 +129,7 @@ namespace Tango.FSE.UI TangoIOC.Default.Unregister<IBuildProvider>(); TangoIOC.Default.Unregister<IRemoteJobUploadProvider>(); TangoIOC.Default.Unregister<IHotFolderService>(); + TangoIOC.Default.Unregister<IStatisticsProvider>(); TangoIOC.Default.Register<IBuildProvider, DefaultBuildProvider>(); @@ -169,6 +172,7 @@ namespace Tango.FSE.UI TangoIOC.Default.Register<IDataStoreProvider, DefaultDataStoreProvider>(); TangoIOC.Default.Register<IRemoteJobUploadProvider, DefaultRemoteJobUploadProvider>(); TangoIOC.Default.Register<IHotFolderService, DefaultHotFolderService>(); + TangoIOC.Default.Register<IStatisticsProvider, DefaultStatisticsProvider>(); TangoIOC.Default.Register<MainWindowVM>(); |
