diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-31 14:33:22 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-31 14:33:22 +0200 |
| commit | fcbc4e2fad831e0e9bc972df86d155311f9f83a4 (patch) | |
| tree | 10ddab3715541c59d6fddb3d1113f1d86856d724 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer | |
| parent | 80c023fa734d7788e155d4f311ab16220aa80650 (diff) | |
| download | Tango-fcbc4e2fad831e0e9bc972df86d155311f9f83a4.tar.gz Tango-fcbc4e2fad831e0e9bc972df86d155311f9f83a4.zip | |
Added Process Parameters Table Selection.
Fixed issue with infinity values on BrushStop.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer')
2 files changed, 44 insertions, 8 deletions
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 7afb099db..8fbce16a3 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 @@ -91,7 +91,6 @@ namespace Tango.MachineStudio.Developer.ViewModels } private ProcessParametersTablesGroup _selectedGroupHistory; - /// <summary> /// Gets or sets the selected process parameters tables group history. /// </summary> @@ -108,7 +107,7 @@ namespace Tango.MachineStudio.Developer.ViewModels public ProcessParametersTable SelectedProcessParametersTable { get { return _selectedProcessParametersTable; } - set { _selectedProcessParametersTable = value; RaisePropertyChangedAuto(); } + set { _selectedProcessParametersTable = value; RaisePropertyChangedAuto(); OnSelectedParametersTableChanged(); } } private Job _selectedJob; @@ -261,6 +260,11 @@ namespace Tango.MachineStudio.Developer.ViewModels /// </summary> public RelayCommand RemoveBrushStopCommand { get; set; } + /// <summary> + /// Gets or sets the save jobs command. + /// </summary> + public RelayCommand SaveJobsCommand { get; set; } + #endregion #region Constructors @@ -302,6 +306,7 @@ namespace Tango.MachineStudio.Developer.ViewModels RemoveJobCommand = new RelayCommand(RemoveJob); AddBrushStopCommand = new RelayCommand(AddBrushStop); RemoveBrushStopCommand = new RelayCommand(RemoveBrushStop); + SaveJobsCommand = new RelayCommand(SaveJobs); } #endregion @@ -325,6 +330,14 @@ namespace Tango.MachineStudio.Developer.ViewModels private void SelectedProcessParametersTable_DyeingSpeedChanged(object sender, EventArgs e) { + if (SelectedSegment != null) + { + foreach (var liquidVolume in SelectedSegment.BrushStops.SelectMany(x => x.LiquidVolumes)) + { + liquidVolume.Invalidate(); + } + } + UpdateEstimatedDuration(); } @@ -332,6 +345,11 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Virtual Methods + protected virtual void OnSelectedParametersTableChanged() + { + SetSegmentBrushStopsLiquidVolumes(SelectedSegment); + } + /// <summary> /// Called when the process parameters table group has been changed /// </summary> @@ -400,6 +418,17 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Private Methods + private async void SaveJobs() + { + if (SelectedMachine != null) + { + using (_notification.PushTaskItem("Saving machine jobs...")) + { + await SelectedMachine.SaveAsync(); + } + } + } + private void UpdateEstimatedDuration() { if (SelectedJob != null && SelectedProcessParametersTable != null) @@ -410,11 +439,11 @@ namespace Tango.MachineStudio.Developer.ViewModels private void SetSegmentBrushStopsLiquidVolumes(Segment segment) { - if (!DesignMode) + if (!DesignMode && segment != null) { foreach (var stop in segment.BrushStops) { - stop.SetLiquidVolumes(SelectedMachine.Configuration, SelectedRML); + stop.SetLiquidVolumes(SelectedMachine.Configuration, SelectedRML, SelectedProcessParametersTable); } } } @@ -522,7 +551,6 @@ namespace Tango.MachineStudio.Developer.ViewModels { if (SelectedJob != null && SelectedSegment != null) { - SelectedSegment.DefferedDelete(); SelectedJob.Segments.Remove(SelectedSegment); } } @@ -550,7 +578,6 @@ namespace Tango.MachineStudio.Developer.ViewModels { if (SelectedMachine != null && SelectedJob != null) { - SelectedJob.Delete(); SelectedMachine.Jobs.Remove(SelectedJob); } } @@ -591,7 +618,7 @@ namespace Tango.MachineStudio.Developer.ViewModels var stop = new BrushStop(); stop.ColorSpace = Adapter.ColorSpaces.FirstOrDefault(); stop.Color = Colors.Black; - stop.SetLiquidVolumes(SelectedMachine.Configuration, SelectedRML); + stop.SetLiquidVolumes(SelectedMachine.Configuration, SelectedRML, SelectedProcessParametersTable); SelectedSegment.BrushStops.Add(stop); } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml index 0c3cd62b5..284ffe925 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml @@ -503,6 +503,15 @@ </StackPanel> + <Grid HorizontalAlignment="Right"> + <Button Height="40" Width="170" Margin="0 40 40 0" Command="{Binding SaveJobsCommand}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon VerticalAlignment="Center" Width="24" Height="24" Kind="ContentSave" /> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">SAVE</TextBlock> + </StackPanel> + </Button> + </Grid> + <Grid Grid.Row="1" Margin="0 20 0 0"> <Grid.RowDefinitions> <RowDefinition Height="1*" /> @@ -570,7 +579,7 @@ <Image Source="../Images/ruler.png" Width="32"></Image> <TextBlock VerticalAlignment="Center" Margin="5 0 0 0" FontSize="10">Length</TextBlock> </StackPanel> - <mahapps:NumericUpDown StringFormat="{}{0:N1} m" IsEnabled="{Binding SelectedJob.EnableInterSegment}" Margin="0 2 0 0" Minimum="1" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0 0 0 1" BorderBrush="DimGray" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding SelectedSegment.Length,Mode=TwoWay}"></mahapps:NumericUpDown> + <mahapps:NumericUpDown StringFormat="{}{0:N1} m" Margin="0 2 0 0" Minimum="1" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0 0 0 1" BorderBrush="DimGray" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding SelectedSegment.Length,Mode=TwoWay}"></mahapps:NumericUpDown> </StackPanel> </Border> </StackPanel> |
