From db89412e079e151a3217ed2a108820ebe6ba2f30 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 20 Feb 2018 15:53:44 +0200 Subject: Improved module popout.. --- .../ViewModels/MachineTechViewVM.cs | 29 ++++++---------------- 1 file changed, 7 insertions(+), 22 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index 6ccc1caa0..ad763fe54 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -18,6 +18,7 @@ using Tango.Editors; using Tango.Integration.Observables; using Tango.Integration.Observables.Enumerations; using Tango.Integration.Operators; +using Tango.MachineStudio.Common.Diagnostics; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.Common.StudioApplication; using Tango.MachineStudio.Technician.Editors; @@ -168,19 +169,7 @@ namespace Tango.MachineStudio.Technician.ViewModels /// /// The application manager. /// The notification provider. - [PreferredConstructor] - public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider) : this(applicationManager, notificationProvider, true) - { - - } - - /// - /// Initializes a new instance of the class. - /// - /// The application manager. - /// The notification provider. - /// if set to true [load last project]. - public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, bool loadLastProject) + public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider _diagnosticsFrameProvider) { _notification = notificationProvider; _singleControllers = new Dictionary(); @@ -200,10 +189,12 @@ namespace Tango.MachineStudio.Technician.ViewModels _lastTechProjectFile = SettingsManager.Default.MachineStudio.TechnicianModule.LasTechProjectFile; - if (File.Exists(_lastTechProjectFile) && loadLastProject) + if (File.Exists(_lastTechProjectFile)) { OpenProjectFile(_lastTechProjectFile); } + + _diagnosticsFrameProvider.FrameReceived += DiagnosticsFrameProvider_FrameReceived; } #endregion @@ -218,20 +209,14 @@ namespace Tango.MachineStudio.Technician.ViewModels private void ApplicationManager_ConnectedMachineChanged(object sender, Integration.Services.IExternalBridgeClient machine) { MachineOperator = machine; - - if (MachineOperator != null) - { - MachineOperator.DiagnosticsDataAvailable -= MachineOperator_DiagnosticsDataAvailable; - MachineOperator.DiagnosticsDataAvailable += MachineOperator_DiagnosticsDataAvailable; - } } /// - /// Machines the operator diagnostics data available. + /// Handles the diagnostics frame provider data. /// /// The sender. /// The response. - private void MachineOperator_DiagnosticsDataAvailable(object sender, PushDiagnosticsResponse response) + private void DiagnosticsFrameProvider_FrameReceived(object sender, PushDiagnosticsResponse response) { PopulateDiagnosticsData(response); } -- cgit v1.3.1