From 8a0b8f6abe3d143b43131a330e0ee39c2547ce8f Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Sun, 4 Jul 2021 15:25:08 +0300 Subject: After Virus --- .../ViewModels/MainViewVM.cs | 64 +++++++++++++--------- 1 file changed, 39 insertions(+), 25 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs index b3e020c85..f44034a2f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -101,26 +101,26 @@ namespace Tango.MachineStudio.RML.ViewModels set { _fiberSynths = value; RaisePropertyChangedAuto(); } } - private ObservableCollection _spoolTypes; - public ObservableCollection SpoolTypes - { - get { return _spoolTypes; } - set { _spoolTypes = value; RaisePropertyChangedAuto(); } - } - - private ObservableCollection _btsrApplicationTypes; - public ObservableCollection BtsrApplicationTypes - { - get { return _btsrApplicationTypes; } - set { _btsrApplicationTypes = value; RaisePropertyChangedAuto(); } - } - - private ObservableCollection _btsrYarnTypes; - public ObservableCollection BtsrYarnTypes - { - get { return _btsrYarnTypes; } - set { _btsrYarnTypes = value; RaisePropertyChangedAuto(); } - } + //private ObservableCollection _spoolTypes; + //public ObservableCollection SpoolTypes + //{ + // get { return _spoolTypes; } + // set { _spoolTypes = value; RaisePropertyChangedAuto(); } + //} + + //private ObservableCollection _btsrApplicationTypes; + //public ObservableCollection BtsrApplicationTypes + //{ + // get { return _btsrApplicationTypes; } + // set { _btsrApplicationTypes = value; RaisePropertyChangedAuto(); } + //} + + //private ObservableCollection _btsrYarnTypes; + //public ObservableCollection BtsrYarnTypes + //{ + // get { return _btsrYarnTypes; } + // set { _btsrYarnTypes = value; RaisePropertyChangedAuto(); } + //} private Rml _selectedRML; public Rml SelectedRML @@ -136,6 +136,17 @@ namespace Tango.MachineStudio.RML.ViewModels set { _activeRML = value; RaisePropertyChangedAuto(); } } + private List _manufacturers; + + public List Manufacturers + { + get { return _manufacturers; } + set { _manufacturers = value; + RaisePropertyChangedAuto(); + } + } + + private CalibrationDataViewVM _calibrationDataViewVM; public CalibrationDataViewVM CalibrationDataViewVM { @@ -312,7 +323,7 @@ namespace Tango.MachineStudio.RML.ViewModels x.Guid, x.FileName }).ToListAsync(); - + foreach (var rml in Rmls) { var cct = ccts.SingleOrDefault(x => x.Guid == rml.CctGuid); @@ -337,6 +348,8 @@ namespace Tango.MachineStudio.RML.ViewModels || r.Name.ToLower().Contains(RMLFilter.ToLower()); }; + + } } catch (Exception ex) @@ -373,7 +386,7 @@ namespace Tango.MachineStudio.RML.ViewModels }).ToObservableCollection(); CCTS.Where(x => String.IsNullOrWhiteSpace(x.FileName)).ToList().ForEach(x => x.FileName = x.Guid); - + LoadRmlProperties(); ActiveRML = await new RmlBuilder(_active_context) @@ -499,9 +512,10 @@ namespace Tango.MachineStudio.RML.ViewModels LinearMassDensityUnits = _active_context.LinearMassDensityUnits.ToObservableCollection(); FiberShapes = _active_context.FiberShapes.ToObservableCollection(); FiberSynths = _active_context.FiberSynths.ToObservableCollection(); - SpoolTypes = _active_context.SpoolTypes.ToObservableCollection(); - BtsrApplicationTypes = _active_context.BtsrApplicationTypes.ToObservableCollection(); - BtsrYarnTypes = _active_context.BtsrYarnTypes.ToObservableCollection(); + //SpoolTypes = _active_context.SpoolTypes.ToObservableCollection(); + //BtsrApplicationTypes = _active_context.BtsrApplicationTypes.ToObservableCollection(); + //BtsrYarnTypes = _active_context.BtsrYarnTypes.ToObservableCollection(); + Manufacturers = _active_context.YarnManufacturers.Select(x => x.Name).ToList(); } private async void AddNewRml() -- cgit v1.3.1 From cde89b7390bcf308701e196a68d364a94af2b6d5 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Tue, 20 Jul 2021 19:41:52 +0300 Subject: Save Manufacturer in YarnManufactors table on first open RML/RMLExtention Related Work Items: #4219 --- .../ViewModels/MainViewVM.cs | 3 +++ .../Tango.MachineStudio.RML/ViewModels/MainViewVM.cs | 19 +++++++++++++++++++ .../ViewModels/MainViewVM.cs | 19 +++++++++---------- .../Views/RMLExtensionsView.xaml | 2 +- 4 files changed, 32 insertions(+), 11 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index cd1abff60..8d83c0a42 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -1256,6 +1256,9 @@ namespace Tango.MachineStudio.Developer.ViewModels { String filter = JobFilter.ToLower(); + if (JobsCollectionView == null) + return; + JobsCollectionView.Filter = (job) => { try diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs index 13cac9c88..bde174f07 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -184,6 +184,17 @@ namespace Tango.MachineStudio.RML.ViewModels set { _colorCalibrationVM = value; RaisePropertyChangedAuto(); } } + private List _manufacturers; + public List Manufacturers + { + get { return _manufacturers; } + set + { + _manufacturers = value; + RaisePropertyChangedAuto(); + } + } + private String _RMLFilter; /// /// Gets or sets the job filter. @@ -397,6 +408,13 @@ namespace Tango.MachineStudio.RML.ViewModels } } + if (!String.IsNullOrEmpty(ActiveRML.Manufacturer) && false == Manufacturers.Any(x => x == ActiveRML.Manufacturer)) + { + _active_context.YarnManufacturers.Add(new YarnManufacturer() { Name = ActiveRML.Manufacturer }); + await _active_context.SaveChangesAsync(); + Manufacturers.Add(ActiveRML.Manufacturer); + } + ActiveProcessParametersGroup = ActiveRML.ProcessParametersTablesGroups.ToList().FirstOrDefault(); ActiveProcessParametersTableView = CollectionViewSource.GetDefaultView(ActiveProcessParametersGroup.ProcessParametersTables); ActiveProcessParametersTableView.SortDescriptions.Add(new SortDescription(nameof(ProcessParametersTable.TableIndex), ListSortDirection.Ascending)); @@ -482,6 +500,7 @@ namespace Tango.MachineStudio.RML.ViewModels SpoolTypes = _active_context.SpoolTypes.ToObservableCollection(); BtsrApplicationTypes = _active_context.BtsrApplicationTypes.ToObservableCollection(); BtsrYarnTypes = _active_context.BtsrYarnTypes.ToObservableCollection(); + Manufacturers = _active_context.YarnManufacturers.Select(x => x.Name).ToList(); } private async void AddNewRml() 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 10ec55958..bbabb612e 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 @@ -837,15 +837,7 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels Status = x.RMLExtesion == null ? RMLExtensionStatus.New : x.RMLExtesion.RMLStatus }).ToList(); RmlExtensions = q; - // RmlExtCollectionView = CollectionViewSource.GetDefaultView(RmlExtensions); - // RmlExtCollectionView.SortDescriptions.Add(new SortDescription(nameof(Rml.LastUpdated), ListSortDirection.Ascending)); - - //RmlExtCollectionView.Filter = (rml) => - //{ - // RmlExtensionModel r = rml as RmlExtensionModel; - // return String.IsNullOrWhiteSpace(Filter) - // || r.Name.ToLower().Contains(Filter.ToLower()); - //}; + } } catch (Exception ex) @@ -954,7 +946,14 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels ActiveRML = new RmlBuilder(_active_context) .Set(SelectedRMLExtension.RMLGuid) .Build(); - + + if (!String.IsNullOrEmpty(ActiveRML.Manufacturer) && false == Manufacturers.Any(x => x == ActiveRML.Manufacturer)) + { + _active_context.YarnManufacturers.Add(new YarnManufacturer() { Name = ActiveRML.Manufacturer }); + await _active_context.SaveChangesAsync(); + Manufacturers.Add(ActiveRML.Manufacturer); + } + var machineIdsHasTest = (from c in _active_context.ColorProcessParameters.Where(x => x.RmlsExtensionsGuid == guid) select new { MichineGUID = c.MachineGuid }). Union (from p in _active_context.RmlExtensionTestResults.Where(x => x.RmlsExtensionsGuid == guid) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml index b2bff1dae..13d2cd660 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml @@ -25,7 +25,7 @@ - + -- cgit v1.3.1