diff options
Diffstat (limited to 'Software/Visual_Studio/FSE/Tango.FSE.UI/SystemInfo/DefaultSystemInfoProvider.cs')
| -rw-r--r-- | Software/Visual_Studio/FSE/Tango.FSE.UI/SystemInfo/DefaultSystemInfoProvider.cs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/SystemInfo/DefaultSystemInfoProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/SystemInfo/DefaultSystemInfoProvider.cs new file mode 100644 index 000000000..9b72b308a --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/SystemInfo/DefaultSystemInfoProvider.cs @@ -0,0 +1,49 @@ +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.FSE.Common.Connection; +using Tango.FSE.Common.SystemInfo; +using Tango.Integration.ExternalBridge.Network.Information; + +namespace Tango.FSE.UI.SystemInfo +{ + public class DefaultSystemInfoProvider : ExtendedObject, ISystemInfoProvider + { + private InformationPackage _package; + + private IMachineProvider MachineProvider { get; set; } + + public DefaultSystemInfoProvider(IMachineProvider machineProvider) + { + MachineProvider = machineProvider; + MachineProvider.MachineDisconnected += MachineProvider_MachineDisconnected; + } + + private void MachineProvider_MachineDisconnected(object sender, MachineDisconnectedEventArgs e) + { + _package = null; + } + + public async Task<InformationPackage> GetSystemInformationPackage() + { + if (_package == null) + { + var response = await MachineProvider.MachineOperator.SendGenericRequest<GetMachineInformationRequest, GetMachineInformationResponse>(new GetMachineInformationRequest(), new Transport.TransportRequestConfig() + { + Timeout = TimeSpan.FromSeconds(30) + }); + + _package = response.Package; + return _package; + } + else + { + return _package; + } + } + } +} |
