aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs58
1 files changed, 3 insertions, 55 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs
index c67e83fc6..5f5fb4f7e 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs
@@ -18,6 +18,7 @@ using Tango.PPC.Common.Modules;
using System.Windows.Threading;
using Tango.Transport.Adapters;
using Tango.PMR.Connection;
+using Tango.PPC.Common.Connection;
namespace Tango.PPC.UI.PPCApplication
{
@@ -31,11 +32,6 @@ namespace Tango.PPC.UI.PPCApplication
private List<PPCViewModel> _notifiedViewModels;
/// <summary>
- /// Occurs when the connected machine property has changed.
- /// </summary>
- public event EventHandler<IMachineOperator> ConnectedMachineChanged;
-
- /// <summary>
/// Occurs when the application has started.
/// </summary>
public event EventHandler ApplicationStarted;
@@ -50,26 +46,6 @@ namespace Tango.PPC.UI.PPCApplication
/// </summary>
public bool IsShuttingDown { get; private set; }
- private IMachineOperator _connectedMachine;
- /// <summary>
- /// Gets or sets the currently connected machine if any.
- /// </summary>
- /// <exception cref="NotImplementedException">
- /// </exception>
- public IMachineOperator ConnectedMachine
- {
- get
- {
- return _connectedMachine;
- }
- set
- {
- _connectedMachine = value;
- RaisePropertyChangedAuto();
- ConnectedMachineChanged?.Invoke(this, ConnectedMachine);
- }
- }
-
/// <summary>
/// Gets the application version.
/// </summary>
@@ -82,26 +58,10 @@ namespace Tango.PPC.UI.PPCApplication
}
}
- private Machine _machine;
- /// <summary>
- /// Gets the associated observable entity machine.
- /// </summary>
- public Machine Machine
- {
- private set
- {
- _machine = value;
- }
- get
- {
- return _machine;
- }
- }
-
/// <summary>
/// Initializes a new instance of the <see cref="DefaultPPCApplicationManager"/> class.
/// </summary>
- public DefaultPPCApplicationManager()
+ public DefaultPPCApplicationManager(IMachineProvider machineProvider)
{
if (!DesignMode)
{
@@ -136,7 +96,6 @@ namespace Tango.PPC.UI.PPCApplication
}
ObservablesEntitiesAdapter.Instance.Initialize();
- Machine = ObservablesEntitiesAdapter.Instance.Machines.FirstOrDefault();
});
ApplicationStarted?.Invoke(this, new EventArgs());
@@ -168,8 +127,7 @@ namespace Tango.PPC.UI.PPCApplication
}
ModulesInitialized?.Invoke(this, new EventArgs());
-
- ConnectToMachine();
+ machineProvider.Init();
};
}
};
@@ -190,15 +148,5 @@ namespace Tango.PPC.UI.PPCApplication
vm.OnApplicationShuttingDown();
}
}
-
- private async void ConnectToMachine()
- {
- Transport.Discovery.UsbCommunicationScanner<ConnectRequest, ConnectResponse> scanner = new Transport.Discovery.UsbCommunicationScanner<ConnectRequest, ConnectResponse>(UsbSerialBaudRates.BR_9600);
- var response = await scanner.Scan(new ConnectRequest() { Password = "1234" }, TimeSpan.FromSeconds(10));
-
- var machine = new MachineOperator(response.Adapter);
- await machine.Connect();
- ConnectedMachine = machine;
- }
}
}