aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2021-12-19 09:01:41 +0200
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2021-12-19 09:01:41 +0200
commitf67b8d11029ce185b4f13ec0fd866bfe4380be7d (patch)
tree8d0fe61a89f84929b39126c816223f35d93d3fc4 /Software/Visual_Studio
parentf4929c38abd1389377d30fca6c9304d2d6639d30 (diff)
downloadTango-f67b8d11029ce185b4f13ec0fd866bfe4380be7d.tar.gz
Tango-f67b8d11029ce185b4f13ec0fd866bfe4380be7d.zip
Disable buttons on collapsed panel when segments are not selected.
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs10
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml11
2 files changed, 16 insertions, 5 deletions
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 0d95d02cc..c7b9d9b6d 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
@@ -381,6 +381,12 @@ namespace Tango.PPC.Jobs.Models
}
}
+ public bool HasSelectedItems
+ {
+ get {
+ bool test = Segments.ToList().Any(x => x.IsSelected);
+ return Segments.ToList().Any(x => x.IsSelected); }
+ }
public List<SegmentModel> SegmentsToCopy { get; set; }
public TimeSpan GetEstimatedDuration
@@ -503,7 +509,8 @@ namespace Tango.PPC.Jobs.Models
{
_selectAllSegments = false;
}
- RaisePropertyChanged("SelectAllSegments");
+ RaisePropertyChanged(nameof(SelectAllSegments));
+ RaisePropertyChanged(nameof(HasSelectedItems));
}
}
@@ -527,6 +534,7 @@ namespace Tango.PPC.Jobs.Models
_preventChange = true;
Segments.ToList().ForEach(x => x.IsSelected = SelectAllSegments);
_preventChange = false;
+ RaisePropertyChanged(nameof(HasSelectedItems));
}
}
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 ee5a58264..b8930089d 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
@@ -61,6 +61,9 @@
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="{StaticResource TangoDisabledBackgroundBrush}"></Setter>
</Trigger>
+ <DataTrigger Binding="{Binding JobModel.HasSelectedItems}" Value="false">
+ <Setter Property="Background" Value="{StaticResource TangoDisabledBackgroundBrush}"></Setter>
+ </DataTrigger>
</Style.Triggers>
</Style>
@@ -540,25 +543,25 @@
<TextBlock FontWeight="Medium" Margin="0 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoSmallFontSizeBar}" Foreground="{StaticResource TangoMidAccentBrush}">Repeat</TextBlock>
</StackPanel>
</touch:TouchButton>
- <touch:TouchButton Style="{StaticResource CollapsedPanelButton}" EnableDropShadow="False" Command="{Binding ReverseCommand}" >
+ <touch:TouchButton Style="{StaticResource CollapsedPanelButton}" EnableDropShadow="False" Command="{Binding ReverseCommand}" IsEnabled="{Binding JobModel.HasSelectedItems, Converter={StaticResource BooleanToVisibilityConverter}}">
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
<Image Width="20" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/reverse.png"/>
<TextBlock FontWeight="Medium" Margin="0 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoSmallFontSizeBar}" Foreground="{StaticResource TangoMidAccentBrush}">Reverse</TextBlock>
</StackPanel>
</touch:TouchButton>
- <touch:TouchButton Style="{StaticResource CollapsedPanelButton}" EnableDropShadow="False" Command="{Binding DeleteSegmentCommand}">
+ <touch:TouchButton Style="{StaticResource CollapsedPanelButton}" EnableDropShadow="False" Command="{Binding DeleteSegmentCommand}" IsEnabled="{Binding JobModel.HasSelectedItems, Converter={StaticResource BooleanToVisibilityConverter}}">
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
<Image Width="20" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/delete_segment.png"/>
<TextBlock FontWeight="Medium" Margin="0" VerticalAlignment="Center" FontSize="{StaticResource TangoSmallFontSizeBar}" Foreground="{StaticResource TangoMidAccentBrush}">Delete</TextBlock>
</StackPanel>
</touch:TouchButton>
- <touch:TouchButton Style="{StaticResource CollapsedPanelButton}" EnableDropShadow="False" Command="{Binding PasteCommand}" >
+ <touch:TouchButton Style="{StaticResource CollapsedPanelButton}" EnableDropShadow="False" Command="{Binding PasteCommand}" IsEnabled="{Binding JobModel.HasSelectedItems, Converter={StaticResource BooleanToVisibilityConverter}}" >
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
<Image Width="20" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/paste.png"/>
<TextBlock FontWeight="Medium" Margin="0" VerticalAlignment="Center" FontSize="{StaticResource TangoSmallFontSizeBar}" Foreground="{StaticResource TangoMidAccentBrush}">Paste</TextBlock>
</StackPanel>
</touch:TouchButton>
- <touch:TouchButton Style="{StaticResource CollapsedPanelButton}" EnableDropShadow="False" Command="{Binding CopyCommand}" >
+ <touch:TouchButton Style="{StaticResource CollapsedPanelButton}" EnableDropShadow="False" Command="{Binding CopyCommand}" IsEnabled="{Binding JobModel.HasSelectedItems, Converter={StaticResource BooleanToVisibilityConverter}}">
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
<Image Width="20" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/duplicate.png"/>
<TextBlock FontWeight="Medium" Margin="0" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="{StaticResource TangoSmallFontSizeBar}" Foreground="{StaticResource TangoMidAccentBrush}">Copy</TextBlock>