diff options
| author | Roy <Roy.mail.net@gmail.com> | 2022-11-01 17:58:50 +0200 |
|---|---|---|
| committer | Roy <Roy.mail.net@gmail.com> | 2022-11-01 17:58:50 +0200 |
| commit | 5ab455fb09c659e92ad4de41ec7472e2b8e48499 (patch) | |
| tree | 77a6786eee4e5ae07d9b2b8e14fca7d8a6b3bcc3 /Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels | |
| parent | a8a1e530d7fb014a92b39e7414385b02691236a8 (diff) | |
| download | Tango-5ab455fb09c659e92ad4de41ec7472e2b8e48499.tar.gz Tango-5ab455fb09c659e92ad4de41ec7472e2b8e48499.zip | |
Hot folder impl completed.
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels')
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs index b37cd1c68..0b039b618 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs @@ -893,71 +893,71 @@ namespace Tango.PPC.Jobs.ViewModels private async void HandleCsvJobFileLoaded(List<ExplorerFileItem> files) { - var item = files.FirstOrDefault(); - if (item == null) return; + //var item = files.FirstOrDefault(); + //if (item == null) return; - var vm = new ImportCsvJobViewVM(); - vm.Name = Path.GetFileNameWithoutExtension(item.Name); - await vm.Init(); - await NotificationProvider.ShowDialog<ImportCsvJobViewVM>(vm); + //var vm = new ImportCsvJobViewVM(); + //vm.Name = Path.GetFileNameWithoutExtension(item.Name); + //await vm.Init(); + //await NotificationProvider.ShowDialog<ImportCsvJobViewVM>(vm); - if (vm.DialogResult && vm.SelectedRml != null) - { - try - { - NotificationProvider.SetGlobalBusyMessage("Importing job from file..."); + //if (vm.DialogResult && vm.SelectedRml != null) + //{ + // try + // { + // NotificationProvider.SetGlobalBusyMessage("Importing job from file..."); - using (ObservablesContext db = ObservablesContext.CreateDefault()) - { - var segments = await SegmentsCsvHelper.FromFile(item.Path, MachineProvider.Machine, db); + // using (ObservablesContext db = ObservablesContext.CreateDefault()) + // { + // var segments = await SegmentsCsvHelper.FromFile(item.Path, MachineProvider.Machine, db); - Job job = new Job(); - job.LastUpdated = DateTime.UtcNow; - job.JobSource = JobSource.Local; - job.Name = vm.Name; - job.NumberOfHeads = 1; - job.NumberOfUnits = 1; - job.SampleUnitsOrMeters = 1; - job.CreationDate = DateTime.UtcNow; - job.JobStatus = JobStatuses.Draft; - job.JobType = JobTypes.Knitting; - job.EnableLubrication = true; - job.MachineGuid = MachineProvider.Machine.Guid; - job.RmlGuid = vm.SelectedRml.Guid; - job.Machine = await new MachineBuilder(db).Set(job.MachineGuid).WithCats().WithConfiguration().BuildAsync(); - job.Rml = await new RmlBuilder(db).Set(job.RmlGuid).WithActiveParametersGroup().WithCAT(MachineProvider.Machine.Guid).WithCCT().WithGbdAndLub().WithLiquidFactors().BuildAsync(); - job.WindingMethodGuid = Adapter.WindingMethods.FirstOrDefault().Guid; - job.SpoolTypeGuid = Settings.SpoolTypeGuid != null ? Settings.SpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid; + // Job job = new Job(); + // job.LastUpdated = DateTime.UtcNow; + // job.JobSource = JobSource.Local; + // job.Name = vm.Name; + // job.NumberOfHeads = 1; + // job.NumberOfUnits = 1; + // job.SampleUnitsOrMeters = 1; + // job.CreationDate = DateTime.UtcNow; + // job.JobStatus = JobStatuses.Draft; + // job.JobType = JobTypes.Knitting; + // job.EnableLubrication = true; + // job.MachineGuid = MachineProvider.Machine.Guid; + // job.RmlGuid = vm.SelectedRml.Guid; + // job.Machine = await new MachineBuilder(db).Set(job.MachineGuid).WithCats().WithConfiguration().BuildAsync(); + // job.Rml = await new RmlBuilder(db).Set(job.RmlGuid).WithActiveParametersGroup().WithCAT(MachineProvider.Machine.Guid).WithCCT().WithGbdAndLub().WithLiquidFactors().BuildAsync(); + // job.WindingMethodGuid = Adapter.WindingMethods.FirstOrDefault().Guid; + // job.SpoolTypeGuid = Settings.SpoolTypeGuid != null ? Settings.SpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid; - foreach (var segment in segments) - { - segment.Job = job; - job.Segments.Add(segment); - } + // foreach (var segment in segments) + // { + // segment.Job = job; + // job.Segments.Add(segment); + // } - IColorConverter converter = new DefaultColorConverter(); + // IColorConverter converter = new DefaultColorConverter(); - foreach (var stop in segments.SelectMany(x => x.BrushStops.Where(y => y.BrushColorSpace == ColorSpaces.Volume))) - { - var output = converter.Convert(stop, false); - var suggestion = output.CreateSingleSuggestion(); - stop.Color = suggestion.Color; - } + // foreach (var stop in segments.SelectMany(x => x.BrushStops.Where(y => y.BrushColorSpace == ColorSpaces.Volume))) + // { + // var output = converter.Convert(stop, false); + // var suggestion = output.CreateSingleSuggestion(); + // stop.Color = suggestion.Color; + // } - db.Jobs.Add(job); - await db.SaveChangesAsync(); - LoadJobs(); - } + // db.Jobs.Add(job); + // await db.SaveChangesAsync(); + // LoadJobs(); + // } - NotificationProvider.ReleaseGlobalBusyMessage(); - } - catch (Exception ex) - { - NotificationProvider.ReleaseGlobalBusyMessage(); - LogManager.Log(ex, "Error importing job from CSV."); - await NotificationProvider.ShowError($"Error importing job from csv file.\n{ex.FlattenMessage()}"); - } - } + // NotificationProvider.ReleaseGlobalBusyMessage(); + // } + // catch (Exception ex) + // { + // NotificationProvider.ReleaseGlobalBusyMessage(); + // LogManager.Log(ex, "Error importing job from CSV."); + // await NotificationProvider.ShowError($"Error importing job from csv file.\n{ex.FlattenMessage()}"); + // } + //} } #endregion |
