aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs
diff options
context:
space:
mode:
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.cs16
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();
+ }
}
}