diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-28 16:35:16 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-28 16:35:16 +0300 |
| commit | f3fc87dd10b3d55591a84ecbfb0612769f0c09b9 (patch) | |
| tree | 640621ab876dd5368d91e44b07b4f2872752e5bb /Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs | |
| parent | 37fe17f09478a486dcd51f0edd8028724dc85c16 (diff) | |
| download | Tango-f3fc87dd10b3d55591a84ecbfb0612769f0c09b9.tar.gz Tango-f3fc87dd10b3d55591a84ecbfb0612769f0c09b9.zip | |
Working on BL Builders !
Working on making PPC work with builders..
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs index e6050f761..b290f9513 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs @@ -12,6 +12,7 @@ using Tango.PMR.Connection; using Tango.Transport.Adapters; using Tango.Settings; using Tango.Logging; +using Tango.BL.Builders; namespace Tango.PPC.Common.Connection { @@ -23,6 +24,7 @@ namespace Tango.PPC.Common.Connection public class DefaultMachineProvider : ExtendedObject, IMachineProvider { private bool _isInitialized; + private ObservablesContext _db; /// <summary> /// Occurs when current <see cref="IMachineOperator" /> has changed. @@ -86,7 +88,7 @@ namespace Tango.PPC.Common.Connection /// <summary> /// Initializes this machine provider start machine port scanning and connection. /// </summary> - public void Init() + public void Init(Machine machine) { if (!_isInitialized) { @@ -95,7 +97,8 @@ namespace Tango.PPC.Common.Connection _isInitialized = true; LogManager.Log("Retrieving first machine database entry..."); - Machine = ObservablesStaticCollections.Instance.Machines.FirstOrDefault(); + + Machine = machine; if (Machine != null) { @@ -141,5 +144,14 @@ namespace Tango.PPC.Common.Connection LogManager.Log(ex, "Error while trying to scan and connect to the machine."); } } + + /// <summary> + /// Saves the machine settings. + /// </summary> + /// <returns></returns> + public Task SaveMachine() + { + return Machine.GetDbContext().SaveChangesAsync(); + } } } |
