From b934b152eea671fa06678baa0cdf7f8811e6d2d9 Mon Sep 17 00:00:00 2001 From: Roy Date: Wed, 14 Feb 2018 22:51:52 +0200 Subject: MERGE. --- .../Tango.MachineStudio.DataCapture.csproj | 174 +++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj') 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 new file mode 100644 index 000000000..1c13be809 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj @@ -0,0 +1,174 @@ + + + + + Debug + AnyCPU + {FC337A7F-1214-41D8-9992-78092A3B961E} + library + Tango.MachineStudio.DataCapture + Tango.MachineStudio.DataCapture + v4.6 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + true + full + false + ..\..\..\Build\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.dll + + + ..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Extras.dll + + + ..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Platform.dll + + + ..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll + + + ..\..\..\packages\MaterialDesignColors.1.1.2\lib\net45\MaterialDesignColors.dll + + + ..\..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll + + + ..\..\..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll + + + + + ..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll + + + + + + + + + 4.0 + + + + + + + + + + + MainView.xaml + + + GlobalVersionInfo.cs + + + + RecordingBarView.xaml + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + {4206ac58-3b57-4699-8835-90bf6db01a61} + Tango.Integration + + + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} + Tango.Logging + + + {e4927038-348d-4295-aaf4-861c58cb3943} + Tango.PMR + + + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} + Tango.Settings + + + {8491d07b-c1f6-4b62-a412-41b9fd2d6538} + Tango.SharedUI + + + {74e700b0-1156-4126-be40-ee450d3c3026} + Tango.Transport + + + {9652f972-2bd1-4283-99cb-fc6240434c17} + Tango.Video + + + {cb0b0aa2-bb24-4bca-a720-45e397684e12} + Tango.MachineStudio.Common + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- 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/Tango.MachineStudio.DataCapture.csproj') 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 From 95b4e14bc4e06ffb94199f5ec4e0d2d9bebceeff Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 18 Feb 2018 18:48:16 +0200 Subject: Working on new developer module. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes .../Tango.MachineStudio.DataCapture.csproj | 1 + .../Tango.MachineStudio.DataCapture/app.config | 11 ++ .../Tango.MachineStudio.Developer.csproj | 3 + .../ViewModels/MainViewVM.cs | 151 +++++++++++++++++++-- .../Views/JobView.xaml | 13 +- .../Views/MachineJobSelectionView.xaml | 13 +- .../Tango.MachineStudio.Developer/packages.config | 1 + .../Tango.CodeGeneration/EntityCodeFile.cs | 2 + .../Templates/EntityCodeFile.cshtml | 4 + .../Visual_Studio/Tango.Core/IParameterized.cs | 2 + .../Observables/Entities/ActionType.cs | 2 + .../Observables/Entities/Address.cs | 2 + .../Entities/ApplicationDisplayPanelVersion.cs | 2 + .../Entities/ApplicationFirmwareVersion.cs | 2 + .../Observables/Entities/ApplicationOsVersion.cs | 2 + .../Observables/Entities/ApplicationVersion.cs | 2 + .../Observables/Entities/BrushStop.cs | 9 ++ .../Observables/Entities/CartridgeType.cs | 2 + .../Tango.Integration/Observables/Entities/Cat.cs | 8 ++ .../Tango.Integration/Observables/Entities/Cct.cs | 5 + .../Observables/Entities/ColorSpace.cs | 2 + .../Observables/Entities/Configuration.cs | 23 ++++ .../Observables/Entities/Contact.cs | 2 + .../Observables/Entities/DispenserType.cs | 2 + .../Entities/EmbeddedFirmwareVersion.cs | 2 + .../Entities/EmbeddedSoftwareVersion.cs | 2 + .../Observables/Entities/EventType.cs | 2 + .../Observables/Entities/EventTypesAction.cs | 8 ++ .../Observables/Entities/FiberShape.cs | 2 + .../Observables/Entities/FiberSynth.cs | 2 + .../Observables/Entities/HardwareVersion.cs | 2 + .../Observables/Entities/IdsPack.cs | 20 +++ .../Observables/Entities/IdsPackFormula.cs | 2 + .../Tango.Integration/Observables/Entities/Job.cs | 14 ++ .../Observables/Entities/JobRun.cs | 5 + .../Observables/Entities/LinearMassDensityUnit.cs | 2 + .../Observables/Entities/LiquidType.cs | 2 + .../Observables/Entities/LiquidTypesRml.cs | 8 ++ .../Observables/Entities/Machine.cs | 11 ++ .../Observables/Entities/MachineVersion.cs | 5 + .../Observables/Entities/MachinesConfiguration.cs | 8 ++ .../Observables/Entities/MachinesEvent.cs | 11 ++ .../Observables/Entities/MediaColor.cs | 2 + .../Observables/Entities/MediaCondition.cs | 2 + .../Observables/Entities/MediaMaterial.cs | 2 + .../Observables/Entities/MediaPurpos.cs | 2 + .../Observables/Entities/MidTankType.cs | 2 + .../Observables/Entities/Organization.cs | 8 ++ .../Observables/Entities/Permission.cs | 2 + .../Observables/Entities/ProcessParametersTable.cs | 5 + .../Entities/ProcessParametersTablesGroup.cs | 5 + .../Tango.Integration/Observables/Entities/Rml.cs | 23 ++++ .../Tango.Integration/Observables/Entities/Role.cs | 2 + .../Observables/Entities/RolesPermission.cs | 8 ++ .../Observables/Entities/Segment.cs | 5 + .../Observables/Entities/SyncConfiguration.cs | 2 + .../Observables/Entities/TechDispenser.cs | 2 + .../Observables/Entities/TechIo.cs | 2 + .../Observables/Entities/TechMonitor.cs | 2 + .../Observables/Entities/TechMotor.cs | 2 + .../Observables/Entities/TechValf.cs | 2 + .../Tango.Integration/Observables/Entities/User.cs | 11 ++ .../Observables/Entities/UsersRole.cs | 8 ++ .../Observables/Entities/WindingMethod.cs | 2 + .../Observables/IObservableEntity.cs | 12 ++ .../Observables/ObservableEntity.cs | 33 ++++- .../Tango.Integration/Printing/BrushStop.cs | 21 +++ .../Tango.Integration/Printing/Job.cs | 22 ++- .../Tango.Integration/Printing/LiquidVolume.cs | 20 ++- .../Tango.Integration/Printing/Segment.cs | 32 ++++- .../Tango.Integration/Tango.Integration.csproj | 3 + .../Tango.Integration/packages.config | 1 + .../Tango.SharedUI/Controls/MultiSelectDataGrid.cs | 37 +++++ .../Tango.SharedUI/Controls/MultiSelectListBox.cs | 38 ++++++ .../Tango.SharedUI/Tango.SharedUI.csproj | 2 + .../ObservablesGenerator.cs | 1 + 78 files changed, 663 insertions(+), 34 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/app.config create mode 100644 Software/Visual_Studio/Tango.SharedUI/Controls/MultiSelectDataGrid.cs create mode 100644 Software/Visual_Studio/Tango.SharedUI/Controls/MultiSelectListBox.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 0484aed80..0e6d30aef 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 0a2fb21b2..cb15dbe51 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/Tango.MachineStudio.DataCapture.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj index 8936a66db..d97f540b1 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 @@ -118,6 +118,7 @@ ResXFileCodeGenerator Resources.Designer.cs + SettingsSingleFileGenerator diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/app.config new file mode 100644 index 000000000..cacd4cd77 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj index 086d6cd91..eae234a8b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj @@ -31,6 +31,9 @@ 4 + + ..\..\..\packages\DeepEqual.1.6.0.0\lib\net40\DeepEqual.dll + ..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll 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 7a1c94504..5c5531063 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 @@ -34,6 +34,8 @@ using Tango.MachineStudio.Common.Video; using Tango.Integration.Services; using Tango.MachineStudio.Developer.Navigation; using System.Data.Entity; +using Tango.MachineStudio.Common.Authentication; +using DeepEqual.Syntax; namespace Tango.MachineStudio.Developer.ViewModels { @@ -52,18 +54,24 @@ namespace Tango.MachineStudio.Developer.ViewModels private ObservablesContext _dbJobContext; private Job _jobFromList; private bool _blockInvalidateCommands; + private IAuthenticationProvider _authentication; #region Properties private ObservableCollection _colorSpaces; - + /// + /// Gets or sets the color spaces. + /// public ObservableCollection ColorSpaces { get { return _colorSpaces; } set { _colorSpaces = value; RaisePropertyChangedAuto(); } } - private ObservableCollection _rmls; + private ObservableCollection _rmls; + /// + /// Gets or sets the RMLS. + /// public ObservableCollection Rmls { get { return _rmls; } @@ -172,6 +180,16 @@ namespace Tango.MachineStudio.Developer.ViewModels } } + private ObservableCollection _selectedJobs; + /// + /// Gets or sets the selected jobs. + /// + public ObservableCollection SelectedJobs + { + get { return _selectedJobs; } + set { _selectedJobs = value; RaisePropertyChangedAuto(); } + } + private Segment _selectedSegment; /// /// Gets or sets the job selected segment. @@ -182,6 +200,16 @@ namespace Tango.MachineStudio.Developer.ViewModels set { _selectedSegment = value; RaisePropertyChangedAuto(); OnSelectedSegmentChanged(); } } + private ObservableCollection _selectedSegments; + /// + /// Gets or sets the selected segments. + /// + public ObservableCollection SelectedSegments + { + get { return _selectedSegments; } + set { _selectedSegments = value; RaisePropertyChangedAuto(); } + } + private BrushStop _selectedBrushStop; /// /// Gets or sets the selected segment selected brush stop. @@ -192,6 +220,16 @@ namespace Tango.MachineStudio.Developer.ViewModels set { _selectedBrushStop = value; RaisePropertyChangedAuto(); } } + private ObservableCollection _selectedBrushStops; + /// + /// Gets or sets the selected brush stops. + /// + public ObservableCollection SelectedBrushStops + { + get { return _selectedBrushStops; } + set { _selectedBrushStops = value; RaisePropertyChangedAuto(); } + } + private Rml _selectedRML; /// /// Gets or sets the selected RML. @@ -457,6 +495,11 @@ namespace Tango.MachineStudio.Developer.ViewModels /// public RelayCommand LoadJobCommand { get; set; } + /// + /// Gets or sets the duplicate job command. + /// + public RelayCommand DuplicateJobCommand { get; set; } + #endregion #region Constructors @@ -482,8 +525,12 @@ namespace Tango.MachineStudio.Developer.ViewModels /// The application manager. /// The notification provider. [PreferredConstructor] - public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IMainView view, IDiagnosticsFrameProvider diagnosticsFrameProvider, IVideoCaptureProvider videoCaptureProvider, DeveloperNavigationManager navigation) : this(view) + public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IMainView view, IDiagnosticsFrameProvider diagnosticsFrameProvider, IVideoCaptureProvider videoCaptureProvider, DeveloperNavigationManager navigation, IAuthenticationProvider authentication) : this(view) { + SelectedJobs = new ObservableCollection(); + + _authentication = authentication; + _notification = notificationProvider; _navigation = navigation; ApplicationManager = applicationManager; @@ -509,6 +556,7 @@ namespace Tango.MachineStudio.Developer.ViewModels CloseJobCompletionStatusCommand = new RelayCommand(CloseJobCompletionStatusBar); ExitFullScreenCommand = new RelayCommand(ExitFullScreen); LoadJobCommand = new RelayCommand(LoadJob, () => SelectedJob != null); + DuplicateJobCommand = new RelayCommand(DuplicateJob, () => SelectedJob != null); ToggleCameraCommand = new RelayCommand(ToggleCamera); @@ -547,6 +595,7 @@ namespace Tango.MachineStudio.Developer.ViewModels private void SelectedMachine_Saved(object sender, EventArgs e) { InvalidateLiquidFactorsAndProcessTables(); + SelectedMachine.Reload(); } /// @@ -640,14 +689,43 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Private Methods + private async void DuplicateJob() + { + if (SelectedJobs.Count > 0) + { + using (_notification.PushTaskItem("Cloning selected jobs...")) + { + int index = SelectedMachine.Jobs.Max(x => x.JobIndex); + + foreach (var job in SelectedJobs) + { + var cloned = job.Clone(); + cloned.JobIndex = ++index; + SelectedMachine.Jobs.Add(cloned); + } + + await SelectedMachine.SaveAsync(); + } + } + } + private async void LoadJob() { if (SelectedJob != null) { + SelectedSegments = new ObservableCollection(); + SelectedBrushStops = new ObservableCollection(); + SelectedRML = null; + SelectedSegment = null; + SelectedGroupHistory = null; + SelectedBrushStop = null; + SelectedProcessParametersTable = null; + RmlProcessParametersTableGroup = null; + using (_notification.PushTaskItem("Loading job details...")) { - await Task.Factory.StartNew(() => - { + //await Task.Factory.StartNew(() => + //{ _blockInvalidateCommands = false; _dbJobContext = ObservablesContext.CreateDefault(); @@ -675,7 +753,7 @@ namespace Tango.MachineStudio.Developer.ViewModels InvalidateRelayCommands(); InvokeUI(() => _navigation.NavigateTo(DeveloperNavigationView.JobView)); - }); + //}); } } } @@ -688,15 +766,45 @@ namespace Tango.MachineStudio.Developer.ViewModels { SelectedJob.LastUpdated = DateTime.UtcNow; SelectedJob.Rml = SelectedRML; - await SelectedJob.SaveAsync(); + await SelectedJob.SaveAsync(_dbJobContext); + _jobFromList = SelectedMachine.Jobs.SingleOrDefault(x => x.Guid == SelectedJob.Guid); await _jobFromList.Reload(); + + foreach (var segment in _jobFromList.Segments) + { + await segment.Reload(); + + foreach (var stop in segment.BrushStops) + { + await stop.Reload(); + } + } } } } private void DiscardJob() { - if (_notification.ShowQuestion("This will discard the current job changes. Are you sue?")) + //bool jobModified = !SelectedJob.WithDeepEqual(_jobFromList) + // .IgnoreSourceProperty(x => x.Machine) + // .IgnoreSourceProperty(x => x.JobRuns) + // .IgnoreSourceProperty(x => x.Parameters) + // .IgnoreSourceProperty(x => x.Rml) + // .IgnoreSourceProperty(x => x.User) + // .IgnoreSourceProperty(x => x.Segments) + // .Compare(); + + bool jobModified = !SelectedJob.CompareUsingJson(_jobFromList); + + if (jobModified) + { + if (_notification.ShowQuestion("This will discard the current job changes. Are you sue?")) + { + _dbJobContext.Dispose(); + _navigation.NavigateTo(DeveloperNavigationView.MachineJobSelectionView); + } + } + else { _dbJobContext.Dispose(); _navigation.NavigateTo(DeveloperNavigationView.MachineJobSelectionView); @@ -1012,11 +1120,18 @@ namespace Tango.MachineStudio.Developer.ViewModels /// /// Removes the selected job. /// - private void RemoveJob() + private async void RemoveJob() { if (SelectedMachine != null && SelectedJob != null) { - SelectedMachine.Jobs.Remove(SelectedJob); + if (_notification.ShowQuestion("Are you sure you want to delete the selected jobs?")) + { + SelectedJobs.ToList().ForEach(x => + { + x.DefferedDelete(); + }); + await SelectedMachine.SaveAsync(); + } } } @@ -1027,11 +1142,19 @@ namespace Tango.MachineStudio.Developer.ViewModels { if (SelectedMachine != null) { - SelectedMachine.Jobs.Add(new Job(DateTime.UtcNow) + String jobName = _notification.ShowTextInput("Please provide a job name", "Name"); + + if (!String.IsNullOrWhiteSpace(jobName)) { - Name = "Untitled Job", - CreationDate = DateTime.UtcNow, - }); + Job newJob = new Job(); + newJob.Name = jobName; + newJob.CreationDate = DateTime.UtcNow; + newJob.User = _authentication.CurrentUser; + newJob.Rml = Adapter.Rmls.FirstOrDefault(); + + SelectedJob = newJob; + LoadJob(); + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index b6455175e..35a30e91e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -14,6 +14,7 @@ xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:db="clr-namespace:Tango.MachineStudio.DB.Views.DBViews;assembly=Tango.MachineStudio.DB" xmlns:commonControls="clr-namespace:Tango.MachineStudio.Common.Controls;assembly=Tango.MachineStudio.Common" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:designer="clr-namespace:Tango.MachineStudio.MachineDesigner.Views;assembly=Tango.MachineStudio.MachineDesigner" xmlns:vm="clr-namespace:Tango.MachineStudio.Developer.ViewModels" xmlns:localConverters="clr-namespace:Tango.MachineStudio.Developer.Converters" @@ -230,7 +231,7 @@