diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-02-07 15:39:12 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-02-07 15:39:12 +0200 |
| commit | bd3cb640be12621ac37253e8a8c627ae40692e4d (patch) | |
| tree | cddc36bc95b966f48e1b7387fed1955504d3975b /Software/Visual_Studio/PPC/Tango.PPC.Common | |
| parent | 7a1f9f14cc50001366be0efefc25fd5af403d02e (diff) | |
| download | Tango-bd3cb640be12621ac37253e8a8c627ae40692e4d.tar.gz Tango-bd3cb640be12621ac37253e8a8c627ae40692e4d.zip | |
Some fixes and improvements for PPC & Machine Studio.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common')
5 files changed, 8 insertions, 66 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 2a0392dd6..95912e1ea 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs @@ -33,11 +33,6 @@ namespace Tango.PPC.Common.Connection private bool _isInitialized; private Thread _connection_thread; - /// <summary> - /// Occurs when current <see cref="IMachineOperator" /> has changed. - /// </summary> - public event EventHandler<MachineOperatorChangedEventArgs> MachineOperatorChanged; - private Machine _machine; /// <summary> /// Gets the database machine entity associated with the current machine. @@ -67,24 +62,12 @@ namespace Tango.PPC.Common.Connection } private set { - var oldOperator = _machineOperator; _machineOperator = value; - OnMachineOperatorChanged(oldOperator, _machineOperator); RaisePropertyChangedAuto(); } } /// <summary> - /// Called when the machine operator has been changed - /// </summary> - /// <param name="oldOperator">The old operator.</param> - /// <param name="newOperator">The new operator.</param> - protected virtual void OnMachineOperatorChanged(IMachineOperator oldOperator, IMachineOperator newOperator) - { - MachineOperatorChanged?.Invoke(this, new MachineOperatorChangedEventArgs(oldOperator, newOperator)); - } - - /// <summary> /// Initializes a new instance of the <see cref="DefaultMachineProvider"/> class. /// </summary> public DefaultMachineProvider() @@ -128,7 +111,6 @@ namespace Tango.PPC.Common.Connection MachineOperator.Adapter = response.Adapter; MachineOperator.JobHandlingMode = JobHandlerModes.SettingUp; LogManager.Log("Connecting machine operator..."); - MachineOperatorChanged?.Invoke(this, new MachineOperatorChangedEventArgs(MachineOperator, MachineOperator)); await MachineOperator.Connect(); @@ -142,7 +124,6 @@ namespace Tango.PPC.Common.Connection UsbTransportAdapter adapter = new UsbTransportAdapter(settings.EmbeddedComPort, UsbSerialBaudRates.BR_115200); MachineOperator.Adapter = adapter; MachineOperator.JobHandlingMode = JobHandlerModes.SettingUp; - MachineOperatorChanged?.Invoke(this, new MachineOperatorChangedEventArgs(MachineOperator, MachineOperator)); await MachineOperator.Connect(); await Task.Delay(1000); @@ -165,7 +146,6 @@ namespace Tango.PPC.Common.Connection MachineOperator.Adapter = adapter; MachineOperator.JobHandlingMode = JobHandlerModes.SettingUp; LogManager.Log("Connecting machine operator..."); - MachineOperatorChanged?.Invoke(this, new MachineOperatorChangedEventArgs(MachineOperator, MachineOperator)); await MachineOperator.Connect(); await Task.Delay(1000); 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 df4a448f7..43a6c290e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/IMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/IMachineProvider.cs @@ -15,11 +15,6 @@ namespace Tango.PPC.Common.Connection public interface IMachineProvider { /// <summary> - /// Occurs when current <see cref="IMachineOperator"/> has changed. - /// </summary> - event EventHandler<MachineOperatorChangedEventArgs> MachineOperatorChanged; - - /// <summary> /// Gets the database machine entity associated with the current machine. /// </summary> Machine Machine { get; } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs index 6ef19c765..d99047f8f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs @@ -45,21 +45,7 @@ namespace Tango.PPC.Common.Diagnostics public DefaultDiagnosticsFrameProvider(IMachineProvider machineProvider) { _machineProvider = machineProvider; - machineProvider.MachineOperatorChanged += MachineProvider_MachineOperatorChanged; - } - - - /// <summary> - /// Handles the Machine Provider Machine Operator Changed event. - /// </summary> - /// <param name="sender">The source of the event.</param> - /// <param name="e">The event arguments.</param> - private void MachineProvider_MachineOperatorChanged(object sender, MachineOperatorChangedEventArgs e) - { - if (e.MachineOperator != null) - { - e.MachineOperator.DiagnosticsDataAvailable += MachineOperator_DiagnosticsDataAvailable; - } + machineProvider.MachineOperator.DiagnosticsDataAvailable += MachineOperator_DiagnosticsDataAvailable; } /// <summary> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs index 8e1f7c722..d540e3fd3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs @@ -73,7 +73,12 @@ namespace Tango.PPC.Common.EventLogging _logThread.IsBackground = true; _logThread.Start(); - _machineProvider.MachineOperatorChanged += _machineProvider_MachineOperatorChanged; + _machineProvider.MachineOperator.MachineEventsStateProvider.NewEvents += MachineEventsStateProvider_NewEvents; + _machineProvider.MachineOperator.MachineEventsStateProvider.EventsResolved += MachineEventsStateProvider_EventsResolved; + + _machineProvider.MachineOperator.RequestSent += Machine_RequestSent; + _machineProvider.MachineOperator.RequestFailed += Machine_RequestFailed; + _machineProvider.MachineOperator.ResponseReceived += Machine_ResponseReceived; } #endregion @@ -108,30 +113,6 @@ namespace Tango.PPC.Common.EventLogging #region Event Handlers - private void _machineProvider_MachineOperatorChanged(object sender, MachineOperatorChangedEventArgs e) - { - var machine = e.MachineOperator; - - if (machine != null) - { - if (machine.MachineEventsStateProvider != null) - { - machine.MachineEventsStateProvider.NewEvents -= MachineEventsStateProvider_NewEvents; - machine.MachineEventsStateProvider.NewEvents += MachineEventsStateProvider_NewEvents; - machine.MachineEventsStateProvider.EventsResolved -= MachineEventsStateProvider_EventsResolved; - machine.MachineEventsStateProvider.EventsResolved += MachineEventsStateProvider_EventsResolved; - } - - machine.RequestSent -= Machine_RequestSent; - machine.RequestFailed -= Machine_RequestFailed; - machine.ResponseReceived -= Machine_ResponseReceived; - - machine.RequestSent += Machine_RequestSent; - machine.RequestFailed += Machine_RequestFailed; - machine.ResponseReceived += Machine_ResponseReceived; - } - } - /// <summary> /// Handles the RequestSent event of the connected machine. /// </summary> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultOperationSystemManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultOperationSystemManager.cs index 23722319c..a073c1c5e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultOperationSystemManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultOperationSystemManager.cs @@ -82,7 +82,7 @@ namespace Tango.PPC.Common.OS CmdCommand command = new CmdCommand("cscript", $"C:\\Windows\\System32\\slmgr.vbs -ipk {activationKey}"); await command.Run(); - await Task.Delay(5000); + await Task.Delay(10000); if (!await IsActivated()) { |
