diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2021-07-04 15:25:08 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2021-07-04 15:25:08 +0300 |
| commit | 8a0b8f6abe3d143b43131a330e0ee39c2547ce8f (patch) | |
| tree | 7178cbe758b1adefb37c53be6839446e18d9d791 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions | |
| parent | b29f337cff7513e0fe0e4b98e6bc7970da89e837 (diff) | |
| download | Tango-8a0b8f6abe3d143b43131a330e0ee39c2547ce8f.tar.gz Tango-8a0b8f6abe3d143b43131a330e0ee39c2547ce8f.zip | |
After Virus
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions')
26 files changed, 2435 insertions, 738 deletions
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<string, double> FACTOR100 = new Dictionary<string, double>() { - { "CYAN", 51.95}, {"MAGENTA", 47.47}, { "YELLOW", 94.05}, {"BLACK", 26.58}}; + public static Dictionary<FactorColors, double> FACTOR100 = new Dictionary<FactorColors, double>() { + { FactorColors.CYAN, 51.95}, {FactorColors.MAGENTA, 47.47}, { FactorColors.YELLOW, 94.05}, {FactorColors.BLACK, 26.58}}; - public static Dictionary<string, double> FACTOR200 = new Dictionary<string, double>() { - { "CYAN", 46.3}, {"MAGENTA", 41.04}, { "YELLOW", 97.78}, {"BLACK", 21.01}}; + public static Dictionary<FactorColors, double> FACTOR200 = new Dictionary<FactorColors, double>() { + { 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<DataPoint> _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; } } /// <summary> @@ -94,12 +95,12 @@ namespace Tango.MachineStudio.ThreadExtensions.Models } } - public PlotProperties(string colorName) + public PlotProperties(FactorColors color) { this.Points = new List<DataPoint>(); Target100Points = new List<DataPoint>(); Target200Points = new List<DataPoint>(); - 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 @@ <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> <HintPath>..\..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> </Reference> + <Reference Include="FontAwesome.WPF, Version=4.7.0.37774, Culture=neutral, PublicKeyToken=0758b07a11a4f466, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll</HintPath> + </Reference> <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> <HintPath>..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> </Reference> @@ -85,28 +88,40 @@ <Link>GlobalVersionInfo.cs</Link> </Compile> <Compile Include="Contracts\IMainView.cs" /> + <Compile Include="Converters\BoolToDisplayStatusConverter.cs" /> <Compile Include="Converters\ColorNameToBrushConverter.cs" /> + <Compile Include="Converters\ColorWithPercentToBrushConverter.cs" /> <Compile Include="Models\ColorDataExcelModel.cs" /> <Compile Include="Models\FactorTarget.cs" /> + <Compile Include="Models\MachineModel.cs" /> <Compile Include="Models\PlotProperties.cs" /> + <Compile Include="Models\RmlExtensionModel.cs" /> <Compile Include="ViewModelLocator.cs" /> <Compile Include="ViewModels\ColorParametersVewVM.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="ViewModels\TestResultsViewVM.cs" /> + <Compile Include="ViewModels\TestResultViewVM.cs" /> <Compile Include="Views\ColorParametersView.xaml.cs"> <DependentUpon>ColorParametersView.xaml</DependentUpon> </Compile> + <Compile Include="Views\MachineTestResultsView.xaml.cs"> + <DependentUpon>MachineTestResultsView.xaml</DependentUpon> + </Compile> <Compile Include="Views\MainView.xaml.cs"> <DependentUpon>MainView.xaml</DependentUpon> </Compile> <Compile Include="ThreadExtensionsModule.cs" /> + <Compile Include="Views\TestResultsView.xaml.cs"> + <DependentUpon>TestResultsView.xaml</DependentUpon> + </Compile> <Compile Include="Views\ThreadCharacteristicsView.xaml.cs"> <DependentUpon>ThreadCharacteristicsView.xaml</DependentUpon> </Compile> - <Compile Include="Views\ThreadExtensionView.xaml.cs"> - <DependentUpon>ThreadExtensionView.xaml</DependentUpon> + <Compile Include="Views\RMLExtensionView.xaml.cs"> + <DependentUpon>RMLExtensionView.xaml</DependentUpon> </Compile> - <Compile Include="Views\ThreadExtensionsView.xaml.cs"> - <DependentUpon>ThreadExtensionsView.xaml</DependentUpon> + <Compile Include="Views\RMLExtensionsView.xaml.cs"> + <DependentUpon>RMLExtensionsView.xaml</DependentUpon> </Compile> <Page Include="App.xaml"> <Generator>MSBuild:Compile</Generator> @@ -116,19 +131,27 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Views\MachineTestResultsView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\MainView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Views\TestResultsView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\ThreadCharacteristicsView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> - <Page Include="Views\ThreadExtensionView.xaml"> + <Page Include="Views\RMLExtensionView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> - <Page Include="Views\ThreadExtensionsView.xaml"> + <Page Include="Views\RMLExtensionsView.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> 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<ColorProcessData> _magentaProcessData; public ObservableCollection<ColorProcessData> MagentaProcessData { @@ -76,7 +81,7 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels RaisePropertyChangedAuto(); } } - + private ObservableCollection<ColorProcessData> _yellowProcessData; public ObservableCollection<ColorProcessData> 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; } } - /// <summary> - /// Gets or sets the machines providers. - /// </summary> - public ISuggestionProvider MachinesProvider { get; set; } - protected Machine _selectedMachine; + private string _RMLExtentionGUID; + + public string RMLExtemtionGUID + { + get { return _RMLExtentionGUID; } + set + { + _RMLExtentionGUID = value; + OnRMLExtensionGUIDChanged(); + } + } + + protected string _selectedMachineGuid; /// <summary> /// Gets or sets the selected machine. /// </summary> - 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<string, ColorProcessData> _removedColorProcessDataBeforeSave; - - public Dictionary<string, ColorProcessData> RemovedColorProcessDataBeforeSave - { - get { return _removedColorProcessDataBeforeSave; } - set { _removedColorProcessDataBeforeSave = value; } - } + + /// <summary> + /// Saved guid of the removed color process data before save. + /// </summary> + private List<string> RemovedColorProcessDataBeforeSave { get; set;} #endregion #region commands + public RelayCommand SaveCommand { get; set; } + + public RelayCommand<FactorColors> 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<ColorDataExcelModel> 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<string, ColorProcessData>(); + RemovedColorProcessDataBeforeSave = new List<string>(); - MachinesProvider = new SuggestionProvider((filter) => - { - try - { - return _machineDbContext.Machines.Where(x => x.SerialNumber.StartsWith(filter)).ToList(); - } - catch - { - return null; - } - }); CyanProcessData = new ObservableCollection<ColorProcessData>(); CyanProcessData.CollectionChanged += OnCyanCollectionChanged; @@ -362,115 +377,125 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels BlackProcessData = new ObservableCollection<ColorProcessData>(); 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<FactorColors>(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) + { + BlackPlot.CreateGraph(BlackProcessData.ToList(), true); + UpdateFactorsOnChangeProcessData(FactorColors.BLACK); + } + } + + private void OnColorCollectionChange(NotifyCollectionChangedEventArgs e, FactorColors color, PropertyChangedEventHandler eventHandler) + { + if (e.Action == NotifyCollectionChangedAction.Reset) { - var blackProcessData = SelectedColorProcessParameter.ColorProcessData.Where(x => x.ColorName == "BLACK").ToObservableCollection(); - foreach (ColorProcessData item in blackProcessData) + 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 /// </summary> /// <param name="factor">The factor.</param> /// <param name="item">The item.</param> - 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; + } /// <summary> /// Calculate and Update the factors on change process data. /// </summary> /// <param name="color">The color.</param> - 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) + //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<ColorProcessData> 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 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; - } - if (minInk == null || minInk.InkNlCm > item.InkNlCm) + 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)) { - 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<string, ColorProcessData> 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<User> _allUsers; + #region properties - private ObservableCollection<RmlsExtension> _rmlsExtension; - public ObservableCollection<RmlsExtension> RmlsExtensions + //private ObservableCollection<RmlsExtension> _rmlsExtension; + //public ObservableCollection<RmlsExtension> RmlsExtensions + //{ + // get { return _rmlsExtension; } + // set { _rmlsExtension = value; + // RaisePropertyChangedAuto(); } + //} + + private List<RmlExtensionModel> _rmlExtensions; + public List<RmlExtensionModel> RmlExtensions { - get { return _rmlsExtension; } - set { _rmlsExtension = value; + 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> _yarnColor; - public ObservableCollection<YarnColor> YarnColor + private ObservableCollection<YarnWhiteShade> _yarnWhiteShade; + public ObservableCollection<YarnWhiteShade> YarnWhiteShade { - get { return _yarnColor; } - set { _yarnColor = value; RaisePropertyChangedAuto(); } + get { return _yarnWhiteShade; } + set { _yarnWhiteShade = value; RaisePropertyChangedAuto(); } } - - private ObservableCollection<YarnEndUse> _enduse; - public ObservableCollection<YarnEndUse> EndUse + private ObservableCollection<MediaPurpos> _enduse; + public ObservableCollection<MediaPurpos> EndUse { get { return _enduse; } set { _enduse = value; RaisePropertyChangedAuto(); } } - + + private ObservableCollection<LinearMassDensityUnit> _units; + public ObservableCollection<LinearMassDensityUnit> Units + { + get { return _units; } + set { _units = value; RaisePropertyChangedAuto(); } + } + private ObservableCollection<YarnFamily> _family; public ObservableCollection<YarnFamily> Family { @@ -112,8 +141,8 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels set { _family = value; RaisePropertyChangedAuto(); } } - private ObservableCollection<YarnGeometry> _geometry; - public ObservableCollection<YarnGeometry> Geometry + private ObservableCollection<FiberShape> _geometry; + public ObservableCollection<FiberShape> Geometry { get { return _geometry; } set { _geometry = value; RaisePropertyChangedAuto(); } @@ -133,20 +162,30 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels set { _group = value; RaisePropertyChangedAuto(); } } - private ObservableCollection<YarnManufacturer> _manufacturer; - public ObservableCollection<YarnManufacturer> Manufacturer + //private ObservableCollection<YarnManufacturer> _manufacturer; + //public ObservableCollection<YarnManufacturer> Manufacturer + //{ + // get { return _manufacturer; } + // set { _manufacturer = value; RaisePropertyChangedAuto(); } + //} + private List<String> _manufacturers; + + public List<String> Manufacturers { - get { return _manufacturer; } - set { _manufacturer = value; RaisePropertyChangedAuto(); } + get { return _manufacturers; } + set { _manufacturers = value; + RaisePropertyChangedAuto(); + } } - private ObservableCollection<YarnMaterial> _materials; - public ObservableCollection<YarnMaterial> Materials + + private ObservableCollection<MediaMaterial> _materials; + public ObservableCollection<MediaMaterial> Materials { get { return _materials; } set { _materials = value; RaisePropertyChangedAuto(); } } - + private ObservableCollection<YarnSubFamily> _subFamilies; public ObservableCollection<YarnSubFamily> 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,98 +235,70 @@ 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; + /// <summary> + /// Gets or sets the selected machine. + /// </summary> + public Machine SelectedMachine { - using (_notification.PushTaskItem("Cloning thread...")) + get { return _selectedMachine; } + set { - try + if (value != null && _selectedMachine != value) { - 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) - { - 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<MachineModel> _machines; + /// <summary> + /// Gets or sets the Machines. + /// </summary> + public ObservableCollection<MachineModel> 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) { _notification = notificationProvider; @@ -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(); + 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() + { + Guid = x.Guid, + Name = x.Name, + SerialNumber = x.SerialNumber + }).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) + + private RmlsExtension GetNewRMLsExtension( string RML_Guid) { - using (_notification.PushTaskItem("Creating new RML Extension...")) - { - 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(); + 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(); - //_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); + //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; - IsFree = true; - } + return rml_extention; } - private async void LoadActiveRMLExtention(String guid) + 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<MachineStudioSettings>(); + 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."); + /// <summary> + /// Saves this instance. + /// </summary> + 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; + /// <summary> + /// Gets or sets the name of the thread. Using in print + /// </summary> + /// <value> + /// The name of the thread. + /// </value> + public string ThreadName + { + get { return _threadName; } + set + { + _threadName = value; + RaisePropertyChangedAuto(); + } + } + + + private bool _isSelected; + /// <summary> + /// Gets or sets a value indicating whether this instance is selected. + /// </summary> + 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<RmlExtensionTestResult> _selectedTestResults; + + public SynchronizedObservableCollection<RmlExtensionTestResult> SelectedTestResults + { + get { return _selectedTestResults; } + set { _selectedTestResults = value; } + } + + + private ObservableCollection<TestResultViewVM> _resultTabs; + + public ObservableCollection<TestResultViewVM> ResultTabs + { + get { return _resultTabs; } + set { _resultTabs = value; } + } + + private TestResultViewVM _selectedTab; + /// <summary> + /// Gets or sets the selected tab. + /// </summary> + 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(); + } + } + /// <summary> + /// Gets or sets the machines providers. + /// </summary> + //public ISuggestionProvider MachinesProvider { get; set; } + + protected Machine _selectedMachine; + /// <summary> + /// Gets or sets the selected machine. + /// </summary> + 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 + /// <summary> + /// Gets or sets the add tab command. + /// </summary> + public RelayCommand AddTabCommand { get; set; } + + /// <summary> + /// Gets or sets the remove tab command. + /// </summary> + public RelayCommand<TestResultViewVM> RemoveTabCommand { get; set; } + + /// <summary> + /// Gets or sets the rename tab command. + /// </summary> + 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<TestResultViewVM>(); + + AddTabCommand = new RelayCommand(() => AddNewTab()); + RemoveTabCommand = new RelayCommand<TestResultViewVM>(RemoveTab); + RenameTabCommand = new RelayCommand(RenameTab); + + FlytoProcessParametersCommand = new RelayCommand(FlytoProcessParameters); + SaveCommand = new RelayCommand(Save, () => IsFree); + } + + #region Tabs modification + + /// <summary> + /// Removes the specified tab. + /// </summary> + /// <param name="tab">The tab.</param> + 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(); + + } + } + + /// <summary> + /// Adds a new tab. + /// </summary> + 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; + } + } + + /// <summary> + /// Renames the tab. + /// </summary> + /// <param name="tab">The tab.</param> + 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<MachineStudioSettings>(); + + 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<RubbingResult>(); + 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<TensileResult>(); + 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 @@ <UserControl.Resources> + <autoCompleteMachine:MachinesProvider x:Key="MachinesProvider" /> <converters:ColorNameToBrushConverter x:Key="ColorNameToBrushConverter"/> <Style x:Key="CellNumericUpDown" TargetType="{x:Type mahapps:NumericUpDown}" BasedOn="{StaticResource {x:Type mahapps:NumericUpDown}}"> @@ -81,20 +84,6 @@ </Grid.ColumnDefinitions> <DockPanel Grid.Column="0"> - <StackPanel Orientation="Horizontal" DockPanel.Dock="Top"> - <TextBlock Margin="40 20" FontSize="30" FontWeight="SemiBold" FontStyle="Italic">TARGET MACHINE</TextBlock> - - <autoComplete:AutoCompleteTextBox Provider="{Binding MachinesProvider}" LoadingContent="Loading..." FontSize="20" SelectedItem="{Binding SelectedMachine,Mode=TwoWay}" materialDesign:HintAssist.Hint="Serial Number" DisplayMember="SerialNumber"> - <autoComplete:AutoCompleteTextBox.ItemTemplate> - <DataTemplate> - <StackPanel> - <TextBlock Text="{Binding SerialNumber}" FontWeight="Bold" FontStyle="Italic"></TextBlock> - <TextBlock FontSize="11" Text="{Binding Name}" Foreground="Gray"></TextBlock> - </StackPanel> - </DataTemplate> - </autoComplete:AutoCompleteTextBox.ItemTemplate> - </autoComplete:AutoCompleteTextBox> - </StackPanel> <UniformGrid Columns="2" FirstColumn="0" Name="uniformGrid1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" > <DockPanel Grid.Column="0" Grid.Row="0" x:Name="CyanPanel"> @@ -107,6 +96,7 @@ <Button DockPanel.Dock="Right" HorizontalAlignment="Left" Padding="2" Height="26" Width="140" Background="Transparent" Command="{Binding ImportCyanDataCommand}" ToolTip="Import Cyan data " Margin="0 0 10 0" BorderBrush="{StaticResource TransparentBackgroundBrush200}" BorderThickness="1 1 0.8 2"> <TextBlock FontSize="14" Foreground="{StaticResource MainWindow.Foreground}">IMPORT DATA</TextBlock> </Button> + <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Margin="20 4 0 0" FontSize="16" Padding="0">LIQUID TYPE CYAN</TextBlock> </DockPanel> @@ -308,7 +298,22 @@ </DockPanel> </UniformGrid> </DockPanel> - <StackPanel Orientation="Vertical" Grid.Column="1" Margin="40 60 0 0"> + <DockPanel Grid.Column="1"> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Top" HorizontalAlignment="Right"> + <Button HorizontalAlignment="Right" VerticalAlignment="Center" Height="35" Width="170" ToolTip="Apply to RML Liquid factors" Margin="0 0 20 0" > + <TextBlock FontSize="14" >Save Factors</TextBlock> + </Button> + <Button HorizontalAlignment="Right" Width="170" Height="35" VerticalAlignment="Center" Command="{Binding SaveCommand}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="ContentSaveAll" Width="24" Height="24" /> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">SAVE</TextBlock> + </StackPanel> + </Button> + +</StackPanel> + + + <StackPanel Orientation="Vertical" Margin="40 20 0 0"> <Border BorderBrush="{StaticResource Statistics.BorderBrush}" BorderThickness="1"> <UniformGrid Rows="2" Columns="4" x:Name="whitePointsGrid" DataContext="{Binding SelectedColorProcessParameter}"> <Border BorderThickness="0 0 0 0" Background="Transparent" BorderBrush="{StaticResource BorderBrushGainsboro}"> @@ -327,26 +332,19 @@ <TextBlock FontSize="12" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10 0 0 0" Foreground="{StaticResource GrayBrush200}">White point</TextBlock> </Border> <Border BorderThickness="1 1 0 0" Background="Transparent" BorderBrush="{StaticResource BorderBrushGainsboro}"> - <mahapps:NumericUpDown Minimum="-500" Maximum="500" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding WhitePointL, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Margin="10 0 0 0"></mahapps:NumericUpDown> + <mahapps:NumericUpDown Minimum="-500" Maximum="500" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding Path=DataContext.ActiveRML.WhitePointL, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" FontSize="14" Margin="10 0 0 0"></mahapps:NumericUpDown> </Border> <Border BorderThickness="1 1 0 0" Background="Transparent" BorderBrush="{StaticResource BorderBrushGainsboro}"> - <mahapps:NumericUpDown Minimum="-500" Maximum="500" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding WhitePointA,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Margin="10 0 0 0"></mahapps:NumericUpDown> + <mahapps:NumericUpDown Minimum="-500" Maximum="500" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding Path=DataContext.ActiveRML.WhitePointA,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" FontSize="14" Margin="10 0 0 0"></mahapps:NumericUpDown> </Border> <Border BorderThickness="1 1 0 0" Background="Transparent" BorderBrush="{StaticResource BorderBrushGainsboro}"> - <mahapps:NumericUpDown Minimum="-500" Maximum="500" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding WhitePointB,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Margin="10 0 0 0"></mahapps:NumericUpDown> + <mahapps:NumericUpDown Minimum="-500" Maximum="500" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding Path=DataContext.ActiveRML.WhitePointB,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" FontSize="14" Margin="10 0 0 0"></mahapps:NumericUpDown> </Border> </UniformGrid> </Border> - <!--<DataGrid x:Name="whitePointGrid" HorizontalAlignment="Left" VerticalScrollBarVisibility ="Auto" Height="Auto" SelectionUnit="FullRow" BorderBrush="{StaticResource DarkGrayBrush }" BorderThickness="1" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding WhitePoints}" Margin="0 0 0 20"> - <DataGrid.Columns> - <DataGridTextColumn Header="" Width="1*" Binding="{Binding Name}" /> - <mahapps:DataGridNumericUpDownColumn Header="L" Minimum="0" Maximum="100" Binding="{Binding L}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}"/> - <mahapps:DataGridNumericUpDownColumn Header="A" Minimum="-128" Maximum="127" Binding="{Binding A}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" /> - <mahapps:DataGridNumericUpDownColumn Header="B" Minimum="-128" Maximum="127" Binding="{Binding B}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" /> - </DataGrid.Columns> - </DataGrid>--> - - <DataGrid x:Name="Factor100Grid" HorizontalAlignment="Left" VerticalScrollBarVisibility ="Auto" MaxHeight="250" RowHeight="26" Padding="0" SelectionUnit="FullRow" BorderBrush="{StaticResource DarkGrayBrush }" BorderThickness="1" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Factor100ProcessData}" Margin="0 10 0 20"> + + + <DataGrid x:Name="Factor100Grid" HorizontalAlignment="Left" VerticalScrollBarVisibility ="Auto" MaxHeight="250" RowHeight="26" Padding="0" SelectionUnit="FullRow" BorderBrush="{StaticResource DarkGrayBrush }" BorderThickness="1" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Factor100ProcessData}" Margin="0 20 0 20"> <DataGrid.CellStyle> <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> <Setter Property="BorderThickness" Value="0"/> @@ -360,7 +358,7 @@ <DataGridTemplateColumn Header="Factor 100%" Width="1*"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> - <Border BorderThickness="0" Background="{Binding ColorName, Converter={StaticResource ColorNameToBrushConverter}}"> + <Border BorderThickness="0" Background="{Binding FactorColor, Converter={StaticResource ColorNameToBrushConverter}}"> <mahapps:NumericUpDown Minimum="0" Maximum="500" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" VerticalContentAlignment="Top" Margin="0" Padding="0" HideUpDownButtons="True" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding InkNlCm,Mode=TwoWay}" FontSize="14"></mahapps:NumericUpDown> </Border> @@ -389,14 +387,13 @@ <DataGridTemplateColumn Header="Factor 200%" Width="1*"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> - <Border BorderThickness="0" Background="{Binding ColorName, Converter={StaticResource ColorNameToBrushConverter}}"> + <Border BorderThickness="0" Background="{Binding FactorColor, Converter={StaticResource ColorNameToBrushConverter}}"> <mahapps:NumericUpDown Minimum="0" Maximum="500" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding InkNlCm,Mode=TwoWay}" FontSize="14"></mahapps:NumericUpDown> </Border> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> - <!--<mahapps:DataGridNumericUpDownColumn Header="Factor 200%" Minimum="0" Maximum="100" Binding="{Binding InkNlCm}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource ColorCellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" />--> <mahapps:DataGridNumericUpDownColumn Header="L" Minimum="0" Maximum="100" Binding="{Binding L}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource FactorCellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}"/> <mahapps:DataGridNumericUpDownColumn Header="A" Minimum="-128" Maximum="127" Binding="{Binding A}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource FactorCellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" /> <mahapps:DataGridNumericUpDownColumn Header="B" Minimum="-128" Maximum="127" Binding="{Binding B}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource FactorCellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" /> @@ -418,15 +415,14 @@ <DataGridTemplateColumn Header="Min Ink Uptake" Width="1*"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> - <Border BorderThickness="0" Background="{Binding ColorName, Converter={StaticResource ColorNameToBrushConverter}}"> + <Border BorderThickness="0" Background="{Binding FactorColor, Converter={StaticResource ColorNameToBrushConverter}}"> <mahapps:NumericUpDown Minimum="0" Maximum="500" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding InkNlCm,Mode=TwoWay}" FontSize="14"></mahapps:NumericUpDown> </Border> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> - <!--<mahapps:DataGridNumericUpDownColumn Header="Factor 200%" Minimum="0" Maximum="100" Binding="{Binding InkNlCm}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource ColorCellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" />--> - <mahapps:DataGridNumericUpDownColumn Header="L" Minimum="0" Maximum="100" Binding="{Binding L}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource FactorCellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}"/> + <mahapps:DataGridNumericUpDownColumn Header="L" Minimum="0" Maximum="100" Binding="{Binding L}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource FactorCellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}"/> <mahapps:DataGridNumericUpDownColumn Header="A" Minimum="-128" Maximum="127" Binding="{Binding A}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource FactorCellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" /> <mahapps:DataGridNumericUpDownColumn Header="B" Minimum="-128" Maximum="127" Binding="{Binding B}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource FactorCellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" /> </DataGrid.Columns> @@ -447,28 +443,20 @@ <DataGridTemplateColumn Header="Max Ink Uptake" Width="1*"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> - <Border BorderThickness="0" Background="{Binding ColorName, Converter={StaticResource ColorNameToBrushConverter}}"> + <Border BorderThickness="0" Background="{Binding FactorColor, Converter={StaticResource ColorNameToBrushConverter}}"> <mahapps:NumericUpDown Minimum="0" Maximum="500" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding InkNlCm,Mode=TwoWay}" FontSize="14"></mahapps:NumericUpDown> </Border> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> - <!--<mahapps:DataGridNumericUpDownColumn Header="Factor 200%" Minimum="0" Maximum="100" Binding="{Binding InkNlCm}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource ColorCellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" />--> <mahapps:DataGridNumericUpDownColumn Header="L" Minimum="0" Maximum="100" Binding="{Binding L}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource FactorCellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" /> <mahapps:DataGridNumericUpDownColumn Header="A" Minimum="-128" Maximum="127" Binding="{Binding A}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource FactorCellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" /> <mahapps:DataGridNumericUpDownColumn Header="B" Minimum="-128" Maximum="127" Binding="{Binding B}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource FactorCellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" /> </DataGrid.Columns> </DataGrid> - - <!--<DataGrid x:Name="inktGrid" HeadersVisibility="None" HorizontalAlignment="Left" VerticalScrollBarVisibility ="Auto" MaxHeight="280" SelectionUnit="FullRow" BorderBrush="{StaticResource DarkGrayBrush }" BorderThickness="1" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding InkUptake}" Margin="0 10 0 20"> - <DataGrid.Columns> - <DataGridTextColumn Header="" Width="1*" Binding="{Binding Name}" /> - <mahapps:DataGridNumericUpDownColumn Minimum="0" Maximum="100" Binding="{Binding InkUptakeValue}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}"/> - </DataGrid.Columns> - </DataGrid>--> - </StackPanel> + </DockPanel> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MachineTestResultsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MachineTestResultsView.xaml new file mode 100644 index 000000000..a8aa173df --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MachineTestResultsView.xaml @@ -0,0 +1,82 @@ +<UserControl x:Class="Tango.MachineStudio.ThreadExtensions.Views.MachineTestResultsView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="clr-namespace:Tango.MachineStudio.ThreadExtensions.Views" + xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete" + xmlns:autoCompleteMachine="clr-namespace:Tango.MachineStudio.Common.AutoComplete;assembly=Tango.MachineStudio.Common" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:vm="clr-namespace:Tango.MachineStudio.ThreadExtensions.ViewModels" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:global="clr-namespace:Tango.MachineStudio.ThreadExtensions" + mc:Ignorable="d" + d:DesignHeight="450" d:DesignWidth="1200" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + + <UserControl.Resources> + + <autoCompleteMachine:MachinesProvider x:Key="MachinesProvider" /> + </UserControl.Resources> + + <Grid> + <DockPanel> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Top"> + <TextBlock Margin="40 10" FontSize="20" FontWeight="SemiBold" FontStyle="Italic">TARGET MACHINE</TextBlock> + + <controls:SearchComboBox FontSize="20" SelectedItem="{Binding SelectedMachine,Mode=TwoWay}" materialDesign:HintAssist.Hint="Serial Number" Width="280" HorizontalContentAlignment="Stretch" SearchProperty="Name" ItemsSource="{Binding Machines}"> + <controls:SearchComboBox.ItemTemplate> + <DataTemplate> + <StackPanel> + <TextBlock Text="{Binding SerialNumber}" FontWeight="Bold" FontStyle="Italic"/> + <TextBlock FontSize="11" Text="{Binding Name}" Foreground="Gray"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Style.Triggers> + <DataTrigger Binding="{Binding HasTestResults ,RelativeSource={RelativeSource FindAncestor, AncestorType=ContentControl}}" Value="True"> + <Setter Property="Foreground" Value="Red"/> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </StackPanel> + <DataTemplate.Triggers> + <DataTrigger Binding="{Binding HasRMLTest,RelativeSource={RelativeSource FindAncestor, AncestorType=ContentControl}}"> + <Setter Property="ContentTemplate"> + <Setter.Value> + <DataTemplate> + <StackPanel> + <TextBlock Text="{Binding SerialNumber}" FontWeight="Bold" FontStyle="Italic"></TextBlock> + <TextBlock FontSize="11" Text="{Binding Name}" Foreground="Gray"></TextBlock> + </StackPanel> + </DataTemplate> + </Setter.Value> + </Setter> + </DataTrigger> + </DataTemplate.Triggers> + </DataTemplate> + </controls:SearchComboBox.ItemTemplate> + </controls:SearchComboBox> + </StackPanel> + <Grid IsEnabled="{Binding IsFree}" Margin="0 30 20 10" > + <TabControl Background="Transparent" Margin="0,-50,0,0" x:Name="processTabControl" Padding="0 25 0 0" > + <TabControl.Resources> + <Style TargetType="TabPanel"> + <Setter Property="HorizontalAlignment" Value="Center"/> + </Style> + <Style TargetType="TabItem" BasedOn="{StaticResource {x:Type TabItem}}"> + <Setter Property="Padding" Value="20,2"></Setter> + </Style> + </TabControl.Resources> + <TabItem Header="COLOR PARAMETERS" Margin="20 0 0 0" mahapps:ControlsHelper.HeaderFontSize="20"> + <local:ColorParametersView/> + </TabItem> + <TabItem Header="TEST RESULTS" Margin="20 0 0 0" mahapps:ControlsHelper.HeaderFontSize="20"> + <local:TestResultsView /> + </TabItem> + </TabControl> + </Grid> + </DockPanel> + </Grid> +</UserControl> 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 +{ + /// <summary> + /// Interaction logic for MachineTestResults.xaml + /// </summary> + 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}"> <Grid IsEnabled="{Binding IsFree}"> <controls:NavigationControl x:Name="navigationControl" TransitionType="Slide"> - <local:ThreadExtensionsView /> - <local:ThreadExtentionView/> + <local:RMLExtensionsView /> + <local:RMLExtentionView/> </controls:NavigationControl> </Grid> </UserControl> 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<IMainView>(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/ThreadExtensionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionView.xaml index f9d8a2dc3..7e9d85f49 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionView.xaml @@ -1,4 +1,4 @@ -<UserControl x:Class="Tango.MachineStudio.ThreadExtensions.Views.ThreadExtentionView" +<UserControl x:Class="Tango.MachineStudio.ThreadExtensions.Views.RMLExtentionView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -6,12 +6,26 @@ xmlns:global="clr-namespace:Tango.MachineStudio.ThreadExtensions" xmlns:local="clr-namespace:Tango.MachineStudio.ThreadExtensions.Views" xmlns:vm="clr-namespace:Tango.MachineStudio.ThreadExtensions.ViewModels" + xmlns:localconv ="clr-namespace:Tango.MachineStudio.ThreadExtensions.Converters" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:sys="clr-namespace:System;assembly=mscorlib" mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + + <UserControl.Resources> + <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter"/> + + <ObjectDataProvider x:Key="RMLExtensionStatus" ObjectType="{x:Type sys:Enum}" MethodName="GetValues"> + <ObjectDataProvider.MethodParameters> + <x:Type TypeName="enumerations:RMLExtensionStatus"/> + </ObjectDataProvider.MethodParameters> + </ObjectDataProvider> + + </UserControl.Resources> <Grid> <DockPanel> <Grid DockPanel.Dock="Top" Panel.ZIndex="200"> @@ -19,15 +33,19 @@ <Button Style="{StaticResource MaterialDesignFlatButton}" Height="Auto" Command="{Binding BackToThreadExtensionViewsCommand}"> <materialDesign:PackIcon Kind="ArrowLeft" Width="50" Height="50" Foreground="{StaticResource DarkGrayBrush200}" ToolTip="Back to Thread list" /> </Button> - <TextBlock MaxWidth="350" Text="{Binding ActiveRMLExtention.Name}" VerticalAlignment="Center" Margin="10 0 0 0" FontSize="30" TextWrapping="Wrap"></TextBlock> + <TextBlock MaxWidth="350" Text="{Binding ActiveRML.Name}" VerticalAlignment="Center" Margin="10 0 0 0" FontSize="30" TextWrapping="Wrap"></TextBlock> </StackPanel> - - <Button HorizontalAlignment="Right" Width="170" Height="45" Margin="0 0 20 0" VerticalAlignment="Center" Command="{Binding SaveCommand}"> - <StackPanel Orientation="Horizontal"> - <materialDesign:PackIcon Kind="ContentSaveAll" Width="24" Height="24" /> - <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">SAVE</TextBlock> - </StackPanel> - </Button> + <StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Margin="0 20 50 0"> + <TextBlock Text="Status: " VerticalAlignment="Center" FontSize="20" Margin="0 3 0 0"></TextBlock> + <ComboBox Margin="20 0 40 0" FontSize="20" ItemsSource="{Binding Source={StaticResource RMLExtensionStatus}}" SelectedItem="{Binding ActiveRMLExtension.RMLStatus, Mode=TwoWay}" Width="160"> + <ComboBox.ItemTemplate> + <DataTemplate> + <TextBlock Text="{Binding Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock> + </DataTemplate> + </ComboBox.ItemTemplate> + </ComboBox> + </StackPanel> + </Grid> <Grid DockPanel.Dock="Bottom"> @@ -35,7 +53,7 @@ <Grid> <Grid IsEnabled="{Binding IsFree}" Margin="40" > - <TabControl Background="Transparent" Margin="0,-70,0,0" x:Name="processTabControl" Padding="0 25 0 0"> + <TabControl Background="Transparent" Margin="0,-70,0,0" x:Name="processTabControl" Padding="0 25 0 0" > <TabControl.Resources> <Style TargetType="TabPanel"> <Setter Property="HorizontalAlignment" Value="Center"/> @@ -47,11 +65,14 @@ <TabItem Header="THREAD CHARACTERISTICS" Margin="-100 0 0 0" mahapps:ControlsHelper.HeaderFontSize="20"> <local:ThreadCharacteristicsView x:Name="threadParametersView" /> </TabItem> - <TabItem Header="COLOR PARAMETERS" Margin="-100 0 0 0" mahapps:ControlsHelper.HeaderFontSize="20"> + <TabItem Header="MACHINE TEST RESULTS" Margin="-100 0 0 0" mahapps:ControlsHelper.HeaderFontSize="20"> + <local:MachineTestResultsView/> + </TabItem> + <!--<TabItem Header="COLOR PARAMETERS" Margin="-100 0 0 0" mahapps:ControlsHelper.HeaderFontSize="20"> <local:ColorParametersView/> </TabItem> - <!--<TabItem Header="COLOR parameters" Margin="-100 0 0 0" mahapps:ControlsHelper.HeaderFontSize="20"> - <local:ColorCalibrationView DataContext="{Binding ColorCalibrationVM}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"/> + <TabItem Header="TEST RESULTS" Margin="-100 0 0 0" mahapps:ControlsHelper.HeaderFontSize="20"> + <local:TestResultsView /> </TabItem>--> </TabControl> </Grid> 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/RMLExtensionView.xaml.cs index 2cce29e57..1c7978f64 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionView.xaml.cs @@ -17,9 +17,9 @@ namespace Tango.MachineStudio.ThreadExtensions.Views /// <summary> /// Interaction logic for ThreadExtView.xaml /// </summary> - public partial class ThreadExtentionView : UserControl + public partial class RMLExtentionView : UserControl { - public ThreadExtentionView() + public RMLExtentionView() { 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/RMLExtensionsView.xaml index b85222b12..6a1436348 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml @@ -1,4 +1,4 @@ -<UserControl x:Class="Tango.MachineStudio.ThreadExtensions.Views.ThreadExtensionsView" +<UserControl x:Class="Tango.MachineStudio.ThreadExtensions.Views.RMLExtensionsView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" @@ -10,12 +10,15 @@ xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:localconverters="clr-namespace:Tango.MachineStudio.ThreadExtensions.Converters" mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> <UserControl.Resources> <converters:DateTimeUTCToShortDateTimeConverter x:Key="DateTimeUTCToShortDateTimeConverter" /> - <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> + <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"/> + <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter"/> + <localconverters:BoolToDisplayStatusConverter x:Key="BoolToDisplayStatusConverter"/> </UserControl.Resources> <Grid IsEnabled="{Binding IsFree}"> @@ -30,7 +33,7 @@ <Grid DockPanel.Dock="Bottom"> <StackPanel> <Grid> - <StackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Left" Margin="0 0 0 0"> + <!--<StackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Left" Margin="0 0 0 0"> <Button Margin="0 0 10 0" MinWidth="160" Height="50" Background="{StaticResource RedBrush300}" BorderBrush="{StaticResource RedBrush300}" Command="{Binding RemoveRmlExtensionCommand}"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon Kind="Delete" Width="20" Height="20" /> @@ -49,7 +52,7 @@ <TextBlock Margin="5 0 0 0" FontSize="16">NEW</TextBlock> </StackPanel> </Button> - </StackPanel> + </StackPanel>--> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> <Button Margin="50 0 0 0" MinWidth="200" Height="60" Command="{Binding ManageRmlExtensionCommand}"> <StackPanel Orientation="Horizontal"> @@ -61,7 +64,7 @@ </Grid> <StackPanel Orientation="Horizontal" Margin="0 40 0 0"> - <Button Command="{Binding ImportRMLFileCommand}" Foreground="{StaticResource BlackForegroundBrush}" FontSize="16" Style="{StaticResource emptyButton}" Cursor="Hand"> + <!--<Button Command="{Binding ImportRMLFileCommand}" Foreground="{StaticResource BlackForegroundBrush}" FontSize="16" Style="{StaticResource emptyButton}" Cursor="Hand"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon Kind="FileImport" VerticalAlignment="Center" Width="30" Height="30" /> <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" TextDecorations="Underline">Import Thread File</TextBlock> @@ -73,28 +76,30 @@ <materialDesign:PackIcon Kind="FileExport" VerticalAlignment="Center" Width="30" Height="30" /> <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" TextDecorations="Underline">Export Thread File</TextBlock> </StackPanel> - </Button> + </Button>--> </StackPanel> </StackPanel> </Grid> <Grid> - <DataGrid Margin="0 0 0 10" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" RowHeight="60" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding RmlsExtensions}" SelectedItem="{Binding SelectedRMLExtension}"> + <DataGrid Margin="0 0 0 10" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" RowHeight="60" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding RmlExtensions}" SelectedItem="{Binding SelectedRMLExtension}"> <DataGrid.CellStyle> <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> <Setter Property="BorderThickness" Value="0"/> <Setter Property="FocusVisualStyle" Value="{x:Null}"/> <Setter Property="VerticalContentAlignment" Value="Center"></Setter> <Setter Property="Padding" Value="4"></Setter> - <Setter Property="Margin" Value="10 5 0 0"></Setter> + <Setter Property="Margin" Value="0 5 0 0"></Setter> </Style> </DataGrid.CellStyle> <DataGrid.Columns> - <DataGridTextColumn Header="MANUFACTURER" Binding="{Binding YarnManufacturer.Name}" Width="Auto" /> - <DataGridTextColumn Header="BRAND" Binding="{Binding YarnBrand.Name}" Width="Auto" /> + <DataGridTextColumn Header="RML Name" Binding="{Binding Name}" Width="Auto" /> + <DataGridTextColumn Header="MANUFACTURER" Binding="{Binding Manufacturer}" Width="Auto" /> + <DataGridTextColumn Header="BRAND" Binding="{Binding Brand}" Width="Auto" /> <DataGridTextColumn Header="LINEAR DENSITY" Binding="{Binding LinearDensity}" Width="140"/> - <DataGridTextColumn Header="CREATED BY" Binding="{Binding User.Contact.FirstName}" Width="Auto"/> + <DataGridTextColumn Header="CREATED BY" Binding="{Binding CreatedBy}" Width="Auto"/> <DataGridTextColumn Header="CREATED" Binding="{Binding Created,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="Auto" /> <DataGridTextColumn Header="LAST UPDATED" Binding="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="Auto" /> + <DataGridTextColumn Header="STATUS" Binding="{Binding Status, Converter={StaticResource EnumToDescriptionConverter}}" Width="Auto" /> </DataGrid.Columns> </DataGrid> </Grid> 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/RMLExtensionsView.xaml.cs index 9afb7a5c8..03bac4bbe 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionsView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml.cs @@ -17,9 +17,9 @@ namespace Tango.MachineStudio.ThreadExtensions.Views /// <summary> /// Interaction logic for ThreadExtViews.xaml /// </summary> - public partial class ThreadExtensionsView : UserControl + public partial class RMLExtensionsView : UserControl { - public ThreadExtensionsView() + 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 @@ +<UserControl x:Class="Tango.MachineStudio.ThreadExtensions.Views.TestResultsView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:sys="clr-namespace:System;assembly=mscorlib" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:local="clr-namespace:Tango.MachineStudio.ThreadExtensions.Views" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:autoCompleteMachine="clr-namespace:Tango.MachineStudio.Common.AutoComplete;assembly=Tango.MachineStudio.Common" + xmlns:vm="clr-namespace:Tango.MachineStudio.ThreadExtensions.ViewModels" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:localconverters="clr-namespace:Tango.MachineStudio.ThreadExtensions.Converters" + xmlns:global="clr-namespace:Tango.MachineStudio.ThreadExtensions" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete" + xmlns:fa="http://schemas.fontawesome.io/icons/" + mc:Ignorable="d" + d:DesignHeight="950" d:DesignWidth="1200" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}" FontSize="16"> + + <UserControl.Resources> + + <localconverters:ColorNameToBrushConverter x:Key="ColorNameToBrushConverter"/> + <localconverters:ColorWithPercentToBrushConverter x:Key="ColorWithPercentToBrushConverter"/> + <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" /> + <autoCompleteMachine:MachinesProvider x:Key="MachinesProvider" /> + + + <Style TargetType="{x:Type ListBoxItem}" x:Key="basicListBoxItem"> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="BorderThickness" Value="0"></Setter> + <Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter> + <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> + <Setter Property="Padding" Value="0"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type ListBoxItem}"> + <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0" Background="{TemplateBinding Background}" Padding="0" SnapsToDevicePixels="true"> + <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> + </Border> + <ControlTemplate.Triggers> + <Trigger Property="IsSelected" Value="true"> + <Setter Property="Background" TargetName="Bd" Value="Transparent"/> + </Trigger> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition Property="IsSelected" Value="true"/> + <Condition Property="Selector.IsSelectionActive" Value="false"/> + </MultiTrigger.Conditions> + <Setter Property="Background" TargetName="Bd" Value="Transparent"/> + </MultiTrigger> + <Trigger Property="IsEnabled" Value="false"> + <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <DataTemplate x:Key="TabTemplate"> + <Border IsVisibleChanged="Border_IsVisibleChanged" BorderThickness="1" BorderBrush="{StaticResource GrayBrush50}" CornerRadius="5"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="Visibility" Value="Visible"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsSelected}" Value="False"> + <Setter Property="Visibility" Value="Hidden"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + </Grid> + </Border> + </DataTemplate> + + <Style x:Key="CellNumericUpDown" TargetType="{x:Type mahapps:NumericUpDown}" BasedOn="{StaticResource {x:Type mahapps:NumericUpDown}}"> + <Setter Property="FrameworkElement.HorizontalAlignment" Value="Stretch"/> + <Setter Property="HorizontalContentAlignment" Value="Left"/> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/> + <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled"/> + <Setter Property="Focusable" Value="false"/> + <Setter Property="IsHitTestVisible" Value="false"/> + <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled"/> + <Setter Property="FrameworkElement.VerticalAlignment" Value="Top"/> + <Setter Property="VerticalContentAlignment" Value="Center"/> + <Setter Property="FrameworkElement.MinHeight" Value="0"/> + <Setter Property="HideUpDownButtons" Value="true"/> + <Setter Property="FontSize" Value="16"/> + </Style> + + <Style x:Key="EditableCellNumericUpDown" TargetType="{x:Type mahapps:NumericUpDown}" BasedOn="{StaticResource {x:Type mahapps:NumericUpDown}}"> + <Setter Property="FrameworkElement.HorizontalAlignment" Value="Stretch"/> + <Setter Property="HorizontalContentAlignment" Value="Left"/> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/> + <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled"/> + <Setter Property="FrameworkElement.VerticalAlignment" Value="Center"/> + <Setter Property="VerticalContentAlignment" Value="Center"/> + <Setter Property="FrameworkElement.MinHeight" Value="0"/> + <Setter Property="FontSize" Value="16"/> + </Style> + <Style x:Key="EditableCellNumericUpDownWithTrigger" TargetType="{x:Type mahapps:NumericUpDown}" BasedOn="{StaticResource EditableCellNumericUpDown}"> + <Setter Property="Visibility" Value="Visible" /> + <Style.Triggers> + <DataTrigger Binding="{Binding TestResultColor, Converter={StaticResource EnumToDescriptionConverter}}" Value="REF"> + <Setter Property="Visibility" Value="Collapsed" /> + </DataTrigger> + </Style.Triggers> + </Style> + + <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="FocusVisualStyle" Value="{x:Null}"/> + <Setter Property="VerticalContentAlignment" Value="Center"></Setter> + </Style> + + <Style x:Key="Rounded_Corners_TextBox_Multiline" TargetType="TextBox"> + <Setter Property="Background" Value="{StaticResource TransparentBackgroundBrush}"></Setter> + <Setter Property="BorderBrush" Value="{StaticResource DarkGrayBrush200}"></Setter> + <Setter Property="Foreground" Value="{StaticResource HomePageForeground}"></Setter> + <Setter Property="VerticalContentAlignment" Value="Top"></Setter> + <Setter Property="HorizontalContentAlignment" Value="Left"></Setter> + <Setter Property="Height" Value="Auto"></Setter> + <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/> + <Setter Property="FocusVisualStyle" Value="{x:Null}"/> + <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/> + <Setter Property="Stylus.IsFlicksEnabled" Value="False"/> + <Setter Property="AcceptsReturn" Value="True"></Setter> + <Setter Property="CaretBrush" Value="{StaticResource GrayBrush200}"></Setter> + <Setter Property="Padding" Value="3"></Setter> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type TextBoxBase}"> + <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True" CornerRadius="5"> + <ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto"/> + </Border> + <ControlTemplate.Triggers> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Foreground" Value= "{StaticResource DimGrayBrush}"/> + </Trigger> + <Trigger Property="Width" Value="Auto"> + <Setter Property="MinWidth" Value="100"/> + </Trigger> + <Trigger Property="Height" Value="Auto"> + <Setter Property="MinHeight" Value="20"/> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + </UserControl.Resources> + <Grid DataContext="{Binding TestResultsViewVM}"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + <DockPanel Grid.Row="0"> + <Button DockPanel.Dock="Top" HorizontalAlignment="Right" Width="170" Height="36" Margin="0 0 26 0" VerticalAlignment="Center" Command="{Binding SaveCommand}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="ContentSaveAll" Width="24" Height="24" /> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">SAVE</TextBlock> + </StackPanel> + </Button> + <!--<StackPanel Orientation="Horizontal" DockPanel.Dock="Top"> + <TextBlock Margin="40 20" FontSize="30" FontWeight="SemiBold" FontStyle="Italic">TARGET MACHINE</TextBlock> + + <autoComplete:AutoCompleteTextBox Provider="{StaticResource MachinesProvider}" LoadingContent="Loading..." FontSize="20" SelectedItem="{Binding SelectedMachine,Mode=TwoWay}" materialDesign:HintAssist.Hint="Serial Number" DisplayMember="SerialNumber" Width="280"> + <autoComplete:AutoCompleteTextBox.ItemTemplate> + <DataTemplate> + <StackPanel> + <TextBlock Text="{Binding SerialNumber}" FontWeight="Bold" FontStyle="Italic"></TextBlock> + <TextBlock FontSize="11" Text="{Binding Name}" Foreground="Gray"></TextBlock> + </StackPanel> + </DataTemplate> + </autoComplete:AutoCompleteTextBox.ItemTemplate> + </autoComplete:AutoCompleteTextBox> + </StackPanel>--> + </DockPanel> + <Grid Grid.Row="1" > + <Grid.RowDefinitions> + <RowDefinition Height="30"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <StackPanel Orientation="Horizontal" Margin="35 0 0 0"> + <ListBox Style="{x:Null}" HorizontalAlignment="Left" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" ItemContainerStyle="{StaticResource basicListBoxItem}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled" Background="Transparent" BorderThickness="0" ItemsSource="{Binding ResultTabs}" SelectedItem="{Binding SelectedTab}"> + <ListBox.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel HorizontalAlignment="Left" Orientation="Horizontal"></StackPanel> + </ItemsPanelTemplate> + </ListBox.ItemsPanel> + + <ListBox.ItemTemplate> + <DataTemplate> + <Border Padding="5 5" Width="160" CornerRadius="10 10 0 0" Margin="1 0" Tag="{Binding RelativeSource={RelativeSource AncestorType=ListBox},Path=DataContext}"> + <Border.ContextMenu> + <ContextMenu DataContext="{Binding Path=PlacementTarget.Tag, RelativeSource={RelativeSource Self}}" Style="{x:Null}" > + <MenuItem Header="Rename" Command="{Binding RenameTabCommand}" MinWidth="210" MaxHeight="40" > + <MenuItem.Icon> + <fa:ImageAwesome Icon="Pencil" Width="16" /> + </MenuItem.Icon> + </MenuItem> + </ContextMenu> + </Border.ContextMenu> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="Background" Value="{StaticResource LightGrayBrush150}"></Setter> + <Setter Property="TextElement.Foreground" Value="{StaticResource DarkGrayBrush}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsSelected}" Value="True"> + <Setter Property="Background" Value="{StaticResource AccentColorBrush}"></Setter> + <Setter Property="TextElement.Foreground" Value="{StaticResource WhiteTextBrush}"></Setter> + </DataTrigger> + <Trigger Property="IsMouseOver" Value="True"> + <Setter Property="Opacity" Value="0.8"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </Border.Style> + <DockPanel VerticalAlignment="Center"> + <Button Cursor="Hand" Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}, Path=DataContext.RemoveTabCommand}" CommandParameter="{Binding }" DockPanel.Dock="Right" Margin="5 0 0 0" Style="{StaticResource MaterialDesignFlatButton}" Padding="2" Height="Auto"> + <materialDesign:PackIcon Kind="Close"> + <materialDesign:PackIcon.Style> + <Style TargetType="materialDesign:PackIcon"> + <Setter Property="Foreground" Value="{StaticResource DarkGrayBrush}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsSelected}" Value="True"> + <Setter Property="Foreground" Value="{StaticResource WhiteTextBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </materialDesign:PackIcon.Style> + </materialDesign:PackIcon> + </Button> + <TextBlock Text="{Binding TestResult.Name}" VerticalAlignment="Center" TextAlignment="Center" TextTrimming="CharacterEllipsis" FontSize="11"></TextBlock> + </DockPanel> + </Border> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + <Button Margin="10 0 0 0" Style="{StaticResource MaterialDesignFlatButton}" Padding="2" Height="24" Cursor="Hand" Command="{Binding AddTabCommand}" ToolTip="New tab"> + <materialDesign:PackIcon Width="20" Height="20" Kind="Plus" Foreground="{StaticResource AccentColorBrush}" /> + </Button> + </StackPanel> + <Grid Margin="5 0 5 5" Grid.Row="1"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="20"/> + </Grid.ColumnDefinitions> + + <ItemsControl ItemsSource="{Binding ResultTabs}" ItemTemplate="{StaticResource TabTemplate}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <Grid/> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + </ItemsControl> + + <Grid Grid.Column="0" MinWidth="600" HorizontalAlignment="Left" > + <DockPanel > + + <Button DockPanel.Dock="Bottom" Width="200" HorizontalAlignment="Right" Margin="20" Command="{Binding SelectedTab.ExportToFileCommand}" IsEnabled="False"> Export to File</Button> + + <Grid DockPanel.Dock="Bottom" Margin="20 20 20 0"> + <TextBlock FontSize="21">Conclusion:</TextBlock> + <TextBox Margin="120 0 20 0" HorizontalAlignment="Stretch" MinHeight="40" Text="{Binding SelectedTab.TestResult.Conclusions}" Style="{StaticResource Rounded_Corners_TextBox_Multiline}"></TextBox> + </Grid> + + <Grid DockPanel.Dock="Bottom" Margin="20 20 20 0"> + <TextBlock FontSize="21">Comments:</TextBlock> + <TextBox Margin="120 0 20 0" Style="{StaticResource Rounded_Corners_TextBox_Multiline}" HorizontalAlignment="Stretch" MinHeight="40" Text="{Binding SelectedTab.TestResult.Comment}"></TextBox> + + </Grid> + + <Border Padding="10 10 20 10" DockPanel.Dock="Top" BorderBrush="Transparent" BorderThickness="1" > + + <ScrollViewer VerticalScrollBarVisibility="Auto" > + <Grid HorizontalAlignment="Left"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"></ColumnDefinition> + <ColumnDefinition Width="1*"></ColumnDefinition> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + <Border> + <StackPanel x:Name="DryerTempPanel" HorizontalAlignment="Stretch" Grid.Column="0" Grid.Row="0" > + <DockPanel Margin="0 0 0 0"> + <Button DockPanel.Dock="Right" Margin="0 0 40 0" HorizontalAlignment="Left" Padding="2" Height="30" Width="200" Command="{Binding FlytoProcessParametersCommand}" ToolTip="Apply to Process Parameters"> + <TextBlock FontSize="14" Background="Transparent" >Apply to Process Parameters</TextBlock> + </Button> + <TextBlock HorizontalAlignment="Center" FontSize="21" Margin="180 10 0 0"> Process Parameters</TextBlock> + </DockPanel> + <Border BorderThickness="1" BorderBrush="{StaticResource GrayBrush200}" Margin="20 10 40 10"> + <UniformGrid Columns="2" HorizontalAlignment="Left" MinWidth="{ Binding ElementName=RubbingResultsGrid, Path= ActualWidth }" > + <Border BorderThickness="0 0 1 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Dryer temperature</TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <mahapps:NumericUpDown HasDecimals="False" HorizontalContentAlignment="Left" Minimum="0" Maximum="300" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" Value="{Binding SelectedTab.TestResult.DryerTemperature, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Margin="10 0 0 0"></mahapps:NumericUpDown> + </Border> + <Border BorderThickness="0 0 1 1" Background="{StaticResource TransparentBackgroundBrush700}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Tunnel temperature</TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush700}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <mahapps:NumericUpDown VerticalAlignment="Center" HasDecimals="False" Minimum="0" Maximum="400" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding SelectedTab.TestResult.TunnelTemperature,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Margin="10 0 0 0"></mahapps:NumericUpDown> + </Border> + <Border BorderThickness="0 0 1 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Tunnel flow</TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <mahapps:NumericUpDown VerticalAlignment="Center" HasDecimals="True" Minimum="0" Maximum="20" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding SelectedTab.TestResult.TunnelFlow,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Margin="10 0 0 0"></mahapps:NumericUpDown> + </Border> + <Border BorderThickness="0 0 1 1" Background="{StaticResource TransparentBackgroundBrush700}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Tunnel AVG temperature</TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush700}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <mahapps:NumericUpDown VerticalAlignment="Center" HasDecimals="True" Minimum="0" Maximum="400" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding SelectedTab.TestResult.TunnelAvgTemperature,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Margin="10 0 0 0"></mahapps:NumericUpDown> + </Border> + </UniformGrid> + </Border> + </StackPanel></Border> + <StackPanel x:Name="RubbingResultsPanel" Grid.Column="0" Grid.Row="1" Margin="0 30 0 0"> + <TextBlock HorizontalAlignment="Center" FontSize="21"> Rubbing results</TextBlock> + + <DataGrid x:Name="RubbingResultsGrid" HorizontalAlignment="Left" VerticalScrollBarVisibility ="Auto" MaxHeight="280" RowHeight="26" Padding="0" SelectionUnit="FullRow" BorderBrush="{StaticResource DarkGrayBrush }" BorderThickness="1" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding SelectedTab.TestResult.RubbingResults}" Margin="20 10 40 10" FontSize="16"> + <DataGrid.ColumnHeaderStyle > + <Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}"> + <Setter Property="FontSize" Value="16"/> + <Setter Property="HorizontalAlignment" Value="Left"/> + <Setter Property="Margin" Value="2 0 0 0"/> + <Setter Property="Padding" Value="0 5"/> + <Setter Property="FrameworkElement.HorizontalAlignment" Value="Stretch"/> + <Setter Property="HorizontalContentAlignment" Value="Left"/> + </Style> + </DataGrid.ColumnHeaderStyle> + <DataGrid.CellStyle> + <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="FocusVisualStyle" Value="{x:Null}"/> + <Setter Property="VerticalContentAlignment" Value="Center"></Setter> + <Setter Property="Padding" Value="0"></Setter> + <Setter Property="Margin" Value="0 0 0 0"></Setter> + </Style> + </DataGrid.CellStyle> + <DataGrid.Columns> + <DataGridTemplateColumn Header="Color" Width="80"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Border BorderThickness="0" Background="{Binding TestResultColor, Converter={StaticResource ColorNameToBrushConverter}}"> + <TextBlock Text="{Binding TestResultColor, Converter={StaticResource EnumToDescriptionConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10 0 0 0"></TextBlock> + </Border> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + + <mahapps:DataGridNumericUpDownColumn Header="DeltaE CIE 100%" Minimum="0" Maximum="100" Binding="{Binding DeltaeCie100, StringFormat={}{0:F2}}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" /> + + + <DataGridTemplateColumn Header="GS 100%" Width="1*"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <mahapps:NumericUpDown HasDecimals="True" Minimum="1" Maximum="5" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding Gs100Min,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="16" Margin="0 0 0 0" Padding="0" StringFormat="{}{0:F2}" HorizontalAlignment="Right" MinWidth="26"/> + <TextBlock FontSize="16" VerticalAlignment="Center"> -</TextBlock> + <mahapps:NumericUpDown HasDecimals="True" Minimum="1" Maximum="5" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding Gs100Max,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="16" Margin="0 0 0 0" Padding="0" StringFormat="{}{0:F2}" HorizontalAlignment="Left" MinWidth="26"/> + </StackPanel> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + + <mahapps:DataGridNumericUpDownColumn Header="DeltaE CIE 200%" Minimum="0" Maximum="100" Binding="{Binding DeltaeCie200}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" FontSize="16"/> + + <DataGridTemplateColumn Header="GS 200%" Width="1*"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <mahapps:NumericUpDown HasDecimals="True" Minimum="1" Maximum="5" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding Gs200Min,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="16" Margin="0 0 0 0" Padding="0" StringFormat="{}{0:F2}" HorizontalAlignment="Right" MinWidth="26"/> + <TextBlock FontSize="16" VerticalAlignment="Center"> -</TextBlock> + <mahapps:NumericUpDown HasDecimals="True" Minimum="1" Maximum="5" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding Gs200Max,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="16" Margin="0 0 0 0" Padding="0" StringFormat="{}{0:F2}" HorizontalAlignment="Left" MinWidth="26"/> + </StackPanel> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + </DataGrid.Columns> + </DataGrid> + + </StackPanel> + <StackPanel x:Name="TensionresultsPanel" Grid.Column="1" Grid.Row="0" Margin="0 10 0 0" > + <TextBlock HorizontalAlignment="Center" FontSize="21"> Tension through the thread path</TextBlock> + <Border BorderThickness="1" BorderBrush="{StaticResource GrayBrush200}" Margin="0 10 20 10" > + <UniformGrid Columns="4" Background="{StaticResource TransparentBackgroundBrush}" HorizontalAlignment="Left" MinWidth="{ Binding ElementName=MechanicalPropertiesGrid, Path= ActualWidth }" > + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock FontWeight="Light" Margin="5 0 0 0" VerticalAlignment="Center">Tension in Zone</TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock FontWeight="Light" Margin="5 0 0 0" VerticalAlignment="Center">Tensiometer (gr)</TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock FontWeight="Light" Margin="5 0 0 0" VerticalAlignment="Center">Tension in Zone</TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock FontWeight="Light" Margin="5 0 0 0" VerticalAlignment="Center">MS</TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush700}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock Margin="5 0 0 0">Head</TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush700}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <StackPanel Orientation="Horizontal"> + <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding SelectedTab.TestResult.TensionHeadMin,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="16" Margin="10 0 0 0" Padding="0" StringFormat="{}{0:F2}" HorizontalAlignment="Right" MinWidth="26"/> + <TextBlock FontSize="16" VerticalAlignment="Center"> -</TextBlock> + <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding SelectedTab.TestResult.TensionHeadMax,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="16" Margin="0 0 0 0" Padding="0" StringFormat="{}{0:F2}" HorizontalAlignment="Left" MinWidth="26"/> + </StackPanel> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush700}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock Margin="5 0 0 0">BTSR</TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush700}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <StackPanel Orientation="Horizontal"> + <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding SelectedTab.TestResult.BtsrMin,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="16" Margin="10 0 0 0" Padding="0" StringFormat="{}{0:F2}" HorizontalAlignment="Right" MinWidth="26"/> + <TextBlock FontSize="16" VerticalAlignment="Center"> -</TextBlock> + <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding SelectedTab.TestResult.BtsrMax,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="16" Margin="0 0 0 0" Padding="0" StringFormat="{}{0:F2}" HorizontalAlignment="Left" MinWidth="26"/> + </StackPanel> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock Margin="5 0 0 0">After dryer</TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <StackPanel Orientation="Horizontal"> + <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding SelectedTab.TestResult.TensionAfterDryerMin,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="16" Margin="10 0 0 0" Padding="0" StringFormat="{}{0:F2}" HorizontalAlignment="Right" MinWidth="26"/> + <TextBlock FontSize="16" VerticalAlignment="Center"> -</TextBlock> + <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding SelectedTab.TestResult.TensioinAfterDryerMax,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="16" Margin="0 0 0 0" Padding="0" StringFormat="{}{0:F2}" HorizontalAlignment="Left" MinWidth="26"/> + </StackPanel> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock Margin="5 0 0 0" >Puller tension</TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <StackPanel Orientation="Horizontal"> + <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding SelectedTab.TestResult.PullerTensionMin,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="16" Margin="10 0 0 0" Padding="0" StringFormat="{}{0:F2}" HorizontalAlignment="Right" MinWidth="26"/> + <TextBlock FontSize="16" VerticalAlignment="Center"> -</TextBlock> + <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding SelectedTab.TestResult.PullerTensionMax,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="16" Margin="0 0 0 0" Padding="0" StringFormat="{}{0:F2}" HorizontalAlignment="Left" MinWidth="26"/> + </StackPanel> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush700}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock Margin="5 0 0 0">Winder</TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush700}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <StackPanel Orientation="Horizontal"> + <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding SelectedTab.TestResult.TensionWinderMin,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="16" Margin="10 0 0 0" Padding="0" StringFormat="{}{0:F2}" HorizontalAlignment="Right" MinWidth="26"/> + <TextBlock FontSize="16" VerticalAlignment="Center"> -</TextBlock> + <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding SelectedTab.TestResult.TensionWinderMax,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="16" Margin="0 0 0 0" Padding="0" StringFormat="{}{0:F2}" HorizontalAlignment="Left" MinWidth="26"/> + </StackPanel> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush700}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock Margin="5 0 0 0">Winder Exit Tension</TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush700}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <StackPanel Orientation="Horizontal"> + <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding SelectedTab.TestResult.ExitTensionMin,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="16" Margin="10 0 0 0" Padding="0" StringFormat="{}{0:F2}" HorizontalAlignment="Right" MinWidth="26"/> + <TextBlock FontSize="16" VerticalAlignment="Center"> - </TextBlock> + <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding SelectedTab.TestResult.ExitTensionMax,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="16" Margin="0 0 0 0" Padding="0" StringFormat="{}{0:F2}" HorizontalAlignment="Left" MinWidth="26"/> + </StackPanel> + </Border> + </UniformGrid> + </Border> + </StackPanel> + <StackPanel x:Name="MechanicalPropertiesPanel" Grid.Column="1" Grid.Row="1" Margin="0 30 0 0"> + <TextBlock HorizontalAlignment="Center" FontSize="21" MaxHeight="600" >Mechanical properties</TextBlock> + <DataGrid x:Name="MechanicalPropertiesGrid" HorizontalAlignment="Left" VerticalScrollBarVisibility ="Auto" MaxHeight="250" RowHeight="26" Padding="0" SelectionUnit="FullRow" BorderBrush="{StaticResource DarkGrayBrush }" BorderThickness="1" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding SelectedTab.TestResult.TensileResults}" Margin="0 10 20 10" FontSize="16"> + <DataGrid.ColumnHeaderStyle > + <Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}"> + <Setter Property="FontSize" Value="16"/> + <Setter Property="HorizontalAlignment" Value="Left"/> + <Setter Property="Margin" Value="2 0 0 0"/> + <Setter Property="Padding" Value="0 5"/> + <Setter Property="FrameworkElement.HorizontalAlignment" Value="Stretch"/> + <Setter Property="HorizontalContentAlignment" Value="Left"/> + </Style> + </DataGrid.ColumnHeaderStyle> + <DataGrid.CellStyle> + <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="FocusVisualStyle" Value="{x:Null}"/> + <Setter Property="VerticalContentAlignment" Value="Center"></Setter> + <Setter Property="Padding" Value="0"></Setter> + <Setter Property="Margin" Value="0 0 0 0"></Setter> + </Style> + </DataGrid.CellStyle> + <DataGrid.Columns> + <DataGridTextColumn Header="% Color" Binding="{ Binding ColorPercent}" MinWidth="100"></DataGridTextColumn> + <DataGridTemplateColumn Header="Color" Width="80"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Border BorderThickness="0"> + <Border.Background> + <MultiBinding Converter="{StaticResource ColorWithPercentToBrushConverter}"> + <Binding Path="TestResultColor"></Binding> + <Binding Path="ColorPercent"></Binding> + </MultiBinding> + </Border.Background> + <TextBlock Text="{Binding TestResultColor, Converter={StaticResource EnumToDescriptionConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10 0 0 0"></TextBlock> + </Border> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + + <mahapps:DataGridNumericUpDownColumn Header="Load at 
Maximum 
Load(N)" Minimum="0" Maximum="100" Binding="{Binding MaxLoad}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" StringFormat="{}{0:F2}" /> + <mahapps:DataGridNumericUpDownColumn Header="STDEV" Minimum="0" Maximum="100" Binding="{Binding StdevMaxLoad}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" StringFormat="{}{0:F2}" /> + <mahapps:DataGridNumericUpDownColumn Header="% Change" Minimum="-100" Maximum="100" Binding="{Binding PercentChangeLoad}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDownWithTrigger}" StringFormat="{}{0:F2}" /> + + <mahapps:DataGridNumericUpDownColumn Header="Percentage 
Strain at 
Maximum Load" Minimum="0" Maximum="100" Binding="{Binding StrainMaxLoad}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" StringFormat="{}{0:F2}" /> + + <mahapps:DataGridNumericUpDownColumn Header="STDEV" Minimum="0" Maximum="100" Binding="{Binding StdevStrainMaxLoad}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" StringFormat="{}{0:F2}" /> + + <mahapps:DataGridNumericUpDownColumn Header="% Change" Minimum="-100" Maximum="100" Binding="{Binding PercentChangeStrain}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDownWithTrigger}" StringFormat="{}{0:F2}"/> + + </DataGrid.Columns> + </DataGrid> + + </StackPanel> + <StackPanel x:Name="UniformityPanel" HorizontalAlignment="Center" Grid.Column="0" Grid.Row="2" > + <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="21"> Uniformity</TextBlock> + <Border BorderThickness="1" BorderBrush="{StaticResource GrayBrush200}" Margin="20 10 40 10"> + <UniformGrid Columns="2" HorizontalAlignment="Left" MinWidth="{ Binding ElementName=RubbingResultsGrid, Path= ActualWidth }" > + <Border BorderThickness="0 0 1 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock FontWeight="Light" Margin="5 0 0 0" VerticalAlignment="Center">Uniformity</TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock FontWeight="Light" VerticalAlignment="Center" Margin="5 0 0 0">Severity</TextBlock> + </Border> + <Border BorderThickness="0 0 1 1" Background="{StaticResource TransparentBackgroundBrush700}" BorderBrush="{StaticResource BorderBrushGainsboro}" > + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Zone 1</TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush700}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <mahapps:NumericUpDown VerticalAlignment="Center" HasDecimals="True" Minimum="0" Maximum="10" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Right" Value="{Binding SelectedTab.TestResult.SeverityZone1Min,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="10 0 0 0" Padding="0" StringFormat="{}{0:F1}" HorizontalAlignment="Right" FontSize="16" MinWidth="26"></mahapps:NumericUpDown> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">-</TextBlock> + <mahapps:NumericUpDown VerticalAlignment="Center" HasDecimals="True" Minimum="0" Maximum="10" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding SelectedTab.TestResult.SeverityZone1Max,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="0 0 0 0" Width="Auto" FontSize="16" StringFormat="{}{0:F1}" ></mahapps:NumericUpDown> + </StackPanel> + </Border> + <Border BorderThickness="0 0 1 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Zone 2</TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <mahapps:NumericUpDown VerticalAlignment="Center" HasDecimals="True" Minimum="0" Maximum="10" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Right" Value="{Binding SelectedTab.TestResult.SeverityZone2Min,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="10 0 0 0" MaxWidth="20" Padding="0" StringFormat="{}{0:F1}" HorizontalAlignment="Right" FontSize="16" MinWidth="26"></mahapps:NumericUpDown> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">-</TextBlock> + <mahapps:NumericUpDown VerticalAlignment="Center" HasDecimals="True" Minimum="0" Maximum="10" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Left" Value="{Binding SelectedTab.TestResult.SeverityZone2Max,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="0 0 0 0" Width="Auto" FontSize="16" StringFormat="{}{0:F1}" ></mahapps:NumericUpDown> + </StackPanel> + </Border> + </UniformGrid> + </Border> + </StackPanel> + <StackPanel x:Name="COFPanel" HorizontalAlignment="Center" Grid.Column="1" Grid.Row="2" > + <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="21"> COF</TextBlock> + <Border BorderThickness="1" BorderBrush="{StaticResource GrayBrush200}" Margin="0 10 20 10" > + <UniformGrid Columns="4" HorizontalAlignment="Left" MinWidth="{ Binding ElementName=MechanicalPropertiesGrid, Path= ActualWidth }" > + <Border BorderThickness="0 0 1 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock FontWeight="Light" Margin="5 0 0 0" VerticalAlignment="Center">Thread name</TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock FontWeight="Light" VerticalAlignment="Center" Margin="5 0 0 0">Lub version</TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock FontWeight="Light" VerticalAlignment="Center" Margin="5 0 0 0">COF</TextBlock> + </Border> + <Border BorderThickness="0 1 1 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock FontWeight="Light" VerticalAlignment="Center" Margin="5 0 0 0">Lub amount</TextBlock> + </Border> + + + <Border BorderThickness="1 0 1 1" Background="{StaticResource TransparentBackgroundBrush700}" BorderBrush="{StaticResource BorderBrushGainsboro}" > + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">REF</TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush700}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBox Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding SelectedTab.TestResult.RefLubVersion}"></TextBox> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush700}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <mahapps:NumericUpDown VerticalAlignment="Center" HasDecimals="True" Minimum="0" Maximum="10" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Right" Value="{Binding SelectedTab.TestResult.RefCof,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="10 0 0 0" MaxWidth="20" Padding="0" StringFormat="{}{0:F2}" HorizontalAlignment="Left" FontSize="16"></mahapps:NumericUpDown> + </Border> + <Border BorderThickness="0 0 1 1" Background="{StaticResource TransparentBackgroundBrush700}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <mahapps:NumericUpDown VerticalAlignment="Center" HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Right" Value="{Binding SelectedTab.TestResult.RefLub,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="10 0 0 0" MaxWidth="20" Padding="0" StringFormat="{}{0:F2}" HorizontalAlignment="Left" FontSize="16"></mahapps:NumericUpDown> + </Border> + + + <Border BorderThickness="1 0 1 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding ThreadName}"></TextBlock> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBox Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding SelectedTab.TestResult.ThreadLubVersion}"></TextBox> + </Border> + <Border BorderThickness="0 0 0 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <mahapps:NumericUpDown VerticalAlignment="Center" HasDecimals="True" Minimum="0" Maximum="10" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Right" Value="{Binding SelectedTab.TestResult.ThreadCof,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="10 0 0 0" MaxWidth="20" Padding="0" StringFormat="{}{0:F2}" HorizontalAlignment="Left" FontSize="16"></mahapps:NumericUpDown> + </Border> + <Border BorderThickness="0 0 1 1" Background="{StaticResource TransparentBackgroundBrush}" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <mahapps:NumericUpDown VerticalAlignment="Center" HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HideUpDownButtons="True" InterceptMouseWheel="True" HorizontalContentAlignment="Right" Value="{Binding SelectedTab.TestResult.ThreadLub,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="10 0 0 0" MaxWidth="20" Padding="0" StringFormat="{}{0:F2}" HorizontalAlignment="Left" FontSize="16"></mahapps:NumericUpDown> + </Border> + </UniformGrid> + </Border> + </StackPanel> + </Grid> + </ScrollViewer> + </Border> + + </DockPanel> + </Grid> + </Grid> + </Grid> + + </Grid> +</UserControl> 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 +{ + /// <summary> + /// Interaction logic for TestResultsView.xaml + /// </summary> + public partial class TestResultsView : UserControl + { + private Dictionary<Border, UIElement> _tabs_content; + + public TestResultsView() + { + InitializeComponent(); + + _tabs_content = new Dictionary<Border, UIElement>(); + + 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}"> - + <UserControl.Resources> - <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter"/> <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter"/> + + <ObjectDataProvider x:Key="TwistDirections" ObjectType="{x:Type sys:Enum}" MethodName="GetValues"> + <ObjectDataProvider.MethodParameters> + <x:Type TypeName="enumerations:TwistDirections"/> + </ObjectDataProvider.MethodParameters> + </ObjectDataProvider> + + <ObjectDataProvider x:Key="Plies" ObjectType="{x:Type sys:Enum}" MethodName="GetValues"> + <ObjectDataProvider.MethodParameters> + <x:Type TypeName="enumerations:Plies"/> + </ObjectDataProvider.MethodParameters> + </ObjectDataProvider> + </UserControl.Resources> <Grid> <materialDesign:Card Background="{DynamicResource MaterialDesignBackground}" VerticalAlignment="Stretch" Padding="40"> - <UniformGrid Columns="4" > - - <Grid Margin="10"> - <materialDesign:Card Background="{DynamicResource MaterialDesignBackground}" VerticalAlignment="Stretch" > - <Grid Margin="20"> - <DockPanel> - <TextBlock DockPanel.Dock="Top" Margin="20 10 0 10" FontSize="20" FontWeight="DemiBold">Yarn Source</TextBlock> - <controls:TableGrid RowHeight="60" Margin="0 20 0 0" MakeFirstColumnVerticalAlignmentBottom="False" > - <controls:TableGrid.Resources> - <Style TargetType="TextBlock"> - <Setter Property="VerticalAlignment" Value="Center"></Setter> - <Setter Property="Margin" Value="0 3 0 0"></Setter> - </Style> - </controls:TableGrid.Resources> - <TextBlock Text="Manufacturer:" VerticalAlignment="Center" FontSize="16" Margin="0 3 0 0"></TextBlock> - <ComboBox VerticalAlignment="Center" ItemsSource="{Binding Manufacturer}" SelectedItem="{Binding ActiveRMLExtention.YarnManufacturer,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True" Margin="20 0 20 0"/> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="1*"/> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + <UniformGrid Columns="4" Grid.Row="0"> + <Grid Margin="10"> + <materialDesign:Card Background="{DynamicResource MaterialDesignBackground}" VerticalAlignment="Stretch" > + <Grid Margin="20"> + <DockPanel> + <TextBlock DockPanel.Dock="Top" Margin="20 10 0 10" FontSize="20" FontWeight="DemiBold">Yarn Source</TextBlock> + <controls:TableGrid RowHeight="60" Margin="0 20 0 0" MakeFirstColumnVerticalAlignmentBottom="False" > + <controls:TableGrid.Resources> + <Style TargetType="TextBlock"> + <Setter Property="VerticalAlignment" Value="Center"></Setter> + <Setter Property="Margin" Value="0 3 0 0"></Setter> + </Style> + </controls:TableGrid.Resources> + <TextBlock Text="Manufacturer:" VerticalAlignment="Center" FontSize="16" Margin="0 3 0 0"></TextBlock> + <ComboBox VerticalAlignment="Center" ItemsSource="{Binding Manufacturers}" SelectedItem="{Binding ActiveRML.Manufacturer,Mode=TwoWay}" IsEditable="False" Margin="20 0 20 0"/> - <TextBlock Text="Brand:" VerticalAlignment="Center" ></TextBlock> - <ComboBox ItemsSource="{Binding Brands}" SelectedItem="{Binding ActiveRMLExtention.YarnBrand,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True" Margin="20 0 20 0"></ComboBox> + <TextBlock Text="Brand:" VerticalAlignment="Center" ></TextBlock> + <ComboBox ItemsSource="{Binding Brands}" SelectedItem="{Binding ActiveRMLExtension.YarnBrand,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True" Margin="20 0 20 0"></ComboBox> - <TextBlock Text="Country:" ></TextBlock> - <TextBox Text="{Binding ActiveRMLExtention.Country,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center"></TextBox> + <TextBlock Text="Country:" ></TextBlock> + <TextBox Text="{Binding ActiveRMLExtension.Country,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center"></TextBox> - <TextBlock Text="End Use:" ></TextBlock> - <ComboBox ItemsSource="{Binding EndUse}" SelectedItem="{Binding ActiveRMLExtention.YarnEndUse,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> + <TextBlock Text="End Use:" ></TextBlock> + <ComboBox ItemsSource="{Binding EndUse}" SelectedItem="{Binding ActiveRML.MediaPurpose,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> - <TextBlock Text="Applications:" ></TextBlock> - <ComboBox ItemsSource="{Binding Applications}" SelectedItem="{Binding ActiveRMLExtention.YarnApplications,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> + <TextBlock Text="Applications:" ></TextBlock> + <ComboBox ItemsSource="{Binding Applications}" SelectedItem="{Binding ActiveRMLExtension.YarnApplication,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> - <TextBlock Text="Industry Sector:" ></TextBlock> - <ComboBox ItemsSource="{Binding IndustrySector}" SelectedItem="{Binding ActiveRMLExtention.YarnIndustrysector,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> + <TextBlock Text="Industry Sector:" ></TextBlock> + <ComboBox ItemsSource="{Binding IndustrySector}" SelectedItem="{Binding ActiveRMLExtension.YarnIndustrysector,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> - </controls:TableGrid> - </DockPanel> - </Grid> - </materialDesign:Card> - </Grid> + </controls:TableGrid> + </DockPanel> + </Grid> + </materialDesign:Card> + </Grid> - <Grid Margin="10"> - <materialDesign:Card Background="{DynamicResource MaterialDesignBackground}" VerticalAlignment="Stretch" > - <Grid Margin="20"> - <DockPanel> - <TextBlock DockPanel.Dock="Top" FontSize="20" FontWeight="DemiBold">Yarn Source</TextBlock> - <controls:TableGrid RowHeight="55" Margin="0 20 0 0" MakeFirstColumnVerticalAlignmentBottom="False" > - <controls:TableGrid.Resources> - <Style TargetType="TextBlock"> - <Setter Property="VerticalAlignment" Value="Center"></Setter> - <Setter Property="Margin" Value="0 3 0 0"></Setter> - </Style> - </controls:TableGrid.Resources> - <TextBlock Text="Material:" ></TextBlock> - <ComboBox ItemsSource="{Binding Materials}" SelectedItem="{Binding ActiveRMLExtention.YarnMaterial,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> + <Grid Margin="10"> + <materialDesign:Card Background="{DynamicResource MaterialDesignBackground}" VerticalAlignment="Stretch" > + <Grid Margin="20"> + <DockPanel> + <TextBlock DockPanel.Dock="Top" FontSize="20" FontWeight="DemiBold">Yarn Source</TextBlock> + <controls:TableGrid RowHeight="55" Margin="0 20 0 0" MakeFirstColumnVerticalAlignmentBottom="False" > + <controls:TableGrid.Resources> + <Style TargetType="TextBlock"> + <Setter Property="VerticalAlignment" Value="Center"></Setter> + <Setter Property="Margin" Value="0 3 0 0"></Setter> + </Style> + </controls:TableGrid.Resources> + <TextBlock Text="Material:" ></TextBlock> + <ComboBox ItemsSource="{Binding Materials}" SelectedItem="{Binding ActiveRML.MediaMaterial}" DisplayMemberPath="Name" IsEditable="False"></ComboBox> - <TextBlock Text="Type:" ></TextBlock> - <ComboBox ItemsSource="{Binding YarnTypes}" SelectedItem="{Binding ActiveRMLExtention.YarnType,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> + <TextBlock Text="Type:" ></TextBlock> + <ComboBox ItemsSource="{Binding YarnTypes}" SelectedItem="{Binding ActiveRMLExtension.YarnType,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> - <TextBlock Text="Sub family:" ></TextBlock> - <ComboBox ItemsSource="{Binding SubFamilies}" SelectedItem="{Binding ActiveRMLExtention.YarnSubFamily,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> + <TextBlock Text="Sub family:" ></TextBlock> + <ComboBox ItemsSource="{Binding SubFamilies}" SelectedItem="{Binding ActiveRMLExtension.YarnSubFamily,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> - <TextBlock Text="Family:" ></TextBlock> - <ComboBox ItemsSource="{Binding Family}" SelectedItem="{Binding ActiveRMLExtention.YarnFamily,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> + <TextBlock Text="Family:" ></TextBlock> + <ComboBox ItemsSource="{Binding Family}" SelectedItem="{Binding ActiveRMLExtension.YarnFamily,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> - <TextBlock Text="Group:" ></TextBlock> - <ComboBox ItemsSource="{Binding Group}" SelectedItem="{Binding ActiveRMLExtention.YarnGroup,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> + <TextBlock Text="Group:" ></TextBlock> + <ComboBox ItemsSource="{Binding Group}" SelectedItem="{Binding ActiveRMLExtension.YarnGroup,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> - <TextBlock Text="Texturing:" ></TextBlock> - <ComboBox ItemsSource="{Binding Texturing}" SelectedItem="{Binding ActiveRMLExtention.YarnTexturing,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> + <TextBlock Text="Texturing:" ></TextBlock> + <ComboBox ItemsSource="{Binding Texturing}" SelectedItem="{Binding ActiveRMLExtension.YarnTexturing,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> - <TextBlock Text="Geometry:" ></TextBlock> - <ComboBox ItemsSource="{Binding Geometry }" SelectedItem="{Binding ActiveRMLExtention.YarnGeometry ,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> + <TextBlock Text="Geometry:" ></TextBlock> + <ComboBox ItemsSource="{Binding Geometry }" SelectedItem="{Binding ActiveRML.FiberShape ,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> - <TextBlock Text="Color:" ></TextBlock> - <ComboBox ItemsSource="{Binding YarnColor}" SelectedItem="{Binding ActiveRMLExtention.YarnColor,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> + <TextBlock Text="Thread Shade:" ></TextBlock> + <ComboBox ItemsSource="{Binding YarnWhiteShade}" SelectedItem="{Binding ActiveRMLExtension.YarnWhiteShade,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> - <TextBlock Text="Gloss level:" ></TextBlock> - <ComboBox ItemsSource="{Binding GlossLevel }" SelectedItem="{Binding ActiveRMLExtention.YarnGlossLevel ,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> - </controls:TableGrid> - </DockPanel> - </Grid> - </materialDesign:Card> - </Grid> - <Grid Margin="10"> - <materialDesign:Card Background="{DynamicResource MaterialDesignBackground}" VerticalAlignment="Stretch" > - <Grid Margin="20"> - <DockPanel> - <TextBlock DockPanel.Dock="Top" FontSize="20" FontWeight="DemiBold">Yarn Data</TextBlock> - <controls:TableGrid RowHeight="55" Margin="0 20 0 0" MakeFirstColumnVerticalAlignmentBottom="False" > - <controls:TableGrid.Resources> - <Style TargetType="TextBlock"> - <Setter Property="VerticalAlignment" Value="Center"></Setter> - <Setter Property="Margin" Value="0 3 0 0"></Setter> - </Style> - </controls:TableGrid.Resources> + <TextBlock Text="Gloss level:" ></TextBlock> + <ComboBox ItemsSource="{Binding GlossLevel }" SelectedItem="{Binding ActiveRMLExtension.YarnGlossLevel ,Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True"></ComboBox> + </controls:TableGrid> + </DockPanel> + </Grid> + </materialDesign:Card> + </Grid> + <Grid Margin="10"> + <materialDesign:Card Background="{DynamicResource MaterialDesignBackground}" VerticalAlignment="Stretch" > + <Grid Margin="20"> + <DockPanel> + <TextBlock DockPanel.Dock="Top" FontSize="20" FontWeight="DemiBold">Yarn Data</TextBlock> + <controls:TableGrid RowHeight="55" Margin="0 20 0 0" MakeFirstColumnVerticalAlignmentBottom="False" > + <controls:TableGrid.Resources> + <Style TargetType="TextBlock"> + <Setter Property="VerticalAlignment" Value="Center"></Setter> + <Setter Property="Margin" Value="0 3 0 0"></Setter> + </Style> + </controls:TableGrid.Resources> - <TextBlock Text="Linear Density:" ></TextBlock> - <mahapps:NumericUpDown Minimum="0" Maximum="9999" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding ActiveRMLExtention.LinearDensity,Mode=TwoWay}" FontSize="16"></mahapps:NumericUpDown> + <TextBlock Text="Linear Density:" ></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="9999" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding ActiveRML.FiberSize,Mode=TwoWay}" FontSize="16"></mahapps:NumericUpDown> - <TextBlock Text="Unit:" ></TextBlock> - <ComboBox ItemsSource="{Binding Source={x:Type enumerations:YarnUnits},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedItem="{Binding ActiveRMLExtention.YarnUnit}" SelectedValuePath="Value" DisplayMemberPath="DisplayName" Validation.ErrorTemplate="{x:Null}"></ComboBox> + <TextBlock Text="Unit:" ></TextBlock> + <ComboBox ItemsSource="{Binding Units}" SelectedItem="{Binding ActiveRML.LinearMassDensityUnit}" DisplayMemberPath="Name"></ComboBox> - <TextBlock Text="Plies:" ></TextBlock> - <ComboBox ItemsSource="{Binding Source={x:Type enumerations:Plies},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedItem="{Binding ActiveRMLExtention.YarnPlies}" SelectedValuePath="Value" DisplayMemberPath="DisplayName" Validation.ErrorTemplate="{x:Null}"></ComboBox> + <TextBlock Text="Plies:" ></TextBlock> + <ComboBox ItemsSource="{Binding Source={StaticResource Plies}}" SelectedItem="{Binding ActiveRML.RMLPlies, Mode=TwoWay}" > + <ComboBox.ItemTemplate> + <DataTemplate> + <TextBlock Text="{Binding Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock> + </DataTemplate> + </ComboBox.ItemTemplate> + </ComboBox> - <TextBlock Text="Filament count per plies:" ></TextBlock> - <mahapps:NumericUpDown Minimum="0" Maximum="500" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding ActiveRMLExtention.FilamentCount,Mode=TwoWay}" FontSize="16"></mahapps:NumericUpDown> + <TextBlock Text="Filament count per plies:" ></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="500" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding ActiveRML.PliesPerFiber,Mode=TwoWay}" FontSize="16"></mahapps:NumericUpDown> - <TextBlock Text="Count (den)" ></TextBlock> - <TextBlock Text="{Binding ActiveRMLExtention.DencityCount}" Foreground="Blue" ></TextBlock> + <TextBlock Text="Count (den)" ></TextBlock> + <TextBlock Text="{Binding ActiveRML.DencityCount}" Foreground="Blue" ></TextBlock> - <TextBlock Text="Fiber count " ></TextBlock> - <TextBlock Text="{Binding ActiveRMLExtention.FiberCount}" Foreground="Blue" ></TextBlock> + <TextBlock Text="Fiber count " ></TextBlock> + <TextBlock Text="{Binding ActiveRML.FiberCount}" Foreground="Blue" ></TextBlock> - <TextBlock Text="Twist(tpm):" ></TextBlock> - <mahapps:NumericUpDown Minimum="0" Maximum="9999" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding ActiveRMLExtention.TwistTpm,Mode=TwoWay}" FontSize="16"></mahapps:NumericUpDown> + <TextBlock Text="Twist(tpm):" ></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="9999" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding ActiveRMLExtension.TwistTpm,Mode=TwoWay}" FontSize="16"></mahapps:NumericUpDown> - <TextBlock Text="Twist direction:" ></TextBlock> - <ComboBox ItemsSource="{Binding Source={x:Type enumerations:TwistDirections}, Converter={StaticResource EnumToItemsSourceConverter}}" SelectedItem="{Binding ActiveRMLExtention.YarnTwistDirections }" SelectedValuePath="Value" DisplayMemberPath="DisplayName" Validation.ErrorTemplate="{x:Null}"></ComboBox> - </controls:TableGrid> - </DockPanel> - </Grid> - </materialDesign:Card> - </Grid> - <Grid Margin="10"> - <materialDesign:Card Background="{DynamicResource MaterialDesignBackground}" VerticalAlignment="Stretch" > - <Grid Margin="20"> - <DockPanel> - <TextBlock DockPanel.Dock="Top" FontSize="20" FontWeight="DemiBold">Yarn Properties from datasheet</TextBlock> - <controls:TableGrid RowHeight="55" Margin="0 20 0 0" MakeFirstColumnVerticalAlignmentBottom="False" > - <controls:TableGrid.Resources> - <Style TargetType="TextBlock"> - <Setter Property="VerticalAlignment" Value="Center"></Setter> - <Setter Property="Margin" Value="0 3 0 0"></Setter> - </Style> - <Style TargetType="{x:Type mahapps:NumericUpDown}"> - <Setter Property="BorderThickness" Value="0 0 0 0.5"></Setter> - <Setter Property="FontSize" Value="16"/> - </Style> + <TextBlock Text="Twist direction:" ></TextBlock> + <ComboBox ItemsSource="{Binding Source={StaticResource TwistDirections}}" SelectedItem="{Binding ActiveRMLExtension.YarnTwistDirections,Mode=TwoWay}" > + <ComboBox.ItemContainerStyle> + <Style TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}"> + <Setter Property="Background" Value="{StaticResource WhiteBrush100}"></Setter> + </Style> + </ComboBox.ItemContainerStyle> + <ComboBox.ItemTemplate> + <DataTemplate> + <TextBlock Text="{Binding Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock> + </DataTemplate> + </ComboBox.ItemTemplate> + </ComboBox> + </controls:TableGrid> + </DockPanel> + </Grid> + </materialDesign:Card> + </Grid> + <Grid Margin="10"> + <materialDesign:Card Background="{DynamicResource MaterialDesignBackground}" VerticalAlignment="Stretch" > + <Grid Margin="20"> + <DockPanel> + <TextBlock DockPanel.Dock="Top" FontSize="20" FontWeight="DemiBold">Yarn Properties from datasheet</TextBlock> + <controls:TableGrid RowHeight="55" Margin="0 20 0 0" MakeFirstColumnVerticalAlignmentBottom="False" > + <controls:TableGrid.Resources> + <Style TargetType="TextBlock"> + <Setter Property="VerticalAlignment" Value="Center"></Setter> + <Setter Property="Margin" Value="0 3 0 0"></Setter> + </Style> + <Style TargetType="{x:Type mahapps:NumericUpDown}"> + <Setter Property="BorderThickness" Value="0 0 0 0.5"></Setter> + <Setter Property="FontSize" Value="16"/> + </Style> </controls:TableGrid.Resources> - <TextBlock Text="Max Force (N):" ></TextBlock> - <StackPanel Orientation="Horizontal"> - <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" HideUpDownButtons="True" Value="{Binding ActiveRMLExtention.MinMaxForceN}" HorizontalContentAlignment="Left" BorderBrush="{StaticResource MainWindow.Foreground}" Foreground="{StaticResource MainWindow.Foreground}" /> - <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" HideUpDownButtons="True" Value="{Binding ActiveRMLExtention.MaxMaxForceN}" HorizontalContentAlignment="Left" BorderBrush="{StaticResource MainWindow.Foreground}" Foreground="{StaticResource MainWindow.Foreground}" Margin="10 0 0 0"/> - </StackPanel> - - <TextBlock Text="Elasticity (%)" ></TextBlock> - <StackPanel Orientation="Horizontal"> - <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" HideUpDownButtons="True" Value="{Binding ActiveRMLExtention.MinElasticity}" HorizontalContentAlignment="Left" BorderBrush="{StaticResource MainWindow.Foreground}" Foreground="{StaticResource MainWindow.Foreground}" /> - <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" HideUpDownButtons="True" Value="{Binding ActiveRMLExtention.MaxElasticity}" HorizontalContentAlignment="Left" BorderBrush="{StaticResource MainWindow.Foreground}" Foreground="{StaticResource MainWindow.Foreground}" Margin="10 0 0 0"/> - </StackPanel> + <TextBlock Text="Max Force (N):" ></TextBlock> + <StackPanel Orientation="Horizontal"> + <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" HideUpDownButtons="True" Value="{Binding ActiveRMLExtension.MinMaxForceN}" HorizontalContentAlignment="Left" BorderBrush="{StaticResource MainWindow.Foreground}" Foreground="{StaticResource MainWindow.Foreground}" /> + <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" HideUpDownButtons="True" Value="{Binding ActiveRMLExtension.MaxMaxForceN}" HorizontalContentAlignment="Left" BorderBrush="{StaticResource MainWindow.Foreground}" Foreground="{StaticResource MainWindow.Foreground}" Margin="10 0 0 0"/> + </StackPanel> + + <TextBlock Text="Elasticity (%)" ></TextBlock> + <StackPanel Orientation="Horizontal"> + <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" HideUpDownButtons="True" Value="{Binding ActiveRMLExtension.MinElasticity}" HorizontalContentAlignment="Left" BorderBrush="{StaticResource MainWindow.Foreground}" Foreground="{StaticResource MainWindow.Foreground}" /> + <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" HideUpDownButtons="True" Value="{Binding ActiveRMLExtension.MaxElasticity}" HorizontalContentAlignment="Left" BorderBrush="{StaticResource MainWindow.Foreground}" Foreground="{StaticResource MainWindow.Foreground}" Margin="10 0 0 0"/> + </StackPanel> - <TextBlock Text="Tenacity (%)" ></TextBlock> - <StackPanel Orientation="Horizontal"> - <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" HideUpDownButtons="True" Value="{Binding ActiveRMLExtention.MinTenacity}" HorizontalContentAlignment="Left" BorderBrush="{StaticResource MainWindow.Foreground}" Foreground="{StaticResource MainWindow.Foreground}" /> - <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" HideUpDownButtons="True" Value="{Binding ActiveRMLExtention.MaxTenacity}" HorizontalContentAlignment="Left" BorderBrush="{StaticResource MainWindow.Foreground}" Foreground="{StaticResource MainWindow.Foreground}" Margin="10 0 0 0"/> - </StackPanel> + <TextBlock Text="Tenacity (%)" ></TextBlock> + <StackPanel Orientation="Horizontal"> + <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" HideUpDownButtons="True" Value="{Binding ActiveRMLExtension.MinTenacity}" HorizontalContentAlignment="Left" BorderBrush="{StaticResource MainWindow.Foreground}" Foreground="{StaticResource MainWindow.Foreground}" /> + <mahapps:NumericUpDown HasDecimals="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" HideUpDownButtons="True" Value="{Binding ActiveRMLExtension.MaxTenacity}" HorizontalContentAlignment="Left" BorderBrush="{StaticResource MainWindow.Foreground}" Foreground="{StaticResource MainWindow.Foreground}" Margin="10 0 0 0"/> + </StackPanel> - <TextBlock Text="Finishing:" ></TextBlock> - <TextBlock Text="{Binding ActiveRMLExtention.Finishing}" ></TextBlock> + <TextBlock Text="Finishing:" VerticalAlignment="Bottom" Margin=" 0 20 0 0"></TextBlock> + <TextBox Text="{Binding ActiveRMLExtension.Finishing}" ></TextBox> - </controls:TableGrid> - </DockPanel> - </Grid> - </materialDesign:Card> - </Grid> + </controls:TableGrid> + </DockPanel> + </Grid> + </materialDesign:Card> + </Grid> - </UniformGrid> + </UniformGrid> + <Button Grid.Row="1" HorizontalAlignment="Right" Width="170" Height="45" Margin="0 0 20 0" VerticalAlignment="Center" Command="{Binding SaveCommand}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="ContentSaveAll" Width="24" Height="24" /> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">SAVE</TextBlock> + </StackPanel> + </Button> + </Grid> </materialDesign:Card> </Grid> </UserControl> 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 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="EntityFramework" version="6.2.0" targetFramework="net461" /> + <package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net461" /> <package id="Google.Protobuf" version="3.4.1" targetFramework="net461" /> <package id="MahApps.Metro" version="1.5.0" targetFramework="net461" /> <package id="MaterialDesignColors" version="1.1.2" targetFramework="net461" /> |
