From b934b152eea671fa06678baa0cdf7f8811e6d2d9 Mon Sep 17 00:00:00 2001 From: Roy Date: Wed, 14 Feb 2018 22:51:52 +0200 Subject: MERGE. --- .../ViewModels/MainViewVM.cs | 297 +++++++++++++++++++++ 1 file changed, 297 insertions(+) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..b63ee51d0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs @@ -0,0 +1,297 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Controls; +using Tango.Core.Commands; +using Tango.Integration.Diagnostics; +using Tango.Integration.Operators; +using Tango.MachineStudio.Common.Diagnostics; +using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.Common.StudioApplication; +using Tango.MachineStudio.Common.Video; +using Tango.MachineStudio.DataCapture.Recording; +using Tango.MachineStudio.DataCapture.Views; +using Tango.PMR.Diagnostics; +using Tango.Settings; +using Tango.SharedUI; +using Tango.Video.DirectCapture; + +namespace Tango.MachineStudio.DataCapture.ViewModels +{ + /// + /// Represents the data capture main view, view model. + /// + /// + public class MainViewVM : ViewModel + { + private INotificationProvider _notification; + private IStudioApplicationManager _applicationManager; + private IDiagnosticsFrameProvider _frameProvider; + private String _recordingsFolder; + + #region Properties + + private ObservableCollection _recordings; + /// + /// Gets or sets the recordings collection. + /// + public ObservableCollection Recordings + { + get { return _recordings; } + set { _recordings = value; RaisePropertyChangedAuto(); } + } + + private DataRecording _selectedRecording; + /// + /// Gets or sets the selected recording. + /// + public DataRecording SelectedRecording + { + get { return _selectedRecording; } + set { _selectedRecording = value; RaisePropertyChangedAuto(); } + } + + /// + /// Gets or sets the video capture provider. + /// + public IVideoCaptureProvider VideoCaptureProvider { get; set; } + + private DiagnosticsFileRecorder _recorder; + /// + /// Gets or sets the diagnostics file recorder. + /// + public DiagnosticsFileRecorder Recorder + { + get { return _recorder; } + set { _recorder = value; RaisePropertyChangedAuto(); } + } + + private DiagnosticsFilePlayer _player; + /// + /// Gets or sets the diagnostics file player. + /// + public DiagnosticsFilePlayer Player + { + get { return _player; } + set { _player = value; RaisePropertyChangedAuto(); } + } + + /// + /// Gets or sets the machine operator. + /// + public IMachineOperator MachineOperator { get; set; } + + #endregion + + #region Commands + + /// + /// Gets or sets the remove recording command. + /// + public RelayCommand RemoveRecordingCommand { get; set; } + + /// + /// Gets or sets the toggle camera command. + /// + public RelayCommand ToggleCameraCommand { get; set; } + + /// + /// Gets or sets the media recording command. + /// + public RelayCommand MediaRecordingCommand { get; set; } + + /// + /// Gets or sets the media stop command. + /// + public RelayCommand MediaStopCommand { get; set; } + + /// + /// Gets or sets the media toggle play pause command. + /// + public RelayCommand MediaTogglePlayPauseCommand { get; set; } + + /// + /// Gets or sets the media play pause command. + /// + public RelayCommand MediaPlayPauseCommand { get; set; } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public MainViewVM(IVideoCaptureProvider videoCaptureProvider, INotificationProvider notification, IStudioApplicationManager applicationManager, IDiagnosticsFrameProvider frameProvider) + { + _notification = notification; + _applicationManager = applicationManager; + _frameProvider = frameProvider; + + Recorder = new DiagnosticsFileRecorder(); + Player = new DiagnosticsFilePlayer(); + + VideoCaptureProvider = videoCaptureProvider; + Recordings = new ObservableCollection(); + + ToggleCameraCommand = new RelayCommand(ToggleCamera); + + Recordings.Add(new DataRecording() + { + Name = "Recording 1" + }); + Recordings.Add(new DataRecording() + { + Name = "Recording 2" + }); + Recordings.Add(new DataRecording() + { + Name = "Recording 3" + }); + + RemoveRecordingCommand = new RelayCommand(RemoveRecording); + + MediaRecordingCommand = new RelayCommand(StartDiagnosticsRecording, () => !Recorder.IsRecording && MachineOperator != null && !Player.IsPlaying); + MediaStopCommand = new RelayCommand(StopRecorderOrPlayer, () => Recorder.IsRecording || Player.IsPlaying); + MediaPlayPauseCommand = new RelayCommand(DiagnosticsTogglePlayPause, () => !Recorder.IsRecording && Player.IsLoaded); + + _recordingsFolder = Path.Combine(SettingsManager.DefaultFolder, "Recordings"); + Directory.CreateDirectory(_recordingsFolder); + + _frameProvider.FrameReceived += _frameProvider_FrameReceived; + + _notification.PushBarItem(new RecordingBarView() { DataContext = this }); + + applicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; + } + + private void ApplicationManager_ConnectedMachineChanged(object sender, Integration.Services.IExternalBridgeClient machine) + { + MachineOperator = machine; + InvalidateRelayCommands(); + } + + private void _frameProvider_FrameReceived(object sender, PushDiagnosticsResponse frame) + { + if (!_frameProvider.Disable) + { + if (Recorder.IsRecording) + { + Recorder.Write(frame); + } + } + } + + #endregion + + #region Private Methods + + /// + /// Removes the recording. + /// + /// The recording. + private void RemoveRecording(DataRecording recording) + { + Recordings.Remove(recording); + } + + /// + /// Toggles the camera. + /// + /// The capture device. + private void ToggleCamera(CaptureDevice captureDevice) + { + if (captureDevice.Device != null) + { + captureDevice.IsStarted = !captureDevice.IsStarted; + } + } + + private void DiagnosticsTogglePlayPause() + { + if (!Player.IsPlaying || Player.IsPaused) + { + _frameProvider.Disable = true; + Player.Play(); + } + else + { + Player.Pause(); + } + + InvalidateRelayCommands(); + } + + private async void LoadSelectedRecording() + { + using (_notification.PushTaskItem("Loading Recording...")) + { + if (Player != null) + { + Player.Dispose(); + } + + Player = new DiagnosticsFilePlayer(); + Player.FrameReceived += Player_FrameReceived; + await Player.Load(SelectedRecording.FilePath); + } + + InvalidateRelayCommands(); + } + + private void Player_FrameReceived(object sender, DataFileFrame frame) + { + if (_frameProvider.Disable) + { + _frameProvider.PushFrame(frame.PushDiagnosticsResponse); + } + } + + private void StartDiagnosticsRecording() + { + using (_notification.PushTaskItem("Starting Recording...")) + { + Recorder.Start(); + } + + InvalidateRelayCommands(); + } + + private async void StopRecorderOrPlayer() + { + if (Recorder.IsRecording) + { + using (_notification.PushTaskItem("Stopping Recording...")) + { + await Recorder.Stop(); + } + + String recordingName = _notification.ShowTextInput("Enter recording name", "Recording name"); + + if (!String.IsNullOrWhiteSpace(recordingName)) + { + using (_notification.PushTaskItem("Saving Recording...")) + { + await Recorder.Save(Path.Combine(_recordingsFolder, recordingName + ".tdr")); + } + } + + Recorder.Dispose(); + Recorder = new DiagnosticsFileRecorder(); + } + else if (Player.IsPlaying) + { + await Player.Stop(); + _frameProvider.Disable = false; + } + + InvalidateRelayCommands(); + } + + #endregion + } +} -- cgit v1.3.1 From e4c917c43e90a4453c6cd5b1842a418dc0f1b514 Mon Sep 17 00:00:00 2001 From: Roy Date: Thu, 15 Feb 2018 00:29:13 +0200 Subject: Working on Data Capture Module.. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes .../Recording/DataRecording.cs | 23 +++++- .../Tango.MachineStudio.DataCapture.csproj | 7 ++ .../ViewModels/MainViewVM.cs | 83 ++++++++++++++------- .../Views/MainView.xaml | 5 +- .../Views/PlayingBarView.xaml | 53 +++++++++++++ .../Views/PlayingBarView.xaml.cs | 28 +++++++ .../ViewModels/MainViewVM.cs | 31 +++++--- .../Notifications/BarItem.cs | 5 ++ .../Diagnostics/DiagnosticsFilePlayer.cs | 7 +- 11 files changed, 195 insertions(+), 47 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index da65c19c8..11640e60d 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index c6adffec8..ecbb1e3f1 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Recording/DataRecording.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Recording/DataRecording.cs index a191c244e..ddf24e113 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Recording/DataRecording.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Recording/DataRecording.cs @@ -1,14 +1,31 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.Core; +using Tango.Integration.Diagnostics; namespace Tango.MachineStudio.DataCapture.Recording { public class DataRecording : ExtendedObject { + public DataRecording() + { + Date = DateTime.Now; + } + + public DataRecording(String filePath) : this() + { + FilePath = filePath; + } + + public DataRecording(String filePath, DateTime date) : this(filePath) + { + Date = date; + } + private DateTime _date; public DateTime Date @@ -17,12 +34,9 @@ namespace Tango.MachineStudio.DataCapture.Recording set { _date = value; RaisePropertyChangedAuto(); } } - private String _name; - public String Name { - get { return _name; } - set { _name = value; RaisePropertyChangedAuto(); } + get { return Path.GetFileNameWithoutExtension(FilePath); } } private String _file; @@ -33,5 +47,6 @@ namespace Tango.MachineStudio.DataCapture.Recording set { _file = value; RaisePropertyChangedAuto(); } } + public DiagnosticsFilePlayer Player { get; set; } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj index 1c13be809..8936a66db 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj @@ -81,6 +81,9 @@ GlobalVersionInfo.cs + + PlayingBarView.xaml + RecordingBarView.xaml @@ -88,6 +91,10 @@ Designer MSBuild:Compile + + MSBuild:Compile + Designer + Designer MSBuild:Compile diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs index b63ee51d0..269007dac 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; using System.Linq; +using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; using System.Windows.Controls; @@ -32,6 +33,8 @@ namespace Tango.MachineStudio.DataCapture.ViewModels private IStudioApplicationManager _applicationManager; private IDiagnosticsFrameProvider _frameProvider; private String _recordingsFolder; + private BarItem _recordingBarItem; + private BarItem _playerBarItem; #region Properties @@ -52,7 +55,7 @@ namespace Tango.MachineStudio.DataCapture.ViewModels public DataRecording SelectedRecording { get { return _selectedRecording; } - set { _selectedRecording = value; RaisePropertyChangedAuto(); } + set { _selectedRecording = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } /// @@ -140,35 +143,29 @@ namespace Tango.MachineStudio.DataCapture.ViewModels ToggleCameraCommand = new RelayCommand(ToggleCamera); - Recordings.Add(new DataRecording() - { - Name = "Recording 1" - }); - Recordings.Add(new DataRecording() - { - Name = "Recording 2" - }); - Recordings.Add(new DataRecording() - { - Name = "Recording 3" - }); - RemoveRecordingCommand = new RelayCommand(RemoveRecording); MediaRecordingCommand = new RelayCommand(StartDiagnosticsRecording, () => !Recorder.IsRecording && MachineOperator != null && !Player.IsPlaying); MediaStopCommand = new RelayCommand(StopRecorderOrPlayer, () => Recorder.IsRecording || Player.IsPlaying); - MediaPlayPauseCommand = new RelayCommand(DiagnosticsTogglePlayPause, () => !Recorder.IsRecording && Player.IsLoaded); + MediaPlayPauseCommand = new RelayCommand(DiagnosticsTogglePlayPause, () => !Recorder.IsRecording && SelectedRecording != null); _recordingsFolder = Path.Combine(SettingsManager.DefaultFolder, "Recordings"); Directory.CreateDirectory(_recordingsFolder); _frameProvider.FrameReceived += _frameProvider_FrameReceived; - _notification.PushBarItem(new RecordingBarView() { DataContext = this }); - applicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; + + _recordingBarItem = new BarItem(_notification, new RecordingBarView() { DataContext = this }); + _playerBarItem = new BarItem(_notification, new PlayingBarView() { DataContext = this }); + + LoadRecordings(); } + #endregion + + #region Event Handlers + private void ApplicationManager_ConnectedMachineChanged(object sender, Integration.Services.IExternalBridgeClient machine) { MachineOperator = machine; @@ -186,10 +183,19 @@ namespace Tango.MachineStudio.DataCapture.ViewModels } } + #endregion #region Private Methods + private void LoadRecordings() + { + foreach (var file in Directory.GetFiles(_recordingsFolder, "*.tdr")) + { + Recordings.Add(new DataRecording(file, File.GetCreationTime(file))); + } + } + /// /// Removes the recording. /// @@ -211,11 +217,28 @@ namespace Tango.MachineStudio.DataCapture.ViewModels } } - private void DiagnosticsTogglePlayPause() + private async void DiagnosticsTogglePlayPause() { if (!Player.IsPlaying || Player.IsPaused) { _frameProvider.Disable = true; + + if (SelectedRecording.Player == null) + { + using (_notification.PushTaskItem("Loading Recording...")) + { + SelectedRecording.Player = new DiagnosticsFilePlayer(); + await SelectedRecording.Player.Load(SelectedRecording.FilePath); + } + } + + RegisterPlayer(SelectedRecording.Player); + + if (!Player.IsPlaying) + { + _playerBarItem.Push(); + } + Player.Play(); } else @@ -226,21 +249,21 @@ namespace Tango.MachineStudio.DataCapture.ViewModels InvalidateRelayCommands(); } - private async void LoadSelectedRecording() + private void RegisterPlayer(DiagnosticsFilePlayer player) { - using (_notification.PushTaskItem("Loading Recording...")) + foreach (var recording in Recordings) { - if (Player != null) + if (recording.Player != null) { - Player.Dispose(); + recording.Player.FrameReceived -= Player_FrameReceived; } + } - Player = new DiagnosticsFilePlayer(); + if (player != null) + { + Player = player; Player.FrameReceived += Player_FrameReceived; - await Player.Load(SelectedRecording.FilePath); } - - InvalidateRelayCommands(); } private void Player_FrameReceived(object sender, DataFileFrame frame) @@ -256,6 +279,8 @@ namespace Tango.MachineStudio.DataCapture.ViewModels using (_notification.PushTaskItem("Starting Recording...")) { Recorder.Start(); + + _recordingBarItem.Push(); } InvalidateRelayCommands(); @@ -268,6 +293,7 @@ namespace Tango.MachineStudio.DataCapture.ViewModels using (_notification.PushTaskItem("Stopping Recording...")) { await Recorder.Stop(); + _recordingBarItem.Pop(); } String recordingName = _notification.ShowTextInput("Enter recording name", "Recording name"); @@ -276,7 +302,9 @@ namespace Tango.MachineStudio.DataCapture.ViewModels { using (_notification.PushTaskItem("Saving Recording...")) { - await Recorder.Save(Path.Combine(_recordingsFolder, recordingName + ".tdr")); + String filePath = Path.Combine(_recordingsFolder, recordingName + ".tdr"); + await Recorder.Save(filePath); + Recordings.Insert(0, new DataRecording(filePath)); } } @@ -287,6 +315,7 @@ namespace Tango.MachineStudio.DataCapture.ViewModels { await Player.Stop(); _frameProvider.Disable = false; + _playerBarItem.Pop(); } InvalidateRelayCommands(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml index 74addf942..72f7da03d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml @@ -17,6 +17,7 @@ + @@ -38,7 +39,7 @@ - + @@ -50,7 +51,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml new file mode 100644 index 000000000..3e76ce6ef --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml @@ -0,0 +1,53 @@ + + + + + + + + / + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml.cs new file mode 100644 index 000000000..f9e502f8b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.DataCapture.Views +{ + /// + /// Interaction logic for RecordingBarView.xaml + /// + public partial class PlayingBarView : UserControl + { + public PlayingBarView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 148e4375c..10c35b3b9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -29,6 +29,7 @@ using Tango.Integration.Printing; using Tango.Integration.Diagnostics; using Microsoft.Win32; using Tango.MachineStudio.Technician.ViewModels; +using Tango.MachineStudio.Common.Diagnostics; namespace Tango.MachineStudio.Developer.ViewModels { @@ -496,10 +497,11 @@ namespace Tango.MachineStudio.Developer.ViewModels /// The application manager. /// The notification provider. [PreferredConstructor] - public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IMainView view) : this(view) + public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IMainView view, IDiagnosticsFrameProvider diagnosticsFrameProvider) : this(view) { _notification = notificationProvider; ApplicationManager = applicationManager; + diagnosticsFrameProvider.FrameReceived += DiagnosticsFrameProvider_FrameReceived; //Initialize Commands... EditMachineCommand = new RelayCommand(EditMachine, () => SelectedMachine != null); @@ -520,8 +522,8 @@ namespace Tango.MachineStudio.Developer.ViewModels ExitFullScreenCommand = new RelayCommand(ExitFullScreen); MediaRecordingCommand = new RelayCommand(StartDiagnosticsRecording, () => !Recorder.IsRecording && MachineOperator != null && !Player.IsPlaying); MediaStopCommand = new RelayCommand(StopRecorderOrPlayer, () => Recorder.IsRecording || Player.IsPlaying); - MediaLoadCommand = new RelayCommand(LoadDiagnosticsRecordingFile,() => !Recorder.IsRecording && !Player.IsPlaying); - MediaPlayPauseCommand = new RelayCommand(DiagnosticsTogglePlayPause,() => !Recorder.IsRecording && Player.IsLoaded); + MediaLoadCommand = new RelayCommand(LoadDiagnosticsRecordingFile, () => !Recorder.IsRecording && !Player.IsPlaying); + MediaPlayPauseCommand = new RelayCommand(DiagnosticsTogglePlayPause, () => !Recorder.IsRecording && Player.IsLoaded); CaptureDevices = new ObservableCollection(); var availableDevices = CaptureDevice.GetAvailableCaptureDevices(); @@ -549,6 +551,11 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Event Handlers + private void DiagnosticsFrameProvider_FrameReceived(object sender, PushDiagnosticsResponse response) + { + PopulateDiagnosticsData(response); + } + private void Player_FrameReceived(object sender, DataFileFrame frame) { PopulateDiagnosticsData(frame.PushDiagnosticsResponse); @@ -567,15 +574,15 @@ namespace Tango.MachineStudio.Developer.ViewModels private void MachineOperator_DiagnosticsDataAvailable(object sender, PushDiagnosticsResponse response) { - if (Recorder.IsRecording) - { - Recorder.Write(response); - } + //if (Recorder.IsRecording) + //{ + // Recorder.Write(response); + //} - if (!Player.IsPlaying) - { - PopulateDiagnosticsData(response); - } + //if (!Player.IsPlaying) + //{ + // PopulateDiagnosticsData(response); + //} } /// @@ -1085,7 +1092,7 @@ namespace Tango.MachineStudio.Developer.ViewModels if (SelectedBrushStop != null && SelectedSegment != null) { SelectedSegment.BrushStops.Remove(SelectedBrushStop); - + if (SelectedSegment.BrushStops.Count > 1) { SelectedSegment.BrushStops.Last().OffsetPercent = 100; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/BarItem.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/BarItem.cs index 8d3cefa40..d46bf5b5d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/BarItem.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/BarItem.cs @@ -19,6 +19,11 @@ namespace Tango.MachineStudio.Common.Notifications _notificationProvider = notificationProvider; } + public BarItem(INotificationProvider notificationProvider, FrameworkElement element) : this(notificationProvider) + { + Element = element; + } + /// /// Removed this item from the queue. /// diff --git a/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFilePlayer.cs b/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFilePlayer.cs index 7e5927648..1900e49e1 100644 --- a/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFilePlayer.cs +++ b/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFilePlayer.cs @@ -122,9 +122,9 @@ namespace Tango.Integration.Diagnostics /// /// Absolute file path. /// - public Task Load(String fileName) + public async Task Load(String fileName) { - return Task.Factory.StartNew(() => + Task task = new Task(() => { try { @@ -161,6 +161,9 @@ namespace Tango.Integration.Diagnostics throw LogManager.Log(ex); } }); + + task.Start(); + await task; } /// -- cgit v1.3.1