diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2022-01-30 14:45:35 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2022-01-30 14:45:35 +0200 |
| commit | 7340cf3da145a6eff01903fc7cf9da15983bf8af (patch) | |
| tree | e027e35068749df40174c6725c133669d83cb8fe /Software/Visual_Studio/PPC/Modules | |
| parent | 99ab23894ab92eb93774cca163c5558c43e6180f (diff) | |
| parent | 94506b081ec7cd46a7088718902313401999cb90 (diff) | |
| download | Tango-7340cf3da145a6eff01903fc7cf9da15983bf8af.tar.gz Tango-7340cf3da145a6eff01903fc7cf9da15983bf8af.zip | |
Merged Vica Fixes to new PPC UI.
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
8 files changed, 70 insertions, 147 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs index 10fe6e821..0412cb64a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs @@ -290,7 +290,7 @@ namespace Tango.PPC.Jobs.Dialogs public ColorSelectionViewVM() { - SelectedColorTab = ColorTab.RGB; + SelectedColorTab = ColorTab.Volume; _volumeConversionTimer = new ActionTimer(TimeSpan.FromMilliseconds(50)); _converter = new DefaultColorConverter(); CollectionFilter = new DefaultCollectionFilter(); @@ -356,7 +356,7 @@ namespace Tango.PPC.Jobs.Dialogs else { SelectedBrushStop = DialogEditObject.BrushStopForEdit; - SelectedColorTab = ColorTab.RGB; + SelectedColorTab = ColorTab.Volume; SelectedCatalog = Catalogs.FirstOrDefault(); } SelectedBrushStop.ColorCatalogsItemChanged -= OnColorSelectionItemChanged; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs index 03ae2bbab..2033fac48 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs @@ -613,21 +613,31 @@ namespace Tango.PPC.Jobs.Models LiquidVolumesOutOfRange = false; } - public BrushStopModel(BrushStop brushStop, SegmentModel segmentModel) + public BrushStopModel(BrushStop brushStop, SegmentModel segmentModel, int version) { SegmentModel = segmentModel; OffsetPercent = brushStop.OffsetPercent; Color = brushStop.Color; BestMatchColor = brushStop.Color; ColorSpace = brushStop.ColorSpace.Space; - ColorCatalogsItem = brushStop.ColorCatalogsItem; - StopIndex = brushStop.StopIndex; + _colorcatalogsitem = brushStop.ColorCatalogsItem; + _stopindex = brushStop.StopIndex; PreventPropertyUpdate = true; - Cyan = brushStop.Cyan; - Magenta = brushStop.Magenta; - Yellow = brushStop.Yellow; - Black = brushStop.Black; + if(version == 1) + { + Cyan = brushStop.GetVolume(LiquidTypes.Cyan); + Magenta = brushStop.GetVolume(LiquidTypes.Magenta); + Yellow = brushStop.GetVolume(LiquidTypes.Yellow); + Black = brushStop.GetVolume(LiquidTypes.Black); + } + else + { + Cyan = brushStop.Cyan; + Magenta = brushStop.Magenta; + Yellow = brushStop.Yellow; + Black = brushStop.Black; + } Red = brushStop.Red; Green = brushStop.Green; Blue = brushStop.Blue; @@ -1081,7 +1091,8 @@ namespace Tango.PPC.Jobs.Models } catch (Exception ex) { - LogManager.Log(ex, "An error occurred while trying to get volume => RGB from conversion engine."); + LogManager.Log(ex, "An error occurred while trying to get volume => RGB from conversion engine." + ex); + //convertedString = Regex.Replace(ex,@"\xEF\xBF\xBD"," "); } finally { @@ -1274,7 +1285,7 @@ namespace Tango.PPC.Jobs.Models } catch (Exception ex) { - LogManager.Log(ex, "An error occurred while trying to get volume => RGB from conversion engine."); + LogManager.Log(ex, "An error occurred while trying to get volume => RGB from conversion engine." + ex); BestMatchColor = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); } finally diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs index c7b9d9b6d..0106d82c4 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs @@ -384,7 +384,7 @@ namespace Tango.PPC.Jobs.Models public bool HasSelectedItems { get { - bool test = Segments.ToList().Any(x => x.IsSelected); + //bool test = Segments.ToList().Any(x => x.IsSelected); return Segments.ToList().Any(x => x.IsSelected); } } public List<SegmentModel> SegmentsToCopy { get; set; } @@ -541,8 +541,11 @@ namespace Tango.PPC.Jobs.Models private void OnInterSegmentlengthChanged() { _preventChange = true; - int max = Segments.Max(x => x.SegmentIndex); - Segments.Where(i => i.SegmentIndex != max).ToList().ForEach(x => x.EnableInterSegment = InterSegmentLength > 0); + if (Segments.Count > 0) + { + int max = Segments.Max(x => x.SegmentIndex); + Segments.Where(i => i.SegmentIndex != max).ToList().ForEach(x => x.EnableInterSegment = InterSegmentLength > 0); + } _preventChange = false; } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobSummeryViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobSummeryViewVM.cs index 467013607..10593cc36 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobSummeryViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobSummeryViewVM.cs @@ -182,10 +182,12 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log(ex, "Error calculating recommended process parameters."); } }); - IsPreparingJob = false; - - _canStartJob = true; + if(Job.Segments.Where( x=>x.BrushStops.Count == 0).ToList().Count == 0) + { + _canStartJob = true; + } + InvalidateRelayCommands(); } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs index d770dbe51..d00cf14fd 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs @@ -193,35 +193,6 @@ namespace Tango.PPC.Jobs.ViewModels set { _approvalFineTuneItems = value; RaisePropertyChangedAuto(); } } - //private bool _isFineTuneExpanded; - ///// <summary> - ///// Gets or sets a value indicating whether the fine tuning region is expanded. - ///// </summary> - //public bool IsFineTuneExpanded - //{ - // get { return _isFineTuneExpanded; } - // set - // { - // _isFineTuneExpanded = value; - // RaisePropertyChangedAuto(); - - // if (_isFineTuneExpanded) - // { - // SyncFineTuneItemsToBrushStops(); - // } - // } - //} - - //private bool _isJobDetailsExpanded; - ///// <summary> - ///// Gets or sets a value indicating whether the job details area is expanded. - ///// </summary> - //public bool IsJobDetailsExpanded - //{ - // get { return _isJobDetailsExpanded; } - // set { _isJobDetailsExpanded = value; RaisePropertyChangedAuto(); } - //} - /// <summary> /// Gets or sets the twine catalog automatic complete provider. /// </summary> @@ -549,8 +520,7 @@ namespace Tango.PPC.Jobs.ViewModels ColorSpace = Job.ColorSpace, SpoolType = Job.SpoolType, User = Job.User, - Machine = Job.Machine, - InterSegmentLength = Job.EnableInterSegment ? Job.InterSegmentLength : 0 + Machine = Job.Machine }; foreach (var segm in Job.Segments) @@ -578,8 +548,8 @@ namespace Tango.PPC.Jobs.ViewModels brushes[index].Segment = currentSegment; brushes[index + 1].Segment = currentSegment; csegmentModel.Length = (lengthOfOldSegment * (brushes[index + 1].OffsetPercent - brushes[index].OffsetPercent) / 100d); - BrushStopModel brushStopModelFirst = new BrushStopModel(brushes[index], csegmentModel); - BrushStopModel brushStopModelSecond = new BrushStopModel(brushes[index + 1], csegmentModel); + BrushStopModel brushStopModelFirst = new BrushStopModel(brushes[index], csegmentModel, 1); + BrushStopModel brushStopModelSecond = new BrushStopModel(brushes[index + 1], csegmentModel, 1); csegmentModel.CreateGradientBrushes(brushStopModelFirst, brushStopModelSecond); jobModel.Segments.Add(csegmentModel); @@ -597,7 +567,7 @@ namespace Tango.PPC.Jobs.ViewModels }; foreach (var brushStop in segm.BrushStops) { - BrushStopModel brushStopModel = new BrushStopModel(brushStop, segmentModel); + BrushStopModel brushStopModel = new BrushStopModel(brushStop, segmentModel, Job.Version); segmentModel.BrushStops.Add(brushStopModel); } @@ -605,6 +575,8 @@ namespace Tango.PPC.Jobs.ViewModels jobModel.Segments.Add(segmentModel); } } + + jobModel.InterSegmentLength = Job.EnableInterSegment ? Job.InterSegmentLength : 0; jobModel.Segments.Last().IsLast = true; JobModel = jobModel; SegmentsCollectionView = CollectionViewSource.GetDefaultView(JobModel.Segments); @@ -1131,9 +1103,9 @@ namespace Tango.PPC.Jobs.ViewModels } catch (Exception ex) { - LogManager.Log(ex, "Error saving job to database."); + LogManager.Log(ex, "Error saving job to database. " + ex.InnerException.Message); await NotificationProvider.ShowError("Error saving the current job."); - return false; + return true; } } @@ -1180,8 +1152,13 @@ namespace Tango.PPC.Jobs.ViewModels private async void DeleteSegments() { - if (false == JobModel.Segments.ToList().Any(x => x.IsSelected)) + if (!JobModel.HasSelectedItems) + return; + if(JobModel.Segments.ToList().Where(x => x.IsSelected).ToList().Count == JobModel.Segments.Count) + { + await NotificationProvider.ShowInfo("A job must contain at least one segment. Please, change selection."); return; + } if (JobModel.Segments.Count > 1) { @@ -1317,7 +1294,7 @@ namespace Tango.PPC.Jobs.ViewModels } Job.LastUpdated = DateTime.UtcNow; Job.IsSynchronized = false; - Job.JobStatus = BL.Enumerations.JobStatuses.Draft; + //Job.JobStatus = BL.Enumerations.JobStatuses.Draft; //_current_job_string = Job.ToJobFileWhenLoaded().ToString(); RaiseMessage(new JobSavedMessage() { Job = Job }); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs index 3b1d6d9e6..85d469ac1 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs @@ -424,9 +424,9 @@ namespace Tango.PPC.Jobs.ViewModels } JobCreationViewVM vm = new JobCreationViewVM( _spoolTypes.ToList(), _rmls.ToList(), 0, false ); var selectedRmlGuid = Settings.DefaultRmlGuid; - var selectedSpoolTypeGuid = Settings.DefaultSpoolTypeGuid; + var selectedSpoolTypeGuid = Settings.SpoolTypeGuid; vm.SelectedRML = _rmls.FirstOrDefault(x => x.Guid == Settings.DefaultRmlGuid); - vm.SelectedSpoolType = _spoolTypes.FirstOrDefault( x=>x.Guid == Settings.DefaultSpoolTypeGuid ); + vm.SelectedSpoolType = _spoolTypes.FirstOrDefault( x=>x.Guid == Settings.SpoolTypeGuid ); if (twnFile == null) { vm = await NotificationProvider.ShowDialog<JobCreationViewVM>(vm); @@ -854,7 +854,7 @@ namespace Tango.PPC.Jobs.ViewModels 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().WithLiquidFactors().BuildAsync(); job.WindingMethodGuid = Adapter.WindingMethods.FirstOrDefault().Guid; - job.SpoolTypeGuid = Settings.DefaultSpoolTypeGuid != null ? Settings.DefaultSpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid; + job.SpoolTypeGuid = Settings.SpoolTypeGuid != null ? Settings.SpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid; foreach (var segment in segments) { diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml index b8930089d..2e3884479 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml @@ -197,13 +197,13 @@ </DataTemplate> <DataTemplate x:Key="Segment_Template" DataType="{x:Type entities:Segment}"> - <Grid Height="430" Margin="57 15 57 0"> + <Grid Height="380" Margin="57 15 57 0"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> - <RowDefinition Height="Auto" /> + <RowDefinition Height="1*" /> </Grid.RowDefinitions> <DockPanel> @@ -346,7 +346,7 @@ <Grid Grid.Row="4" x:Name="add_new_segment_gap" HorizontalAlignment="Stretch" Margin="0 30 0 0" > <Grid.RowDefinitions> <RowDefinition Height="Auto"/> - <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <Rectangle Stroke="{StaticResource TangoDividerBrush}" StrokeThickness="1" VerticalAlignment="Top" /> @@ -626,7 +626,7 @@ <!--Border x:Name="borderDockFloat" Height="10" Margin="0 0 0 0" BorderBrush="Transparent" > <DockPanel x:Name="dockEdit" LastChildFill="False" Height="10" Width="50" HorizontalAlignment="Right" RenderTransformOrigin="0.58,2.08"/> </Border> --> - <ListBox x:Name="listSegments" Margin="10 0 10 40" ItemsSource="{Binding SegmentsCollectionView}" ItemTemplate="{StaticResource Segment_Template}" Style="{StaticResource SegmentsListBox}" + <ListBox x:Name="listSegments" Margin="10 0 10 60" ItemsSource="{Binding SegmentsCollectionView}" ItemTemplate="{StaticResource Segment_Template}" Style="{StaticResource SegmentsListBox}" ScrollViewer.VerticalScrollBarVisibility="Visible" Visibility="{Binding IsFullMode, Converter={StaticResource BooleanToVisibilityConverter}}" /> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml.cs index 31a7f7918..6693f67e0 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml.cs @@ -48,96 +48,11 @@ namespace Tango.PPC.Jobs.Views } - //private void OnBrushStopFieldValueChanged(object sender, Touch.Controls.DoubleValueChangedEventArgs e) - //{ - // _vm.OnBrushStopFieldValueChanged((sender as FrameworkElement).DataContext as BrushStop); - //} - - public void DisplaySampleDye() - { - //expander_sample_dye.IsExpanded = true; - //await Task.Delay(500); - //scrollViewer.ScrollToElement(expander_sample_dye); - } - - public void DisplayFineTuning() - { - //expander_fine_tuning.IsExpanded = true; - //await Task.Delay(500); - //scrollViewer.ScrollToElement(expander_fine_tuning); - } - public void OnNavigatedFrom() { } - - //private void scrollViewer_Scrolling(object sender, Touch.Controls.DoubleValueChangedEventArgs e) - //{ - // if (_vm.JobModel != null && _vm.JobModel.Segments != null && _vm.JobModel.Segments.Count > 3) - // { - // var position = scrollViewer.GetElementPosition(listSegments); - // var stackOutputPosition = scrollViewer.GetElementPosition(stackOutput); - - // if (stackOutputPosition.Y > 100) - // { - // if (position.Y < 110 && !_is_edit_docked) - // { - // DockEditing(); - // } - // else if (position.Y > 110 && _is_edit_docked) - // { - // FloatEditing(); - // } - // } - // else - // { - // borderEditDock.Visibility = Visibility.Collapsed; - // } - // } - // else if (_is_edit_docked) - // { - // FloatEditing(); - // } - //} - - //private void DockEditing() - //{ - // _is_edit_docked = true; - // borderDockFloat.Child = null; - // borderEditDock.Child = dockEdit; - // borderEditDock.Visibility = Visibility.Visible; - //} - - //private void FloatEditing() - //{ - // _is_edit_docked = false; - // borderEditDock.Child = null; - // borderDockFloat.Child = dockEdit; - // borderEditDock.Visibility = Visibility.Collapsed; - //} - - //private void OnLiquidVolumeFieldValueChanged(object sender, Touch.Controls.DoubleValueChangedEventArgs e) - //{ - // var liquidVolume = (sender as FrameworkElement).DataContext as LiquidVolume; - - // if (liquidVolume != null) - // { - // _vm.OnBrushStopFieldValueChanged(liquidVolume.BrushStop); - // } - //} - public void ScrollToTop() - { - if(listSegments.IsVisible && listSegments.Items.Count > 0) - { - listSegments.ScrollIntoView(listSegments.Items[0]); - - } - //FloatEditing(); - //scrollViewer.ScrollToTop(); - } - private void Length_ValueChanged(object sender, Touch.Controls.DoubleValueChangedEventArgs e) { var segmentModel = (sender as FrameworkElement).DataContext as SegmentModel; @@ -156,5 +71,20 @@ namespace Tango.PPC.Jobs.Views } } + + public void DisplaySampleDye() + { + + } + + public void DisplayFineTuning() + { + + } + + public void ScrollToTop() + { + + } } } |
