diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer')
2 files changed, 41 insertions, 9 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 0742ca752..8f3d2a7e3 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 @@ -44,7 +44,19 @@ namespace Tango.MachineStudio.Developer.ViewModels public Machine SelectedMachine { get { return _selectedMachine; } - set { _selectedMachine = value; RaisePropertyChangedAuto(); OnMachineChanged(); InvalidateRelayCommands(); } + set + { + _selectedMachine = value; + RaisePropertyChangedAuto(); + OnMachineChanged(); + InvalidateRelayCommands(); + + if (_selectedMachine != null) + { + _selectedMachine.Saved -= SelectedMachine_Saved; + _selectedMachine.Saved += SelectedMachine_Saved; + } + } } private List<LiquidTypesRml> _liquidTypesRmls; @@ -104,7 +116,13 @@ namespace Tango.MachineStudio.Developer.ViewModels public Rml SelectedRML { get { return _selectedRML; } - set { _selectedRML = value; RaisePropertyChangedAuto(); InvalidateLiquidFactorsAndProcessTables(); InvalidateRelayCommands(); } + set + { + _selectedRML = value; + RaisePropertyChangedAuto(); + InvalidateLiquidFactorsAndProcessTables(); + InvalidateRelayCommands(); + } } private bool _isSideBarOpened; @@ -205,6 +223,20 @@ namespace Tango.MachineStudio.Developer.ViewModels #endregion + #region Event Handlers + + /// <summary> + /// Handles the Saved event of the SelectedMachine. + /// </summary> + /// <param name="sender">The source of the event.</param> + /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> + private void SelectedMachine_Saved(object sender, EventArgs e) + { + InvalidateLiquidFactorsAndProcessTables(); + } + + #endregion + #region Virtual Methods /// <summary> @@ -278,7 +310,7 @@ namespace Tango.MachineStudio.Developer.ViewModels foreach (var table in RmlProcessParametersTableGroup.ProcessParametersTables) { var newTable = table.CloneEntity(); - newTable.ProcessParametersTablesGroups = group; + newTable.ProcessParametersTablesGroup = group; tables.Add(newTable); } @@ -313,7 +345,7 @@ namespace Tango.MachineStudio.Developer.ViewModels { if (SelectedRML != null && SelectedMachine != null) { - LiquidTypesRmls = SelectedMachine.Configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidTypes).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == SelectedRML.Guid).ToList(); + LiquidTypesRmls = SelectedMachine.Configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == SelectedRML.Guid).ToList(); RmlProcessParametersTableGroup = SelectedRML.ProcessParametersTablesGroups.SingleOrDefault(x => x.Active); if (RmlProcessParametersTableGroup != null) 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 a18e4145e..243165cd5 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 @@ -219,7 +219,7 @@ <ContentPresenter Content="{TemplateBinding Content}"></ContentPresenter> </Border> - <materialDesign:PackIcon HorizontalAlignment="Left" VerticalAlignment="Top" Margin="-2 -2 0 0" Width="12" Height="12" Kind="Settings"></materialDesign:PackIcon> + <materialDesign:PackIcon HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0 0 0 0" Width="12" Height="12" Kind="Settings"></materialDesign:PackIcon> </Grid> </ControlTemplate> </Setter.Value> @@ -455,7 +455,7 @@ <Image Source="../Images/wind.png" Width="32"></Image> <TextBlock VerticalAlignment="Center" Margin="5 0 0 0" FontSize="10">Winding Method</TextBlock> </StackPanel> - <ComboBox ItemsSource="{Binding Adapter.WindingMethods}" SelectedItem="{Binding SelectedJob.WindingMethods}" DisplayMemberPath="Name" ></ComboBox> + <ComboBox ItemsSource="{Binding Adapter.WindingMethods}" SelectedItem="{Binding SelectedJob.WindingMethod}" DisplayMemberPath="Name" ></ComboBox> </StackPanel> </Border> @@ -736,7 +736,7 @@ </DataTemplate> </ComboBox.ItemTemplate> </ComboBox> - <designer:MachineView IsHitTestVisible="False" Margin="0 40 0 0" DataContext="{Binding SelectedMachine}" /> + <designer:MachineView Width="540" IsHitTestVisible="False" Margin="0 40 0 0" DataContext="{Binding SelectedMachine}" /> <Button Command="{Binding EditMachineCommand}" HorizontalAlignment="Right" Margin="0 10 20 20" Style="{StaticResource MaterialDesignFlatButton}"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon VerticalAlignment="Center" Kind="Pencil"></materialDesign:PackIcon> @@ -790,12 +790,12 @@ <ItemsControl.ItemTemplate> <DataTemplate DataType="{x:Type observables:LiquidTypesRml}"> <StackPanel Margin="0 0 10 20"> - <TextBlock HorizontalAlignment="Center" FontSize="10" Foreground="DimGray" Text="{Binding LiquidTypes.Name}"></TextBlock> + <TextBlock HorizontalAlignment="Center" FontSize="10" Foreground="DimGray" Text="{Binding LiquidType.Name}"></TextBlock> <Grid Width="60" Height="50" Margin="0 5 0 0"> <shapes:Hexagon StrokeThickness="1" Stroke="Gray"> <shapes:Hexagon.Fill> <LinearGradientBrush Opacity="0.7" > - <GradientStop Color="{Binding LiquidTypes.Color,Converter={StaticResource ColorToIntegerConverter}}"/> + <GradientStop Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"/> <GradientStop Color="White" Offset="1"/> </LinearGradientBrush> </shapes:Hexagon.Fill> |
