From 8a0b8f6abe3d143b43131a330e0ee39c2547ce8f Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Sun, 4 Jul 2021 15:25:08 +0300 Subject: After Virus --- .../Contracts/IMainView.cs | 8 +- .../Converters/BoolToDisplayStatusConverter.cs | 32 ++ .../Converters/ColorNameToBrushConverter.cs | 9 + .../Converters/ColorWithPercentToBrushConverter.cs | 57 ++ .../Models/FactorTarget.cs | 13 +- .../Models/MachineModel.cs | 44 ++ .../Models/PlotProperties.cs | 17 +- .../Models/RmlExtensionModel.cs | 33 ++ .../Tango.MachineStudio.ThreadExtensions.csproj | 35 +- .../ViewModels/ColorParametersVewVM.cs | 539 +++++++++--------- .../ViewModels/MainViewVM.cs | 555 ++++++++++-------- .../ViewModels/TestResultViewVM.cs | 201 +++++++ .../ViewModels/TestResultsViewVM.cs | 368 ++++++++++++ .../Views/ColorParametersView.xaml | 76 ++- .../Views/MachineTestResultsView.xaml | 82 +++ .../Views/MachineTestResultsView.xaml.cs | 28 + .../Views/MainView.xaml | 4 +- .../Views/MainView.xaml.cs | 2 +- .../Views/RMLExtensionView.xaml | 82 +++ .../Views/RMLExtensionView.xaml.cs | 27 + .../Views/RMLExtensionsView.xaml | 108 ++++ .../Views/RMLExtensionsView.xaml.cs | 27 + .../Views/TestResultsView.xaml | 622 +++++++++++++++++++++ .../Views/TestResultsView.xaml.cs | 56 ++ .../Views/ThreadCharacteristicsView.xaml | 377 +++++++------ .../Views/ThreadExtensionView.xaml | 61 -- .../Views/ThreadExtensionView.xaml.cs | 27 - .../Views/ThreadExtensionsView.xaml | 103 ---- .../Views/ThreadExtensionsView.xaml.cs | 27 - .../packages.config | 1 + 30 files changed, 2659 insertions(+), 962 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Converters/BoolToDisplayStatusConverter.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Converters/ColorWithPercentToBrushConverter.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/MachineModel.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/RmlExtensionModel.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/TestResultViewVM.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/TestResultsViewVM.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MachineTestResultsView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MachineTestResultsView.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionView.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/TestResultsView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/TestResultsView.xaml.cs delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionView.xaml delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionView.xaml.cs delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionsView.xaml delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionsView.xaml.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Contracts/IMainView.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Contracts/IMainView.cs index 0f432eefb..cd1bfcd75 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Contracts/IMainView.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Contracts/IMainView.cs @@ -7,14 +7,14 @@ using Tango.SharedUI; namespace Tango.MachineStudio.ThreadExtensions.Contracts { - public enum ThreadExtensionNavigationView + public enum RMLExtensionNavigationView { - ThreadExtentionView, - ThreadExtensionsView, + RMLExtentionView, + RMLExtensionsView, } public interface IMainView : IView { - void NavigateTo(ThreadExtensionNavigationView view); + void NavigateTo(RMLExtensionNavigationView view); } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Converters/BoolToDisplayStatusConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Converters/BoolToDisplayStatusConverter.cs new file mode 100644 index 000000000..b06bb0309 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Converters/BoolToDisplayStatusConverter.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows.Media; + +namespace Tango.MachineStudio.ThreadExtensions.Converters +{ + public class BoolToDisplayStatusConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if( value is bool) + { + if((bool)value) + { + return "Done"; + } + } + return "In progress"; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Converters/ColorNameToBrushConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Converters/ColorNameToBrushConverter.cs index c9e246bb8..5d97626fe 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Converters/ColorNameToBrushConverter.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Converters/ColorNameToBrushConverter.cs @@ -18,7 +18,16 @@ namespace Tango.MachineStudio.ThreadExtensions.Converters { string colorName = value as string; if(String.IsNullOrEmpty(colorName)) + { + if(value.GetType().IsEnum ) + { + colorName = value.ToString(); + } + } + if (String.IsNullOrEmpty(colorName)) + { return new SolidColorBrush(Colors.Transparent); + } Color color = (Color)TypeDescriptor.GetConverter(typeof(Color)).ConvertFromString(colorName); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Converters/ColorWithPercentToBrushConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Converters/ColorWithPercentToBrushConverter.cs new file mode 100644 index 000000000..eb45b3959 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Converters/ColorWithPercentToBrushConverter.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows.Media; + + +namespace Tango.MachineStudio.ThreadExtensions.Converters +{ + public class ColorWithPercentToBrushConverter : IMultiValueConverter + { + + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + if (values.Length == 2) + { + if (values[0].GetType().IsEnum) + { + string colorName = values[0].ToString(); + if (String.IsNullOrEmpty(colorName)) + { + return new SolidColorBrush(Colors.Transparent); + } + int persent = System.Convert.ToInt32(values[1]); + double opacity = persent == 100 ? 0.3 : 0.7; + + Color color = (Color)TypeDescriptor.GetConverter(typeof(Color)).ConvertFromString(colorName); + SolidColorBrush brush = new SolidColorBrush(color); + brush.Opacity = opacity; + return brush; + } + else + { + return new SolidColorBrush(Colors.Transparent); + } + } + else + { + return new SolidColorBrush(Colors.Transparent); + } + } + + //public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + //{ + // throw new NotImplementedException(); + //} + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/FactorTarget.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/FactorTarget.cs index 32f568f5f..0cb2679fd 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/FactorTarget.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/FactorTarget.cs @@ -3,18 +3,19 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Enumerations; namespace Tango.MachineStudio.ThreadExtensions.Models { public static class FactorTarget { - public static Dictionary FACTOR100 = new Dictionary() { - { "CYAN", 51.95}, {"MAGENTA", 47.47}, { "YELLOW", 94.05}, {"BLACK", 26.58}}; + public static Dictionary FACTOR100 = new Dictionary() { + { FactorColors.CYAN, 51.95}, {FactorColors.MAGENTA, 47.47}, { FactorColors.YELLOW, 94.05}, {FactorColors.BLACK, 26.58}}; - public static Dictionary FACTOR200 = new Dictionary() { - { "CYAN", 46.3}, {"MAGENTA", 41.04}, { "YELLOW", 97.78}, {"BLACK", 21.01}}; + public static Dictionary FACTOR200 = new Dictionary() { + { FactorColors.CYAN, 46.3}, {FactorColors.MAGENTA, 41.04}, { FactorColors.YELLOW, 97.78}, {FactorColors.BLACK, 21.01}}; - public static double GetFactor100(string color) + public static double GetFactor100(FactorColors color) { double result; @@ -24,7 +25,7 @@ namespace Tango.MachineStudio.ThreadExtensions.Models } return 0.0; } - public static double GetFactor200(string color) + public static double GetFactor200(FactorColors color) { double result; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/MachineModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/MachineModel.cs new file mode 100644 index 000000000..e41a6a220 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/MachineModel.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; + +namespace Tango.MachineStudio.ThreadExtensions.Models +{ + public class MachineModel : ExtendedObject + { + public String Guid { get; set; } + + public string Name { get; set; } + + protected String _serialnumber; + + public String SerialNumber + { + get{ return _serialnumber; } + set + { + _serialnumber = value; + RaisePropertyChangedAuto(); + } + } + + private bool _hasRMLTest; + + public bool HasRMLTest + { + get { return _hasRMLTest; } + set { _hasRMLTest = value; + RaisePropertyChangedAuto(); + } + } + + public MachineModel() + { + HasRMLTest = false; + } + + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/PlotProperties.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/PlotProperties.cs index 47632d3aa..ee882ad4b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/PlotProperties.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/PlotProperties.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using Tango.BL.Entities; +using Tango.BL.Enumerations; using Tango.Core; using Tango.MachineStudio.ThreadExtensions.ViewModels; @@ -15,12 +16,12 @@ namespace Tango.MachineStudio.ThreadExtensions.Models public Plot PlotControl { get; set; } private IList _points; - private string _colorName; + private FactorColors _color; - public string ColorName + public FactorColors Color { - get { return _colorName; } - set { _colorName = value; } + get { return _color; } + set { _color = value; } } /// @@ -94,12 +95,12 @@ namespace Tango.MachineStudio.ThreadExtensions.Models } } - public PlotProperties(string colorName) + public PlotProperties(FactorColors color) { this.Points = new List(); Target100Points = new List(); Target200Points = new List(); - ColorName = colorName; + Color = color; } @@ -121,8 +122,8 @@ namespace Tango.MachineStudio.ThreadExtensions.Models ClearResults(); PlotControl.InvalidatePlot(true); - double target100Y = FactorTarget.GetFactor100(ColorName); - double target200Y = FactorTarget.GetFactor200(ColorName); + double target100Y = FactorTarget.GetFactor100(Color); + double target200Y = FactorTarget.GetFactor200(Color); _to = target100Y > target200Y? target100Y + 10: target200Y + 10; _from = target100Y < target200Y ? target100Y - 10 : target200Y - 10; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/RmlExtensionModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/RmlExtensionModel.cs new file mode 100644 index 000000000..9b5d9d8ce --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/RmlExtensionModel.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Enumerations; +using Tango.Core; + +namespace Tango.MachineStudio.ThreadExtensions.Models +{ + public class RmlExtensionModel : ExtendedObject + { + public String Guid { get; set; } + + public String RMLGuid { get; set; } + + public string Name { get; set; } + + public String Manufacturer { get; set; } + + public String Brand { get; set; } + + public int LinearDensity { get; set; } + + public String CreatedBy { get; set;} + + public DateTime Created { get; set; } + + public DateTime LastUpdated { get; set; } + + public RMLExtensionStatus Status{ get; set; } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj index 6b7204aac..1c9ac345b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj @@ -38,6 +38,9 @@ ..\..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll + + ..\..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll + ..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll @@ -85,28 +88,40 @@ GlobalVersionInfo.cs + + + + + + ColorParametersView.xaml + + MachineTestResultsView.xaml + MainView.xaml + + TestResultsView.xaml + ThreadCharacteristicsView.xaml - - ThreadExtensionView.xaml + + RMLExtensionView.xaml - - ThreadExtensionsView.xaml + + RMLExtensionsView.xaml MSBuild:Compile @@ -116,19 +131,27 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile - + Designer MSBuild:Compile - + MSBuild:Compile Designer diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorParametersVewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorParametersVewVM.cs index b2e677339..ae90263d2 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorParametersVewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorParametersVewVM.cs @@ -21,6 +21,11 @@ using Tango.MachineStudio.ThreadExtensions.Models; using Tango.Core.Commands; using Microsoft.Win32; using System.Diagnostics; +using Tango.Settings; +using Tango.MachineStudio.Common; +using Tango.Logging; +using Tango.BL.Enumerations; +using System.Data.Entity; namespace Tango.MachineStudio.ThreadExtensions.ViewModels { @@ -28,10 +33,10 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels { private INotificationProvider _notification; private IActionLogManager _actionLogManager; - + private ObservablesContext _active_context; - private ObservablesContext _machineDbContext; - // private ColorProcessParameterDTO _hwBeforeSave; + + public event EventHandler SaveColorParameters; #region Properties @@ -48,7 +53,7 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels RaisePropertyChangedAuto(); } } - + private ObservableCollection _magentaProcessData; public ObservableCollection MagentaProcessData { @@ -76,7 +81,7 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels RaisePropertyChangedAuto(); } } - + private ObservableCollection _yellowProcessData; public ObservableCollection YellowProcessData { @@ -167,7 +172,8 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels public PlotProperties CyanPlot { get { return _cyanPlot; } - set { + set + { _cyanPlot = value; RaisePropertyChangedAuto(); } @@ -196,23 +202,32 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels get { return _blackPlot; } set { _blackPlot = value; } } - /// - /// Gets or sets the machines providers. - /// - public ISuggestionProvider MachinesProvider { get; set; } - protected Machine _selectedMachine; + private string _RMLExtentionGUID; + + public string RMLExtemtionGUID + { + get { return _RMLExtentionGUID; } + set + { + _RMLExtentionGUID = value; + OnRMLExtensionGUIDChanged(); + } + } + + protected string _selectedMachineGuid; /// /// Gets or sets the selected machine. /// - public Machine SelectedMachine + public String SelectedMachineGUID { - get { return _selectedMachine; } + get { return _selectedMachineGuid; } set { - if (value != null && _selectedMachine != value) + if (value != null && _selectedMachineGuid != value) { - _selectedMachine = value; + _selectedMachineGuid = value; + SelectedMachineChanged(); RaisePropertyChangedAuto(); InvalidateRelayCommands(); } @@ -229,25 +244,27 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels public bool IsViewLoaded { get { return _isViewLoaded; } - set { - if(_isViewLoaded != value) + set + { + if (_isViewLoaded != value) { _isViewLoaded = value; } } } - - private Dictionary _removedColorProcessDataBeforeSave; - - public Dictionary RemovedColorProcessDataBeforeSave - { - get { return _removedColorProcessDataBeforeSave; } - set { _removedColorProcessDataBeforeSave = value; } - } + + /// + /// Saved guid of the removed color process data before save. + /// + private List RemovedColorProcessDataBeforeSave { get; set;} #endregion #region commands + public RelayCommand SaveCommand { get; set; } + + public RelayCommand FlytoRMLLiquidFactorsCommand { get; set; } + public RelayCommand ImportCyanDataCommand { get; set; } public RelayCommand ImportMagentaDataCommand { get; set; } public RelayCommand ImportYellowDataCommand { get; set; } @@ -259,9 +276,10 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels if (LoadColorDataFromExcel(out items) && items != null) { MagentaProcessData.Clear(); - items.ForEach(x => MagentaProcessData.Add(new ColorProcessData() { InkNlCm = x.NlCm, L = x.L, A = x.A, B = x.B, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid})); + RemoveColorDataByColor((int)FactorColors.MAGENTA, SelectedColorProcessParameter.Guid); + items.ForEach(x => MagentaProcessData.Add(new ColorProcessData() { InkNlCm = x.NlCm, L = x.L, A = x.A, B = x.B, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid })); MagentaPlot.CreateGraph(MagentaProcessData.ToList(), true); - UpdateFactorsOnChangeProcessData("MAGENTA"); + UpdateFactorsOnChangeProcessData(FactorColors.MAGENTA); } } @@ -271,9 +289,10 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels if (LoadColorDataFromExcel(out items) && items != null) { YellowProcessData.Clear(); - items.ForEach(x => YellowProcessData.Add(new ColorProcessData() { InkNlCm = x.NlCm, L = x.L, A = x.A, B = x.B, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid})); + RemoveColorDataByColor((int)FactorColors.YELLOW, SelectedColorProcessParameter.Guid); + items.ForEach(x => YellowProcessData.Add(new ColorProcessData() { InkNlCm = x.NlCm, L = x.L, A = x.A, B = x.B, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid })); YellowPlot.CreateGraph(YellowProcessData.ToList(), false); - UpdateFactorsOnChangeProcessData("YELLOW"); + UpdateFactorsOnChangeProcessData(FactorColors.YELLOW); } } @@ -283,21 +302,28 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels if (LoadColorDataFromExcel(out items) && items != null) { CyanProcessData.Clear(); + RemoveColorDataByColor((int)FactorColors.CYAN, SelectedColorProcessParameter.Guid); items.ForEach(x => CyanProcessData.Add(new ColorProcessData() { InkNlCm = x.NlCm, L = x.L, A = x.A, B = x.B, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid })); CyanPlot.CreateGraph(CyanProcessData.ToList(), true); - UpdateFactorsOnChangeProcessData("CYAN"); + UpdateFactorsOnChangeProcessData(FactorColors.CYAN); } } + private void FlytoRMLLiquidFactors(FactorColors obj) + { + throw new NotImplementedException(); + } + private void ImportBlackData(object obj) { List items; if (LoadColorDataFromExcel(out items) && items != null) { BlackProcessData.Clear(); + RemoveColorDataByColor((int)FactorColors.BLACK, SelectedColorProcessParameter.Guid); items.ForEach(x => BlackProcessData.Add(new ColorProcessData() { InkNlCm = x.NlCm, L = x.L, A = x.A, B = x.B, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid })); BlackPlot.CreateGraph(BlackProcessData.ToList(), true); - UpdateFactorsOnChangeProcessData("BLACK"); + UpdateFactorsOnChangeProcessData(FactorColors.BLACK); } } @@ -336,19 +362,8 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels _notification = notification; _actionLogManager = actionLogManager; _isViewLoaded = false; - RemovedColorProcessDataBeforeSave = new Dictionary(); + RemovedColorProcessDataBeforeSave = new List(); - MachinesProvider = new SuggestionProvider((filter) => - { - try - { - return _machineDbContext.Machines.Where(x => x.SerialNumber.StartsWith(filter)).ToList(); - } - catch - { - return null; - } - }); CyanProcessData = new ObservableCollection(); CyanProcessData.CollectionChanged += OnCyanCollectionChanged; @@ -362,115 +377,125 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels BlackProcessData = new ObservableCollection(); BlackProcessData.CollectionChanged += OnBlackCollectionChanged; - CyanPlot = new PlotProperties("CYAN"); - YellowPlot = new PlotProperties("YELLOW"); - MagentaPlot = new PlotProperties("MAGENTA"); - BlackPlot = new PlotProperties("BLACK"); - + CyanPlot = new PlotProperties(FactorColors.CYAN); + YellowPlot = new PlotProperties(FactorColors.YELLOW); + MagentaPlot = new PlotProperties(FactorColors.MAGENTA); + BlackPlot = new PlotProperties(FactorColors.BLACK); + + SaveCommand = new RelayCommand(Save, () => IsFree); ImportCyanDataCommand = new RelayCommand(ImportCyanData); ImportMagentaDataCommand = new RelayCommand(ImportMagentaData); ImportYellowDataCommand = new RelayCommand(ImportYellowData); ImportBlackDataCommand = new RelayCommand(ImportBlackData); + + FlytoRMLLiquidFactorsCommand = new RelayCommand(FlytoRMLLiquidFactors, () => IsFree); } + #region Loading - public async void LoadColorParameters(string RMLExtemtionGUID) + public async void LoadColorParameters() { + if (SelectedMachineGUID == null) + { + _notification.ShowWarning(LogManager.Log($"Please, select machine.", LogCategory.Warning)); + IsFree = false; + return; + } IsFree = false; if (_active_context != null) { _active_context.Dispose(); } - if (_machineDbContext != null) - { - _machineDbContext.Dispose(); - } - - LogManager.Log("Initializing machine Db context..."); - - _machineDbContext = ObservablesContext.CreateDefault(); - - _active_context = ObservablesContext.CreateDefault(); await Task.Factory.StartNew(() => { using (_notification.PushTaskItem("Loading Color Process Parameters ...")) { - - var currentcolorProcessParameter = _active_context.ColorProcessParameters.Where(x => x.RmlsExtensionsGuid == RMLExtemtionGUID).FirstOrDefault(); - if(currentcolorProcessParameter != null) + + var currentcolorProcessParameter = _active_context.ColorProcessParameters.Where(x => x.RmlsExtensionsGuid == RMLExtemtionGUID && x.MachineGuid == SelectedMachineGUID).FirstOrDefault(); + if (currentcolorProcessParameter != null) { - SelectedColorProcessParameter = new ColorProcessParametersBuilder(_active_context).Set(currentcolorProcessParameter.Guid).WithColorProcessData().WithColorProcessFactor(). Build(); + SelectedColorProcessParameter = new ColorProcessParametersBuilder(_active_context).Set(currentcolorProcessParameter.Guid).WithColorProcessData().WithColorProcessFactor().Build(); } - + if (SelectedColorProcessParameter == null) { - SelectedColorProcessParameter = new ColorProcessParameter() { RmlsExtensionsGuid = RMLExtemtionGUID }; + SelectedColorProcessParameter = new ColorProcessParameter() { RmlsExtensionsGuid = RMLExtemtionGUID, MachineGuid = SelectedMachineGUID }; SelectedColorProcessParameter.WhitePointL = 0.0; SelectedColorProcessParameter.WhitePointA = 0.0; SelectedColorProcessParameter.WhitePointB = 0.0; - SelectedColorProcessParameter.ColorProcessFactor.Add(new ColorProcessFactor() { ColorName = "CYAN", FactorPercent = 100, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); - SelectedColorProcessParameter.ColorProcessFactor.Add(new ColorProcessFactor() { ColorName = "MAGENTA", FactorPercent = 100, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); - SelectedColorProcessParameter.ColorProcessFactor.Add(new ColorProcessFactor() { ColorName = "YELLOW", FactorPercent = 100, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); - SelectedColorProcessParameter.ColorProcessFactor.Add(new ColorProcessFactor() { ColorName = "BLACK", FactorPercent = 100, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); - SelectedColorProcessParameter.ColorProcessFactor.Add(new ColorProcessFactor() { ColorName = "CYAN", FactorPercent = 200, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); - SelectedColorProcessParameter.ColorProcessFactor.Add(new ColorProcessFactor() { ColorName = "MAGENTA", FactorPercent = 200, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); - SelectedColorProcessParameter.ColorProcessFactor.Add(new ColorProcessFactor() { ColorName = "YELLOW", FactorPercent = 200, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); - SelectedColorProcessParameter.ColorProcessFactor.Add(new ColorProcessFactor() { ColorName = "BLACK", FactorPercent = 200, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); - SelectedColorProcessParameter.ColorProcessFactor.Add(new ColorProcessFactor() { ColorName = "CYAN", FactorPercent = 1, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); - SelectedColorProcessParameter.ColorProcessFactor.Add(new ColorProcessFactor() { ColorName = "MAGENTA", FactorPercent = 1, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); - SelectedColorProcessParameter.ColorProcessFactor.Add(new ColorProcessFactor() { ColorName = "YELLOW", FactorPercent = 1, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); - SelectedColorProcessParameter.ColorProcessFactor.Add(new ColorProcessFactor() { ColorName = "BLACK", FactorPercent = 1, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); - SelectedColorProcessParameter.ColorProcessFactor.Add(new ColorProcessFactor() { ColorName = "CYAN", FactorPercent = 1111, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); - SelectedColorProcessParameter.ColorProcessFactor.Add(new ColorProcessFactor() { ColorName = "MAGENTA", FactorPercent = 1111, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); - SelectedColorProcessParameter.ColorProcessFactor.Add(new ColorProcessFactor() { ColorName = "YELLOW", FactorPercent = 1111, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); - SelectedColorProcessParameter.ColorProcessFactor.Add(new ColorProcessFactor() { ColorName = "BLACK", FactorPercent = 1111, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); + SelectedColorProcessParameter.ColorProcessFactors.Add(new ColorProcessFactor() { FactorColor = FactorColors.CYAN, FactorPercent = 100, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); + SelectedColorProcessParameter.ColorProcessFactors.Add(new ColorProcessFactor() { FactorColor = FactorColors.MAGENTA, FactorPercent = 100, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); + SelectedColorProcessParameter.ColorProcessFactors.Add(new ColorProcessFactor() { FactorColor = FactorColors.YELLOW, FactorPercent = 100, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); + SelectedColorProcessParameter.ColorProcessFactors.Add(new ColorProcessFactor() { FactorColor = FactorColors.BLACK, FactorPercent = 100, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); + SelectedColorProcessParameter.ColorProcessFactors.Add(new ColorProcessFactor() { FactorColor = FactorColors.CYAN, FactorPercent = 200, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); + SelectedColorProcessParameter.ColorProcessFactors.Add(new ColorProcessFactor() { FactorColor = FactorColors.MAGENTA, FactorPercent = 200, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); + SelectedColorProcessParameter.ColorProcessFactors.Add(new ColorProcessFactor() { FactorColor = FactorColors.YELLOW, FactorPercent = 200, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); + SelectedColorProcessParameter.ColorProcessFactors.Add(new ColorProcessFactor() { FactorColor = FactorColors.BLACK, FactorPercent = 200, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); + SelectedColorProcessParameter.ColorProcessFactors.Add(new ColorProcessFactor() { FactorColor = FactorColors.CYAN, FactorPercent = 1, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); + SelectedColorProcessParameter.ColorProcessFactors.Add(new ColorProcessFactor() { FactorColor = FactorColors.MAGENTA, FactorPercent = 1, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); + SelectedColorProcessParameter.ColorProcessFactors.Add(new ColorProcessFactor() { FactorColor = FactorColors.YELLOW, FactorPercent = 1, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); + SelectedColorProcessParameter.ColorProcessFactors.Add(new ColorProcessFactor() { FactorColor = FactorColors.BLACK, FactorPercent = 1, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); + SelectedColorProcessParameter.ColorProcessFactors.Add(new ColorProcessFactor() { FactorColor = FactorColors.CYAN, FactorPercent = 1111, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); + SelectedColorProcessParameter.ColorProcessFactors.Add(new ColorProcessFactor() { FactorColor = FactorColors.MAGENTA, FactorPercent = 1111, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); + SelectedColorProcessParameter.ColorProcessFactors.Add(new ColorProcessFactor() { FactorColor = FactorColors.YELLOW, FactorPercent = 1111, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); + SelectedColorProcessParameter.ColorProcessFactors.Add(new ColorProcessFactor() { FactorColor = FactorColors.BLACK, FactorPercent = 1111, ColorProcessParametersGuid = SelectedColorProcessParameter.Guid }); _active_context.ColorProcessParameters.Add(SelectedColorProcessParameter); _active_context.SaveChangesAsync(); } - + } }); - + LoadParameters(); IsFree = true; } private void LoadParameters() { - Factor100ProcessData = SelectedColorProcessParameter.ColorProcessFactor.Where(x => x.FactorPercent == 100).ToObservableCollection(); + Factor100ProcessData = SelectedColorProcessParameter.ColorProcessFactors.Where(x => x.FactorPercent == 100).ToObservableCollection(); - Factor200ProcessData = SelectedColorProcessParameter.ColorProcessFactor.Where(x => x.FactorPercent == 200).ToObservableCollection(); + Factor200ProcessData = SelectedColorProcessParameter.ColorProcessFactors.Where(x => x.FactorPercent == 200).ToObservableCollection(); - MinInkUptake = SelectedColorProcessParameter.ColorProcessFactor.Where(x => x.FactorPercent == 1).ToObservableCollection(); + MinInkUptake = SelectedColorProcessParameter.ColorProcessFactors.Where(x => x.FactorPercent == 1).ToObservableCollection(); - MaxInkUptake = SelectedColorProcessParameter.ColorProcessFactor.Where(x => x.FactorPercent == 1111).ToObservableCollection(); + MaxInkUptake = SelectedColorProcessParameter.ColorProcessFactors.Where(x => x.FactorPercent == 1111).ToObservableCollection(); RemovedColorProcessDataBeforeSave.Clear(); - var cyanDataList = SelectedColorProcessParameter.ColorProcessData.Where(x => x.ColorName == "CYAN").ToList().OrderBy(x => x.InkNlCm ).ToList(); + var cyanDataList = SelectedColorProcessParameter.ColorProcessData.Where(x => x.FactorColor == FactorColors.CYAN).ToList().OrderBy(x => x.InkNlCm).ToList(); CyanProcessData.Clear(); - cyanDataList.ForEach( y => CyanProcessData.Add(y)); + cyanDataList.ForEach(y => CyanProcessData.Add(y)); - var magentaDatalist = SelectedColorProcessParameter.ColorProcessData.Where(x => x.ColorName == "MAGENTA").ToList().OrderBy(x => x.InkNlCm).ToList(); ; + var magentaDatalist = SelectedColorProcessParameter.ColorProcessData.Where(x => x.FactorColor == FactorColors.MAGENTA).ToList().OrderBy(x => x.InkNlCm).ToList(); ; MagentaProcessData.Clear(); magentaDatalist.ForEach(y => MagentaProcessData.Add(y)); - var yellowDatalist = SelectedColorProcessParameter.ColorProcessData.Where(x => x.ColorName == "YELLOW").ToList().OrderBy(x => x.InkNlCm).ToList(); ; + var yellowDatalist = SelectedColorProcessParameter.ColorProcessData.Where(x => x.FactorColor == FactorColors.YELLOW).ToList().OrderBy(x => x.InkNlCm).ToList(); ; YellowProcessData.Clear(); yellowDatalist.ForEach(y => YellowProcessData.Add(y)); - var blackDatalist = SelectedColorProcessParameter.ColorProcessData.Where(x => x.ColorName == "BLACK").ToList().OrderBy(x => x.InkNlCm).ToList(); ; + var blackDatalist = SelectedColorProcessParameter.ColorProcessData.Where(x => x.FactorColor == FactorColors.BLACK).ToList().OrderBy(x => x.InkNlCm).ToList(); ; BlackProcessData.Clear(); blackDatalist.ForEach(y => BlackProcessData.Add(y)); - + UpdatePlots(); - SelectedColorProcessParameter.ColorProcessFactor.ToList().ForEach(x => UpdateFactorsOnChangeProcessData(x.ColorName)); + SelectedColorProcessParameter.ColorProcessFactors.ToList().ForEach(x => UpdateFactorsOnChangeProcessData(x.FactorColor)); } + private void OnRMLExtensionGUIDChanged() + { + SelectedColorProcessParameter = null; + } + + private void SelectedMachineChanged() + { + SelectedColorProcessParameter = null; + LoadColorParameters(); + } #endregion #region Update Plot @@ -488,83 +513,21 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels private void OnCyanCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { - if (e.Action == NotifyCollectionChangedAction.Reset) - { - var cyanProcessData = SelectedColorProcessParameter.ColorProcessData.Where(x => x.ColorName == "CYAN").ToObservableCollection(); - foreach (ColorProcessData item in cyanProcessData) - { - SelectedColorProcessParameter.ColorProcessData.Remove(item); - RemovedColorProcessDataBeforeSave[item.Guid] = item; - item.PropertyChanged -= CyanMeasurementModelPropertyChanged; - } - // UpdateFactorsOnChangeProcessData("Cyan"); - } - else if (e.Action == NotifyCollectionChangedAction.Remove) - { - foreach (ColorProcessData item in e.OldItems) - { - SelectedColorProcessParameter.ColorProcessData.Remove(item); - RemovedColorProcessDataBeforeSave[item.Guid] = item; - item.PropertyChanged -= CyanMeasurementModelPropertyChanged; - } - UpdateFactorsOnChangeProcessData("CYAN"); - } - else if (e.Action == NotifyCollectionChangedAction.Add) - { - foreach (ColorProcessData item in e.NewItems) - { - item.ColorName = "CYAN"; - item.ColorProcessParametersGuid = SelectedColorProcessParameter.Guid; - SelectedColorProcessParameter.ColorProcessData.Add(item); - RemovedColorProcessDataBeforeSave.Remove(item.Guid); - item.PropertyChanged += CyanMeasurementModelPropertyChanged; - } - } + OnColorCollectionChange(e, FactorColors.CYAN, CyanMeasurementModelPropertyChanged); } private void CyanMeasurementModelPropertyChanged(object sender, PropertyChangedEventArgs e) { - if(IsFree) + if (IsFree) { CyanPlot.CreateGraph(CyanProcessData.ToList(), true); - UpdateFactorsOnChangeProcessData("CYAN"); + UpdateFactorsOnChangeProcessData(FactorColors.CYAN); } } - + private void OnMagentaCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { - if (e.Action == NotifyCollectionChangedAction.Reset) - { - var magentaProcessData = SelectedColorProcessParameter.ColorProcessData.Where(x => x.ColorName == "MAGENTA").ToObservableCollection(); - foreach (ColorProcessData item in magentaProcessData) - { - item.PropertyChanged -= MagentaMeasurementModelPropertyChanged; - SelectedColorProcessParameter.ColorProcessData.Remove(item); - RemovedColorProcessDataBeforeSave[item.Guid] = item; - } - // UpdateFactorsOnChangeProcessData("Magenta"); - } - else if (e.Action == NotifyCollectionChangedAction.Remove) - { - foreach (ColorProcessData item in e.OldItems) - { - SelectedColorProcessParameter.ColorProcessData.Remove(item); - RemovedColorProcessDataBeforeSave[item.Guid] = item; - item.PropertyChanged -= MagentaMeasurementModelPropertyChanged; - } - UpdateFactorsOnChangeProcessData("MAGENTA"); - } - else if (e.Action == NotifyCollectionChangedAction.Add) - { - foreach (ColorProcessData item in e.NewItems) - { - item.ColorName = "MAGENTA"; - item.ColorProcessParametersGuid = SelectedColorProcessParameter.Guid; - SelectedColorProcessParameter.ColorProcessData.Add(item); - RemovedColorProcessDataBeforeSave.Remove(item.Guid); - item.PropertyChanged += MagentaMeasurementModelPropertyChanged; - } - } + OnColorCollectionChange(e, FactorColors.MAGENTA, MagentaMeasurementModelPropertyChanged); } private void MagentaMeasurementModelPropertyChanged(object sender, PropertyChangedEventArgs e) @@ -572,44 +535,13 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels if (IsFree) { MagentaPlot.CreateGraph(MagentaProcessData.ToList(), true); - UpdateFactorsOnChangeProcessData("MAGENTA"); + UpdateFactorsOnChangeProcessData(FactorColors.MAGENTA); } } private void OnYellowCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { - if (e.Action == NotifyCollectionChangedAction.Reset) - { - var yellowProcessData = SelectedColorProcessParameter.ColorProcessData.Where(x => x.ColorName == "YELLOW").ToObservableCollection(); - foreach (ColorProcessData item in yellowProcessData) - { - item.PropertyChanged -= YellowMeasurementModelPropertyChanged; - SelectedColorProcessParameter.ColorProcessData.Remove(item); - RemovedColorProcessDataBeforeSave[item.Guid] = item; - } - //UpdateFactorsOnChangeProcessData("Yellow"); - } - else if (e.Action == NotifyCollectionChangedAction.Remove) - { - foreach (ColorProcessData item in e.OldItems) - { - SelectedColorProcessParameter.ColorProcessData.Remove(item); - RemovedColorProcessDataBeforeSave[item.Guid] = item; - item.PropertyChanged -= YellowMeasurementModelPropertyChanged; - } - UpdateFactorsOnChangeProcessData("YELLOW"); - } - else if (e.Action == NotifyCollectionChangedAction.Add) - { - foreach (ColorProcessData item in e.NewItems) - { - item.ColorName = "YELLOW"; - item.ColorProcessParametersGuid = SelectedColorProcessParameter.Guid; - SelectedColorProcessParameter.ColorProcessData.Add(item); - RemovedColorProcessDataBeforeSave.Remove(item.Guid); - item.PropertyChanged += YellowMeasurementModelPropertyChanged; - } - } + OnColorCollectionChange(e, FactorColors.YELLOW, YellowMeasurementModelPropertyChanged); } private void YellowMeasurementModelPropertyChanged(object sender, PropertyChangedEventArgs e) @@ -617,56 +549,58 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels if (IsFree) { YellowPlot.CreateGraph(YellowProcessData.ToList(), false); - UpdateFactorsOnChangeProcessData("YELLOW"); + UpdateFactorsOnChangeProcessData(FactorColors.YELLOW); } } - + private void OnBlackCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { - if(e.Action == NotifyCollectionChangedAction.Reset) + OnColorCollectionChange(e, FactorColors.BLACK, BlackMeasurementModelPropertyChanged); + } + + private void BlackMeasurementModelPropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (IsFree) { - var blackProcessData = SelectedColorProcessParameter.ColorProcessData.Where(x => x.ColorName == "BLACK").ToObservableCollection(); - foreach (ColorProcessData item in blackProcessData) + BlackPlot.CreateGraph(BlackProcessData.ToList(), true); + UpdateFactorsOnChangeProcessData(FactorColors.BLACK); + } + } + + private void OnColorCollectionChange(NotifyCollectionChangedEventArgs e, FactorColors color, PropertyChangedEventHandler eventHandler) + { + if (e.Action == NotifyCollectionChangedAction.Reset) + { + var processData = SelectedColorProcessParameter.ColorProcessData.Where(x => x.FactorColor == color).ToObservableCollection(); + + foreach (ColorProcessData item in processData) { - item.PropertyChanged -= BlackMeasurementModelPropertyChanged; + item.PropertyChanged -= eventHandler; SelectedColorProcessParameter.ColorProcessData.Remove(item); - RemovedColorProcessDataBeforeSave[item.Guid] = item; } - //UpdateFactorsOnChangeProcessData("Black"); + //UpdateFactorsOnChangeProcessData(color); } else if (e.Action == NotifyCollectionChangedAction.Remove) { foreach (ColorProcessData item in e.OldItems) { SelectedColorProcessParameter.ColorProcessData.Remove(item); - RemovedColorProcessDataBeforeSave[item.Guid] = item; - item.PropertyChanged -= BlackMeasurementModelPropertyChanged; + item.PropertyChanged -= eventHandler; + RemovedColorProcessDataBeforeSave.Add(item.Guid); } - UpdateFactorsOnChangeProcessData("BLACK"); + UpdateFactorsOnChangeProcessData(color); } else if (e.Action == NotifyCollectionChangedAction.Add) { foreach (ColorProcessData item in e.NewItems) { - item.ColorName = "BLACK"; + item.FactorColor = color; item.ColorProcessParametersGuid = SelectedColorProcessParameter.Guid; SelectedColorProcessParameter.ColorProcessData.Add(item); - RemovedColorProcessDataBeforeSave.Remove(item.Guid); - item.PropertyChanged += BlackMeasurementModelPropertyChanged; + item.PropertyChanged += eventHandler; } - - } - } - - private void BlackMeasurementModelPropertyChanged(object sender, PropertyChangedEventArgs e) - { - if (IsFree) - { - BlackPlot.CreateGraph(BlackProcessData.ToList(), true); - UpdateFactorsOnChangeProcessData("BLACK"); } } - #endregion #region update factors @@ -676,100 +610,155 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels /// /// The factor. /// The item. - private void UpdateFactor(ColorProcessFactor factor, ColorProcessData item) + private void UpdateFactor(ColorProcessFactor factor, DataPoint point) { if (factor == null) return; - if (item == null) + if (point.X == 0) { factor.InkNlCm = 0; factor.L = factor.A = factor.B = 0.0; return; } - factor.InkNlCm = item.InkNlCm; - factor.L = item.L; - factor.A = item.A; - factor.B = item.B; + factor.InkNlCm = (int)point.X; + } /// /// Calculate and Update the factors on change process data. /// /// The color. - private void UpdateFactorsOnChangeProcessData(string color) + private void UpdateFactorsOnChangeProcessData(FactorColors color) { - bool isLtype = color.ToLower() == "yellow" ? false : true; - var processData = SelectedColorProcessParameter.ColorProcessData.Where(x => x.ColorName.ToLower() == color.ToLower()).ToObservableCollection(); + bool isLtype = color == FactorColors.YELLOW ? false : true; + var processData = SelectedColorProcessParameter.ColorProcessData.Where(x => x.FactorColor == color).ToList(); double target100 = FactorTarget.GetFactor100(color); double target200 = FactorTarget.GetFactor200(color); - ColorProcessData closest100 = null; - ColorProcessData closest200 = null; - ColorProcessData minInk = null; - ColorProcessData maxInk = null; + //ColorProcessData closest100 = null; + //ColorProcessData closest200 = null; - var minDifference100 = double.MaxValue; - var minDifference200 = double.MaxValue; + //var minDifference100 = double.MaxValue; + //var minDifference200 = double.MaxValue; if (processData.Count == 0) return; - foreach (var item in processData) - { - var colorvalue = isLtype ? item.L : item.B; - var difference100 = Math.Abs(colorvalue - target100); - if (minDifference100 > difference100) - { - minDifference100 = (int)difference100; - closest100 = item; - } - var difference200 = Math.Abs(colorvalue - target200); - if (minDifference200 > difference200) + //foreach (var item in processData) + //{ + // var colorvalue = isLtype ? item.L : item.B; + // var difference100 = Math.Abs(colorvalue - target100); + // if (minDifference100 > difference100) + // { + // minDifference100 = (int)difference100; + // closest100 = item; + // } + // var difference200 = Math.Abs(colorvalue - target200); + // if (minDifference200 > difference200) + // { + // minDifference200 = (int)difference200; + // closest200 = item; + // } + //} + var point100 = GetTargetPoint(processData, target100, isLtype); + UpdateFactor(Factor100ProcessData.FirstOrDefault(x => x.FactorColor == color), point100); + var point200 = GetTargetPoint(processData, target200, isLtype); + UpdateFactor(Factor200ProcessData.FirstOrDefault(x => x.FactorColor == color), point200); + } + + private DataPoint GetTargetPoint(List listValues, double factor, bool isLtype) + { + if (listValues.Count < 2 || factor <= 0) + return new DataPoint(0, 0); + + var test = listValues.GroupBy(x => x.InkNlCm, x => isLtype ? x.L : x.B, (Ink, Value) => new { InkValuep = Ink, ColorValue = Value.Average() }).ToList(); + var distinctItems = listValues.GroupBy(x => x.InkNlCm, x => isLtype ? x.L : x.B, (Ink, Value) => new { InkValuep = Ink, ColorValue = Value }).Select(y => new ColorProcessData { InkNlCm = y.InkValuep, L = y.ColorValue.Average() }).ToList(); + + double calculatedX = 0.0; + ColorProcessData prevItem = distinctItems[0]; + for (int index = 1; index < distinctItems.Count; index++) + { + var item = distinctItems[index]; + if (prevItem.L > item.L && (factor > prevItem.L || (factor <= prevItem.L && factor >= item.L)) + || (prevItem.L <= item.L && (factor > prevItem.L || (factor >= prevItem.L && factor <= item.L))) + || ((index + 1) == distinctItems.Count && calculatedX == 0.0)) { - minDifference200 = (int)difference200; - closest200 = item; - } - if (minInk == null || minInk.InkNlCm > item.InkNlCm) - { - minInk = item; - } - if (maxInk == null || maxInk.InkNlCm < item.InkNlCm) - { - maxInk = item; + calculatedX = CalculateXValue(factor, new DataPoint(prevItem.InkNlCm, prevItem.L), new DataPoint(item.InkNlCm, item.L)); + break; + } + prevItem = item; } - UpdateFactor(Factor100ProcessData.FirstOrDefault(x => x.ColorName == color), closest100); - UpdateFactor(Factor200ProcessData.FirstOrDefault(x => x.ColorName == color), closest200); - UpdateFactor(MinInkUptake.FirstOrDefault(x => x.ColorName == color), minInk); - UpdateFactor(MaxInkUptake.FirstOrDefault(x => x.ColorName == color), maxInk); + + return new DataPoint(calculatedX, factor); ; } + private double CalculateXValue(double factor, DataPoint leftPoint, DataPoint rightPoint) + { + double deltaX = rightPoint.X - leftPoint.X; + double deltaY = rightPoint.Y - leftPoint.Y; + + // prevents division by zero exceptions. + if (deltaX == 0) + return 0.0; + + double slope = deltaY / deltaX; + + // double c = leftPoint.Y - slope * leftPoint.X; + // double cX = (factor - c) / slope; + + return (leftPoint.X + (factor - leftPoint.Y) / slope); + + } #endregion #region save + private async void RemoveColorDataByColor(int color, string colorProcessParamGuid) + { + if(_active_context == null) + { + return; + } + var existingColorProcessData = await _active_context.ColorProcessData.Where(y => y.Color == color && y.ColorProcessParametersGuid == colorProcessParamGuid).ToListAsync(); + foreach( var data in existingColorProcessData) + { + _active_context.ColorProcessData.Remove(data); + } + } public async void Save() { + if (String.IsNullOrEmpty(SelectedMachineGUID)) + { + _notification.ShowWarning(LogManager.Log($"Could not save Color Process Parameters. Please, select machine before save.", LogCategory.Warning)); + return; + } + try { IsFree = false; - await Task.Factory.StartNew(() => - { - SelectedColorProcessParameter.LastUpdated = DateTime.UtcNow; - var colorProcessParameterAfterChange = ColorProcessParameterDTO.FromObservable(SelectedColorProcessParameter); + SelectedColorProcessParameter.LastUpdated = DateTime.UtcNow; - foreach (KeyValuePair item in RemovedColorProcessDataBeforeSave) + foreach (var item in RemovedColorProcessDataBeforeSave) + { + var existingColorProcessData = await _active_context.ColorProcessData.FirstOrDefaultAsync(y => y.Guid == item); + if (existingColorProcessData != null) { - var existingColorProcessData = _active_context.ColorProcessData.FirstOrDefault(y => y.Guid == item.Value.Guid); - if (existingColorProcessData != null) - { - _active_context.ColorProcessData.Remove(existingColorProcessData); - } + _active_context.ColorProcessData.Remove(existingColorProcessData); } - _active_context.SaveChanges(); - - }); - LoadColorParameters(SelectedColorProcessParameter.RmlsExtensionsGuid); + } + foreach(var colordata in SelectedColorProcessParameter.ColorProcessData) + { + colordata.LastUpdated = DateTime.UtcNow; + } + foreach (var factordata in SelectedColorProcessParameter.ColorProcessFactors) + { + factordata.LastUpdated = DateTime.UtcNow; + } + + await _active_context.SaveChangesAsync(); + + LoadColorParameters(); } catch (Exception ex) { @@ -779,9 +768,11 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels finally { IsFree = true; + EventHandler handler = SaveColorParameters; + handler?.Invoke(this, new EventArgs()); } } - + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs index 3fde7abbe..09befb26f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs @@ -25,6 +25,8 @@ using Tango.BL.DTO; using Tango.BL.Enumerations; using Tango.MachineStudio.ThreadExtensions.Contracts; using Tango.MachineStudio.ThreadExtensions.Views; +using Tango.MachineStudio.ThreadExtensions.Models; +using Tango.Settings; namespace Tango.MachineStudio.ThreadExtensions.ViewModels { @@ -33,34 +35,55 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels private INotificationProvider _notification; private IAuthenticationProvider _authentication; private IActionLogManager _actionLogManager; - private RmlsExtensionDTO _rmlExtensionBeforeSave; - + private ObservablesContext _rmlExtentions_context; private ObservablesContext _active_context; + private List _allUsers; + #region properties - private ObservableCollection _rmlsExtension; - public ObservableCollection RmlsExtensions - { - get { return _rmlsExtension; } - set { _rmlsExtension = value; + //private ObservableCollection _rmlsExtension; + //public ObservableCollection RmlsExtensions + //{ + // get { return _rmlsExtension; } + // set { _rmlsExtension = value; + // RaisePropertyChangedAuto(); } + //} + + private List _rmlExtensions; + public List RmlExtensions + { + get { return _rmlExtensions; } + set { _rmlExtensions = value; RaisePropertyChangedAuto(); } } - - private RmlsExtension _activeRMLExtention; - public RmlsExtension ActiveRMLExtention + private RmlsExtension _ActiveRMLExtension; + public RmlsExtension ActiveRMLExtension { - get { return _activeRMLExtention; } - set { _activeRMLExtention = value; + get { return _ActiveRMLExtension; } + set { _ActiveRMLExtension = value; RaisePropertyChangedAuto(); } } - private RmlsExtension _selectedRMLExtension; - public RmlsExtension SelectedRMLExtension + private Rml _activeRML; + public Rml ActiveRML + { + get { return _activeRML; } + set + { + _activeRML = value; + RaisePropertyChangedAuto(); + } + } + + private RmlExtensionModel _selectedRMLExtension; + public RmlExtensionModel SelectedRMLExtension { get { return _selectedRMLExtension; } - set { _selectedRMLExtension = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + set { _selectedRMLExtension = value; + RaisePropertyChangedAuto(); + InvalidateRelayCommands(); } } private ICollectionView _rmlExtCollectionView; @@ -91,20 +114,26 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels set { _brands = value; RaisePropertyChangedAuto(); } } - private ObservableCollection _yarnColor; - public ObservableCollection YarnColor + private ObservableCollection _yarnWhiteShade; + public ObservableCollection YarnWhiteShade { - get { return _yarnColor; } - set { _yarnColor = value; RaisePropertyChangedAuto(); } + get { return _yarnWhiteShade; } + set { _yarnWhiteShade = value; RaisePropertyChangedAuto(); } } - - private ObservableCollection _enduse; - public ObservableCollection EndUse + private ObservableCollection _enduse; + public ObservableCollection EndUse { get { return _enduse; } set { _enduse = value; RaisePropertyChangedAuto(); } } - + + private ObservableCollection _units; + public ObservableCollection Units + { + get { return _units; } + set { _units = value; RaisePropertyChangedAuto(); } + } + private ObservableCollection _family; public ObservableCollection Family { @@ -112,8 +141,8 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels set { _family = value; RaisePropertyChangedAuto(); } } - private ObservableCollection _geometry; - public ObservableCollection Geometry + private ObservableCollection _geometry; + public ObservableCollection Geometry { get { return _geometry; } set { _geometry = value; RaisePropertyChangedAuto(); } @@ -133,20 +162,30 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels set { _group = value; RaisePropertyChangedAuto(); } } - private ObservableCollection _manufacturer; - public ObservableCollection Manufacturer + //private ObservableCollection _manufacturer; + //public ObservableCollection Manufacturer + //{ + // get { return _manufacturer; } + // set { _manufacturer = value; RaisePropertyChangedAuto(); } + //} + private List _manufacturers; + + public List Manufacturers { - get { return _manufacturer; } - set { _manufacturer = value; RaisePropertyChangedAuto(); } + get { return _manufacturers; } + set { _manufacturers = value; + RaisePropertyChangedAuto(); + } } - private ObservableCollection _materials; - public ObservableCollection Materials + + private ObservableCollection _materials; + public ObservableCollection Materials { get { return _materials; } set { _materials = value; RaisePropertyChangedAuto(); } } - + private ObservableCollection _subFamilies; public ObservableCollection SubFamilies { @@ -185,9 +224,9 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels set { _Filter = value; RaisePropertyChangedAuto(); OnFilterChanged(); } } - private void OnFilterChanged() + private async void OnFilterChanged() { - RmlExtCollectionView.Refresh(); + await LoadRmlExtentions(); } private ColorParametersVewVM _colorParametersVewVM; @@ -196,97 +235,69 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels get { return _colorParametersVewVM; } set { _colorParametersVewVM = value; RaisePropertyChangedAuto(); } } - #endregion - #region commands - - public RelayCommand SaveCommand { get; set; } - - public RelayCommand ManageRmlExtensionCommand { get; set; } - - public RelayCommand AddRmlExtCommand { get; set; } - - public RelayCommand RemoveRmlExtensionCommand { get; set; } - - public RelayCommand CloneRmlExtensionCommand { get; set; } - - public RelayCommand BackToThreadExtensionViewsCommand { get; set; } - - - private void BackToThreadExtensionViews(object obj) + private TestResultsViewVM _testResultsViewVM; + public TestResultsViewVM TestResultsViewVM { - View.NavigateTo(ThreadExtensionNavigationView.ThreadExtensionsView); - LoadRmlExtentions(); + get { return _testResultsViewVM; } + set { _testResultsViewVM = value; RaisePropertyChangedAuto(); } } - private async void CloneSelectedRmlExtension(object obj) + protected Machine _selectedMachine; + /// + /// Gets or sets the selected machine. + /// + public Machine SelectedMachine { - using (_notification.PushTaskItem("Cloning thread...")) + get { return _selectedMachine; } + set { - try - { - IsFree = false; - - using (var context = ObservablesContext.CreateDefault()) - { - RmlsExtension rml_extention = await new RmlExtensionsBuilder(_rmlExtentions_context).Set(SelectedRMLExtension.Guid).WithUser().BuildAsync(); - - RmlsExtension cloned = new RmlsExtension(); - rml_extention.MapPropertiesTo(cloned, MappingFlags.NoReferenceTypes); - - cloned.Guid = Guid.NewGuid().ToString(); - cloned.ID = 0; - - - context.RmlsExtensions.Add(cloned); - await context.SaveChangesAsync(); - - //_actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlCreated, _authentication.CurrentUser, cloned.Name, cloned, "RML cloned from Machine Studio."); - } - - LoadRmlExtentions(); - } - catch (Exception ex) + if (value != null && _selectedMachine != value) { - LogManager.Log(ex, "Error cloning thread."); - _notification.ShowError($"An error occurred while trying to clone the selected thread\n{ex.Message}"); - } - finally - { - IsFree = true; + _selectedMachine = value; + SelectedMachineChanged(); + RaisePropertyChangedAuto(); + InvalidateRelayCommands(); } } } - private async void RemoveRmlExtension(object obj) + private ObservableCollection _machines; + /// + /// Gets or sets the Machines. + /// + public ObservableCollection Machines { - if (_notification.ShowQuestion(" Are you sure you want to delete the selected RML Extension?")) + get { - using (_notification.PushTaskItem("Removing RML Extension...")) - { - try - { - IsFree = false; - - await SelectedRMLExtension.DeleteCascadeAsync(_rmlExtentions_context); - //_actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlDeleted, _authentication.CurrentUser, SelectedRML.Name, SelectedRML, "RML deleted from Machine Studio."); + return _machines; + } - LoadRmlExtentions(); - } - catch (Exception ex) - { - LogManager.Log(ex, $"Error removing selected RML {SelectedRMLExtension?.Name}."); - _notification.ShowError($"An error occurred while trying to remove the selected RML Extension.\n{ex.FlattenMessage()}"); - LoadRmlExtentions(); - } - finally - { - IsFree = true; - } - } + set + { + _machines = value; RaisePropertyChanged(nameof(Machines)); } + } + #endregion + + #region commands + + public RelayCommand SaveCommand { get; set; } + + public RelayCommand ManageRmlExtensionCommand { get; set; } + + public RelayCommand BackToThreadExtensionViewsCommand { get; set; } + + private async void BackToThreadExtensionViews(object obj) + { + View.NavigateTo(RMLExtensionNavigationView.RMLExtensionsView); + await LoadRmlExtentions(); + } + + #endregion + public MainViewVM(INotificationProvider notificationProvider, IAuthenticationProvider authentication, IActionLogManager actionLogManager) { @@ -296,21 +307,20 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels BackToThreadExtensionViewsCommand = new RelayCommand(BackToThreadExtensionViews, () => IsFree); SaveCommand = new RelayCommand(Save, () => IsFree); - ManageRmlExtensionCommand = new RelayCommand(() => LoadActiveRMLExtention(SelectedRMLExtension.Guid), () => SelectedRMLExtension != null); - RemoveRmlExtensionCommand = new RelayCommand(RemoveRmlExtension, () => SelectedRMLExtension != null); - CloneRmlExtensionCommand = new RelayCommand(CloneSelectedRmlExtension, () => SelectedRMLExtension != null); - AddRmlExtCommand = new RelayCommand(AddNewRmlExtention); + ManageRmlExtensionCommand = new RelayCommand(() => LoadActiveRMLExtension(SelectedRMLExtension.Guid), () => SelectedRMLExtension != null); } public override void OnApplicationReady() { - LoadRmlExtentions(); } + #region Loading - private async void LoadRmlExtentions() + private async Task LoadRmlExtentions() { + var filter = Filter.ToStringOrEmpty().ToLower(); + try { IsFree = false; @@ -320,19 +330,36 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels if (_rmlExtentions_context != null) _rmlExtentions_context.Dispose(); _rmlExtentions_context = ObservablesContext.CreateDefault(); - RmlsExtensions = await new RMLExtentionsCollectionBuilder(_rmlExtentions_context).SetAll().WithUser().WithYarnProperties().BuildAsync(); - - - RmlExtCollectionView = CollectionViewSource.GetDefaultView(RmlsExtensions); - RmlExtCollectionView.SortDescriptions.Add(new SortDescription(nameof(Rml.LastUpdated), ListSortDirection.Descending)); - - RmlExtCollectionView.Filter = (rml) => - { - RmlsExtension r = rml as RmlsExtension; - return String.IsNullOrWhiteSpace(Filter) - || r.Name.ToLower().Contains(Filter.ToLower()); - }; + Brands = _rmlExtentions_context.YarnBrands.ToObservableCollection(); + _allUsers = await _rmlExtentions_context.Users.Include(x => x.Contact).ToListAsync(); + var q = (from c in _rmlExtentions_context.Rmls.Where(x => x.Name.ToLower().Contains(filter)) + join p in _rmlExtentions_context.RmlsExtensions on c.Guid equals p.RmlsGuid into ps + from p in ps.DefaultIfEmpty() + select new { RML = c, RMLExtesion = p }).Distinct().ToList().DistinctBy(x => x.RML.Guid) + .Select(x => new RmlExtensionModel() + { + RMLGuid = x.RML.Guid, + Guid = x.RMLExtesion == null? null : x.RMLExtesion.Guid, + Name = x.RML.Name, + Manufacturer = x.RML.Manufacturer, + Brand = x.RMLExtesion == null ? "" : (Brands.Where( y => y.Guid == x.RMLExtesion.YarnBrandGuid).Select( z => z.Name).FirstOrDefault()), + LinearDensity = (int) x.RML.FiberSize, + CreatedBy = x.RMLExtesion == null ? "" : _allUsers.SingleOrDefault(y => y.Guid == x.RMLExtesion.UsersGuid).Contact.FullName, + Created = x.RMLExtesion == null ? DateTime.Now : x.RMLExtesion.Created, + LastUpdated = x.RMLExtesion == null ? DateTime.Now : x.RMLExtesion.LastUpdated, + Status = x.RMLExtesion == null ? RMLExtensionStatus.New : x.RMLExtesion.RMLStatus + }).ToList(); + RmlExtensions = q; + RmlExtCollectionView = CollectionViewSource.GetDefaultView(RmlExtensions); + RmlExtCollectionView.SortDescriptions.Add(new SortDescription(nameof(Rml.LastUpdated), ListSortDirection.Ascending)); + + //RmlExtCollectionView.Filter = (rml) => + //{ + // RmlExtensionModel r = rml as RmlExtensionModel; + // return String.IsNullOrWhiteSpace(Filter) + // || r.Name.ToLower().Contains(Filter.ToLower()); + //}; } } catch (Exception ex) @@ -348,84 +375,68 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels private void LoadRmlProperties() { Applications = _active_context.YarnApplications.ToObservableCollection(); - Brands = _active_context.YarnBrand.ToObservableCollection(); - YarnColor = _active_context.YarnColor.ToObservableCollection(); - EndUse = _active_context.YarnEndUse.ToObservableCollection(); - Family = _active_context.YarnFamily.ToObservableCollection(); - Geometry = _active_context.YarnGeometry.ToObservableCollection(); - GlossLevel = _active_context.YarnGlossLevel.ToObservableCollection(); - Group = _active_context.YarnGroup.ToObservableCollection(); - Manufacturer = _active_context.YarnManufacturer.ToObservableCollection(); - - Materials = _active_context.YarnMaterials.ToObservableCollection(); - SubFamilies = _active_context.YarnSubFamily.ToObservableCollection(); - Texturing = _active_context.YarnTexturing.ToObservableCollection(); - YarnTypes = _active_context.YarnType.ToObservableCollection(); - IndustrySector = _active_context.YarnIndustrysector.ToObservableCollection(); - } - - private async void AddNewRmlExtention(object obj) - { - using (_notification.PushTaskItem("Creating new RML Extension...")) + Brands = _active_context.YarnBrands.ToObservableCollection(); + YarnWhiteShade = _active_context.YarnWhiteShades.ToObservableCollection(); + EndUse = _active_context.MediaPurposes.ToObservableCollection(); + Family = _active_context.YarnFamilies.ToObservableCollection(); + Geometry = _active_context.FiberShapes.ToObservableCollection(); + GlossLevel = _active_context.YarnGlossLevels.ToObservableCollection(); + Group = _active_context.YarnGroups.ToObservableCollection(); + //Manufacturer = _active_context.YarnManufacturers.ToObservableCollection(); + Manufacturers = _active_context.YarnManufacturers.Select(x => x.Name).ToList(); + Units = _active_context.LinearMassDensityUnits.ToObservableCollection(); + Materials = _active_context.MediaMaterials.ToObservableCollection(); + SubFamilies = _active_context.YarnSubFamilies.ToObservableCollection(); + Texturing = _active_context.YarnTexturings.ToObservableCollection(); + YarnTypes = _active_context.YarnTypes.ToObservableCollection(); + IndustrySector = _active_context.YarnIndustrysectors.ToObservableCollection(); + Machines = ObservablesStaticCollections.Instance.Machines.Select(x => new MachineModel() { - IsFree = false; - - if (_active_context != null) - { - _active_context.Dispose(); - } - - _active_context = ObservablesContext.CreateDefault(); - - LoadRmlProperties(); - - RmlsExtension rml_extention = new RmlsExtension(); - rml_extention.Created = DateTime.UtcNow; - rml_extention.UserGuid = _authentication.CurrentUser.Guid; - rml_extention.YarnManufacturer = Manufacturer.FirstOrDefault(); - rml_extention.YarnBrand = Brands.FirstOrDefault(); - rml_extention.Country = null; - rml_extention.YarnEndUse = EndUse.FirstOrDefault(); - rml_extention.YarnApplications = Applications.FirstOrDefault(); - rml_extention.YarnIndustrysector = IndustrySector.FirstOrDefault(); - - rml_extention.YarnMaterial = Materials.FirstOrDefault(); - rml_extention.YarnType = YarnTypes.FirstOrDefault(); - rml_extention.YarnSubFamily = SubFamilies.FirstOrDefault(); - rml_extention.YarnFamily = Family.FirstOrDefault(); - rml_extention.YarnGroup = Group.FirstOrDefault(); - rml_extention.YarnTexturing = Texturing.FirstOrDefault(); - rml_extention.YarnGeometry = Geometry.FirstOrDefault(); - rml_extention.YarnColor = YarnColor.FirstOrDefault(); - rml_extention.YarnGlossLevel = GlossLevel.FirstOrDefault(); - rml_extention.LinearDensity = 0; - rml_extention.YarnUnit = YarnUnits.DTEX; - rml_extention.YarnPlies = Plies.P1; - rml_extention.FilamentCount = 0; - rml_extention.TwistTpm = 0; - rml_extention.YarnTwistDirections = TwistDirections.S; - rml_extention.MinElongation = 0.0; - rml_extention.MaxElongation = 100.0; - rml_extention.MinMaxForceN = 0.0; - rml_extention.MaxMaxForceN = 100.0; - rml_extention.MinElasticity = 0.0; - rml_extention.MaxElasticity = 100.0; - rml_extention.MinTenacity = 0.0; - rml_extention.MaxTenacity = 100.0; - rml_extention.Finishing = "Lubrication"; - - _active_context.RmlsExtensions.Add(rml_extention); - await _active_context.SaveChangesAsync(); - - //_actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlCreated, _authentication.CurrentUser, rml.Name, rml, "Rml created using Machine Studio."); - ColorParametersVewVM = new ColorParametersVewVM(_notification, _actionLogManager); - LoadActiveRMLExtention(rml_extention.Guid); + Guid = x.Guid, + Name = x.Name, + SerialNumber = x.SerialNumber + }).ToObservableCollection(); - IsFree = true; - } } - private async void LoadActiveRMLExtention(String guid) + private RmlsExtension GetNewRMLsExtension( string RML_Guid) + { + RmlsExtension rml_extention = new RmlsExtension(); + rml_extention.Created = DateTime.UtcNow; + rml_extention.RmlsGuid = RML_Guid; + rml_extention.UsersGuid = _authentication.CurrentUser.Guid; + //rml_extention.YarnManufacturer = Manufacturer.FirstOrDefault(); + rml_extention.YarnBrand = Brands.FirstOrDefault(); + rml_extention.Country = null; + //rml_extention.YarnEndUse = EndUse.FirstOrDefault(); + rml_extention.YarnApplication = Applications.FirstOrDefault(); + rml_extention.YarnIndustrysector = IndustrySector.FirstOrDefault(); + + //rml_extention.YarnMaterial = Materials.FirstOrDefault(); + rml_extention.YarnType = YarnTypes.FirstOrDefault(); + rml_extention.YarnSubFamily = SubFamilies.FirstOrDefault(); + rml_extention.YarnFamily = Family.FirstOrDefault(); + rml_extention.YarnGroup = Group.FirstOrDefault(); + rml_extention.YarnTexturing = Texturing.FirstOrDefault(); + rml_extention.YarnWhiteShade = YarnWhiteShade.FirstOrDefault(); + rml_extention.YarnGlossLevel = GlossLevel.FirstOrDefault(); + rml_extention.TwistTpm = 0; + rml_extention.YarnTwistDirections = TwistDirections.Unknown; + rml_extention.MinElongation = 0.0; + rml_extention.MaxElongation = 100.0; + rml_extention.MinMaxForceN = 0.0; + rml_extention.MaxMaxForceN = 100.0; + rml_extention.MinElasticity = 0.0; + rml_extention.MaxElasticity = 100.0; + rml_extention.MinTenacity = 0.0; + rml_extention.MaxTenacity = 100.0; + rml_extention.Finishing = "Lubrication"; + rml_extention.RMLStatus = RMLExtensionStatus.New; + + return rml_extention; + } + + private async void LoadActiveRMLExtension(String guid) { using (_notification.PushTaskItem("Loading RML Extension...")) { @@ -439,17 +450,60 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels } _active_context = ObservablesContext.CreateDefault(); - LoadRmlProperties(); - ActiveRMLExtention = await new RmlExtensionsBuilder(_active_context) - .Set(guid) - .WithUser() - .BuildAsync(); + if (guid == null) + { + RmlsExtension rml_extention = GetNewRMLsExtension(SelectedRMLExtension.RMLGuid); + _active_context.RmlsExtensions.Add(rml_extention); + await _active_context.SaveChangesAsync(); + guid = rml_extention.Guid; + } + + ActiveRMLExtension = await new RmlExtensionsBuilder(_active_context) + .Set(guid) + .WithUser() + .BuildAsync(); + + ActiveRML = new RmlBuilder(_active_context) + .Set(SelectedRMLExtension.RMLGuid) + .Build(); + + var machinesWithTest = _active_context.RmlExtensionTestResults.Select(x => x.MachineGuid).ToList(); + var machinesWithTest2 = + Join(_active_context.ColorProcessParameters.Select(y => y.MachineGuid), st1 => st1, st2=> st2, (st1, st2)=>).ToList(); + Machines = ObservablesStaticCollections.Instance.Machines.Select(x => new MachineModel() + { + Guid = x.Guid, + Name = x.Name, + SerialNumber = x.SerialNumber + }).ToObservableCollection(); + var settings = SettingsManager.Default.GetOrCreate(); + SelectedMachine = ObservablesStaticCollections.Instance.Machines.SingleOrDefault(x => x.SerialNumber == settings.LastVirtualMachineSerialNumber); ColorParametersVewVM = new ColorParametersVewVM(_notification, _actionLogManager); - ColorParametersVewVM.LoadColorParameters(guid); - View.NavigateTo(ThreadExtensionNavigationView.ThreadExtentionView); + ColorParametersVewVM.RMLExtemtionGUID = guid; + ColorParametersVewVM.SelectedMachineGUID = SelectedMachine.Guid; + + TestResultsViewVM = new TestResultsViewVM(_notification, _actionLogManager); + TestResultsViewVM.RMLExtemtionGUID = guid; + TestResultsViewVM.ThreadName = ActiveRML.Manufacturer; + + var machineGuidsWithTests = await _active_context.RmlExtensionTestResults.Where(x => x.RmlsExtensionsGuid == guid).Select(y => y.MachineGuid).ToListAsync(); + if(machineGuidsWithTests.Count > 0) + { + + } + + if (ActiveRMLExtension.RMLStatus == RMLExtensionStatus.New) + { + ColorParametersVewVM.SaveColorParameters -= UpdateStatus; + ColorParametersVewVM.SaveColorParameters += UpdateStatus; + TestResultsViewVM.SaveTestResults -= UpdateStatus; + TestResultsViewVM.SaveTestResults += UpdateStatus; + } + + View.NavigateTo(RMLExtensionNavigationView.RMLExtentionView); InvalidateRelayCommands(); @@ -466,22 +520,18 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels } } } - - private async void RefreshView(String guid) + + private async void RefreshView(String guid, String rmlGuid) { try { IsFree = false; - - //if (_active_context != null) - //{ - // _active_context.Dispose(); - //} - - //_active_context = ObservablesContext.CreateDefault(); - + LoadRmlProperties(); - ActiveRMLExtention = await new RmlExtensionsBuilder(_active_context) + ActiveRML = ActiveRML = await new RmlBuilder(_active_context) + .Set(rmlGuid) + .BuildAsync(); + ActiveRMLExtension = await new RmlExtensionsBuilder(_active_context) .Set(guid) .WithUser() .BuildAsync(); @@ -493,7 +543,7 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels catch (Exception ex) { //LogManager.Log($"Error loading RML '{ActiveRML.Name}'..."); - _notification.ShowError($"Error refresh the selected thread.\n{ex.FlattenMessage()}"); + _notification.ShowError($"Error refresh after save the selected thread.\n{ex.FlattenMessage()}"); } finally { @@ -503,34 +553,75 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels #endregion - private async void Save() + #region event handlers + + private async void UpdateStatus(object sender, EventArgs e) { IsFree = false; try { - using (_notification.PushTaskItem("Saving RML Extension...")) - { + ColorParametersVewVM.SaveColorParameters -= UpdateStatus; + TestResultsViewVM.SaveTestResults -= UpdateStatus; + ActiveRMLExtension.RMLStatus = RMLExtensionStatus.InProgress; + ActiveRMLExtension.LastUpdated = DateTime.UtcNow; - ActiveRMLExtention.LastUpdated = DateTime.UtcNow; + await _active_context.SaveChangesAsync(); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error saving Status of RML Extension"); + _notification.ShowError($"An error occurred while trying to save status of the current RML Extension.\n{ex.FlattenMessage()}"); + } + finally + { + IsFree = true; + } + } - ColorParametersVewVM.Save(); + private void SelectedMachineChanged() + { + if(ColorParametersVewVM != null) + { + ColorParametersVewVM.SelectedMachineGUID = SelectedMachine.Guid; + } + } - var rmlExtensionAfter = RmlsExtensionDTO.FromObservable(ActiveRMLExtention); + #endregion - await _active_context.SaveChangesAsync(); + #region Save - //ColorParametersVewVM.LoadColorParameters(ActiveRMLExtention.Guid); - // _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlSaved, _authentication.CurrentUser, _rmlBeforeSave.Name, _rmlBeforeSave, rmlAfter, "RML saved using Machine Studio."); + /// + /// Saves this instance. + /// + private async void Save() + { + IsFree = false; + + try + { + using (_notification.PushTaskItem("Saving RML Extension...")) + { + if(ActiveRMLExtension.RMLStatus == RMLExtensionStatus.New) + { + ActiveRMLExtension.RMLStatus = RMLExtensionStatus.InProgress; + ColorParametersVewVM.SaveColorParameters -= UpdateStatus; + TestResultsViewVM.SaveTestResults -= UpdateStatus; + } - _rmlExtensionBeforeSave = rmlExtensionAfter; + ActiveRMLExtension.LastUpdated = DateTime.UtcNow; + ActiveRML.LastUpdated = DateTime.UtcNow; + + await _active_context.SaveChangesAsync(); - RefreshView(SelectedRMLExtension.Guid); + // _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlSaved, _authentication.CurrentUser, _rmlBeforeSave.Name, _rmlBeforeSave, rmlAfter, "RML saved using Machine Studio."); + + RefreshView(ActiveRMLExtension.Guid, ActiveRML.Guid); } } catch (Exception ex) { - LogManager.Log(ex, $"Error saving RML Extension {ActiveRMLExtention.Name}"); + LogManager.Log(ex, $"Error saving RML Extension of RML{ActiveRML.Name}"); _notification.ShowError($"An error occurred while trying to save the current RML Extension.\n{ex.FlattenMessage()}"); } finally @@ -538,5 +629,7 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels IsFree = true; } } + + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/TestResultViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/TestResultViewVM.cs new file mode 100644 index 000000000..4e7d84e7f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/TestResultViewVM.cs @@ -0,0 +1,201 @@ +using Microsoft.Win32; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.ActionLogs; +using Tango.BL.DTO; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.Core.Commands; +using Tango.MachineStudio.Common.Notifications; +using Tango.SharedUI; + +namespace Tango.MachineStudio.ThreadExtensions.ViewModels +{ + public class TestResultViewVM : ViewModel + { + private INotificationProvider _notification; + private IActionLogManager _actionLogManager; + + #region Properties + + private string _threadName; + /// + /// Gets or sets the name of the thread. Using in print + /// + /// + /// The name of the thread. + /// + public string ThreadName + { + get { return _threadName; } + set + { + _threadName = value; + RaisePropertyChangedAuto(); + } + } + + + private bool _isSelected; + /// + /// Gets or sets a value indicating whether this instance is selected. + /// + public bool IsSelected + { + get { return _isSelected; } + set { _isSelected = value; RaisePropertyChangedAuto(); } + } + + private RmlExtensionTestResult _testResult; + + public RmlExtensionTestResult TestResult + { + get { return _testResult; } + set { _testResult = value; + RaisePropertyChangedAuto(); + } + } + + + #endregion + public RelayCommand ExportToFileCommand { get; set; } + + public TestResultViewVM(INotificationProvider notification, IActionLogManager actionLogManager) + { + _notification = notification; + _actionLogManager = actionLogManager; + ExportToFileCommand = new RelayCommand(ExportToFile); + } + + #region save + // public void Save(ObservablesContext active_context) + //{ + // try + // { + // IsFree = false; + + // TestResult.LastUpdated = DateTime.UtcNow; + + // var RmlExtensionTestResultAfterChange = RmlExtensionTestResultDTO.FromObservable(TestResult); + + // active_context.SaveChanges(); + // } + // catch (Exception ex) + // { + // LogManager.Log(ex, "Could not update RmlExtension TestResult."); + // _notification.ShowError($"An error occurred while trying to save RmlExtension TestResult.\n{ex.Message}"); + // } + // finally + // { + // IsFree = true; + // } + //} + #endregion + + private void ExportToFile() + { + SaveFileDialog dlg = new SaveFileDialog(); + try + { + dlg.Title = $"Export excel calibration file for {TestResult.Name}"; + dlg.Filter = "Text Files|*.txt"; + dlg.DefaultExt = ".txt"; + dlg.FileName = $"RML_EXTENSION_{TestResult.Name}.txt"; + if (dlg.ShowDialog().Value) + { + using (StreamWriter outputFile = new StreamWriter(dlg.FileName)) + { + outputFile.WriteLine(String.Format($" {TestResult.Name.ToUpper()} ")); + outputFile.WriteLine(""); + outputFile.WriteLine(""); + outputFile.WriteLine(" Dryer temperature"); + outputFile.WriteLine(""); + outputFile.WriteLine(String.Format($" Dryer temperature : {TestResult.DryerTemperature.ToString()}")); + outputFile.WriteLine(String.Format($" Tunnel temperature : {TestResult.TunnelTemperature.ToString()}")); + outputFile.WriteLine(String.Format($" Tunnel flow : {TestResult.TunnelFlow.ToString()}")); + outputFile.WriteLine(String.Format($" Tunnel AVG temperature : {TestResult.TunnelAvgTemperature.ToString()}")); + outputFile.WriteLine(""); + outputFile.WriteLine(""); + outputFile.WriteLine(" Tension through the thread path"); + outputFile.WriteLine(""); + outputFile.WriteLine(String.Format($" Head : {TestResult.TensionHeadMin.ToString()} - {TestResult.TensionHeadMax.ToString()}")); + outputFile.WriteLine(String.Format($" After dryer : {TestResult.TensionAfterDryerMin.ToString()} - {TestResult.TensioinAfterDryerMax.ToString()}")); + outputFile.WriteLine(String.Format($" Winder : {TestResult.BtsrMin.ToString()} - {TestResult.BtsrMax.ToString()}")); + outputFile.WriteLine(String.Format($" BTSR : {TestResult.TensionHeadMin.ToString()} - {TestResult.TensionHeadMax.ToString()}")); + outputFile.WriteLine(String.Format($" Puller tension : {TestResult.PullerTensionMin.ToString()} - {TestResult.PullerTensionMax.ToString()}")); + outputFile.WriteLine(String.Format($" Winder exit tension: {TestResult.ExitTensionMin.ToString()} - {TestResult.ExitTensionMax.ToString()}")); + + outputFile.WriteLine(""); + outputFile.WriteLine(" Rubbing results"); + outputFile.WriteLine(""); + outputFile.WriteLine(" Color DeltaE CIE 100 % GS 100% DeltaETestResult CIE 200 % GS 200% "); + foreach (var rubbingResult in TestResult.RubbingResults) + { + StringBuilder sb = new StringBuilder(); + //sb.Append(" Color: "); + sb.Append($" { rubbingResult.TestResultColor.ToString()} "); + //sb.Append(" DeltaE CIE 100 % : "); + sb.Append($" { rubbingResult.DeltaeCie100.ToString()} "); + //sb.Append(" GS 100% : "); + sb.Append($" { rubbingResult.Gs100Min.ToString()}-{rubbingResult.Gs100Max.ToString()} "); + //sb.Append(" DeltaE CIE 200 % : "); + sb.Append($" { rubbingResult.DeltaeCie200.ToString()} "); + //sb.Append(" GS 200% : "); + sb.Append($" { rubbingResult.Gs200Min.ToString()}-{rubbingResult.Gs200Max.ToString()} "); + outputFile.WriteLine(sb); + } + outputFile.WriteLine(""); + outputFile.WriteLine(" Mechanical properties"); + outputFile.WriteLine(""); + outputFile.WriteLine(" %Color Color Load at Maximum Load(N) STDEV Percentage Strain at Maximum Load STDEV "); + foreach (var result in TestResult.TensileResults) + { + StringBuilder sb = new StringBuilder(); + //sb.Append(" % Color: "); + sb.Append($" { result.ColorPercent.ToString()}"); + //sb.Append(" Color : "); + sb.Append($" { result.TestResultColor.ToString()}"); + //sb.Append(" Load at Maximum Load(N) : "); + sb.Append($" { result.MaxLoad.ToString()}"); + //sb.Append(" STDEV : "); + sb.Append($" { result.StdevMaxLoad.ToString()}"); + //sb.Append(" Percentage Strain at Maximum Load: "); + sb.Append($" {result.StrainMaxLoad.ToString()}"); + //sb.Append(" STDEV : "); + sb.Append($" { result.StdevStrainMaxLoad.ToString()}"); + outputFile.WriteLine(sb); + } + outputFile.WriteLine(""); + outputFile.WriteLine(" Uniformity"); + outputFile.WriteLine(""); + outputFile.WriteLine(String.Format($" Zone1 : {TestResult.SeverityZone1Min.ToString()} - {TestResult.SeverityZone1Max.ToString()}")); + outputFile.WriteLine(String.Format($" Zone2 : {TestResult.SeverityZone2Min.ToString()} - {TestResult.SeverityZone2Max.ToString()}")); + outputFile.WriteLine(""); + outputFile.WriteLine(" COF"); + outputFile.WriteLine(""); + outputFile.WriteLine(" Thread name Lub Version COF Lub amount "); + outputFile.WriteLine(String.Format($" REF {TestResult.RefLubVersion} {TestResult.RefCof.ToString()} {TestResult.RefLub.ToString()}")); + outputFile.WriteLine(String.Format($" {ThreadName} {TestResult.ThreadLubVersion} {TestResult.ThreadCof.ToString()} {TestResult.ThreadLub.ToString()}")); + + outputFile.WriteLine(""); + outputFile.WriteLine(String.Format($" Comments: {TestResult.Comment}")); + outputFile.WriteLine(String.Format($" Conclusion: {TestResult.Conclusions}")); + outputFile.WriteLine(""); + outputFile.Flush(); + } + + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error exporting excel file " + dlg.FileName); + _notification.ShowError("An error occurred while trying to export the test result data."); + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/TestResultsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/TestResultsViewVM.cs new file mode 100644 index 000000000..c60d5e4fa --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/TestResultsViewVM.cs @@ -0,0 +1,368 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.AutoComplete.Editors; +using Tango.BL; +using Tango.BL.ActionLogs; +using Tango.BL.Builders; +using Tango.BL.DTO; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.Core; +using Tango.Core.Commands; +using Tango.Logging; +using Tango.MachineStudio.Common; +using Tango.MachineStudio.Common.Notifications; +using Tango.Settings; +using Tango.SharedUI; + +namespace Tango.MachineStudio.ThreadExtensions.ViewModels +{ + public class TestResultsViewVM : ViewModel + { + private INotificationProvider _notification; + private IActionLogManager _actionLogManager; + + private ObservablesContext _active_context; + + public event EventHandler SaveTestResults; + + #region Properties + private SynchronizedObservableCollection _selectedTestResults; + + public SynchronizedObservableCollection SelectedTestResults + { + get { return _selectedTestResults; } + set { _selectedTestResults = value; } + } + + + private ObservableCollection _resultTabs; + + public ObservableCollection ResultTabs + { + get { return _resultTabs; } + set { _resultTabs = value; } + } + + private TestResultViewVM _selectedTab; + /// + /// Gets or sets the selected tab. + /// + public TestResultViewVM SelectedTab + { + get { return _selectedTab; } + set + { + _selectedTab = value; + RaisePropertyChangedAuto(); + + foreach (var tab in ResultTabs.Where(x => x != _selectedTab)) + { + tab.IsSelected = false; + } + + if (_selectedTab != null) + { + _selectedTab.IsSelected = true; + } + + //EnableRenderingForSelectedTabGraphs(); + } + } + /// + /// Gets or sets the machines providers. + /// + //public ISuggestionProvider MachinesProvider { get; set; } + + protected Machine _selectedMachine; + /// + /// Gets or sets the selected machine. + /// + public Machine SelectedMachine + { + get { return _selectedMachine; } + set + { + if (value != null && _selectedMachine != value) + { + _selectedMachine = value; + SelectedMachineChanged(); + RaisePropertyChangedAuto(); + InvalidateRelayCommands(); + } + } + } + + private string _RMLExtentionGUID; + + public string RMLExtemtionGUID + { + get { return _RMLExtentionGUID; } + set { _RMLExtentionGUID = value; + OnRMLExtemtionGUIDChanged(); + } + } + + private string _threadName; + + public string ThreadName + { + get { return _threadName; } + set { _threadName = value; + RaisePropertyChangedAuto(); } + } + + + #endregion + + #region Commands + /// + /// Gets or sets the add tab command. + /// + public RelayCommand AddTabCommand { get; set; } + + /// + /// Gets or sets the remove tab command. + /// + public RelayCommand RemoveTabCommand { get; set; } + + /// + /// Gets or sets the rename tab command. + /// + public RelayCommand RenameTabCommand { get; set; } + + public RelayCommand FlytoProcessParametersCommand { get; set; } + + public RelayCommand SaveCommand { get; set; } + + #endregion + + public TestResultsViewVM(INotificationProvider notification, IActionLogManager actionLogManager) + { + _notification = notification; + _actionLogManager = actionLogManager; + ResultTabs = new ObservableCollection(); + + AddTabCommand = new RelayCommand(() => AddNewTab()); + RemoveTabCommand = new RelayCommand(RemoveTab); + RenameTabCommand = new RelayCommand(RenameTab); + + FlytoProcessParametersCommand = new RelayCommand(FlytoProcessParameters); + SaveCommand = new RelayCommand(Save, () => IsFree); + } + + #region Tabs modification + + /// + /// Removes the specified tab. + /// + /// The tab. + private void RemoveTab(TestResultViewVM tab) + { + if (ResultTabs.Count == 1) + return; + if (_notification.ShowQuestion("Are you sure you want to delete the selected tab?")) + { + _active_context.RubbingResults.RemoveRange(tab.TestResult.RubbingResults); + tab.TestResult.RubbingResults = null; + + _active_context.TensileResults.RemoveRange(tab.TestResult.TensileResults); + tab.TestResult.TensileResults = null; + + _active_context.RmlExtensionTestResults.Remove(tab.TestResult); + + ResultTabs.Remove(tab); + SelectedTab = ResultTabs.LastOrDefault(); + _active_context.SaveChanges(); + + } + } + + /// + /// Adds a new tab. + /// + private bool AddNewTab(String name = null) + { + if (ResultTabs.Count > 7) + { + //_notification.ShowError("Cannot exceed the maximum number of 8 tabs. You can remove a tab, or create a new project."); + return false; + } + + if (name == null) + { + name = _notification.ShowTextInput("Enter tab name", "Tab Name", "Test"); + } + + if (!String.IsNullOrWhiteSpace(name)) + { + var tab = CreateNewTestResultVM(name, (ResultTabs.Count + 1)); + ResultTabs.Add(tab); + _active_context.RmlExtensionTestResults.Add(tab.TestResult); + SelectedTab = tab; + return true; + } + else + { + return false; + } + } + + /// + /// Renames the tab. + /// + /// The tab. + private void RenameTab() + { + if (SelectedTab != null) + { + var name = _notification.ShowTextInput("Enter tab name", "Tab Name", SelectedTab.TestResult.Name); + + if (!String.IsNullOrWhiteSpace(name)) + { + SelectedTab.TestResult.Name = name; + } + } + } + #endregion + + #region Loading test results + + private void OnRMLExtemtionGUIDChanged() + { + ResultTabs.Clear(); + SelectedTab = null; + var settings = SettingsManager.Default.GetOrCreate(); + + SelectedMachine = ObservablesStaticCollections.Instance.Machines.SingleOrDefault(x => x.SerialNumber == settings.LastVirtualMachineSerialNumber); + } + + private void SelectedMachineChanged() + { + ResultTabs.Clear(); + SelectedTab = null; + LoadTestResults(); + } + public async void LoadTestResults() + { + if (SelectedMachine == null || SelectedMachine.Guid == null) + { + _notification.ShowWarning(LogManager.Log($" Please, select machine.", LogCategory.Warning)); + return; + } + + try + { + IsFree = false; + if (_active_context != null) + { + _active_context.Dispose(); + } + _active_context = ObservablesContext.CreateDefault(); + ResultTabs.Clear(); + LogManager.Log("Loading selected test results..."); + + using (_notification.PushTaskItem("Loading Test Results Parameters ...")) + { + var testResults = await new RMLExtensionTestResultsCollectionBuilder(_active_context).SetAll().ForRMLExtension(RMLExtemtionGUID).ForMachine(SelectedMachine.Guid).WithRubbingAndTensileResults().BuildAsync(); + SelectedTestResults = testResults.OrderBy(x => x.ResultIndex).ToSynchronizedObservableCollection(); + foreach (var result in SelectedTestResults) + { + ResultTabs.Add(new TestResultViewVM(_notification, _actionLogManager) { TestResult = result, ThreadName = ThreadName }); + if (result.ResultIndex == 1) + { + SelectedTab = ResultTabs[ResultTabs.Count - 1]; + } + } + if (ResultTabs.Count == 0) + { + SelectedTab = CreateNewTestResultVM("Untitled", 1); + ResultTabs.Add(SelectedTab); + _active_context.RmlExtensionTestResults.Add(SelectedTab.TestResult); + await _active_context.SaveChangesAsync(); + } + } + IsFree = true; + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error loading TestResults.\n{ex.FlattenMessage()}"); + } + finally + { + IsFree = true; + } + } + + private TestResultViewVM CreateNewTestResultVM(string name, int index) + { + TestResultViewVM newtab = new TestResultViewVM(_notification, _actionLogManager) { ThreadName = ThreadName }; + newtab.TestResult = new RmlExtensionTestResult() { RmlsExtensionsGuid = RMLExtemtionGUID, MachineGuid = SelectedMachine.Guid, ResultIndex = index, Name = name, BtsrMax = 0.0, BtsrMin = 0.0, DryerTemperature = 0, TunnelTemperature = 0, TunnelFlow = 0.0, TunnelAvgTemperature = 0.0, TensionHeadMax = 0.0, + TensionHeadMin = 0.0, TensioinAfterDryerMax = 0.0, TensionAfterDryerMin = 0.0, TensionWinderMax = 0.0, TensionWinderMin = 0.0, PullerTensionMax = 0.0, PullerTensionMin = 0.0, ExitTensionMax = 0.0, ExitTensionMin = 0.0, SeverityZone1Max = 0.0, SeverityZone1Min = 0.0, SeverityZone2Max = 0.0, SeverityZone2Min = 0.0, + RefLubVersion="", RefCof = 0.0, RefLub = 0.0, ThreadLubVersion = "", ThreadCof = 0.0, ThreadLub = 0.0, Conclusions="", Comment=""}; + var rubbingresults = new SynchronizedObservableCollection(); + rubbingresults.Add(new RubbingResult() { RmlExtensionTestResultsGuid = newtab.TestResult.Guid, TestResultColor = TestResultColors.CYAN }); + rubbingresults.Add(new RubbingResult() { RmlExtensionTestResultsGuid = newtab.TestResult.Guid, TestResultColor = TestResultColors.MAGENTA }); + rubbingresults.Add(new RubbingResult() { RmlExtensionTestResultsGuid = newtab.TestResult.Guid, TestResultColor = TestResultColors.YELLOW }); + rubbingresults.Add(new RubbingResult() { RmlExtensionTestResultsGuid = newtab.TestResult.Guid, TestResultColor = TestResultColors.BLACK }); + newtab.TestResult.RubbingResults = rubbingresults; + + var tensileresults = new SynchronizedObservableCollection(); + tensileresults.Add(new TensileResult() { RmlExtensionTestResultsGuid = newtab.TestResult.Guid, TestResultColor = TestResultColors.CYAN, ColorPercent = 100 }); + tensileresults.Add(new TensileResult() { RmlExtensionTestResultsGuid = newtab.TestResult.Guid, TestResultColor = TestResultColors.BLACK, ColorPercent = 100 }); + tensileresults.Add(new TensileResult() { RmlExtensionTestResultsGuid = newtab.TestResult.Guid, TestResultColor = TestResultColors.CYAN, ColorPercent = 200 }); + tensileresults.Add(new TensileResult() { RmlExtensionTestResultsGuid = newtab.TestResult.Guid, TestResultColor = TestResultColors.BLACK, ColorPercent = 200 }); + tensileresults.Add(new TensileResult() { RmlExtensionTestResultsGuid = newtab.TestResult.Guid, TestResultColor = TestResultColors.WHITE, ColorPercent = null }); + newtab.TestResult.TensileResults = tensileresults; + + return newtab; + } + + #endregion + #region Save + public void FlytoProcessParameters() + { + + } + + public async void Save() + { + if (SelectedMachine == null || SelectedMachine.Guid == null) + { + _notification.ShowWarning(LogManager.Log($"Could not save Test Results. Please, select machine.", LogCategory.Warning)); + return; + } + try + { + IsFree = false; + await Task.Factory.StartNew(() => + { + foreach (var tab in ResultTabs) + { + tab.TestResult.LastUpdated = DateTime.UtcNow; + } + _active_context.SaveChanges(); + }); + + LoadTestResults(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Could not save test results."); + _notification.ShowError($"An error occurred while trying to save test results.\n{ex.Message}"); + } + finally + { + IsFree = true; + EventHandler handler = SaveTestResults; + handler?.Invoke(this, new EventArgs()); + } + } + + #endregion + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ColorParametersView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ColorParametersView.xaml index 1526a49cb..739a2ae2c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ColorParametersView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ColorParametersView.xaml @@ -6,8 +6,10 @@ xmlns:local="clr-namespace:Tango.MachineStudio.ThreadExtensions.Views" xmlns:vm="clr-namespace:Tango.MachineStudio.ThreadExtensions.ViewModels" xmlns:converters="clr-namespace:Tango.MachineStudio.ThreadExtensions.Converters" + xmlns:enumerators="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" xmlns:global="clr-namespace:Tango.MachineStudio.ThreadExtensions" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:autoCompleteMachine="clr-namespace:Tango.MachineStudio.Common.AutoComplete;assembly=Tango.MachineStudio.Common" xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete" xmlns:oxy="http://oxyplot.org/wpf" xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI" @@ -17,6 +19,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MachineTestResultsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MachineTestResultsView.xaml.cs new file mode 100644 index 000000000..0af378b52 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MachineTestResultsView.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.ThreadExtensions.Views +{ + /// + /// Interaction logic for MachineTestResults.xaml + /// + public partial class MachineTestResultsView : UserControl + { + public MachineTestResultsView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MainView.xaml index 0ef5850c6..d40c3a05d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MainView.xaml @@ -12,8 +12,8 @@ d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - - + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MainView.xaml.cs index 251099c8a..d5af040f6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MainView.xaml.cs @@ -28,7 +28,7 @@ namespace Tango.MachineStudio.ThreadExtensions.Views TangoIOC.Default.Register(this); } - public void NavigateTo(ThreadExtensionNavigationView view) + public void NavigateTo(RMLExtensionNavigationView view) { navigationControl.NavigateTo(view.ToString()); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionView.xaml new file mode 100644 index 000000000..7e9d85f49 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionView.xaml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionView.xaml.cs new file mode 100644 index 000000000..1c7978f64 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionView.xaml.cs @@ -0,0 +1,27 @@ +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.Shapes; + +namespace Tango.MachineStudio.ThreadExtensions.Views +{ + /// + /// Interaction logic for ThreadExtView.xaml + /// + public partial class RMLExtentionView : UserControl + { + public RMLExtentionView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml new file mode 100644 index 000000000..6a1436348 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml.cs new file mode 100644 index 000000000..03bac4bbe --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml.cs @@ -0,0 +1,27 @@ +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.Shapes; + +namespace Tango.MachineStudio.ThreadExtensions.Views +{ + /// + /// Interaction logic for ThreadExtViews.xaml + /// + public partial class RMLExtensionsView : UserControl + { + public RMLExtensionsView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/TestResultsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/TestResultsView.xaml new file mode 100644 index 000000000..2654b4ff3 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/TestResultsView.xaml @@ -0,0 +1,622 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Conclusion: + + + + + Comments: + + + + + + + + + + + + + + + + + + + + + + Process Parameters + + + + + Dryer temperature + + + + + + Tunnel temperature + + + + + + Tunnel flow + + + + + + Tunnel AVG temperature + + + + + + + + + Rubbing results + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + - + + + + + + + + + + + Tension through the thread path + + + + Tension in Zone + + + Tensiometer (gr) + + + Tension in Zone + + + MS + + + Head + + + + + - + + + + + BTSR + + + + + - + + + + + After dryer + + + + + - + + + + + Puller tension + + + + + - + + + + + Winder + + + + + - + + + + + Winder Exit Tension + + + + + - + + + + + + + + Mechanical properties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Uniformity + + + + Uniformity + + + Severity + + + Zone 1 + + + + + - + + + + + Zone 2 + + + + + - + + + + + + + + COF + + + + Thread name + + + Lub version + + + COF + + + Lub amount + + + + + REF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/TestResultsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/TestResultsView.xaml.cs new file mode 100644 index 000000000..a75dc5d09 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/TestResultsView.xaml.cs @@ -0,0 +1,56 @@ +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.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; +using Tango.MachineStudio.ThreadExtensions.ViewModels; + +namespace Tango.MachineStudio.ThreadExtensions.Views +{ + /// + /// Interaction logic for TestResultsView.xaml + /// + public partial class TestResultsView : UserControl + { + private Dictionary _tabs_content; + + public TestResultsView() + { + InitializeComponent(); + + _tabs_content = new Dictionary(); + + this.Loaded += TestResultsView_Loaded; + } + private void TestResultsView_Loaded(object sender, RoutedEventArgs e) + { + + } + private void Border_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) + { + Border border = sender as Border; + if (border.Visibility != Visibility.Visible) + { + _tabs_content[border] = border.Child; + border.Child = null; + } + else + { + if (_tabs_content.ContainsKey(border)) + { + border.Child = _tabs_content[border]; + } + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadCharacteristicsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadCharacteristicsView.xaml index fac8e6af4..707991f0e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadCharacteristicsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadCharacteristicsView.xaml @@ -11,185 +11,226 @@ xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" + xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" mc:Ignorable="d" FontSize="16" d:DesignHeight="450" d:DesignWidth="1200" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - + - + + + + + + + + + + + + + - - - - - - - Yarn Source - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Yarn Source - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Yarn Data - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Yarn Properties from datasheet - - - - + + + + + + + + + + + + Yarn Source + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Yarn Source + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Yarn Data + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Yarn Properties from datasheet + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionView.xaml deleted file mode 100644 index f9d8a2dc3..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionView.xaml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionView.xaml.cs deleted file mode 100644 index 2cce29e57..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionView.xaml.cs +++ /dev/null @@ -1,27 +0,0 @@ -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.Shapes; - -namespace Tango.MachineStudio.ThreadExtensions.Views -{ - /// - /// Interaction logic for ThreadExtView.xaml - /// - public partial class ThreadExtentionView : UserControl - { - public ThreadExtentionView() - { - InitializeComponent(); - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionsView.xaml deleted file mode 100644 index b85222b12..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionsView.xaml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionsView.xaml.cs deleted file mode 100644 index 9afb7a5c8..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionsView.xaml.cs +++ /dev/null @@ -1,27 +0,0 @@ -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.Shapes; - -namespace Tango.MachineStudio.ThreadExtensions.Views -{ - /// - /// Interaction logic for ThreadExtViews.xaml - /// - public partial class ThreadExtensionsView : UserControl - { - public ThreadExtensionsView() - { - InitializeComponent(); - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/packages.config index 5a03cfb57..da5ed8abc 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/packages.config @@ -1,6 +1,7 @@  + -- cgit v1.3.1