diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2021-05-24 17:07:45 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2021-05-24 17:07:45 +0300 |
| commit | b29f337cff7513e0fe0e4b98e6bc7970da89e837 (patch) | |
| tree | 2c43b877cadbba39b119ca96d37882be1998fa18 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions | |
| parent | acf0ca21bf822f1b7a4a60bd4c2d732b2c5cb646 (diff) | |
| download | Tango-b29f337cff7513e0fe0e4b98e6bc7970da89e837.tar.gz Tango-b29f337cff7513e0fe0e4b98e6bc7970da89e837.zip | |
Created a new project Tango.MachineStudio.ThreadExtentions. Changes in Database.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions')
22 files changed, 2685 insertions, 5 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/App.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/App.xaml new file mode 100644 index 000000000..6925f5a1b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/App.xaml @@ -0,0 +1,12 @@ +<Application x:Class="Tango.MachineStudio.ThreadExtensions.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> + <Application.Resources> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="pack://application:,,,/Tango.MachineStudio.Common;component/Resources/MaterialDesign.xaml" /> + <ResourceDictionary Source="pack://application:,,,/Tango.MachineStudio.Common;component/Themes/LightThemeColors.xaml" /> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </Application.Resources> +</Application> 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 new file mode 100644 index 000000000..0f432eefb --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Contracts/IMainView.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.MachineStudio.ThreadExtensions.Contracts +{ + public enum ThreadExtensionNavigationView + { + ThreadExtentionView, + ThreadExtensionsView, + } + + public interface IMainView : IView + { + void NavigateTo(ThreadExtensionNavigationView view); + } +} 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 new file mode 100644 index 000000000..c9e246bb8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Converters/ColorNameToBrushConverter.cs @@ -0,0 +1,42 @@ +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 ColorNameToBrushConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + try + { + string colorName = value as string; + if(String.IsNullOrEmpty(colorName)) + return new SolidColorBrush(Colors.Transparent); + + Color color = (Color)TypeDescriptor.GetConverter(typeof(Color)).ConvertFromString(colorName); + + SolidColorBrush brush = new SolidColorBrush(color); + brush.Opacity = 0.5; + + return brush; + } + catch + { + return new SolidColorBrush(Colors.Transparent); + } + } + + 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/Images/threads.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Images/threads.png Binary files differnew file mode 100644 index 000000000..86eb0b335 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Images/threads.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ColorDataExcelModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ColorDataExcelModel.cs new file mode 100644 index 000000000..da7471e16 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ColorDataExcelModel.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Documents; + +namespace Tango.MachineStudio.ThreadExtensions.Models +{ + public class ColorDataExcelModel + { + public int NlCm { get; set; } + public double L { get; set; } + public double A { get; set; } + public double B { get; set; } + + public ColorDataExcelModel() + { + NlCm = 0; + L = A = B = 0.0; + } + + public static void GetDataFromFile(string fileName, out List<ColorDataExcelModel> items, ref string errors) + { + items = null; + try + { + using (ExcelReader reader = new ExcelReader(fileName)) + { + items = reader.GetDataByIndex<ColorDataExcelModel>("Sheet1", 1); + } + } + catch (Exception ex) + { + errors = ex.Message; + } + } + } +} 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 new file mode 100644 index 000000000..32f568f5f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/FactorTarget.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +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<string, double> FACTOR200 = new Dictionary<string, double>() { + { "CYAN", 46.3}, {"MAGENTA", 41.04}, { "YELLOW", 97.78}, {"BLACK", 21.01}}; + + public static double GetFactor100(string color) + { + double result; + + if (FACTOR100.TryGetValue(color, out result)) + { + return result; + } + return 0.0; + } + public static double GetFactor200(string color) + { + double result; + + if (FACTOR200.TryGetValue(color, out result)) + { + return result; + } + return 0.0; + } + } +} 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 new file mode 100644 index 000000000..47632d3aa --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/PlotProperties.cs @@ -0,0 +1,169 @@ +using OxyPlot; +using OxyPlot.Wpf; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using Tango.BL.Entities; +using Tango.Core; +using Tango.MachineStudio.ThreadExtensions.ViewModels; + +namespace Tango.MachineStudio.ThreadExtensions.Models +{ + public class PlotProperties : ExtendedObject + { + public Plot PlotControl { get; set; } + private IList<DataPoint> _points; + + private string _colorName; + + public string ColorName + { + get { return _colorName; } + set { _colorName = value; } + } + + /// <summary> + /// Binding to ItemsSource of line chart. + /// </summary> + public IList<DataPoint> Points + { + get { return _points; } + set + { + _points = value; + RaisePropertyChangedAuto(); + } + } + private IList<DataPoint> _target100Points; + /// <summary> + /// Binding to ItemsSource of line chart. + /// </summary> + public IList<DataPoint> Target100Points + { + get { return _target100Points; } + set + { + _target100Points = value; + RaisePropertyChangedAuto(); + } + } + private IList<DataPoint> _target200Points; + /// <summary> + /// Binding to ItemsSource of line chart. + /// </summary> + public IList<DataPoint> Target200Points + { + get { return _target200Points; } + set + { + _target200Points = value; + RaisePropertyChangedAuto(); + } + } + private int _step; + public int XStep + { + get { return _step; } + set { _step = value; RaisePropertyChangedAuto(); } + } + + private double _from; + /// <summary> + /// From use to binding to bottom axis min value + /// </summary> + public double From + { + get { return _from; } + set + { + _from = value; RaisePropertyChangedAuto(); + } + } + + private double _to; + /// <summary> + /// To use to binding to bottom axis max value + /// </summary> + public double To + { + get { return _to; } + set + { + _to = value; RaisePropertyChangedAuto(); + } + } + + public PlotProperties(string colorName) + { + this.Points = new List<DataPoint>(); + Target100Points = new List<DataPoint>(); + Target200Points = new List<DataPoint>(); + ColorName = colorName; + + } + + public void ClearResults() + { + Points.Clear(); + Target100Points.Clear(); + Target200Points.Clear(); + } + + public void CreateGraph(List<ColorProcessData> points, bool isLtype) + { + if (PlotControl == null) + { + Debug.WriteLine("ERROR!!! CreateGraph. Plot Control is NULL."); + return; + } + + ClearResults(); + PlotControl.InvalidatePlot(true); + + double target100Y = FactorTarget.GetFactor100(ColorName); + double target200Y = FactorTarget.GetFactor200(ColorName); + + _to = target100Y > target200Y? target100Y + 10: target200Y + 10; + _from = target100Y < target200Y ? target100Y - 10 : target200Y - 10; + + foreach ( var x in points) + { + var point = new DataPoint(x.InkNlCm, isLtype ? x.L : x.B); + Points.Add(point); + + _to = _to > point.Y ? _to : point.Y; + _from = ( _from == 0 || _from > point.Y ) ? point.Y : _from; + + } + if (points.Count > 1) + { + var minInkNlCm = points.Min(n => n.InkNlCm); + var maxInkNlCm = points.Max(n => n.InkNlCm); + if(! Target100Points.Any(x => x.X == minInkNlCm)) + { + Target100Points.Add(new DataPoint(minInkNlCm, target100Y)); + Target200Points.Add(new DataPoint(minInkNlCm, target200Y)); + } + if (!Target100Points.Any(x => x.X == maxInkNlCm)) + { + Target100Points.Add(new DataPoint(maxInkNlCm, target100Y)); + Target200Points.Add(new DataPoint(maxInkNlCm, target200Y)); + } + } + Debug.WriteLine($"CreateGraph. Count Points {points.Count}"); + + if (_to == 0) + _to = isLtype ? 100 : 128; + if (_from == 0) + _from = isLtype ? 0 : -127; + + RaisePropertyChanged("To"); + RaisePropertyChanged("From"); + XStep = (int)(Points.Count / 6); + + PlotControl.InvalidatePlot(true); + + } + } +} 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 ca27b9a48..6b7204aac 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 @@ -32,6 +32,12 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> + <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath> + </Reference> + <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="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> @@ -47,8 +53,17 @@ <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <HintPath>..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> </Reference> + <Reference Include="OxyPlot, Version=2.0.0.0, Culture=neutral, PublicKeyToken=638079a8f0bd61e9, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\OxyPlot.Core.2.0.0\lib\net45\OxyPlot.dll</HintPath> + </Reference> + <Reference Include="OxyPlot.Wpf, Version=2.0.0.0, Culture=neutral, PublicKeyToken=75e952ba404cdbb0, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\OxyPlot.Wpf.2.0.0\lib\net45\OxyPlot.Wpf.dll</HintPath> + </Reference> + <Reference Include="ReachFramework" /> <Reference Include="System" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Data" /> + <Reference Include="System.Printing" /> <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll</HintPath> </Reference> @@ -69,16 +84,54 @@ <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> <Link>GlobalVersionInfo.cs</Link> </Compile> + <Compile Include="Contracts\IMainView.cs" /> + <Compile Include="Converters\ColorNameToBrushConverter.cs" /> + <Compile Include="Models\ColorDataExcelModel.cs" /> + <Compile Include="Models\FactorTarget.cs" /> + <Compile Include="Models\PlotProperties.cs" /> <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\ColorParametersVewVM.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="Views\ColorParametersView.xaml.cs"> + <DependentUpon>ColorParametersView.xaml</DependentUpon> + </Compile> <Compile Include="Views\MainView.xaml.cs"> <DependentUpon>MainView.xaml</DependentUpon> </Compile> <Compile Include="ThreadExtensionsModule.cs" /> + <Compile Include="Views\ThreadCharacteristicsView.xaml.cs"> + <DependentUpon>ThreadCharacteristicsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ThreadExtensionView.xaml.cs"> + <DependentUpon>ThreadExtensionView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ThreadExtensionsView.xaml.cs"> + <DependentUpon>ThreadExtensionsView.xaml</DependentUpon> + </Compile> + <Page Include="App.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ColorParametersView.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\ThreadCharacteristicsView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\ThreadExtensionView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\ThreadExtensionsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs"> @@ -105,8 +158,14 @@ <LastGenOutput>Settings.Designer.cs</LastGenOutput> </None> </ItemGroup> - <ItemGroup /> <ItemGroup> + <Resource Include="Images\threads.png" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\SideChains\Tango.AutoComplete\Tango.AutoComplete.csproj"> + <Project>{bb2abb74-ba58-4812-83aa-ec8171f42df4}</Project> + <Name>Tango.AutoComplete</Name> + </ProjectReference> <ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj"> <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> <Name>Tango.BL</Name> @@ -115,6 +174,10 @@ <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> <Name>Tango.Core</Name> </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Documents\Tango.Documents.csproj"> + <Project>{ca87a608-7b17-4c98-88f2-42abee10f4c1}</Project> + <Name>Tango.Documents</Name> + </ProjectReference> <ProjectReference Include="..\..\..\Tango.Logging\Tango.Logging.csproj"> <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> <Name>Tango.Logging</Name> @@ -139,5 +202,6 @@ <ItemGroup> <Resource Include="Images\Fabric.jpg" /> </ItemGroup> + <ItemGroup /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>
\ No newline at end of file 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 new file mode 100644 index 000000000..b2e677339 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorParametersVewVM.cs @@ -0,0 +1,788 @@ +using OxyPlot; +using OxyPlot.Wpf; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.ActionLogs; +using Tango.BL.Builders; +using Tango.BL.DTO; +using Tango.BL.Entities; +using Tango.Core; +using Tango.MachineStudio.Common.Notifications; +using Tango.SharedUI; +using Tango.AutoComplete.Editors; +using Tango.MachineStudio.ThreadExtensions.Models; +using Tango.Core.Commands; +using Microsoft.Win32; +using System.Diagnostics; + +namespace Tango.MachineStudio.ThreadExtensions.ViewModels +{ + public class ColorParametersVewVM : ViewModel + { + private INotificationProvider _notification; + private IActionLogManager _actionLogManager; + + private ObservablesContext _active_context; + private ObservablesContext _machineDbContext; + // private ColorProcessParameterDTO _hwBeforeSave; + + #region Properties + + private ColorProcessParameter _selectedColorProcessparameter; + /// <summary> + /// Gets or sets the selected RML. + /// </summary> + public ColorProcessParameter SelectedColorProcessParameter + { + get { return _selectedColorProcessparameter; } + set + { + _selectedColorProcessparameter = value; + RaisePropertyChangedAuto(); + } + } + + private ObservableCollection<ColorProcessData> _magentaProcessData; + public ObservableCollection<ColorProcessData> MagentaProcessData + { + get + { + return _magentaProcessData; + } + set + { + _magentaProcessData = value; + RaisePropertyChangedAuto(); + } + } + + private ObservableCollection<ColorProcessData> _cyanProcessData; + public ObservableCollection<ColorProcessData> CyanProcessData + { + get + { + return _cyanProcessData; + } + set + { + _cyanProcessData = value; + RaisePropertyChangedAuto(); + } + } + + private ObservableCollection<ColorProcessData> _yellowProcessData; + public ObservableCollection<ColorProcessData> YellowProcessData + { + get + { + return _yellowProcessData; + } + set + { + _yellowProcessData = value; + RaisePropertyChangedAuto(); + } + } + + private ObservableCollection<ColorProcessData> _blackProcessData; + public ObservableCollection<ColorProcessData> BlackProcessData + { + get + { + return _blackProcessData; + } + set + { + _blackProcessData = value; + RaisePropertyChangedAuto(); + } + } + + private ObservableCollection<ColorProcessFactor> _factor100ProcessData; + public ObservableCollection<ColorProcessFactor> Factor100ProcessData + { + get + { + return _factor100ProcessData; + } + set + { + _factor100ProcessData = value; + RaisePropertyChangedAuto(); + } + } + + private ObservableCollection<ColorProcessFactor> _factor200ProcessData; + public ObservableCollection<ColorProcessFactor> Factor200ProcessData + { + get + { + return _factor200ProcessData; + } + set + { + _factor200ProcessData = value; + RaisePropertyChangedAuto(); + } + } + + private ObservableCollection<ColorProcessFactor> _minInkUptake; + public ObservableCollection<ColorProcessFactor> MinInkUptake + { + get + { + return _minInkUptake; + } + set + { + _minInkUptake = value; + RaisePropertyChangedAuto(); + } + } + + private ObservableCollection<ColorProcessFactor> _maxInkUptake; + public ObservableCollection<ColorProcessFactor> MaxInkUptake + { + get + { + return _maxInkUptake; + } + set + { + _maxInkUptake = value; + RaisePropertyChangedAuto(); + } + } + + + private PlotProperties _cyanPlot; + + public PlotProperties CyanPlot + { + get { return _cyanPlot; } + set { + _cyanPlot = value; + RaisePropertyChangedAuto(); + } + } + + private PlotProperties _magentaPlot; + + public PlotProperties MagentaPlot + { + get { return _magentaPlot; } + set { _magentaPlot = value; } + } + + private PlotProperties _yellowPlot; + + public PlotProperties YellowPlot + { + get { return _yellowPlot; } + set { _yellowPlot = value; } + } + + private PlotProperties _blackPlot; + + public PlotProperties BlackPlot + { + get { return _blackPlot; } + set { _blackPlot = value; } + } + /// <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; + RaisePropertyChangedAuto(); + InvalidateRelayCommands(); + } + } + } + + private bool _isViewLoaded; + /// <summary> + /// Gets or sets a value indicating whether this instance is view loaded. Used to update charts. + /// </summary> + /// <value> + /// <c>true</c> if this instance is view loaded; otherwise, <c>false</c>. + /// </value> + public bool IsViewLoaded + { + get { return _isViewLoaded; } + set { + if(_isViewLoaded != value) + { + _isViewLoaded = value; + } + } + } + + private Dictionary<string, ColorProcessData> _removedColorProcessDataBeforeSave; + + public Dictionary<string, ColorProcessData> RemovedColorProcessDataBeforeSave + { + get { return _removedColorProcessDataBeforeSave; } + set { _removedColorProcessDataBeforeSave = value; } + } + + #endregion + #region commands + + public RelayCommand ImportCyanDataCommand { get; set; } + public RelayCommand ImportMagentaDataCommand { get; set; } + public RelayCommand ImportYellowDataCommand { get; set; } + public RelayCommand ImportBlackDataCommand { get; set; } + + private void ImportMagentaData(object obj) + { + List<ColorDataExcelModel> items; + 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})); + MagentaPlot.CreateGraph(MagentaProcessData.ToList(), true); + UpdateFactorsOnChangeProcessData("MAGENTA"); + } + } + + private void ImportYellowData(object obj) + { + List<ColorDataExcelModel> items; + 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})); + YellowPlot.CreateGraph(YellowProcessData.ToList(), false); + UpdateFactorsOnChangeProcessData("YELLOW"); + } + } + + private void ImportCyanData(object obj) + { + List<ColorDataExcelModel> items; + if (LoadColorDataFromExcel(out items) && items != null) + { + CyanProcessData.Clear(); + 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"); + } + } + + private void ImportBlackData(object obj) + { + List<ColorDataExcelModel> items; + if (LoadColorDataFromExcel(out items) && items != null) + { + BlackProcessData.Clear(); + 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"); + } + } + + private bool LoadColorDataFromExcel(out List<ColorDataExcelModel> items) + { + OpenFileDialog dlg = new OpenFileDialog(); + items = null; + try + { + dlg.Title = $"Import excel file with data"; + dlg.Filter = "Excel Files|*.xlsx"; + if (dlg.ShowDialog().Value) + { + string error = ""; + ColorDataExcelModel.GetDataFromFile(dlg.FileName, out items, ref error); + if (false == String.IsNullOrEmpty(error) || items == null || items.Count == 0) + { + _notification.ShowError("An error occurred while trying to import data form the selected excel file. Please check the file format if valid and is available to read."); + return false; + } + return true; + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error importing excel file " + dlg.FileName); + _notification.ShowError("An error occurred while trying to import the selected excel file. Please check the file format if valid and is available to read."); + } + return false; + } + + #endregion + + public ColorParametersVewVM(INotificationProvider notification, IActionLogManager actionLogManager) + { + _notification = notification; + _actionLogManager = actionLogManager; + _isViewLoaded = false; + RemovedColorProcessDataBeforeSave = new Dictionary<string, ColorProcessData>(); + + 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; + + MagentaProcessData = new ObservableCollection<ColorProcessData>(); + MagentaProcessData.CollectionChanged += OnMagentaCollectionChanged; + + YellowProcessData = new ObservableCollection<ColorProcessData>(); + YellowProcessData.CollectionChanged += OnYellowCollectionChanged; + + BlackProcessData = new ObservableCollection<ColorProcessData>(); + BlackProcessData.CollectionChanged += OnBlackCollectionChanged; + + CyanPlot = new PlotProperties("CYAN"); + YellowPlot = new PlotProperties("YELLOW"); + MagentaPlot = new PlotProperties("MAGENTA"); + BlackPlot = new PlotProperties("BLACK"); + + ImportCyanDataCommand = new RelayCommand(ImportCyanData); + ImportMagentaDataCommand = new RelayCommand(ImportMagentaData); + ImportYellowDataCommand = new RelayCommand(ImportYellowData); + ImportBlackDataCommand = new RelayCommand(ImportBlackData); + } + + #region Loading + + public async void LoadColorParameters(string RMLExtemtionGUID) + { + 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) + { + SelectedColorProcessParameter = new ColorProcessParametersBuilder(_active_context).Set(currentcolorProcessParameter.Guid).WithColorProcessData().WithColorProcessFactor(). Build(); + } + + if (SelectedColorProcessParameter == null) + { + SelectedColorProcessParameter = new ColorProcessParameter() { RmlsExtensionsGuid = RMLExtemtionGUID }; + 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 }); + _active_context.ColorProcessParameters.Add(SelectedColorProcessParameter); + _active_context.SaveChangesAsync(); + } + + } + }); + + LoadParameters(); + IsFree = true; + } + + private void LoadParameters() + { + Factor100ProcessData = SelectedColorProcessParameter.ColorProcessFactor.Where(x => x.FactorPercent == 100).ToObservableCollection(); + + Factor200ProcessData = SelectedColorProcessParameter.ColorProcessFactor.Where(x => x.FactorPercent == 200).ToObservableCollection(); + + MinInkUptake = SelectedColorProcessParameter.ColorProcessFactor.Where(x => x.FactorPercent == 1).ToObservableCollection(); + + MaxInkUptake = SelectedColorProcessParameter.ColorProcessFactor.Where(x => x.FactorPercent == 1111).ToObservableCollection(); + + RemovedColorProcessDataBeforeSave.Clear(); + + var cyanDataList = SelectedColorProcessParameter.ColorProcessData.Where(x => x.ColorName == "CYAN").ToList().OrderBy(x => x.InkNlCm ).ToList(); + CyanProcessData.Clear(); + cyanDataList.ForEach( y => CyanProcessData.Add(y)); + + var magentaDatalist = SelectedColorProcessParameter.ColorProcessData.Where(x => x.ColorName == "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(); ; + YellowProcessData.Clear(); + yellowDatalist.ForEach(y => YellowProcessData.Add(y)); + + var blackDatalist = SelectedColorProcessParameter.ColorProcessData.Where(x => x.ColorName == "BLACK").ToList().OrderBy(x => x.InkNlCm).ToList(); ; + BlackProcessData.Clear(); + blackDatalist.ForEach(y => BlackProcessData.Add(y)); + + UpdatePlots(); + SelectedColorProcessParameter.ColorProcessFactor.ToList().ForEach(x => UpdateFactorsOnChangeProcessData(x.ColorName)); + } + + #endregion + + #region Update Plot + + public void UpdatePlots() + { + if (IsViewLoaded) + { + CyanPlot.CreateGraph(CyanProcessData.ToList(), true); + MagentaPlot.CreateGraph(MagentaProcessData.ToList(), true); + YellowPlot.CreateGraph(YellowProcessData.ToList(), false); + BlackPlot.CreateGraph(BlackProcessData.ToList(), true); + } + } + + 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; + } + } + } + + private void CyanMeasurementModelPropertyChanged(object sender, PropertyChangedEventArgs e) + { + if(IsFree) + { + CyanPlot.CreateGraph(CyanProcessData.ToList(), true); + UpdateFactorsOnChangeProcessData("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; + } + } + } + + private void MagentaMeasurementModelPropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (IsFree) + { + MagentaPlot.CreateGraph(MagentaProcessData.ToList(), true); + UpdateFactorsOnChangeProcessData("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; + } + } + } + + private void YellowMeasurementModelPropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (IsFree) + { + YellowPlot.CreateGraph(YellowProcessData.ToList(), false); + UpdateFactorsOnChangeProcessData("YELLOW"); + } + } + + private void OnBlackCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + { + if(e.Action == NotifyCollectionChangedAction.Reset) + { + var blackProcessData = SelectedColorProcessParameter.ColorProcessData.Where(x => x.ColorName == "BLACK").ToObservableCollection(); + foreach (ColorProcessData item in blackProcessData) + { + item.PropertyChanged -= BlackMeasurementModelPropertyChanged; + SelectedColorProcessParameter.ColorProcessData.Remove(item); + RemovedColorProcessDataBeforeSave[item.Guid] = item; + } + //UpdateFactorsOnChangeProcessData("Black"); + } + else if (e.Action == NotifyCollectionChangedAction.Remove) + { + foreach (ColorProcessData item in e.OldItems) + { + SelectedColorProcessParameter.ColorProcessData.Remove(item); + RemovedColorProcessDataBeforeSave[item.Guid] = item; + item.PropertyChanged -= BlackMeasurementModelPropertyChanged; + } + UpdateFactorsOnChangeProcessData("BLACK"); + } + else if (e.Action == NotifyCollectionChangedAction.Add) + { + foreach (ColorProcessData item in e.NewItems) + { + item.ColorName = "BLACK"; + item.ColorProcessParametersGuid = SelectedColorProcessParameter.Guid; + SelectedColorProcessParameter.ColorProcessData.Add(item); + RemovedColorProcessDataBeforeSave.Remove(item.Guid); + item.PropertyChanged += BlackMeasurementModelPropertyChanged; + } + + } + } + + private void BlackMeasurementModelPropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (IsFree) + { + BlackPlot.CreateGraph(BlackProcessData.ToList(), true); + UpdateFactorsOnChangeProcessData("BLACK"); + } + } + + #endregion + + #region update factors + + /// <summary> + /// Updates the ColorProcessFactor from ColorProcessData item. + /// </summary> + /// <param name="factor">The factor.</param> + /// <param name="item">The item.</param> + private void UpdateFactor(ColorProcessFactor factor, ColorProcessData item) + { + if (factor == null) + return; + if (item == null) + { + 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; + } + + /// <summary> + /// Calculate and Update the factors on change process data. + /// </summary> + /// <param name="color">The color.</param> + private void UpdateFactorsOnChangeProcessData(string color) + { + bool isLtype = color.ToLower() == "yellow" ? false : true; + var processData = SelectedColorProcessParameter.ColorProcessData.Where(x => x.ColorName.ToLower() == color.ToLower()).ToObservableCollection(); + double target100 = FactorTarget.GetFactor100(color); + double target200 = FactorTarget.GetFactor200(color); + ColorProcessData closest100 = null; + ColorProcessData closest200 = null; + ColorProcessData minInk = null; + ColorProcessData maxInk = null; + + var minDifference100 = double.MaxValue; + var minDifference200 = double.MaxValue; + + if (processData.Count == 0) + return; + + foreach (var item in processData) + { + var colorvalue = isLtype ? item.L : item.B; + var difference100 = Math.Abs(colorvalue - target100); + if (minDifference100 > difference100) + { + minDifference100 = (int)difference100; + closest100 = item; + } + var difference200 = Math.Abs(colorvalue - target200); + if (minDifference200 > difference200) + { + minDifference200 = (int)difference200; + closest200 = item; + } + if (minInk == null || minInk.InkNlCm > item.InkNlCm) + { + minInk = item; + } + if (maxInk == null || maxInk.InkNlCm < item.InkNlCm) + { + maxInk = 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); + } + + #endregion + + #region save + + public async void Save() + { + try + { + IsFree = false; + await Task.Factory.StartNew(() => + { + SelectedColorProcessParameter.LastUpdated = DateTime.UtcNow; + + var colorProcessParameterAfterChange = ColorProcessParameterDTO.FromObservable(SelectedColorProcessParameter); + + foreach (KeyValuePair<string, ColorProcessData> item in RemovedColorProcessDataBeforeSave) + { + var existingColorProcessData = _active_context.ColorProcessData.FirstOrDefault(y => y.Guid == item.Value.Guid); + if (existingColorProcessData != null) + { + _active_context.ColorProcessData.Remove(existingColorProcessData); + } + } + _active_context.SaveChanges(); + + }); + LoadColorParameters(SelectedColorProcessParameter.RmlsExtensionsGuid); + } + catch (Exception ex) + { + LogManager.Log(ex, "Could not update color parameters."); + _notification.ShowError($"An error occurred while trying to save color parameters.\n{ex.Message}"); + } + finally + { + IsFree = true; + } + } + + #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 607670461..3fde7abbe 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 @@ -1,18 +1,542 @@ - +using Microsoft.Win32; using System; using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Data; +using Tango.BL; +using Tango.BL.Builders; +using Tango.BL.Calibration; +using Tango.BL.Entities; +using Tango.Core.Commands; using Tango.MachineStudio.Common; +using Tango.MachineStudio.Common.Notifications; + + +using System.Data.Entity; +using Tango.Core.ExtensionMethods; +using Tango.MachineStudio.Common.Authentication; +using Tango.BL.ActionLogs; +using Tango.BL.DTO; +using Tango.BL.Enumerations; +using Tango.MachineStudio.ThreadExtensions.Contracts; +using Tango.MachineStudio.ThreadExtensions.Views; namespace Tango.MachineStudio.ThreadExtensions.ViewModels { - public class MainViewVM : StudioViewModel + public class MainViewVM : StudioViewModel<IMainView> { + private INotificationProvider _notification; + private IAuthenticationProvider _authentication; + private IActionLogManager _actionLogManager; + private RmlsExtensionDTO _rmlExtensionBeforeSave; + + private ObservablesContext _rmlExtentions_context; + private ObservablesContext _active_context; + + #region properties + private ObservableCollection<RmlsExtension> _rmlsExtension; + public ObservableCollection<RmlsExtension> RmlsExtensions + { + get { return _rmlsExtension; } + set { _rmlsExtension = value; + RaisePropertyChangedAuto(); } + } + + + private RmlsExtension _activeRMLExtention; + public RmlsExtension ActiveRMLExtention + { + get { return _activeRMLExtention; } + set { _activeRMLExtention = value; + RaisePropertyChangedAuto(); } + } + + private RmlsExtension _selectedRMLExtension; + public RmlsExtension SelectedRMLExtension + { + get { return _selectedRMLExtension; } + set { _selectedRMLExtension = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + private ICollectionView _rmlExtCollectionView; + /// <summary> + /// Gets or sets the RML collection view. + /// </summary> + public ICollectionView RmlExtCollectionView + { + get { return _rmlExtCollectionView; } + set + { + _rmlExtCollectionView = value; + RaisePropertyChangedAuto(); + } + } + + private ObservableCollection<YarnApplication> _applications; + public ObservableCollection<YarnApplication> Applications + { + get { return _applications; } + set { _applications = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<YarnBrand> _brands; + public ObservableCollection<YarnBrand> Brands + { + get { return _brands; } + set { _brands = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<YarnColor> _yarnColor; + public ObservableCollection<YarnColor> YarnColor + { + get { return _yarnColor; } + set { _yarnColor = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<YarnEndUse> _enduse; + public ObservableCollection<YarnEndUse> EndUse + { + get { return _enduse; } + set { _enduse = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<YarnFamily> _family; + public ObservableCollection<YarnFamily> Family + { + get { return _family; } + set { _family = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<YarnGeometry> _geometry; + public ObservableCollection<YarnGeometry> Geometry + { + get { return _geometry; } + set { _geometry = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<YarnGlossLevel> _glosslevel; + public ObservableCollection<YarnGlossLevel> GlossLevel + { + get { return _glosslevel; } + set { _glosslevel = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<YarnGroup> _group; + public ObservableCollection<YarnGroup> Group + { + get { return _group; } + set { _group = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<YarnManufacturer> _manufacturer; + public ObservableCollection<YarnManufacturer> Manufacturer + { + get { return _manufacturer; } + set { _manufacturer = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<YarnMaterial> _materials; + public ObservableCollection<YarnMaterial> Materials + { + get { return _materials; } + set { _materials = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<YarnSubFamily> _subFamilies; + public ObservableCollection<YarnSubFamily> SubFamilies + { + get { return _subFamilies; } + set { _subFamilies = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<YarnTexturing> _texturing; + public ObservableCollection<YarnTexturing> Texturing + { + get { return _texturing; } + set { _texturing = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<YarnType> _yarnTypes; + public ObservableCollection<YarnType> YarnTypes + { + get { return _yarnTypes; } + set { _yarnTypes = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<YarnIndustrysector> _industrySector; + public ObservableCollection<YarnIndustrysector> IndustrySector + { + get { return _industrySector; } + set { _industrySector = value; RaisePropertyChangedAuto(); } + } + + private String _Filter; + /// <summary> + /// Gets or sets the search filter. + /// </summary> + public String Filter + { + get { return _Filter; } + set { _Filter = value; RaisePropertyChangedAuto(); OnFilterChanged(); } + } + + private void OnFilterChanged() + { + RmlExtCollectionView.Refresh(); + } + + private ColorParametersVewVM _colorParametersVewVM; + public ColorParametersVewVM ColorParametersVewVM + { + 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) + { + View.NavigateTo(ThreadExtensionNavigationView.ThreadExtensionsView); + LoadRmlExtentions(); + } + + private async void CloneSelectedRmlExtension(object obj) + { + using (_notification.PushTaskItem("Cloning thread...")) + { + try + { + IsFree = false; + + using (var context = ObservablesContext.CreateDefault()) + { + RmlsExtension rml_extention = await new RmlExtensionsBuilder(_rmlExtentions_context).Set(SelectedRMLExtension.Guid).WithUser().BuildAsync(); + + RmlsExtension cloned = new RmlsExtension(); + rml_extention.MapPropertiesTo(cloned, MappingFlags.NoReferenceTypes); + + cloned.Guid = Guid.NewGuid().ToString(); + cloned.ID = 0; + + + context.RmlsExtensions.Add(cloned); + await context.SaveChangesAsync(); + + //_actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlCreated, _authentication.CurrentUser, cloned.Name, cloned, "RML cloned from Machine Studio."); + } + + LoadRmlExtentions(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error cloning thread."); + _notification.ShowError($"An error occurred while trying to clone the selected thread\n{ex.Message}"); + } + finally + { + IsFree = true; + } + } + } + + private async void RemoveRmlExtension(object obj) + { + if (_notification.ShowQuestion(" Are you sure you want to delete the selected RML Extension?")) + { + 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."); + + 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; + } + } + } + } + #endregion + + public MainViewVM(INotificationProvider notificationProvider, IAuthenticationProvider authentication, IActionLogManager actionLogManager) + { + _notification = notificationProvider; + _authentication = authentication; + _actionLogManager = actionLogManager; + + 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); + } + public override void OnApplicationReady() { + LoadRmlExtentions(); + } + + #region Loading + + private async void LoadRmlExtentions() + { + try + { + IsFree = false; + + using (_notification.PushTaskItem("Loading RmlExtentions...")) + { + 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()); + }; + + } + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error loading RMLExtensions.\n{ex.FlattenMessage()}"); + } + finally + { + IsFree = true; + } + } + + private void LoadRmlProperties() + { + Applications = _active_context.YarnApplications.ToObservableCollection(); + Brands = _active_context.YarnBrand.ToObservableCollection(); + YarnColor = _active_context.YarnColor.ToObservableCollection(); + EndUse = _active_context.YarnEndUse.ToObservableCollection(); + Family = _active_context.YarnFamily.ToObservableCollection(); + Geometry = _active_context.YarnGeometry.ToObservableCollection(); + GlossLevel = _active_context.YarnGlossLevel.ToObservableCollection(); + Group = _active_context.YarnGroup.ToObservableCollection(); + Manufacturer = _active_context.YarnManufacturer.ToObservableCollection(); + + Materials = _active_context.YarnMaterials.ToObservableCollection(); + SubFamilies = _active_context.YarnSubFamily.ToObservableCollection(); + Texturing = _active_context.YarnTexturing.ToObservableCollection(); + YarnTypes = _active_context.YarnType.ToObservableCollection(); + IndustrySector = _active_context.YarnIndustrysector.ToObservableCollection(); + } + + private async void AddNewRmlExtention(object obj) + { + using (_notification.PushTaskItem("Creating new RML Extension...")) + { + IsFree = false; + + if (_active_context != null) + { + _active_context.Dispose(); + } + + _active_context = ObservablesContext.CreateDefault(); + + LoadRmlProperties(); + + RmlsExtension rml_extention = new RmlsExtension(); + rml_extention.Created = DateTime.UtcNow; + rml_extention.UserGuid = _authentication.CurrentUser.Guid; + rml_extention.YarnManufacturer = Manufacturer.FirstOrDefault(); + rml_extention.YarnBrand = Brands.FirstOrDefault(); + rml_extention.Country = null; + rml_extention.YarnEndUse = EndUse.FirstOrDefault(); + rml_extention.YarnApplications = Applications.FirstOrDefault(); + rml_extention.YarnIndustrysector = IndustrySector.FirstOrDefault(); + + rml_extention.YarnMaterial = Materials.FirstOrDefault(); + rml_extention.YarnType = YarnTypes.FirstOrDefault(); + rml_extention.YarnSubFamily = SubFamilies.FirstOrDefault(); + rml_extention.YarnFamily = Family.FirstOrDefault(); + rml_extention.YarnGroup = Group.FirstOrDefault(); + rml_extention.YarnTexturing = Texturing.FirstOrDefault(); + rml_extention.YarnGeometry = Geometry.FirstOrDefault(); + rml_extention.YarnColor = YarnColor.FirstOrDefault(); + rml_extention.YarnGlossLevel = GlossLevel.FirstOrDefault(); + rml_extention.LinearDensity = 0; + rml_extention.YarnUnit = YarnUnits.DTEX; + rml_extention.YarnPlies = Plies.P1; + rml_extention.FilamentCount = 0; + rml_extention.TwistTpm = 0; + rml_extention.YarnTwistDirections = TwistDirections.S; + rml_extention.MinElongation = 0.0; + rml_extention.MaxElongation = 100.0; + rml_extention.MinMaxForceN = 0.0; + rml_extention.MaxMaxForceN = 100.0; + rml_extention.MinElasticity = 0.0; + rml_extention.MaxElasticity = 100.0; + rml_extention.MinTenacity = 0.0; + rml_extention.MaxTenacity = 100.0; + rml_extention.Finishing = "Lubrication"; + + _active_context.RmlsExtensions.Add(rml_extention); + await _active_context.SaveChangesAsync(); + + //_actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlCreated, _authentication.CurrentUser, rml.Name, rml, "Rml created using Machine Studio."); + ColorParametersVewVM = new ColorParametersVewVM(_notification, _actionLogManager); + LoadActiveRMLExtention(rml_extention.Guid); + + IsFree = true; + } + } + + private async void LoadActiveRMLExtention(String guid) + { + using (_notification.PushTaskItem("Loading RML Extension...")) + { + try + { + IsFree = false; + + if (_active_context != null) + { + _active_context.Dispose(); + } + + _active_context = ObservablesContext.CreateDefault(); + + LoadRmlProperties(); + + ActiveRMLExtention = await new RmlExtensionsBuilder(_active_context) + .Set(guid) + .WithUser() + .BuildAsync(); + + ColorParametersVewVM = new ColorParametersVewVM(_notification, _actionLogManager); + ColorParametersVewVM.LoadColorParameters(guid); + View.NavigateTo(ThreadExtensionNavigationView.ThreadExtentionView); + + InvalidateRelayCommands(); + + IsFree = true; + } + catch (Exception ex) + { + //LogManager.Log($"Error loading RML '{ActiveRML.Name}'..."); + _notification.ShowError($"Error loading the selected thread.\n{ex.FlattenMessage()}"); + } + finally + { + IsFree = true; + } + } + } + + private async void RefreshView(String guid) + { + try + { + IsFree = false; + + //if (_active_context != null) + //{ + // _active_context.Dispose(); + //} + + //_active_context = ObservablesContext.CreateDefault(); + + LoadRmlProperties(); + ActiveRMLExtention = await new RmlExtensionsBuilder(_active_context) + .Set(guid) + .WithUser() + .BuildAsync(); + + InvalidateRelayCommands(); + + IsFree = true; + } + catch (Exception ex) + { + //LogManager.Log($"Error loading RML '{ActiveRML.Name}'..."); + _notification.ShowError($"Error refresh the selected thread.\n{ex.FlattenMessage()}"); + } + finally + { + IsFree = true; + } + } + + #endregion + + private async void Save() + { + IsFree = false; + + try + { + using (_notification.PushTaskItem("Saving RML Extension...")) + { + + ActiveRMLExtention.LastUpdated = DateTime.UtcNow; + + ColorParametersVewVM.Save(); + + var rmlExtensionAfter = RmlsExtensionDTO.FromObservable(ActiveRMLExtention); + + await _active_context.SaveChangesAsync(); + + //ColorParametersVewVM.LoadColorParameters(ActiveRMLExtention.Guid); + // _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlSaved, _authentication.CurrentUser, _rmlBeforeSave.Name, _rmlBeforeSave, rmlAfter, "RML saved using Machine Studio."); + + _rmlExtensionBeforeSave = rmlExtensionAfter; + RefreshView(SelectedRMLExtension.Guid); + } + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error saving RML Extension {ActiveRMLExtention.Name}"); + _notification.ShowError($"An error occurred while trying to save the current RML Extension.\n{ex.FlattenMessage()}"); + } + finally + { + IsFree = true; + } } } } 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 new file mode 100644 index 000000000..1526a49cb --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ColorParametersView.xaml @@ -0,0 +1,474 @@ +<UserControl x:Class="Tango.MachineStudio.ThreadExtensions.Views.ColorParametersView" + 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:vm="clr-namespace:Tango.MachineStudio.ThreadExtensions.ViewModels" + xmlns:converters="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:oxy="http://oxyplot.org/wpf" + xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + 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> + + <converters:ColorNameToBrushConverter x:Key="ColorNameToBrushConverter"/> + + <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="14"/> + </Style> + + <Style x:Key="FactorCellNumericUpDown" 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="Margin" Value=" 10 0 0 0"/> + <Setter Property="FontSize" Value="14"/> + </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="14"/> + </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> + + </UserControl.Resources> + + <Grid x:Name="contentGrid" DataContext="{Binding ColorParametersVewVM}"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="2*"/> + <ColumnDefinition Width="1*"/> + </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"> + <Border DockPanel.Dock="Top" Background="LightCyan" Margin="20 0 0 0 " Padding="5" CornerRadius="5" Height="40" VerticalAlignment="Top"> + <Border.Effect> + <DropShadowEffect Opacity="0.4" /> + </Border.Effect> + <Grid> + <DockPanel> + <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> + </Grid> + </Border> + + <Grid Margin="10 20 0 10"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + + <Grid HorizontalAlignment="Left" VerticalAlignment="Stretch" Grid.Column="0" Grid.Row="0" Margin="20 30 10 0"> + <StackPanel Orientation="Vertical"> + + <DataGrid HorizontalAlignment="Left" VerticalScrollBarVisibility ="Auto" MaxHeight="340" SelectionMode="Single" SelectionUnit="FullRow" BorderBrush="{StaticResource DarkGrayBrush }" BorderThickness="1" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="True" CanUserDeleteRows="True" ItemsSource="{Binding CyanProcessData}" Margin="0 0 0 50"> + + <DataGrid.Columns> + <mahapps:DataGridNumericUpDownColumn Header="nl/cm" Minimum="0" Maximum="100000" Binding="{Binding InkNlCm}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" /> + <mahapps:DataGridNumericUpDownColumn Header="L" Minimum="0" Maximum="100" Binding="{Binding L,Delay=100 ,UpdateSourceTrigger=LostFocus}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}"/> + <mahapps:DataGridNumericUpDownColumn Header="A" Minimum="-128" Maximum="127" Binding="{Binding A,Delay=100, UpdateSourceTrigger=LostFocus}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" /> + <mahapps:DataGridNumericUpDownColumn Header="B" Minimum="-128" Maximum="127" Binding="{Binding B ,Delay=100, UpdateSourceTrigger=LostFocus}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" /> + </DataGrid.Columns> + </DataGrid> + </StackPanel> + </Grid> + + <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="0" Margin="10 0 0 0"> + <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="0" BorderBrush="{StaticResource DarkGrayBrush}" CornerRadius="5"> + <oxy:Plot Title="Cyan" TitleFontSize="14" x:Name="CyanPlotControl" Margin="0 0 10 0" Background="Transparent" > + <oxy:Plot.Series > + <oxy:LineSeries ItemsSource="{Binding CyanPlot.Points}" Color="Cyan" MarkerFill="SteelBlue" MarkerType="Circle" /> + <oxy:LineSeries ItemsSource="{Binding CyanPlot.Target100Points}" Color="#C5E14141" LineStyle="LongDash" /> + <oxy:LineSeries ItemsSource="{Binding CyanPlot.Target200Points}" Color="#C5E14141" LineStyle="Dash" /> + </oxy:Plot.Series> + <oxy:Plot.Axes> + <oxy:LinearAxis Position="Bottom" Title = "nl/cm" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" /> + <oxy:LinearAxis Position="Left" Title = "Lab" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" Minimum="{Binding CyanPlot.From}" Maximum="{Binding CyanPlot.To}" /> + </oxy:Plot.Axes> + </oxy:Plot> + </Border> + </Grid> + </Grid> + </DockPanel> + <DockPanel Grid.Column="1"> + <Border DockPanel.Dock="Top" Background="#FC63FC" Margin="20 0 0 0 " Padding="5" CornerRadius="5" Height="40" VerticalAlignment="Top"> + <Border.Effect> + <DropShadowEffect Opacity="0.4" /> + </Border.Effect> + <Grid> + <DockPanel> + <Button DockPanel.Dock="Right" HorizontalAlignment="Left" Height="26" Padding="2" Width="140" Background="Transparent" Command="{Binding ImportMagentaDataCommand}" ToolTip="Import Magenta 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 MAGENTA</TextBlock> + </DockPanel> + </Grid> + </Border> + <Grid Margin="10 20 0 10"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + + <Grid HorizontalAlignment="Left" VerticalAlignment="Stretch" Grid.Column="0" Grid.Row="0" Margin="20 30 10 0"> + <StackPanel Orientation="Vertical"> + + <DataGrid HorizontalAlignment="Left" VerticalScrollBarVisibility ="Auto" MaxHeight="340" SelectionUnit="FullRow" BorderBrush="{StaticResource DarkGrayBrush }" BorderThickness="1" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="True" CanUserDeleteRows="True" ItemsSource="{Binding MagentaProcessData}" Margin="0 0 0 50"> + + <DataGrid.Columns> + <mahapps:DataGridNumericUpDownColumn Header="nl/cm" Minimum="0" Maximum="100000" Binding="{Binding InkNlCm}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" /> + <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> + </StackPanel> + </Grid> + + <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="0" Margin="10 0 0 0"> + <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="0" BorderBrush="{StaticResource DarkGrayBrush}" CornerRadius="5"> + <oxy:Plot Title="Magenta" TitleFontSize="14" x:Name="MagentaPlotControl" Margin="0 0 10 0" Background="Transparent" > + <oxy:Plot.Series > + <oxy:LineSeries ItemsSource="{Binding MagentaPlot.Points}" Color="Magenta" MarkerFill="SteelBlue" MarkerType="Circle" /> + <oxy:LineSeries ItemsSource="{Binding MagentaPlot.Target100Points}" Color="#C5E14141" LineStyle="LongDash" /> + <oxy:LineSeries ItemsSource="{Binding MagentaPlot.Target200Points}" Color="#C5E14141" LineStyle="Dash" /> + </oxy:Plot.Series> + <oxy:Plot.Axes> + <oxy:LinearAxis Position="Bottom" Title = "nl/cm" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" /> + <oxy:LinearAxis Position="Left" Title = "Lab" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" Minimum="{Binding MagentaPlot.From}" Maximum="{Binding MagentaPlot.To}" /> + </oxy:Plot.Axes> + </oxy:Plot> + </Border> + </Grid> + </Grid> + </DockPanel > + <DockPanel Grid.Column="0" Grid.Row="1" x:Name="YellowPanel"> + <Border DockPanel.Dock="Top" Background="LightYellow" Margin="20 0 0 0 " Padding="5" CornerRadius="5" Height="40" VerticalAlignment="Top"> + <Border.Effect> + <DropShadowEffect Opacity="0.4" /> + </Border.Effect> + <Grid> + <DockPanel> + <Button DockPanel.Dock="Right" HorizontalAlignment="Left" Height="26" Padding="2" Width="140" Background="Transparent" Command="{Binding ImportYellowDataCommand}" ToolTip="Import Yellow 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 YELLOW</TextBlock> + </DockPanel> + </Grid> + </Border> + <Grid Margin="10 20 0 10"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + + <Grid HorizontalAlignment="Left" VerticalAlignment="Stretch" Grid.Column="0" Grid.Row="0" Margin="20 30 10 0"> + <StackPanel Orientation="Vertical"> + <DataGrid HorizontalAlignment="Left" VerticalScrollBarVisibility ="Auto" MaxHeight="340" SelectionUnit="FullRow" BorderBrush="{StaticResource DarkGrayBrush }" BorderThickness="1" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="True" CanUserDeleteRows="True" ItemsSource="{Binding YellowProcessData}" Margin="0 0 0 50"> + <DataGrid.Columns> + <mahapps:DataGridNumericUpDownColumn Header="nl/cm" Minimum="0" Maximum="10000" Binding="{Binding InkNlCm}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" /> + <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> + </StackPanel> + </Grid> + + <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="0" Margin="10 0 0 0"> + <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="0" BorderBrush="{StaticResource DarkGrayBrush}" CornerRadius="5"> + <oxy:Plot Title="Yellow" TitleFontSize="14" x:Name="YellowPlotControl" Margin="0 0 10 0" Background="Transparent" > + <oxy:Plot.Series > + <oxy:LineSeries ItemsSource="{Binding YellowPlot.Points}" Color="Yellow" MarkerFill="SteelBlue" MarkerType="Circle" /> + <oxy:LineSeries ItemsSource="{Binding YellowPlot.Target100Points}" Color="#C5E14141" LineStyle="LongDash" /> + <oxy:LineSeries ItemsSource="{Binding YellowPlot.Target200Points}" Color="#C5E14141" LineStyle="Dash" /> + </oxy:Plot.Series> + <oxy:Plot.Axes> + <oxy:LinearAxis Position="Bottom" Title = "nl/cm" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" /> + <oxy:LinearAxis Position="Left" Title = "Lab" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" Minimum="{Binding YellowPlot.From}" Maximum="{Binding YellowPlot.To}" /> + </oxy:Plot.Axes> + </oxy:Plot> + </Border> + </Grid> + </Grid> + </DockPanel> + <DockPanel Grid.Column="1" Grid.Row="1"> + <Border DockPanel.Dock="Top" Background="DarkGray" Margin="20 0 0 0 " Padding="5" CornerRadius="5" Height="40" VerticalAlignment="Top"> + <Border.Effect> + <DropShadowEffect Opacity="0.4" /> + </Border.Effect> + <Grid> + <DockPanel> + <Button DockPanel.Dock="Right" HorizontalAlignment="Left" Height="26" Padding="2" Width="140" Background="Transparent" Command="{Binding ImportBlackDataCommand}" ToolTip="Import Black 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 BLACK</TextBlock> + </DockPanel> + </Grid> + + </Border> + <Grid Margin="10 20 0 10"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + + <Grid HorizontalAlignment="Left" VerticalAlignment="Stretch" Grid.Column="0" Grid.Row="0" Margin="20 30 10 0"> + <StackPanel Orientation="Vertical" > + + <DataGrid HorizontalAlignment="Left" VerticalScrollBarVisibility ="Auto" MaxHeight="340" SelectionUnit="FullRow" BorderBrush="{StaticResource DarkGrayBrush }" BorderThickness="1" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="True" CanUserDeleteRows="True" ItemsSource="{Binding BlackProcessData}" Margin="0 0 0 50"> + + <DataGrid.Columns> + <mahapps:DataGridNumericUpDownColumn Header="nl/cm" Minimum="0" Maximum="10000" Binding="{Binding InkNlCm}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" /> + <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> + </StackPanel> + </Grid> + + <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="0" Margin="10 0 0 0"> + <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="0" BorderBrush="{StaticResource DarkGrayBrush}" CornerRadius="5"> + <oxy:Plot Title=" Black" TitleFontSize="14" x:Name="BlackPlotControl" Margin="0 0 10 0" Background="Transparent" > + <oxy:Plot.Series > + <oxy:LineSeries ItemsSource="{Binding BlackPlot.Points}" Color="Black" MarkerFill="SteelBlue" MarkerType="Circle" /> + <oxy:LineSeries ItemsSource="{Binding BlackPlot.Target100Points}" Color="#A1E14141" LineStyle="LongDash" /> + <oxy:LineSeries ItemsSource="{Binding BlackPlot.Target200Points}" Color="#A1E14141" LineStyle="Dash" /> + </oxy:Plot.Series> + <oxy:Plot.Axes> + <oxy:LinearAxis Position="Bottom" Title = "nl/cm" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" /> + <oxy:LinearAxis Position="Left" Title = "Lab" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" Minimum="{Binding BlackPlot.From}" Maximum="{Binding BlackPlot.To}" /> + </oxy:Plot.Axes> + </oxy:Plot> + </Border> + </Grid> + </Grid> + </DockPanel> + </UniformGrid> + </DockPanel> + <StackPanel Orientation="Vertical" Grid.Column="1" Margin="40 60 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}"> + <TextBlock></TextBlock> + </Border> + <Border BorderThickness="1 0 0 0" Background="Transparent" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock FontSize="12" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10 0 0 0" Foreground="{StaticResource GrayBrush200}">L</TextBlock> + </Border> + <Border BorderThickness="1 0 0 0" Background="Transparent" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock FontSize="12" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10 0 0 0" Foreground="{StaticResource GrayBrush200}">A</TextBlock> + </Border> + <Border BorderThickness="1 0 0 0" Background="Transparent" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <TextBlock FontSize="12" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10 0 0 0" Foreground="{StaticResource GrayBrush200}">B</TextBlock> + </Border> + <Border BorderThickness="0 1 0 0" Background="Transparent" BorderBrush="{StaticResource BorderBrushGainsboro}"> + <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> + </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> + </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> + </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.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="Factor 100%" Width="1*"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Border BorderThickness="0" Background="{Binding ColorName, 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> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + + <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="Factor200Grid" HorizontalAlignment="Left" VerticalScrollBarVisibility ="Auto" MaxHeight="250" RowHeight="26" SelectionUnit="FullRow" BorderBrush="{StaticResource DarkGrayBrush }" BorderThickness="1" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Factor200ProcessData}" Margin="0 10 0 20"> + <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> + <Setter Property="FontSize" Value="14"/> + </Style> + </DataGrid.CellStyle> + <DataGrid.Columns> + <DataGridTemplateColumn Header="Factor 200%" Width="1*"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Border BorderThickness="0" Background="{Binding ColorName, 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="MinInkUptakeGrid" HorizontalAlignment="Left" VerticalScrollBarVisibility ="Auto" MaxHeight="250" RowHeight="26" SelectionUnit="FullRow" BorderBrush="{StaticResource DarkGrayBrush }" BorderThickness="1" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding MinInkUptake}" Margin="0 10 0 20"> + <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> + <Setter Property="FontSize" Value="14"/> + </Style> + </DataGrid.CellStyle> + <DataGrid.Columns> + <DataGridTemplateColumn Header="Min Ink Uptake" Width="1*"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Border BorderThickness="0" Background="{Binding ColorName, 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="MaxInkUptakeGrid" HorizontalAlignment="Left" VerticalScrollBarVisibility ="Auto" MaxHeight="250" RowHeight="26" SelectionUnit="FullRow" BorderBrush="{StaticResource DarkGrayBrush }" BorderThickness="1" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding MaxInkUptake}" Margin="0 10 0 20"> + <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> + <Setter Property="FontSize" Value="14"/> + </Style> + </DataGrid.CellStyle> + <DataGrid.Columns> + <DataGridTemplateColumn Header="Max Ink Uptake" Width="1*"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Border BorderThickness="0" Background="{Binding ColorName, 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> + </Grid> + +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ColorParametersView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ColorParametersView.xaml.cs new file mode 100644 index 000000000..4e6a8c048 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ColorParametersView.xaml.cs @@ -0,0 +1,44 @@ +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 ColorParametersView.xaml + /// </summary> + public partial class ColorParametersView : UserControl + { + public ColorParametersView() + { + InitializeComponent(); + this.Loaded += ColorParametersView_Loaded; + } + + private void ColorParametersView_Loaded(object sender, RoutedEventArgs e) + { + if (contentGrid != null && contentGrid.DataContext is ColorParametersVewVM) + { + ColorParametersVewVM vm = (ColorParametersVewVM)contentGrid.DataContext; + vm.CyanPlot.PlotControl = CyanPlotControl; + vm.MagentaPlot.PlotControl = MagentaPlotControl; + vm.YellowPlot.PlotControl = YellowPlotControl; + vm.BlackPlot.PlotControl = BlackPlotControl; + vm.IsViewLoaded = true; + } + } + } +} 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 b446c7cc7..0ef5850c6 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 @@ -4,12 +4,16 @@ 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:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:vm="clr-namespace:Tango.MachineStudio.ThreadExtensions.ViewModels" xmlns:global="clr-namespace:Tango.MachineStudio.ThreadExtensions" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" 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}"> <Grid IsEnabled="{Binding IsFree}"> - <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="70">Thread Extensions</TextBlock> + <controls:NavigationControl x:Name="navigationControl" TransitionType="Slide"> + <local:ThreadExtensionsView /> + <local:ThreadExtentionView/> + </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 863a96398..251099c8a 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 @@ -12,17 +12,25 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.Core.DI; +using Tango.MachineStudio.ThreadExtensions.Contracts; namespace Tango.MachineStudio.ThreadExtensions.Views { /// <summary> /// Interaction logic for MainView.xaml /// </summary> - public partial class MainView : UserControl + public partial class MainView : UserControl, IMainView { public MainView() { InitializeComponent(); + TangoIOC.Default.Register<IMainView>(this); + } + + public void NavigateTo(ThreadExtensionNavigationView view) + { + navigationControl.NavigateTo(view.ToString()); } } } 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 new file mode 100644 index 000000000..fac8e6af4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadCharacteristicsView.xaml @@ -0,0 +1,195 @@ +<UserControl x:Class="Tango.MachineStudio.ThreadExtensions.Views.ThreadCharacteristicsView" + 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:vm="clr-namespace:Tango.MachineStudio.ThreadExtensions.ViewModels" + xmlns:global="clr-namespace:Tango.MachineStudio.ThreadExtensions" + xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + 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: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"/> + </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"/> + + + <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="Country:" ></TextBlock> + <TextBox Text="{Binding ActiveRMLExtention.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="Applications:" ></TextBlock> + <ComboBox ItemsSource="{Binding Applications}" SelectedItem="{Binding ActiveRMLExtention.YarnApplications,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> + + </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> + + <TextBlock Text="Type:" ></TextBlock> + <ComboBox ItemsSource="{Binding YarnTypes}" SelectedItem="{Binding ActiveRMLExtention.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="Family:" ></TextBlock> + <ComboBox ItemsSource="{Binding Family}" SelectedItem="{Binding ActiveRMLExtention.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="Texturing:" ></TextBlock> + <ComboBox ItemsSource="{Binding Texturing}" SelectedItem="{Binding ActiveRMLExtention.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="Color:" ></TextBlock> + <ComboBox ItemsSource="{Binding YarnColor}" SelectedItem="{Binding ActiveRMLExtention.YarnColor,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="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="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="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="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="Count (den)" ></TextBlock> + <TextBlock Text="{Binding ActiveRMLExtention.DencityCount}" Foreground="Blue" ></TextBlock> + + <TextBlock Text="Fiber count " ></TextBlock> + <TextBlock Text="{Binding ActiveRMLExtention.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 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> + </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="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="Finishing:" ></TextBlock> + <TextBlock Text="{Binding ActiveRMLExtention.Finishing}" ></TextBlock> + + </controls:TableGrid> + </DockPanel> + </Grid> + </materialDesign:Card> + </Grid> + + </UniformGrid> + </materialDesign:Card> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadCharacteristicsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadCharacteristicsView.xaml.cs new file mode 100644 index 000000000..944cf07f4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadCharacteristicsView.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 ThreadCharacteristicsView.xaml + /// </summary> + public partial class ThreadCharacteristicsView : UserControl + { + public ThreadCharacteristicsView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionView.xaml new file mode 100644 index 000000000..f9d8a2dc3 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionView.xaml @@ -0,0 +1,61 @@ +<UserControl x:Class="Tango.MachineStudio.ThreadExtensions.Views.ThreadExtentionView" + 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:global="clr-namespace:Tango.MachineStudio.ThreadExtensions" + xmlns:local="clr-namespace:Tango.MachineStudio.ThreadExtensions.Views" + xmlns:vm="clr-namespace:Tango.MachineStudio.ThreadExtensions.ViewModels" + 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + 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}"> + <Grid> + <DockPanel> + <Grid DockPanel.Dock="Top" Panel.ZIndex="200"> + <StackPanel Orientation="Horizontal"> + <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> + </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> + </Grid> + <Grid DockPanel.Dock="Bottom"> + + </Grid> + + <Grid> + <Grid IsEnabled="{Binding IsFree}" Margin="40" > + <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"/> + </Style> + <Style TargetType="TabItem" BasedOn="{StaticResource {x:Type TabItem}}"> + <Setter Property="Padding" Value="20,2"></Setter> + </Style> + </TabControl.Resources> + <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"> + <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>--> + </TabControl> + </Grid> + </Grid> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionView.xaml.cs new file mode 100644 index 000000000..2cce29e57 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionView.xaml.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.ThreadExtensions.Views +{ + /// <summary> + /// Interaction logic for ThreadExtView.xaml + /// </summary> + public partial class ThreadExtentionView : UserControl + { + public ThreadExtentionView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionsView.xaml new file mode 100644 index 000000000..b85222b12 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionsView.xaml @@ -0,0 +1,103 @@ +<UserControl x:Class="Tango.MachineStudio.ThreadExtensions.Views.ThreadExtensionsView" + 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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:global="clr-namespace:Tango.MachineStudio.ThreadExtensions" + xmlns:local="clr-namespace:Tango.MachineStudio.ThreadExtensions.Views" + xmlns:observables="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" + xmlns:vm="clr-namespace:Tango.MachineStudio.ThreadExtensions.ViewModels" + 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" + 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> + </UserControl.Resources> + + <Grid IsEnabled="{Binding IsFree}"> + <DockPanel Margin="100 100 100 50" MaxWidth="1200"> + <Grid DockPanel.Dock="Top"> + <Image Source="../Images/threads.png" Width="300" Margin="10" /> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0 0 10 30"> + <materialDesign:PackIcon Kind="Magnify" Width="26" Height="26"/> + <TextBox Width="300" materialDesign:HintAssist.Hint="Search by name" Text="{Binding Filter,UpdateSourceTrigger=PropertyChanged,Delay=500}"></TextBox> + </StackPanel> + </Grid> + <Grid DockPanel.Dock="Bottom"> + <StackPanel> + <Grid> + <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" /> + <TextBlock Margin="5 0 0 0" FontSize="16">DELETE</TextBlock> + </StackPanel> + </Button> + <Button Margin="0 0 10 0" MinWidth="160" Height="50" Background="{StaticResource OrangeBrush300}" BorderBrush="{StaticResource OrangeBrush300}" Command="{Binding CloneRmlExtensionCommand}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="ContentCopy" Width="20" Height="20" /> + <TextBlock Margin="5 0 0 0" FontSize="16">DUPLICATE</TextBlock> + </StackPanel> + </Button> + <Button Margin="0 0 10 0" MinWidth="160" Height="50" Background="{StaticResource GreenBrush300}" BorderBrush="{StaticResource GreenBrush300}" Command="{Binding AddRmlExtCommand}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="Plus" Width="20" Height="20" /> + <TextBlock Margin="5 0 0 0" FontSize="16">NEW</TextBlock> + </StackPanel> + </Button> + </StackPanel> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> + <Button Margin="50 0 0 0" MinWidth="200" Height="60" Command="{Binding ManageRmlExtensionCommand}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="Pencil" Width="24" Height="24" /> + <TextBlock Margin="10 0 0 0" FontSize="18">EDIT</TextBlock> + </StackPanel> + </Button> + </StackPanel> + </Grid> + + <StackPanel Orientation="Horizontal" Margin="0 40 0 0"> + <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> + </StackPanel> + </Button> + + <Button Margin="30 0 0 0" Command="{Binding ExportRMLFileCommand}" Foreground="{StaticResource BlackForegroundBrush}" FontSize="16" Style="{StaticResource emptyButton}" Cursor="Hand"> + <StackPanel Orientation="Horizontal"> + <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> + </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.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> + </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="LINEAR DENSITY" Binding="{Binding LinearDensity}" Width="140"/> + <DataGridTextColumn Header="CREATED BY" Binding="{Binding User.Contact.FirstName}" 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" /> + </DataGrid.Columns> + </DataGrid> + </Grid> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionsView.xaml.cs new file mode 100644 index 000000000..9afb7a5c8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadExtensionsView.xaml.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.ThreadExtensions.Views +{ + /// <summary> + /// Interaction logic for ThreadExtViews.xaml + /// </summary> + public partial class ThreadExtensionsView : UserControl + { + public ThreadExtensionsView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/app.config index 97a204217..7b82e5f7c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/app.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/app.config @@ -1,5 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <configuration> + <configSections> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + </configSections> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> @@ -72,4 +76,10 @@ </dependentAssembly> </assemblyBinding> </runtime> + <entityFramework> + <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> + <providers> + <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> + </providers> + </entityFramework> </configuration>
\ No newline at end of file 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 fd88f4804..5a03cfb57 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/packages.config @@ -1,8 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> <packages> + <package id="EntityFramework" version="6.2.0" 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" /> <package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net461" /> <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" /> + <package id="OxyPlot.Core" version="2.0.0" targetFramework="net461" /> + <package id="OxyPlot.Wpf" version="2.0.0" targetFramework="net461" /> </packages>
\ No newline at end of file |
