aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs
diff options
context:
space:
mode:
authorRoy Ben Shabat <roy.mail.net@gmail.com>2025-09-09 06:51:14 +0300
committerRoy Ben Shabat <roy.mail.net@gmail.com>2025-09-09 06:51:14 +0300
commit1cbef6c4d79a1db8c8d3923edfec2e50277caa51 (patch)
tree6487fb1a2e4c85327bc74348018ad1621cc28fba /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs
parent987e4992d01a0bc84170498c40dad0621542f46c (diff)
downloadTango-1cbef6c4d79a1db8c8d3923edfec2e50277caa51.tar.gz
Tango-1cbef6c4d79a1db8c8d3923edfec2e50277caa51.zip
RMl Default Liquid Factor + Machine Type + Improved RML Filter Loading.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs174
1 files changed, 99 insertions, 75 deletions
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 2e39f9e12..c0318e17b 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
@@ -239,7 +239,15 @@ namespace Tango.MachineStudio.RML.ViewModels
get { return _RMLFilter; }
set { _RMLFilter = value; RaisePropertyChangedAuto(); OnRMLFilterChanged(); }
}
-
+
+ private bool _loadingRmls;
+ public bool LoadingRmls
+ {
+ get { return _loadingRmls; }
+ set { _loadingRmls = value; RaisePropertyChangedAuto(); }
+ }
+
+
#endregion
#region Commands
@@ -348,105 +356,120 @@ namespace Tango.MachineStudio.RML.ViewModels
BatchConversionCommand = new RelayCommand(BatchConversion);
}
- public override async void OnApplicationReady()
+ public override void OnApplicationReady()
{
}
private async Task LoadRmls()
{
- var filter = RMLFilter.ToStringOrEmpty().ToLower();
-
- using (ObservablesContext db = ObservablesContext.CreateDefault())
+ try
{
-
- var rmls = await db.Rmls.Where(x => x.Name.ToLower().Contains(filter) || x.DisplayName.ToLower().Contains(filter))
- .Include(x => x.Cct.FileName)
- .Include(x => x.LiquidTypesRmls)
- .Include(x => x.LiquidTypesRmls.Select(y => y.LiquidType))
- .Include(x => x.BtsrApplicationType.Name)
- .Include(x => x.BtsrYarnType.Name)
- .Include(x => x.ProcessParametersTablesGroups)
- .Select(x => new
- {
- x.Name,
- x.Guid,
- x.DisplayName,
- x.Cct.FileName,
- x.ColorConversionVersion,
- x.UseColorLibGradients,
- x.UseLightInks,
- x.HeadType,
- x.LastUpdated,
- BtsrApplicationType = x.BtsrApplicationType != null ? x.BtsrApplicationType.Name : String.Empty,
- BtsrYarnType = x.BtsrYarnType != null ? x.BtsrYarnType.Name : String.Empty,
- LiquidTypesRmls = x.LiquidTypesRmls,
- LiquidTypes = x.LiquidTypesRmls.Select(y => y.LiquidType),
- ProcessParametersTables = x.ProcessParametersTablesGroups
- }).ToListAsync();
-
-
- List<RmlModel> models = new List<RmlModel>();
+ LoadingRmls = true;
- //var tables = ActiveRML.GetActiveProcessGroup().ProcessParametersTables;
+ var filter = RMLFilter.ToStringOrEmpty().ToLower();
- foreach (var rml in rmls.OrderBy(x => x.Name).ToList())
+ using (ObservablesContext db = ObservablesContext.CreateDefault())
{
- ProcessParametersTable tableZone1 = null;
- ProcessParametersTable tableZone2 = null;
- if (rml.ProcessParametersTables != null)
+
+ var rmls = await db.Rmls.Where(x => x.Name.ToLower().Contains(filter) || x.DisplayName.ToLower().Contains(filter))
+ .Include(x => x.Cct.FileName)
+ .Include(x => x.LiquidTypesRmls)
+ .Include(x => x.LiquidTypesRmls.Select(y => y.LiquidType))
+ .Include(x => x.BtsrApplicationType.Name)
+ .Include(x => x.BtsrYarnType.Name)
+ .Include(x => x.ProcessParametersTablesGroups)
+ .Select(x => new
+ {
+ x.Name,
+ x.Guid,
+ x.DisplayName,
+ x.Cct.FileName,
+ x.ColorConversionVersion,
+ x.UseColorLibGradients,
+ x.UseLightInks,
+ x.HeadType,
+ x.LastUpdated,
+ x.MachineType,
+ BtsrApplicationType = x.BtsrApplicationType != null ? x.BtsrApplicationType.Name : String.Empty,
+ BtsrYarnType = x.BtsrYarnType != null ? x.BtsrYarnType.Name : String.Empty,
+ //LiquidTypesRmls = x.LiquidTypesRmls,
+ //LiquidTypes = x.LiquidTypesRmls.Select(y => y.LiquidType),
+ ProcessParametersTables = x.ProcessParametersTablesGroups
+ }).ToListAsync();
+
+
+ List<RmlModel> models = new List<RmlModel>();
+
+ //var tables = ActiveRML.GetActiveProcessGroup().ProcessParametersTables;
+
+ foreach (var rml in rmls.OrderBy(x => x.Name).ToList())
{
- var activeTablesGroup = rml.ProcessParametersTables.Where(x=>x.Active).FirstOrDefault();
- if ( activeTablesGroup != null)
- {
- try
+ ProcessParametersTable tableZone1 = null;
+ ProcessParametersTable tableZone2 = null;
+ if (rml.ProcessParametersTables != null)
+ {
+ var activeTablesGroup = rml.ProcessParametersTables.Where(x => x.Active).FirstOrDefault();
+ if (activeTablesGroup != null)
{
- var tables = await db.ProcessParametersTables.Where(x => x.ProcessParametersTablesGroupGuid == activeTablesGroup.Guid).OrderBy(x => x.TableIndex).ToListAsync();
- if (tables.Count > 0)
+ try
{
- tableZone1 = tables[0];
+ var tables = await db.ProcessParametersTables.Where(x => x.ProcessParametersTablesGroupGuid == activeTablesGroup.Guid).OrderBy(x => x.TableIndex).ToListAsync();
+ if (tables.Count > 0)
+ {
+ tableZone1 = tables[0];
+ }
+ if (tables.Count > 1)
+ {
+ tableZone2 = tables[1];
+ }
}
- if (tables.Count > 1)
+ catch (Exception ex)
{
- tableZone2 = tables[1];
+ LogManager.Log($"Error loading ProcessParametersTables {ex.Message}");
}
- }
- catch (Exception ex)
- {
- LogManager.Log($"Error loading ProcessParametersTables {ex.Message}");
- }
- };
- }
-
- RmlModel model = new RmlModel();
- model.Guid = rml.Guid;
- model.Name = rml.Name;
- model.LastUpdated = rml.LastUpdated;
- model.DisplayName = rml.DisplayName;
- model.CCT = rml.FileName + " v" + rml.ColorConversionVersion;
- model.UseGradients = rml.UseColorLibGradients;
- model.UseLightInks = rml.UseLightInks;
- model.HeadType = (HeadTypes)rml.HeadType;
- model.Btsr = (String.IsNullOrEmpty(rml.BtsrApplicationType) ? "N/A" : rml.BtsrApplicationType) + ", " + (String.IsNullOrEmpty(rml.BtsrYarnType) ? "N/A" : rml.BtsrYarnType);
-
- if( tableZone1 != null)
+ };
+ }
+
+ RmlModel model = new RmlModel();
+ model.Guid = rml.Guid;
+ model.Name = rml.Name;
+ model.LastUpdated = rml.LastUpdated;
+ model.DisplayName = rml.DisplayName;
+ model.CCT = rml.FileName + " v" + rml.ColorConversionVersion;
+ model.UseGradients = rml.UseColorLibGradients;
+ model.UseLightInks = rml.UseLightInks;
+ model.HeadType = (HeadTypes)rml.HeadType;
+ model.Btsr = (String.IsNullOrEmpty(rml.BtsrApplicationType) ? "N/A" : rml.BtsrApplicationType) + ", " + (String.IsNullOrEmpty(rml.BtsrYarnType) ? "N/A" : rml.BtsrYarnType);
+ model.MachineType = (MachineTypes?)rml.MachineType;
+
+ if (tableZone1 != null)
{
- model.Zone1InkUptake = String.Format($"{tableZone1.MinInkUptake}-{tableZone1.MaxInkUptake}");
+ model.Zone1InkUptake = String.Format($"{tableZone1.MinInkUptake}-{tableZone1.MaxInkUptake}");
model.DyeingSpeed = tableZone1.DyeingSpeed.ToString();
}
- if(tableZone2 != null)
+ if (tableZone2 != null)
{
model.DyeingSpeed += String.Format($"-{tableZone2.DyeingSpeed}");
model.Zone2InkUptake = tableZone2 == null ? "-" : String.Format($"{tableZone2.MinInkUptake}-{tableZone2.MaxInkUptake}");
+ }
+
+ //model.LiquidTypes = rml.LiquidTypes.OrderBy(x => x.Code).Select(x => x.Color).ToList();
+ //model.LiquidTypesR = rml.LiquidTypesRmls.OrderBy(x => x.LiquidType.Code).ToList().Select((n) => new RmlModel.LiquidTypeColorValue(){ Color = n.LiquidType.Color, LiquidTypeValue = n.MaxNlPerCm }).ToList();
+
+ models.Add(model);
}
- model.LiquidTypes = rml.LiquidTypes.OrderBy(x => x.Code).Select(x => x.Color).ToList();
- model.LiquidTypesR = rml.LiquidTypesRmls.OrderBy(x => x.LiquidType.Code).ToList().Select((n) => new RmlModel.LiquidTypeColorValue(){ Color = n.LiquidType.Color, LiquidTypeValue = n.MaxNlPerCm }).ToList();
-
- models.Add(model);
+ Rmls = models;
}
-
- Rmls = models;
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error filtering rmls on RML module.");
+ }
+ finally
+ {
+ LoadingRmls = false;
}
}
@@ -730,6 +753,7 @@ namespace Tango.MachineStudio.RML.ViewModels
rml.DisplayName = name;
rml.QualificationDate = DateTime.UtcNow;
rml.Manufacturer = "Twine";
+ rml.DefaultLiquidFactor = 140;
using (ObservablesContext db = ObservablesContext.CreateDefault())
{