aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2020-10-29 15:55:21 +0200
committerShlomo Hecht <shlomo@twine-s.com>2020-10-29 15:55:21 +0200
commit4b789f33eadfc5cc1d937a80ce03ea8425955ffe (patch)
tree7dbbd0529a24f9ca064cab688a0d6d2b8b762ea1 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
parent8f3baa0d9097aa6ed800863a4680608e867c809a (diff)
parent11fb700fcbc4627162a9c3f84b03b5016248bd97 (diff)
downloadTango-4b789f33eadfc5cc1d937a80ce03ea8425955ffe.tar.gz
Tango-4b789f33eadfc5cc1d937a80ce03ea8425955ffe.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs24
1 files changed, 22 insertions, 2 deletions
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 4205e5246..8f5c67f96 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
@@ -41,6 +41,7 @@ using RealTimeGraphX.WPF;
using Tango.Core.ExtensionMethods;
using System.Diagnostics;
using Tango.BL.Builders;
+using Tango.Core;
namespace Tango.MachineStudio.Technician.ViewModels
{
@@ -83,6 +84,9 @@ namespace Tango.MachineStudio.Technician.ViewModels
private DateTime _diagnosticsStartTime;
private DateTime _diagnosticsNowTime;
+ private ProducerConsumerQueue<StartDiagnosticsResponse> _framesQueue;
+ private Thread _populateFramesThread;
+
#region Properties
private ObservableCollection<MachineTechTabVM> _tabs;
@@ -314,6 +318,8 @@ namespace Tango.MachineStudio.Technician.ViewModels
/// <param name="notificationProvider">The notification provider.</param>
public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IEventLogger eventLogger)
{
+ _framesQueue = new ProducerConsumerQueue<StartDiagnosticsResponse>();
+
Tabs = new ObservableCollection<MachineTechTabVM>();
Tabs.Add(new MachineTechTabVM() { IsSelected = true, Name = "Untitled" });
SelectedTab = Tabs.First();
@@ -448,13 +454,22 @@ namespace Tango.MachineStudio.Technician.ViewModels
/// <param name="response">The response.</param>
private void DiagnosticsFrameProvider_FrameReceived(object sender, StartDiagnosticsResponse response)
{
- PopulateDiagnosticsData(response);
+ _framesQueue.BlockEnqueue(response);
}
#endregion
#region Populate Diagnostics Data
+ private void PopulateFramesThreadMethod()
+ {
+ while (!ApplicationManager.IsShuttingDown)
+ {
+ var frame = _framesQueue.BlockDequeue();
+ PopulateDiagnosticsData(frame);
+ }
+ }
+
/// <summary>
/// Populates the diagnostics data to the proper elements.
/// </summary>
@@ -2308,7 +2323,12 @@ namespace Tango.MachineStudio.Technician.ViewModels
public override void OnApplicationReady()
{
-
+ if (_populateFramesThread == null)
+ {
+ _populateFramesThread = new Thread(PopulateFramesThreadMethod);
+ _populateFramesThread.IsBackground = true;
+ _populateFramesThread.Start();
+ }
}
#endregion