From 331266b13685e16520ae5baa8a7aff50789c31df Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Wed, 13 Nov 2024 05:12:21 +0200 Subject: Inks Extension Support. --- .../ViewModels/MainViewVM.cs | 25 ++- .../Views/JobView.xaml | 4 +- ...go.MachineStudio.Logging_dfcch3km_wpftmp.csproj | 224 +++++++++++++++++++++ .../ViewModels/MainViewVM.cs | 44 +++- .../Views/ConfigurationView.xaml | 1 + .../ViewModels/ColorConversionViewVM.cs | 12 ++ .../ViewModels/MainViewVM.cs | 26 ++- .../Tango.MachineStudio.RML/Views/RmlView.xaml | 46 ++++- 8 files changed, 368 insertions(+), 14 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging_dfcch3km_wpftmp.csproj (limited to 'Software/Visual_Studio/MachineStudio') 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 a32fa58df..073f79a97 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 @@ -233,7 +233,22 @@ namespace Tango.MachineStudio.Developer.ViewModels public List LiquidTypesRmls { get { return _liquidTypesRmls; } - set { _liquidTypesRmls = value; RaisePropertyChangedAuto(); } + set { _liquidTypesRmls = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(LiquidTypesRmlsOrdered)); } + } + + public List LiquidTypesRmlsOrdered + { + get + { + if (Settings.UsePreferredLiquidVolumeIndex) + { + return LiquidTypesRmls.OrderBy(x => x.LiquidType.PreferredIndex).ToList(); + } + else + { + return LiquidTypesRmls; + } + } } private ProcessParametersTablesGroup _rmlProcessParametersTablesGroup; @@ -841,6 +856,14 @@ namespace Tango.MachineStudio.Developer.ViewModels { Settings = SettingsManager.Default.GetOrCreate(); + Settings.PropertyChanged += (x, e) => + { + if (e.PropertyName == nameof(Settings.UsePreferredLiquidVolumeIndex)) + { + RaisePropertyChanged(nameof(LiquidTypesRmlsOrdered)); + } + }; + AutoProcessSelection = Settings.AutoProcessSelection; SelectedJobs = new ObservableCollection(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index 4217d9712..c9842d494 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -793,7 +793,7 @@ - + MEDIA LIQUIDS ( Max Nanolitter/CM ) @@ -802,7 +802,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging_dfcch3km_wpftmp.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging_dfcch3km_wpftmp.csproj new file mode 100644 index 000000000..81201d169 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging_dfcch3km_wpftmp.csproj @@ -0,0 +1,224 @@ + + + + + Debug + AnyCPU + {1674F726-0E66-414F-B9FD-C6F20D7F07C7} + library + Tango.MachineStudio.Logging + Tango.MachineStudio.Logging + v4.6.1 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + true + full + false + ..\..\..\Build\Machine Studio\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\..\Build\Machine Studio\Release\ + TRACE + prompt + 4 + + + + + + GlobalVersionInfo.cs + + + + + + + + + + + + + + + + + + + + + + + + + + EmbeddedLogDetailsView.xaml + + + EmbeddedLogsView.xaml + + + ApplicationLogDetailsView.xaml + + + EventDetailsView.xaml + + + ApplicationLogsView.xaml + + + EventsView.xaml + + + HomeView.xaml + + + MainView.xaml + + + TimelineView.xaml + + + TimelineWrapperView.xaml + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + {bb2abb74-ba58-4812-83aa-ec8171f42df4} + Tango.AutoComplete + + + {f441feee-322a-4943-b566-110e12fd3b72} + Tango.BL + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + {4206ac58-3b57-4699-8835-90bf6db01a61} + Tango.Integration + + + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} + Tango.Logging + + + {e4927038-348d-4295-aaf4-861c58cb3943} + Tango.PMR + + + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} + Tango.Settings + + + {8491d07b-c1f6-4b62-a412-41b9fd2d6538} + Tango.SharedUI + + + {74e700b0-1156-4126-be40-ee450d3c3026} + Tango.Transport + + + {cb0b0aa2-bb24-4bca-a720-45e397684e12} + Tango.MachineStudio.Common + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs index ddc0d91a3..8d539769c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs @@ -261,6 +261,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels public RelayCommand MakePrototypeCommand { get; set; } public RelayCommand UpgradeToGen2Command { get; set; } + + public RelayCommand CreateDispenserCommand { get; set; } #endregion #region Constructors @@ -301,6 +303,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels TupViewVM = new TupViewVM(_notification); UpgradeToGen2Command = new RelayCommand(UpgradeToGEN2); + + CreateDispenserCommand = new RelayCommand(CreateDispenser); } #endregion @@ -318,7 +322,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { Task.Factory.StartNew(() => { - ActiveMachineAdapter.Dispensers = ActiveMachineAdapter.Context.Dispensers.Where(x => x.SerialNumber.ToLower().StartsWith(DispensersFilter.ToLower())).OrderBy(x => x.SerialNumber).ToSynchronizedObservableCollection(); + ActiveMachineAdapter.Dispensers = ActiveMachineAdapter.Context.Dispensers.Where(x => x.SerialNumber.ToLower().StartsWith(DispensersFilter.ToLower())).OrderBy(x => x.SerialNumber).ToSynchronizedObservableCollection().OrderByAlphaNumeric(x => x.SerialNumber).ToSynchronizedObservableCollection(); }); }); } @@ -394,6 +398,18 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// The ids pack. public void DropDispenser(Dispenser dispenser, IdsPack idsPack) { + if (ActiveMachine.Configuration.IdsPacks.Any(x => x.DispenserGuid == dispenser.Guid)) + { + _notification.ShowError("The selected dispenser is already installed on this machine."); + return; + } + + if (ActiveMachineAdapter.Context.IdsPacks.Any(x => x.DispenserGuid == dispenser.Guid)) + { + _notification.ShowError("The selected dispenser is already installed on another machine."); + return; + } + idsPack.Dispenser = dispenser; idsPack.DispenserGuid = dispenser.Guid; } @@ -966,6 +982,32 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels } } + private async void CreateDispenser() + { + String serialNumber = _notification.ShowTextInput("Please enter new serial number", "Serial Number", ActiveMachine.SerialNumber + "_D" + (ActiveMachine.Configuration.IdsPacks.Where(x => x.Dispenser != null).Count() + 1).ToString()); + if (serialNumber.IsNullOrWhiteSpace()) return; + + if (ActiveMachineAdapter.Context.Dispensers.Any(x => x.SerialNumber == serialNumber)) + { + _notification.ShowError($"Dispenser '{serialNumber}' already exists. Please enter a different serial number."); + return; + } + + using (_notification.PushTaskItem("Creating new dispenser...")) + { + using (var db = ObservablesContext.CreateDefault()) + { + Dispenser dispenser = new Dispenser(); + dispenser.SerialNumber = serialNumber; + dispenser.DispenserTypeGuid = ActiveMachineAdapter.Context.DispenserTypes.First(x => x.Code == (int)DispenserTypes.StandardDispenser).Guid; + dispenser.NlPerPulse = 2.34; + db.Dispensers.Add(dispenser); + await db.SaveChangesAsync(); + DispensersFilter = serialNumber; + } + } + } + #endregion private void CloneMachine() diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml index 9b99c9ec5..5278d1780 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml @@ -446,6 +446,7 @@ + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs index ca3c3e322..be7dc3a67 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs @@ -248,6 +248,12 @@ namespace Tango.MachineStudio.RML.ViewModels input.UseLubricantTransform = RML.UseLubricantTransform; input.VMax = RML.VMax; + input.SetPredictionType(RML.PredictionType); + input.SetPredictionMethod(RML.PredictionMethod); + input.CMYKVHueThreshhold = RML.CmykvHueThreshold; + input.CMYKVK = RML.KNearestK; + input.SimpleRGBPreviewFactor = RML.SimpleRgbPreviewFactor; + //Validate calibration data foreach (var vm in LiquidsCalibrationData.Where(x => x.LiquidType.HasPigment)) { @@ -387,6 +393,12 @@ namespace Tango.MachineStudio.RML.ViewModels input.UseLubricantTransform = RML.UseLubricantTransform; input.VMax = RML.VMax; + input.SetPredictionType(RML.PredictionType); + input.SetPredictionMethod(RML.PredictionMethod); + input.CMYKVHueThreshhold = RML.CmykvHueThreshold; + input.CMYKVK = RML.KNearestK; + input.SimpleRGBPreviewFactor = RML.SimpleRgbPreviewFactor; + foreach (var vm in LiquidsCalibrationData.Where(x => x.LiquidType.HasPigment)) { InputLiquid inputLiquid = new InputLiquid(); 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 e3c128cb7..db0d7e2aa 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 @@ -348,9 +348,33 @@ namespace Tango.MachineStudio.RML.ViewModels BatchConversionCommand = new RelayCommand(BatchConversion); } - public override void OnApplicationReady() + public override async void OnApplicationReady() { + using (_notification.PushTaskItem("Loading color measurements...")) + { + using (var db = ObservablesContext.CreateDefault()) + { + var measurements = await db.ColorMeasurements.ToListAsync(); + List pmrMeasurements = new List(); + foreach (var m in measurements) + { + pmrMeasurements.Add(new PMR.ColorLab.ColorMeasurement() + { + C = m.C, + M = m.M, + Y = m.Y, + K = m.K, + V = m.V, + L = m.L, + A = m.A, + B = m.B, + }); + } + + DefaultColorConverter.SetMeasurements(pmrMeasurements); + } + } } private async Task LoadRmls() diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml index 8730355cc..cdacbae60 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml @@ -23,13 +23,14 @@ + - + @@ -105,7 +106,7 @@ --> - + @@ -124,7 +125,7 @@ - + @@ -139,7 +140,7 @@ - +