diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2020-09-14 11:52:07 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2020-09-14 11:52:07 +0300 |
| commit | cf2ff4168ce5da36f2353805bb09d2cd1dc5347f (patch) | |
| tree | f5cf89d5d5f11fd707d6a0f1f2f8f0a4b5ead658 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs | |
| parent | d2341eb3059629ae98ef4d53f341bda6bc84e325 (diff) | |
| parent | 71f91b8aad2bde92eec659852a87dbb5a895d108 (diff) | |
| download | Tango-cf2ff4168ce5da36f2353805bb09d2cd1dc5347f.tar.gz Tango-cf2ff4168ce5da36f2353805bb09d2cd1dc5347f.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_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 |
