aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Integration/Operation
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-02-10 18:28:41 +0200
committerShlomo Hecht <shlomo@twine-s.com>2019-02-10 18:28:41 +0200
commita65868d1d77b1929b855abd0c19bdc08bc9cee9d (patch)
tree09486bed718fb096914780f33313fb82a0207c87 /Software/Visual_Studio/Tango.Integration/Operation
parent82179e1b69b62b971a04af571979e7d10c60fd7a (diff)
parentac9678197fc6142595089155d98442239a64e6d7 (diff)
downloadTango-a65868d1d77b1929b855abd0c19bdc08bc9cee9d.tar.gz
Tango-a65868d1d77b1929b855abd0c19bdc08bc9cee9d.zip
merge
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration/Operation')
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/DefaultMachineEventsStateProvider.cs10
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/IMachineEventsStateProvider.cs5
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs34
3 files changed, 36 insertions, 13 deletions
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/DefaultMachineEventsStateProvider.cs b/Software/Visual_Studio/Tango.Integration/Operation/DefaultMachineEventsStateProvider.cs
index 96f865cc3..8c376ea3e 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/DefaultMachineEventsStateProvider.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/DefaultMachineEventsStateProvider.cs
@@ -136,5 +136,15 @@ namespace Tango.Integration.Operation
{
EventsChanged?.Invoke(this, events);
}
+
+ /// <summary>
+ /// Resets the current events tracking.
+ /// </summary>
+ public void Reset()
+ {
+ _events = new ReadOnlyCollection<MachinesEvent>(new List<MachinesEvent>());
+ RaisePropertyChanged(nameof(Events));
+ OnEventsChanged(new List<MachinesEvent>());
+ }
}
}
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineEventsStateProvider.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineEventsStateProvider.cs
index 0fc086fe3..2cf00904f 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineEventsStateProvider.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineEventsStateProvider.cs
@@ -49,5 +49,10 @@ namespace Tango.Integration.Operation
/// </summary>
/// <param name="events">The events.</param>
void ApplyEvents(IEnumerable<Event> events);
+
+ /// <summary>
+ /// Resets the current events tracking.
+ /// </summary>
+ void Reset();
}
}
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
index 0edc04845..d0e03f873 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
@@ -189,12 +189,15 @@ namespace Tango.Integration.Operation
get { return _status; }
protected set
{
- _status = value;
- RaisePropertyChangedAuto();
- OnMachineStatusChanged(value);
- RaisePropertyChanged(nameof(IsPrinting));
- RaisePropertyChanged(nameof(CanPrint));
- LogManager.Log("Machine operator status changed: " + _status);
+ if (_status != value)
+ {
+ _status = value;
+ RaisePropertyChangedAuto();
+ OnMachineStatusChanged(value);
+ RaisePropertyChanged(nameof(IsPrinting));
+ RaisePropertyChanged(nameof(CanPrint));
+ LogManager.Log("Machine operator status changed: " + _status);
+ }
}
}
@@ -690,11 +693,11 @@ namespace Tango.Integration.Operation
{
LogRequestFailed(request, ex);
}
+ }
- if (MachineEventsStateProvider != null)
- {
- MachineEventsStateProvider.ApplyEvents(new List<Event>());
- }
+ if (MachineEventsStateProvider != null)
+ {
+ MachineEventsStateProvider.Reset();
}
await base.Disconnect();
@@ -724,6 +727,10 @@ namespace Tango.Integration.Operation
DeviceInformation = response.Message.DeviceInformation;
+ _diagnosticsSent = false;
+ _eventsSent = false;
+ _debugSent = false;
+
OnEnableDiagnosticsChanged(EnableDiagnostics);
OnEnableEmbeddedDebuggingChanged(EnableEmbeddedDebugging);
OnEnableEventsNotification(EnableEventsNotification);
@@ -1305,6 +1312,10 @@ namespace Tango.Integration.Operation
LogRequestSent(request);
bool responseLogged = false;
+ Status = MachineStatuses.Printing;
+ RunningJob = originalJob;
+ PrintingStarted?.Invoke(this, new PrintingEventArgs(handler, originalJob));
+
SendContinuousRequest<JobRequest, JobResponse>(request, null, TimeSpan.FromSeconds(2)).Subscribe((response) =>
{
handler.RaiseStatusReceived(response.Message.Status);
@@ -1312,9 +1323,6 @@ namespace Tango.Integration.Operation
if (!responseLogged)
{
responseLogged = true;
- Status = MachineStatuses.Printing;
- RunningJob = originalJob;
- PrintingStarted?.Invoke(this, new PrintingEventArgs(handler, originalJob));
LogResponseReceived(response.Message);
}
}, (ex) =>