diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-09-13 16:05:15 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-09-13 16:05:15 +0300 |
| commit | 56f4fcc504a5a60bb59e48b010aad85f75c4648e (patch) | |
| tree | cd5bb001aa8f58790967f375c79eb4df1c0318b6 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs | |
| parent | 1ad6cf1498affb02a86f9901b5e95f0ec34abc58 (diff) | |
| parent | 11a75198a9aaaa308d9317c5e7e1c9f4b7f59ee5 (diff) | |
| download | Tango-56f4fcc504a5a60bb59e48b010aad85f75c4648e.tar.gz Tango-56f4fcc504a5a60bb59e48b010aad85f75c4648e.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.cs | 24 |
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 |
