From dee664eaeaf48edfa2ad2f90d6384d727dc35432 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 26 Sep 2018 14:35:47 +0300 Subject: Implemented Tech board tabs and project!!! --- .../Notifications/TextInputBoxWindow.xaml.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml.cs index d774c14eb..bc11dfd18 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml.cs @@ -26,6 +26,14 @@ namespace Tango.MachineStudio.UI.Notifications { InitializeComponent(); this.Loaded += TextInputBoxWindow_Loaded; + + ContentRendered += TextInputBoxWindow_ContentRendered; + } + + private void TextInputBoxWindow_ContentRendered(object sender, EventArgs e) + { + txtText.Focus(); + txtText.SelectAll(); } private void TextInputBoxWindow_Loaded(object sender, RoutedEventArgs e) @@ -34,12 +42,8 @@ namespace Tango.MachineStudio.UI.Notifications ani.To = 1; ani.Duration = TimeSpan.FromSeconds(0.5); this.BeginAnimation(Window.OpacityProperty, ani); - - txtText.Focus(); } - - public String Hint { get { return (String)GetValue(HintProperty); } -- cgit v1.3.1 From f7c202490ad028ed6d501a4486a339e4e21eb404 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 26 Sep 2018 17:31:48 +0300 Subject: Added FPGA Versions. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 15400960 -> 15400960 bytes .../Views/ConnectedMachineView.xaml | 14 ++++++++++++++ .../Tango.Emulations/Emulators/MachineEmulator.cs | 3 +++ 4 files changed, 17 insertions(+) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 959a348cc..6cabf0be2 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 5c5f9471c..8bca8ebd2 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml index 26790c67d..4e3de9e60 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml @@ -110,6 +110,12 @@ + + + • + • + + @@ -147,6 +153,14 @@ + + + + + • + • + + diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index d39842531..46b4b6cf1 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -773,6 +773,9 @@ namespace Tango.Emulations.Emulators Version = "1.0.0.0", BuildDate = DateTime.Now.ToString(), Name = "Machine Emulator", + FPGA1Version = "1.1", + FPGA2Version = "2.2", + FPGA3Version = "3.3" }, }, request.Container.Token, null, request.Message.Password == "1234" ? ErrorCode.None : ErrorCode.UnauthorizedConnection); } -- cgit v1.3.1 From 62aaf350dd5645c3778a0a40ea3ff66280e1bf8c Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 26 Sep 2018 19:55:00 +0300 Subject: Implemented Monitor Recorder element !!! --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 15400960 -> 15400960 bytes Software/Graphics/csv.png | Bin 0 -> 1650 bytes .../Editors/MonitorRecorderElementEditor.xaml | 167 +++++++++++++++++++++ .../Editors/MonitorRecorderElementEditor.xaml.cs | 103 +++++++++++++ .../Tango.MachineStudio.Technician/Images/csv.png | Bin 0 -> 1650 bytes .../Models/MultiTechRecordingData.cs | 6 +- .../Models/SingleTechRecordingData.cs | 6 +- .../Models/TechRecordingData.cs | 23 ++- .../MonitorRecorderTemplate.xaml | 42 ++++++ .../MonitorRecorderTemplate.xaml.cs | 28 ++++ .../Tango.MachineStudio.Technician.csproj | 27 ++++ .../TechItems/MonitorRecorderItem.cs | 131 ++++++++++++++++ .../TechItems/MultiGraphItem.cs | 20 ++- .../TechItems/SingleGraphItem.cs | 20 ++- .../TechItems/TechItem.cs | 1 + .../ViewModels/MachineTechViewVM.cs | 155 ++++++++++++++----- .../Views/MachineTechView.xaml | 3 + .../Tango.MachineStudio.Technician/packages.config | 2 + .../Tango.MachineStudio.UI/App.config | 28 ++++ 20 files changed, 696 insertions(+), 66 deletions(-) create mode 100644 Software/Graphics/csv.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorRecorderElementEditor.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorRecorderElementEditor.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/csv.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorRecorderTemplate.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorRecorderTemplate.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorRecorderItem.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 6cabf0be2..fb69b7a48 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 8bca8ebd2..0487b6d9c 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Graphics/csv.png b/Software/Graphics/csv.png new file mode 100644 index 000000000..5f03ac6bd Binary files /dev/null and b/Software/Graphics/csv.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorRecorderElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorRecorderElementEditor.xaml new file mode 100644 index 000000000..ce9675103 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorRecorderElementEditor.xaml @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + selected monitors to record + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorRecorderElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorRecorderElementEditor.xaml.cs new file mode 100644 index 000000000..213fa78e0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorRecorderElementEditor.xaml.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.Editors; +using Tango.BL.Entities; +using Tango.MachineStudio.Technician.TechItems; +using Tango.Core; + +namespace Tango.MachineStudio.Technician.Editors +{ + [ContentProperty("InnerContent")] + public partial class MonitorRecorderElementEditor : ElementEditor + { + /// + /// Initializes a new instance of the class. + /// + public MonitorRecorderElementEditor() + : base() + { + InitializeComponent(); + } + + /// + /// Initializes a new instance of the class. + /// + /// The framework element. + public MonitorRecorderElementEditor(MonitorRecorderItem monitorRecorderItem) + : this() + { + MonitorRecorderItem = monitorRecorderItem; + DataContext = MonitorRecorderItem; + } + + /// + /// Initializes a new instance of the class. + /// + /// The framework element. + /// The bounds. + public MonitorRecorderElementEditor(MonitorRecorderItem monitorRecorderItem, Rect bounds) + : this(monitorRecorderItem) + { + Left = bounds.Left; + Top = bounds.Top; + Width = bounds.Width; + Height = bounds.Height; + } + + private MonitorRecorderItem _monitorRecorderItem; + + public MonitorRecorderItem MonitorRecorderItem + { + get { return _monitorRecorderItem; } + set { _monitorRecorderItem = value; RaisePropertyChanged(nameof(MonitorRecorderItem)); } + } + + + /// + /// Clones this instance. + /// + /// + public override IElementEditor Clone() + { + try + { + var clonedItem = MonitorRecorderItem.Clone() as MonitorRecorderItem; + MonitorRecorderElementEditor cloned = new MonitorRecorderElementEditor(clonedItem); + cloned.Top = Top; + cloned.Left = Left; + cloned.Width = Width; + cloned.Height = Height; + cloned.Angle = Angle; + return cloned; + } + catch (Exception ex) + { + throw new InvalidOperationException("Could not clone this editor. You may have to create a custom editor and implement a custom Clone method.", ex); + } + } + + /// + /// Gets the hosted element. + /// + [ParameterIgnore] + public override Object HostedElement + { + get { return MonitorRecorderItem; } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/csv.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/csv.png new file mode 100644 index 000000000..5f03ac6bd Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/csv.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/MultiTechRecordingData.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/MultiTechRecordingData.cs index e9471fa74..ad3ea1352 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/MultiTechRecordingData.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/MultiTechRecordingData.cs @@ -11,11 +11,11 @@ using Tango.MachineStudio.Technician.TechItems; namespace Tango.MachineStudio.Technician.Models { - public class MultiTechRecordingData : TechRecordingData where T : TechItem + public class MultiTechRecordingData : TechRecordingData { public int ChannelCount { get; set; } - public MultiTechRecordingData(T techItem, int channel_count) : base(techItem) + public MultiTechRecordingData(String name, int channel_count, String fileName) : base(name, fileName) { ChannelCount = channel_count; Init(); @@ -54,7 +54,7 @@ namespace Tango.MachineStudio.Technician.Models protected override List GetColumnNames() { - return Enumerable.Range(1, ChannelCount).Select(x => TechItem.TechName + " " + x).ToList(); + return Enumerable.Range(1, ChannelCount).Select(x => Name + " " + x).ToList(); } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/SingleTechRecordingData.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/SingleTechRecordingData.cs index 7aa9a2b3f..8b480bbf3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/SingleTechRecordingData.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/SingleTechRecordingData.cs @@ -7,9 +7,9 @@ using Tango.MachineStudio.Technician.TechItems; namespace Tango.MachineStudio.Technician.Models { - public class SingleTechRecordingData : TechRecordingData where T : TechItem + public class SingleTechRecordingData : TechRecordingData { - public SingleTechRecordingData(T techItem) : base(techItem) + public SingleTechRecordingData(String name, String fileName) : base(name, fileName) { Init(); } @@ -35,7 +35,7 @@ namespace Tango.MachineStudio.Technician.Models protected override List GetColumnNames() { - return new List() { TechItem.TechName }; + return new List() { Name }; } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/TechRecordingData.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/TechRecordingData.cs index 8024a1375..7b6439dbf 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/TechRecordingData.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/TechRecordingData.cs @@ -11,7 +11,7 @@ using Tango.MachineStudio.Technician.TechItems; namespace Tango.MachineStudio.Technician.Models { - public abstract class TechRecordingData : ExtendedObject, IDisposable where T : TechItem where TValue : TechRecordingValue + public abstract class TechRecordingData : ExtendedObject, IDisposable where TValue : TechRecordingValue { protected bool _initialized; @@ -20,16 +20,18 @@ namespace Tango.MachineStudio.Technician.Models public CsvFile CsvFile { get; set; } - public TemporaryFile TemporaryFile { get; set; } + public String File { get; set; } - public T TechItem { get; set; } + public String Name { get; set; } - public TechRecordingData(T techItem) + public Object Tag { get; set; } + + public TechRecordingData(String name, String fileName) { + File = fileName; _start_time = DateTime.Now; _last_time = DateTime.Now; - TechItem = techItem; - TemporaryFile = TemporaryManager.CreateFile(".csv"); + Name = name; } protected void Init() @@ -37,20 +39,13 @@ namespace Tango.MachineStudio.Technician.Models CsvDefinition definition = new CsvDefinition(); definition.Columns = new List() { "Time" }.Concat(GetColumnNames()); - CsvFile = new CsvFile(new CsvDestination(TemporaryFile), definition); + CsvFile = new CsvFile(new CsvDestination(File), definition); _initialized = true; } - public void Save(String fileName) - { - CsvFile.Dispose(); - File.Copy(TemporaryFile.Path, fileName, true); - } - public void Dispose() { CsvFile.Dispose(); - TemporaryFile.Delete(); } protected abstract List GetColumnNames(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorRecorderTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorRecorderTemplate.xaml new file mode 100644 index 000000000..023191656 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorRecorderTemplate.xaml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorRecorderTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorRecorderTemplate.xaml.cs new file mode 100644 index 000000000..011e108cb --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorRecorderTemplate.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.Technician.PropertiesTemplates +{ + /// + /// Interaction logic for MonitorTemplate.xaml + /// + public partial class MonitorRecorderTemplate : UserControl + { + public MonitorRecorderTemplate() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj index 0d9cd5b63..d937ca15b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj @@ -52,6 +52,15 @@ ..\..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll + + ..\..\..\packages\Microsoft.WindowsAPICodePack-Core.1.1.0.0\lib\Microsoft.WindowsAPICodePack.dll + + + ..\..\..\packages\Microsoft.WindowsAPICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.Shell.dll + + + ..\..\..\packages\Microsoft.WindowsAPICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.ShellExtensions.dll + @@ -101,6 +110,9 @@ + + MonitorRecorderElementEditor.xaml + HeaterElementEditor.xaml @@ -173,6 +185,9 @@ + + MonitorRecorderTemplate.xaml + HeaterTemplate.xaml @@ -244,6 +259,7 @@ + @@ -268,6 +284,10 @@ MachineTechView.xaml + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -352,6 +372,10 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -658,6 +682,9 @@ + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorRecorderItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorRecorderItem.cs new file mode 100644 index 000000000..e2b62092d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorRecorderItem.cs @@ -0,0 +1,131 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using System.Windows.Threading; +using System.Xml.Serialization; +using Tango.BL.Entities; +using Tango.Core.Commands; +using Tango.SharedUI.Components; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.Technician.TechItems +{ + [TechItem(25)] + public class MonitorRecorderItem : TechItem + { + private DispatcherTimer _timer; + private DateTime _recording_start_time; + + public event Action RecordingStarted; + public event Action RecordingStopped; + + /// + /// Gets or sets the monitors. + /// + [XmlIgnore] + public SelectedObjectCollection Monitors { get; set; } + + private bool _isRecording; + /// + /// Gets or sets a value indicating whether this instance is recording. + /// + [XmlIgnore] + public bool IsRecording + { + get { return _isRecording; } + set { _isRecording = value; RaisePropertyChangedAuto(); } + } + + private TimeSpan _recordingTime; + [XmlIgnore] + public TimeSpan RecordingTime + { + get { return _recordingTime; } + set { _recordingTime = value; RaisePropertyChangedAuto(); } + } + + private bool _isPaused; + [XmlIgnore] + public bool IsPaused + { + get { return _isPaused; } + set { _isPaused = value; RaisePropertyChangedAuto(); } + } + + + /// + /// Gets or sets the toggle recording command. + /// + [XmlIgnore] + public RelayCommand ToggleRecordingCommand { get; set; } + + [XmlIgnore] + public RelayCommand TogglePauseCommand { get; set; } + + /// + /// Initializes a new instance of the class. + /// + public MonitorRecorderItem() : base() + { + _timer = new DispatcherTimer(); + _timer.Tick += _timer_Tick; + _timer.Interval = TimeSpan.FromSeconds(1); + + Monitors = new SelectedObjectCollection(Adapter.TechMonitors.ToObservableCollection(), new ObservableCollection()); + Name = "CSV Recorder"; + Description = "Record multiple monitors to a CSV file"; + Image = ResourceHelper.GetImageFromResources("Images/csv.png"); + Color = Colors.White; + + ToggleRecordingCommand = new RelayCommand(ToggleRecording); + TogglePauseCommand = new RelayCommand(() => { IsPaused = !IsPaused; }); + } + + public MonitorRecorderItem(object dummy) : this() + { + + } + + private void _timer_Tick(object sender, EventArgs e) + { + RecordingTime = DateTime.Now - _recording_start_time; + } + + private void ToggleRecording() + { + if (!IsRecording) + { + RecordingStarted?.Invoke(); + } + else + { + RecordingStopped?.Invoke(); + } + } + + public void StartRecording() + { + _recording_start_time = DateTime.Now; + IsRecording = true; + IsPaused = false; + _timer.Start(); + } + + public void StopRecording() + { + _timer.Stop(); + IsPaused = false; + IsRecording = false; + RecordingTime = TimeSpan.FromSeconds(0); + } + + public List GetSelectedMonitors() + { + return Monitors.SynchedSource.ToList(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs index 5a3bd0327..a935ee5a6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs @@ -191,20 +191,28 @@ namespace Tango.MachineStudio.Technician.TechItems { if (!IsRecording) { - _recording_start_time = DateTime.Now; - IsRecording = true; - _timer.Start(); RecordingStarted?.Invoke(); } else { - _timer.Stop(); - IsRecording = false; - RecordingTime = TimeSpan.FromSeconds(0); RecordingStopped?.Invoke(); } } + public void StartRecording() + { + _recording_start_time = DateTime.Now; + IsRecording = true; + _timer.Start(); + } + + public void StopRecording() + { + _timer.Stop(); + IsRecording = false; + RecordingTime = TimeSpan.FromSeconds(0); + } + /// /// Initializes a new instance of the class. /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs index aa404b215..87d971233 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs @@ -184,20 +184,28 @@ namespace Tango.MachineStudio.Technician.TechItems { if (!IsRecording) { - _recording_start_time = DateTime.Now; - IsRecording = true; - _timer.Start(); RecordingStarted?.Invoke(); } else { - _timer.Stop(); - IsRecording = false; - RecordingTime = TimeSpan.FromSeconds(0); RecordingStopped?.Invoke(); } } + public void StartRecording() + { + _recording_start_time = DateTime.Now; + IsRecording = true; + _timer.Start(); + } + + public void StopRecording() + { + _timer.Stop(); + IsRecording = false; + RecordingTime = TimeSpan.FromSeconds(0); + } + /// /// Initializes a new instance of the class. /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs index 0d7568d68..6fa00ae0a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs @@ -40,6 +40,7 @@ namespace Tango.MachineStudio.Technician.TechItems [XmlInclude(typeof(JobRunnerItem))] [XmlInclude(typeof(TextItem))] [XmlInclude(typeof(HeaterItem))] + [XmlInclude(typeof(MonitorRecorderItem))] public abstract class TechItem : ExtendedObject { /// 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 738e871c9..9051b5fa9 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 @@ -34,6 +34,7 @@ using Tango.Core.Commands; using Tango.MachineStudio.Technician.Helpers; using Tango.MachineStudio.Technician.Models; using Tango.Logging; +using Microsoft.WindowsAPICodePack.Dialogs; namespace Tango.MachineStudio.Technician.ViewModels { @@ -56,8 +57,10 @@ namespace Tango.MachineStudio.Technician.ViewModels private const int MIN_DIAGNOSTICS_UPDATE_MILI = 500; private TechnicianModuleSettings _settings; - private List> _single_graphs_recordings; - private List> _multi_graph_recordings; + private List _single_graphs_recordings; + private List _multi_graph_recordings; + private List _single_monitors_recordings; + private List _multi_monitors_recordings; #region Properties @@ -276,8 +279,11 @@ namespace Tango.MachineStudio.Technician.ViewModels _settings = SettingsManager.Default.GetOrCreate(); - _single_graphs_recordings = new List>(); - _multi_graph_recordings = new List>(); + _single_graphs_recordings = new List(); + _multi_graph_recordings = new List(); + + _single_monitors_recordings = new List(); + _multi_monitors_recordings = new List(); GraphsDurationSeconds = _settings.GraphsDuration; TempGraphsDurationSeconds = GraphsDurationSeconds; @@ -378,6 +384,28 @@ namespace Tango.MachineStudio.Technician.ViewModels } + foreach (var sr in _single_monitors_recordings) + { + var prop = _diagnoticsMonitorsDataProperties.SingleOrDefault(x => x.Name == (sr.Tag as TechMonitor).Name); + + if (prop != null) + { + var points = GetDataArray((sr.Tag as TechMonitor), prop.GetValue(data.Monitors)); + sr.PushData(points); + } + } + + foreach (var mr in _multi_monitors_recordings) + { + var prop = _diagnoticsMonitorsDataProperties.SingleOrDefault(x => x.Name == (mr.Tag as TechMonitor).Name); + + if (prop != null) + { + var points = GetDataMatrix((mr.Tag as TechMonitor), prop.GetValue(data.Monitors)); + mr.PushData(points); + } + } + lock (_elementsLock) { var elements = Tabs.SelectMany(x => x.Elements).ToList(); @@ -435,7 +463,7 @@ namespace Tango.MachineStudio.Technician.ViewModels controller.PushData(points); - var _graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.TechItem == graphItem); + var _graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.Tag == graphItem); if (_graph_recording != null) { _graph_recording.PushData(points); @@ -469,7 +497,7 @@ namespace Tango.MachineStudio.Technician.ViewModels controller.PushData(points); - var _graph_recording = _multi_graph_recordings.SingleOrDefault(x => x.TechItem == graphItem); + var _graph_recording = _multi_graph_recordings.SingleOrDefault(x => x.Tag == graphItem); if (_graph_recording != null) { _graph_recording.PushData(points); @@ -720,6 +748,11 @@ namespace Tango.MachineStudio.Technician.ViewModels { CreateElement(bounds, null); } + else if (item is MonitorRecorderItem) + { + var editor = CreateElement(bounds, null); + InitMonitorRecorderItem(editor.MonitorRecorderItem); + } } /// @@ -869,6 +902,10 @@ namespace Tango.MachineStudio.Technician.ViewModels { CreateElement(item); } + else if (item is MonitorRecorderItem) + { + CreateElement(item); + } } /// @@ -881,20 +918,24 @@ namespace Tango.MachineStudio.Technician.ViewModels { if (element.HostedElement is SingleGraphItem) { - var _graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.TechItem == element.HostedElement); + var _graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.Tag == element.HostedElement); if (_graph_recording != null) { + (_graph_recording.Tag as SingleGraphItem).StopRecording(); _single_graphs_recordings.Remove(_graph_recording); + _graph_recording.Dispose(); } } else if (element.HostedElement is MultiGraphItem) { - var _graph_recording = _multi_graph_recordings.SingleOrDefault(x => x.TechItem == element.HostedElement); + var _graph_recording = _multi_graph_recordings.SingleOrDefault(x => x.Tag == element.HostedElement); if (_graph_recording != null) { + (_graph_recording.Tag as MultiGraphItem).StopRecording(); _multi_graph_recordings.Remove(_graph_recording); + _graph_recording.Dispose(); } } } @@ -981,6 +1022,50 @@ namespace Tango.MachineStudio.Technician.ViewModels #region Init Tech Items + private void InitMonitorRecorderItem(MonitorRecorderItem item) + { + item.RecordingStarted += () => + { + CommonOpenFileDialog dlg = new CommonOpenFileDialog(); + dlg.Title = "Select a folder to place all CSV files."; + dlg.IsFolderPicker = true; + if (dlg.ShowDialog() == CommonFileDialogResult.Ok) + { + foreach (var monitor in item.GetSelectedMonitors()) + { + if (!monitor.MultiChannel) + { + _single_monitors_recordings.Add(new SingleTechRecordingData(monitor.Name, dlg.FileName + "\\" + monitor.Name + ".csv") { Tag = monitor }); + } + else + { + _multi_monitors_recordings.Add(new MultiTechRecordingData(monitor.Name, monitor.ChannelCount, dlg.FileName + "\\" + monitor.Name + ".csv") { Tag = monitor }); + } + item.StartRecording(); + } + } + }; + + item.RecordingStopped += () => + { + item.StopRecording(); + + foreach (var sr in _single_monitors_recordings) + { + sr.Dispose(); + } + + _single_monitors_recordings.Clear(); + + foreach (var mr in _multi_monitors_recordings) + { + mr.Dispose(); + } + + _multi_monitors_recordings.Clear(); + }; + } + /// /// Initializes the blower item. /// @@ -1222,29 +1307,30 @@ namespace Tango.MachineStudio.Technician.ViewModels item.RecordingStarted += () => { - _single_graphs_recordings.Add(new SingleTechRecordingData(item)); + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Title = "Save graph data as csv file"; + dlg.Filter = "CSV Files|*.csv"; + dlg.DefaultExt = ".csv"; + dlg.FileName = item.TechName; + if (dlg.ShowDialog().Value) + { + _single_graphs_recordings.Add(new SingleTechRecordingData(item.TechName, dlg.FileName) { Tag = item }); + item.StartRecording(); + } }; item.RecordingStopped += () => { try { - var graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.TechItem == item); + item.StopRecording(); + + var graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.Tag == item); if (graph_recording != null) { _single_graphs_recordings.Remove(graph_recording); - - SaveFileDialog dlg = new SaveFileDialog(); - dlg.Title = "Save graph data as csv file"; - dlg.Filter = "CSV Files|*.csv"; - dlg.DefaultExt = ".csv"; - dlg.FileName = item.TechName; - if (dlg.ShowDialog().Value) - { - graph_recording.Save(dlg.FileName); - graph_recording.Dispose(); - } + graph_recording.Dispose(); } } catch (Exception ex) @@ -1282,29 +1368,30 @@ namespace Tango.MachineStudio.Technician.ViewModels item.RecordingStarted += () => { - _multi_graph_recordings.Add(new MultiTechRecordingData(item, item.TechMonitor.ChannelCount)); + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Title = "Save graph data as csv file"; + dlg.Filter = "CSV Files|*.csv"; + dlg.DefaultExt = ".csv"; + dlg.FileName = item.TechName; + if (dlg.ShowDialog().Value) + { + _multi_graph_recordings.Add(new MultiTechRecordingData(item.TechName, item.TechMonitor.ChannelCount, dlg.FileName) { Tag = item }); + item.StartRecording(); + } }; item.RecordingStopped += () => { try { - var graph_recording = _multi_graph_recordings.SingleOrDefault(x => x.TechItem == item); + item.StopRecording(); + + var graph_recording = _multi_graph_recordings.SingleOrDefault(x => x.Tag == item); if (graph_recording != null) { _multi_graph_recordings.Remove(graph_recording); - - SaveFileDialog dlg = new SaveFileDialog(); - dlg.Title = "Save graph data as csv file"; - dlg.Filter = "CSV Files|*.csv"; - dlg.DefaultExt = ".csv"; - dlg.FileName = item.TechName; - if (dlg.ShowDialog().Value) - { - graph_recording.Save(dlg.FileName); - graph_recording.Dispose(); - } + graph_recording.Dispose(); } } catch (Exception ex) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml index 9e675b2ff..ac207fc55 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml @@ -489,6 +489,9 @@ + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config index ea48e62ff..adee6f7b4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config @@ -8,6 +8,8 @@ + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config index 4147a78ec..0395c36bb 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config @@ -87,6 +87,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.3.1 From 8ae143fbebc5357db447eb6f72076adaaa94fa26 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 27 Sep 2018 15:03:41 +0300 Subject: Working on RML module. Fixed database diagrams. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 15400960 -> 15400960 bytes .../Modules/Tango.MachineStudio.RML/App.config | 46 +++++++ .../Tango.MachineStudio.RML/Images/rml-module.jpg | Bin 0 -> 62359 bytes .../Properties/AssemblyInfo.cs | 19 +++ .../Properties/Resources.Designer.cs | 62 +++++++++ .../Properties/Resources.resx | 117 +++++++++++++++++ .../Properties/Settings.Designer.cs | 30 +++++ .../Properties/Settings.settings | 7 + .../Modules/Tango.MachineStudio.RML/RMLModule.cs | 63 +++++++++ .../Tango.MachineStudio.RML.csproj | 143 +++++++++++++++++++++ .../Tango.MachineStudio.RML/ViewModelLocator.cs | 29 +++++ .../ViewModels/MainViewVM.cs | 98 ++++++++++++++ .../Tango.MachineStudio.RML/Views/MainView.xaml | 14 ++ .../Tango.MachineStudio.RML/Views/MainView.xaml.cs | 28 ++++ .../Tango.MachineStudio.RML/packages.config | 6 + .../Tango.MachineStudio.UI.csproj | 6 +- Software/Visual_Studio/Tango.sln | 43 +++++++ 18 files changed, 710 insertions(+), 1 deletion(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.config create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/rml-module.jpg create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.Designer.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.resx create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.Designer.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.settings create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/RMLModule.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModelLocator.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/packages.config (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 4f1e3baff..70f6e3cce 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 7339c127f..fd5b221a1 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.RML/App.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.config new file mode 100644 index 000000000..bd3d48f6d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.config @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/rml-module.jpg b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/rml-module.jpg new file mode 100644 index 000000000..7999c88fd Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/rml-module.jpg differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..062f0ace5 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +[assembly: AssemblyTitle("Tango - Machine Studio RML Module")] +[assembly: AssemblyVersion("2.0.11.1737")] + +[assembly: ComVisible(false)] + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.Designer.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.Designer.cs new file mode 100644 index 000000000..fb62b4ba4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.MachineStudio.RML.Properties { + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.MachineStudio.RML.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.resx b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.Designer.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.Designer.cs new file mode 100644 index 000000000..30784c8b0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.MachineStudio.RML.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.settings b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/RMLModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/RMLModule.cs new file mode 100644 index 000000000..fdd8cb124 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/RMLModule.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media.Imaging; +using Tango.BL.Enumerations; +using Tango.MachineStudio.RML.Views; +using Tango.MachineStudio.Common; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.ColorLab +{ + [StudioModule(7)] + public class RMLModule : StudioModuleBase + { + public override string Name + { + get + { + return "RML"; + } + } + + public override string Description + { + get + { + return "Create and manage twine's recommended media list (RML). Configure RML's default calibration data and process parameters"; + } + } + + public override BitmapSource Image + { + get + { + return ResourceHelper.GetImageFromResources("Images/rml-module.jpg"); + } + } + + public override Type MainViewType + { + get + { + return typeof(MainView); + } + } + + public override Permissions Permission + { + get + { + return Permissions.RunColorLabModule; + } + } + + public override void Dispose() + { + + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj new file mode 100644 index 000000000..d9e0d5cf1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj @@ -0,0 +1,143 @@ + + + + + Debug + AnyCPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B} + library + Tango.MachineStudio.RML + Tango.MachineStudio.RML + v4.7.2 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + true + full + false + ..\..\..\Build\Machine Studio\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\..\Build\Machine Studio\Release\ + TRACE + prompt + 4 + + + + ..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll + + + ..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll + + + ..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll + + + ..\..\..\packages\MaterialDesignColors.1.1.2\lib\net45\MaterialDesignColors.dll + + + + + + ..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll + + + + + + + + + 4.0 + + + + + + + + GlobalVersionInfo.cs + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + MainView.xaml + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + {f441feee-322a-4943-b566-110e12fd3b72} + Tango.BL + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + {58e8825f-0c96-449c-b320-1e82b0aa876b} + Tango.CSV + + + {ca87a608-7b17-4c98-88f2-42abee10f4c1} + Tango.Documents + + + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} + Tango.Logging + + + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} + Tango.Settings + + + {8491d07b-c1f6-4b62-a412-41b9fd2d6538} + Tango.SharedUI + + + {cb0b0aa2-bb24-4bca-a720-45e397684e12} + Tango.MachineStudio.Common + + + + + + + + Designer + MSBuild:Compile + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModelLocator.cs new file mode 100644 index 000000000..9c2bf2c6b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModelLocator.cs @@ -0,0 +1,29 @@ +using Tango.Core.DI; +using Tango.MachineStudio.RML.ViewModels; +using Tango.MachineStudio.RML.Views; + +namespace Tango.MachineStudio.RML +{ + /// + /// This class contains static references to all the view models in the + /// application and provides an entry point for the bindings. + /// + public static class ViewModelLocator + { + /// + /// Initializes a new instance of the ViewModelLocator class. + /// + static ViewModelLocator() + { + TangoIOC.Default.Register(); + } + + public static MainViewVM MainViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } + } +} \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..ff42d870c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Builders; +using Tango.BL.Entities; +using Tango.MachineStudio.Common; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.RML.ViewModels +{ + public class MainViewVM : StudioViewModel + { + private INotificationProvider _notification; + + private ObservablesContext _rmls_context; + private ObservablesContext _active_context; + + private ObservableCollection _rmls; + public ObservableCollection Rmls + { + get { return _rmls; } + set { _rmls = value; RaisePropertyChangedAuto(); } + } + + private Rml _selectedRML; + public Rml SelectedRML + { + get { return _selectedRML; } + set { _selectedRML = value; RaisePropertyChangedAuto(); OnSelectedRmlChanged(); } + } + + private Rml _activeRML; + public Rml ActiveRML + { + get { return _activeRML; } + set { _activeRML = value; RaisePropertyChangedAuto(); } + } + + public MainViewVM(INotificationProvider notificationProvider) + { + _notification = notificationProvider; + } + + public override void OnApplicationReady() + { + LoadRmls(); + } + + private void LoadRmls() + { + using (_rmls_context = ObservablesContext.CreateDefault()) + { + Rmls = _rmls.ToList().ToObservableCollection(); + } + } + + private void OnSelectedRmlChanged() + { + if (SelectedRML != null) + { + LoadActiveRML(SelectedRML.Guid); + } + else + { + UnloadActiveRML(); + } + } + + private void UnloadActiveRML() + { + ActiveRML = null; + } + + private async void LoadActiveRML(String guid) + { + using (_notification.PushTaskItem("Loading RML...")) + { + if (_active_context != null) + { + _active_context.Dispose(); + } + + _active_context = ObservablesContext.CreateDefault(); + + ActiveRML = await new RmlBuilder(_active_context) + .Set(guid) + .WithAllParametersGroup() + .WithCCT() + .WithLiquidFactors() + .BuildAsync(); + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml new file mode 100644 index 000000000..bdd36af7a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml @@ -0,0 +1,14 @@ + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml.cs new file mode 100644 index 000000000..0fdcd11b8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.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.RML.Views +{ + /// + /// Interaction logic for MainView.xaml + /// + public partial class MainView : UserControl + { + public MainView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/packages.config new file mode 100644 index 000000000..efdb0fb1c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index 5a646e9c0..fce0e717f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -433,6 +433,10 @@ {d0ce8122-077d-42a2-9490-028ae4769b52} Tango.MachineStudio.MachineDesigner + + {d0186ac0-0fcf-4d3b-9619-54812b6e524b} + Tango.MachineStudio.RML + {22c2aa72-9493-4d0d-b421-8ef9789fb192} Tango.MachineStudio.Stubs @@ -579,7 +583,7 @@ copy /Y "$(SolutionDir)Referenced Assemblies\Microsoft.WITDataStore32.dll" "$(Ta - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln index 2879565a9..4cfc8f5ae 100644 --- a/Software/Visual_Studio/Tango.sln +++ b/Software/Visual_Studio/Tango.sln @@ -224,6 +224,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.EmbroideryUI", "Tango EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.WiFi", "Tango.WiFi\Tango.WiFi.csproj", "{6AA425C9-EA6A-4B01-AAED-5FF122E8B663}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.MachineStudio.RML", "MachineStudio\Modules\Tango.MachineStudio.RML\Tango.MachineStudio.RML.csproj", "{D0186AC0-0FCF-4D3B-9619-54812B6E524B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution AppVeyor|Any CPU = AppVeyor|Any CPU @@ -3947,6 +3949,46 @@ Global {6AA425C9-EA6A-4B01-AAED-5FF122E8B663}.Release|x64.Build.0 = Release|Any CPU {6AA425C9-EA6A-4B01-AAED-5FF122E8B663}.Release|x86.ActiveCfg = Release|Any CPU {6AA425C9-EA6A-4B01-AAED-5FF122E8B663}.Release|x86.Build.0 = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.AppVeyor|Any CPU.ActiveCfg = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.AppVeyor|Any CPU.Build.0 = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.AppVeyor|ARM.ActiveCfg = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.AppVeyor|ARM.Build.0 = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.AppVeyor|ARM64.ActiveCfg = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.AppVeyor|ARM64.Build.0 = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.AppVeyor|x64.ActiveCfg = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.AppVeyor|x64.Build.0 = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.AppVeyor|x86.ActiveCfg = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.AppVeyor|x86.Build.0 = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Debug|ARM.ActiveCfg = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Debug|ARM.Build.0 = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Debug|ARM64.Build.0 = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Debug|x64.ActiveCfg = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Debug|x64.Build.0 = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Debug|x86.ActiveCfg = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Debug|x86.Build.0 = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.DefaultBuild|Any CPU.ActiveCfg = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.DefaultBuild|Any CPU.Build.0 = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.DefaultBuild|ARM.ActiveCfg = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.DefaultBuild|ARM.Build.0 = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.DefaultBuild|ARM64.ActiveCfg = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.DefaultBuild|ARM64.Build.0 = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.DefaultBuild|x64.ActiveCfg = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.DefaultBuild|x64.Build.0 = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.DefaultBuild|x86.ActiveCfg = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.DefaultBuild|x86.Build.0 = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Release|Any CPU.Build.0 = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Release|ARM.ActiveCfg = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Release|ARM.Build.0 = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Release|ARM64.ActiveCfg = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Release|ARM64.Build.0 = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Release|x64.ActiveCfg = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Release|x64.Build.0 = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Release|x86.ActiveCfg = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -4014,6 +4056,7 @@ Global {01C3EF89-6A17-4D70-A71F-0395A212F2F8} = {C81ED1A3-D18C-4D80-A8F5-061994A14A60} {D0E71A4D-9EEA-4F07-983F-EEB4416C587F} = {C81ED1A3-D18C-4D80-A8F5-061994A14A60} {0BDA9B52-9879-4C5E-84E3-81D00B75DACC} = {5F6BBAA8-EAD0-4B18-97E5-55B4F56DD760} + {D0186AC0-0FCF-4D3B-9619-54812B6E524B} = {B2AF4F3F-2828-47C3-8F3E-A0EA0BD66FF8} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {7986F7F4-A86A-4994-B1B6-0988D7F057B6} -- cgit v1.3.1