diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2022-03-06 21:31:48 +0200 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2022-03-06 21:31:48 +0200 |
| commit | 6c56b49d815afa016a4ce74eed3e4b983c8a161c (patch) | |
| tree | ab9c8c2bc5b485b775ec7e03dcc08f9f577a2286 /Software/Visual_Studio/PPC/Modules | |
| parent | 49fa62be60dea8a6c60258925a3eafb42bd9bb33 (diff) | |
| download | Tango-6c56b49d815afa016a4ce74eed3e4b983c8a161c.tar.gz Tango-6c56b49d815afa016a4ce74eed3e4b983c8a161c.zip | |
Save grouping segments in file and loading from file.
Related Work Items: #6268, #6280
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
4 files changed, 37 insertions, 11 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml index 2aac7320a..5ab26458c 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml @@ -30,14 +30,14 @@ <!--<Image Source="../Images/JobView/job-details.png" Width="34" />--> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 0 0 0" FontSize="{StaticResource TangoHeaderFontSize}">Job Details</TextBlock> <Border BorderThickness="0 0 1 0" BorderBrush="{StaticResource TangoDividerBrush}" Margin="30 0 0 0"> - <touch:TouchImageButton Width="32" Height="32" Image="{StaticResource Close_mycolorsdlg}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 23 0" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding CloseCommand}" /> + <touch:TouchImageButton Width="32" Height="32" Image="{StaticResource Close_mycolorsdlg}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 23 0" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding CloseCommand}" Focusable="False"/> </Border> </Grid> <Grid Grid.Row="1" Margin="24 17 24 31" Background="{StaticResource TangoPrimaryBackgroundBrush}"> <Grid x:Name="Container" keyboard:KeyboardView.ContainerOffset="40"> <DockPanel Margin="47 38 54 40" > <Grid DockPanel.Dock="Bottom"> - <touch:TouchButton HorizontalAlignment="Center" CornerRadius="25" Command="{Binding OKCommand}" KeyboardNavigation.TabIndex="4" Width="180" Height="48" VerticalAlignment="Bottom" keyboard:KeyboardView.Container="{Binding ElementName=Container}" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoButtonFontSize}" Content="OK"> + <touch:TouchButton HorizontalAlignment="Center" CornerRadius="25" Command="{Binding OKCommand}" KeyboardNavigation.TabIndex="3" Width="180" Height="48" VerticalAlignment="Bottom" keyboard:KeyboardView.Container="{Binding ElementName=Container}" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoButtonFontSize}" Content="OK"> <touch:TouchButton.Style > <Style TargetType="touch:TouchButton" > <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> @@ -72,7 +72,7 @@ <DockPanel HorizontalAlignment="Stretch" Margin="0 50 0 0"> <TextBlock HorizontalAlignment="Left" Margin="0 10 0 0" Text="Thread Type" FontSize="{StaticResource TangoDialogFontSize}" Width="155"/> <Border Margin="49 0 0 0" BorderThickness="1" Height="44" CornerRadius="22" BorderBrush="{StaticResource TangoMidAccentBrush}"> - <touch:TouchComboBox Margin="20 0 10 10" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML,Mode=TwoWay}" KeyboardNavigation.TabIndex="2" keyboard:KeyboardView.Container="{Binding ElementName=Container}"> + <touch:TouchComboBox Margin="20 0 10 10" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML,Mode=TwoWay}" Focusable="False" > <touch:TouchComboBox.ItemTemplate> <DataTemplate> <TextBlock Margin="20 10 10 10" TextTrimming="CharacterEllipsis" FontSize="{StaticResource TangoDialogFontSize}" Text="{Binding Name}"> @@ -89,7 +89,7 @@ </Border> </DockPanel> <DockPanel Margin="210 15 0 0" TextElement.Foreground="{StaticResource TangoGrayTextBrush}" Visibility="{Binding LubricationLevel,Converter={StaticResource IsNullToVisibilityConverter}}"> - <touch:TouchIcon Icon="AlertCircleOutline" Width="16" Foreground="{StaticResource TangoGrayTextBrush}" /> + <touch:TouchIcon Icon="AlertCircleOutline" Width="16" Foreground="{StaticResource TangoGrayTextBrush}" Focusable="False"/> <TextBlock Margin="5 0 0 0"> <Run Text="{Binding LubricationLevel.LubricationLevel,Mode=OneWay,Converter={StaticResource EnumToDescriptionConverter}}"></Run> <Run>Lubrication</Run> @@ -97,7 +97,7 @@ </DockPanel> <StackPanel TextElement.Foreground="{StaticResource TangoGrayTextBrush}" Margin="210 5 0 0" HorizontalAlignment="Left" Visibility="{Binding MachineProvider.Machine.BtsrInstalled,Converter={StaticResource BooleanToVisibilityConverter}}"> <DockPanel> - <touch:TouchIcon Icon="AlertCircleOutline" Width="16" Foreground="{StaticResource TangoGrayTextBrush}" /> + <touch:TouchIcon Icon="AlertCircleOutline" Width="16" Foreground="{StaticResource TangoGrayTextBrush}" Focusable="False" /> <TextBlock Margin="5 0 0 0" VerticalAlignment="Center"> <Run>Required tensioner level is </Run> <Run Text="{Binding BtsrSpoolTension}" FontWeight="Bold"></Run> @@ -133,21 +133,21 @@ <Run Text="[m]" FontWeight="SemiBold"></Run> </TextBlock> <Border Margin="49 0 0 0" BorderThickness="1" Height="44" CornerRadius="22" BorderBrush="{StaticResource TangoMidAccentBrush}"> - <touch:TouchNumericTextBox Margin="20 0 0 10" FontSize="{StaticResource TangoComboBoxItemFontSize}" Value="{Binding WhiteGap, Mode=TwoWay}" IsEnabled="True" HorizontalAlignment="Left" MinWidth="250" VerticalAlignment="Center" FocusSelectionMode="SelectAll" KeyboardNavigation.TabIndex="3" keyboard:KeyboardView.Container="{Binding ElementName=Container}"></touch:TouchNumericTextBox> + <touch:TouchNumericTextBox Margin="20 0 0 10" FontSize="{StaticResource TangoComboBoxItemFontSize}" Value="{Binding WhiteGap, Mode=TwoWay}" IsEnabled="True" HorizontalAlignment="Left" MinWidth="250" VerticalAlignment="Center" FocusSelectionMode="SelectAll" KeyboardNavigation.TabIndex="2"></touch:TouchNumericTextBox> </Border> </DockPanel > </StackPanel> <Grid Grid.Row="2" Margin="0 70 0 0" HorizontalAlignment="Stretch" Visibility="{Binding ShowDuplicate, Converter={StaticResource BooleanToVisibilityConverter}}"> <TextBlock HorizontalAlignment="Left" Margin="0 10 0 0" Text="Duplicate Job As New" FontWeight="Normal" FontSize="{StaticResource TangoDialogFontSize}" Width="Auto"/> - <touch:TouchButton CornerRadius="25" Command="{Binding DuplicateCommand}" Width="180" Height="48" VerticalAlignment="Center" HorizontalAlignment="Right" Background="{StaticResource TangoPrimaryAccentBrush}" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoButtonFontSize}">Duplicate</touch:TouchButton> + <touch:TouchButton CornerRadius="25" Command="{Binding DuplicateCommand}" Width="180" Height="48" VerticalAlignment="Center" HorizontalAlignment="Right" Background="{StaticResource TangoPrimaryAccentBrush}" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoButtonFontSize}" Focusable="False">Duplicate</touch:TouchButton> </Grid> <Grid Grid.Row="3" Margin="0 70 0 0" HorizontalAlignment="Stretch" Visibility="{Binding ShowDuplicate, Converter={StaticResource BooleanToVisibilityConverter}}"> <TextBlock HorizontalAlignment="Left" Margin="0 10 0 0" Text="Save Job As PDF" FontWeight="Normal" FontSize="{StaticResource TangoDialogFontSize}" Width="Auto"/> <touch:TouchButton CornerRadius="25" Width="180" Height="48" VerticalAlignment="Center" HorizontalAlignment="Right" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" - FontSize="{StaticResource TangoButtonFontSize}" Content="Export" IsEnabled="False"> + FontSize="{StaticResource TangoButtonFontSize}" Content="Export" IsEnabled="False" Focusable="False"> <touch:TouchButton.Style > <Style TargetType="touch:TouchButton" > <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> 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 b7106a8a3..465fd426a 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 @@ -626,7 +626,7 @@ namespace Tango.PPC.Jobs.Models ColorSpace = brushStop.ColorSpace.Space; _colorcatalogsitem = brushStop.ColorCatalogsItem; _stopindex = brushStop.StopIndex; - + PreventPropertyUpdate = true; if(version == 1) { 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 735eb77e2..6aaa368c1 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 @@ -16,6 +16,7 @@ namespace Tango.PPC.Jobs.Models private bool _preventChange; #region Properties + protected String _name; public String Name @@ -121,7 +122,6 @@ namespace Tango.PPC.Jobs.Models RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(LengthIncludingNumberOfUnits)); RaisePropertyChanged(nameof(GetEstimatedDuration)); - } } } @@ -317,6 +317,8 @@ namespace Tango.PPC.Jobs.Models } public JobTypes JobType { get; set; } + public bool JobChanged { get; set; } + protected SynchronizedObservableCollection<SegmentModel> _segments; /// <summary> @@ -458,6 +460,8 @@ namespace Tango.PPC.Jobs.Models #endregion + #region constructors + public JobModel(List<ColorSpace> list) { ColorSpacesList = list; @@ -474,8 +478,11 @@ namespace Tango.PPC.Jobs.Models GroupingSegments.CollectionChanged += SegmentsGroup_CollectionChanged; SelectAllSegments = false; NumberOfUnits = 1; + JobChanged = false; } + #endregion + #region modifications private void OnSegmentsChanged() 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 cadbc6275..e37686a33 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 @@ -614,6 +614,7 @@ namespace Tango.PPC.Jobs.ViewModels } segmentModel.ArrangeBrushStopsPosition(); + segmentModel.UpdateMiddleColorBrush(); return segmentModel; } @@ -701,6 +702,7 @@ namespace Tango.PPC.Jobs.ViewModels Job.EnableInterSegment = vm.WhiteGap > 0; JobModel.InterSegmentLength = vm.WhiteGap; JobModel.EnableInterSegment = vm.WhiteGap > 0; + JobModel.JobChanged = true; Job.SpoolType = vm.SelectedSpoolType; JobModel.SpoolType = vm.SelectedSpoolType;//update length!!!! @@ -830,6 +832,7 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log("Adding new segment..."); UndoRedoManager.Instance.InsertAndExecuteCommand(new AddNewSegmentCommand(JobModel, segment, Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 10)); + JobModel.JobChanged = true; ArrangeSegmentsIndixes(); } catch (Exception ex) @@ -852,6 +855,7 @@ namespace Tango.PPC.Jobs.ViewModels if (vm.DialogResult) { group.Repeats = vm.Repeats; + JobModel.JobChanged = true; } } @@ -867,6 +871,7 @@ namespace Tango.PPC.Jobs.ViewModels if (await NotificationProvider.ShowQuestion("Are you sure you want to remove the selected segment?")) { UndoRedoManager.Instance.InsertAndExecuteCommand(new RemoveSegmentCommand(JobModel, segment)); + JobModel.JobChanged = true; ArrangeSegmentsIndixes(); DyeCommand.RaiseCanExecuteChanged(); @@ -895,6 +900,7 @@ namespace Tango.PPC.Jobs.ViewModels UndoRedoManager.Instance.InsertAndExecuteCommand(new DeleteSegmentsGroupCommand(JobModel, segmentsGroup)); ArrangeSegmentsIndixes(); + JobModel.JobChanged = true; DyeCommand.RaiseCanExecuteChanged(); } @@ -917,6 +923,7 @@ namespace Tango.PPC.Jobs.ViewModels { UndoRedoManager.Instance.InsertAndExecuteCommand(new DuplicateSegmentCommand(JobModel, segment)); ArrangeSegmentsIndixes(); + JobModel.JobChanged = true; DyeCommand.RaiseCanExecuteChanged(); } @@ -990,6 +997,7 @@ namespace Tango.PPC.Jobs.ViewModels { UndoRedoManager.Instance.InsertAndExecuteCommand(new EditBrushStopColorCommand(segment, brushStop, vm.SelectedBrushStop)); DyeCommand.RaiseCanExecuteChanged(); + JobModel.JobChanged = true; } } @@ -1013,8 +1021,8 @@ namespace Tango.PPC.Jobs.ViewModels } } UndoRedoManager.Instance.InsertAndExecuteCommand(new AddBrushStopCommand(JobModel, segment, newBrushStop)); - ArrangeSegmentsIndixes(); + JobModel.JobChanged = true; } #endregion @@ -1206,6 +1214,7 @@ namespace Tango.PPC.Jobs.ViewModels UndoRedoManager.Instance.InsertAndExecuteCommand(new ReverseCommand(JobModel)); ArrangeSegmentsIndixes(); + JobModel.JobChanged = true; } private async void DeleteSegments() @@ -1227,6 +1236,7 @@ namespace Tango.PPC.Jobs.ViewModels UndoRedoManager.Instance.InsertAndExecuteCommand(new RemoveSegmentsCommand(JobModel)); ArrangeSegmentsIndixes(); + JobModel.JobChanged = true; DyeCommand.RaiseCanExecuteChanged(); } } @@ -1248,24 +1258,28 @@ namespace Tango.PPC.Jobs.ViewModels return; UndoRedoManager.Instance.InsertAndExecuteCommand(new RepeatCommand(JobModel)); ArrangeSegmentsIndixes(); + JobModel.JobChanged = true; } private void UngroupSegments(SegmentsGroupModel segmentsGroup) { UndoRedoManager.Instance.InsertAndExecuteCommand(new UnGroupSegmentsCommand(JobModel, segmentsGroup)); ArrangeSegmentsIndixes(); + JobModel.JobChanged = true; } private void Paste() { UndoRedoManager.Instance.InsertAndExecuteCommand(new PasteSegmentsCommand(JobModel)); ArrangeSegmentsIndixes(); + JobModel.JobChanged = true; } private void Copy() { UndoRedoManager.Instance.InsertAndExecuteCommand(new CopySegmentCommand(JobModel)); ArrangeSegmentsIndixes(); + JobModel.JobChanged = true; } private void Undo() @@ -1423,6 +1437,11 @@ namespace Tango.PPC.Jobs.ViewModels } Job.LastUpdated = DateTime.UtcNow; Job.IsSynchronized = false; + if(Job.JobStatus == JobStatuses.Completed && JobModel.JobChanged == true) + { + Job.JobStatus = BL.Enumerations.JobStatuses.Draft; + JobModel.JobChanged = false; + } //Job.JobStatus = BL.Enumerations.JobStatuses.Draft; //_current_job_string = Job.ToJobFileWhenLoaded().ToString(); RaiseMessage(new JobSavedMessage() { Job = Job }); |
