From 1746d2c7f601f44c23399aa6d19661fb7ff937ec Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 4 Mar 2019 15:49:59 +0200 Subject: Fixed several issues with PPC. --- .../PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs | 7 +++++-- .../PPC/Tango.PPC.Common/Connection/IMachineProvider.cs | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/Connection') 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 95912e1ea..9a7e29bb7 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs @@ -32,6 +32,7 @@ namespace Tango.PPC.Common.Connection { private bool _isInitialized; private Thread _connection_thread; + private ObservablesContext _context; private Machine _machine; /// @@ -165,7 +166,7 @@ namespace Tango.PPC.Common.Connection /// /// Initializes this machine provider start machine port scanning and connection. /// - public void Init(Machine machine) + public void Init(Machine machine, ObservablesContext context) { if (!_isInitialized) { @@ -175,6 +176,7 @@ namespace Tango.PPC.Common.Connection LogManager.Log("Retrieving first machine database entry..."); + _context = context; Machine = machine; if (Machine != null) @@ -209,7 +211,8 @@ namespace Tango.PPC.Common.Connection /// public async Task SaveMachine() { - await Machine.GetDbContext().SaveChangesAsync(); + await _context.SaveChangesAsync(); + Machine = await new MachineBuilder(_context).SetFirst().WithSettings().BuildAsync(); TangoMessenger.Default.Send(new MachineSettingsSavedMessage() { Machine = Machine }); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/IMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/IMachineProvider.cs index 43a6c290e..10180b9cc 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/IMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/IMachineProvider.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL; using Tango.BL.Entities; using Tango.Integration.ExternalBridge; using Tango.Integration.Operation; @@ -27,7 +28,7 @@ namespace Tango.PPC.Common.Connection /// /// Initializes this machine provider start machine port scanning and connection. /// - void Init(Machine machine); + void Init(Machine machine, ObservablesContext context); /// /// Saves the machine settings. -- cgit v1.3.1