diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-04-19 13:04:38 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-04-19 13:04:38 +0300 |
| commit | 7ba903bb793adf638a7e1a5c7170e8a03bbb6ea9 (patch) | |
| tree | ea8f80de80a9763ca482420aaa424f143a99af2c /Software/Visual_Studio | |
| parent | 1133972c0c51feb478aa3944fad5f374a8a2da35 (diff) | |
| download | Tango-7ba903bb793adf638a7e1a5c7170e8a03bbb6ea9.tar.gz Tango-7ba903bb793adf638a7e1a5c7170e8a03bbb6ea9.zip | |
Menu Gui. Set selection item.
Diffstat (limited to 'Software/Visual_Studio')
3 files changed, 75 insertions, 9 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ComapareModulNameConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ComapareModulNameConverter.cs new file mode 100644 index 000000000..8ac8a44b0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ComapareModulNameConverter.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using Tango.PPC.Common; + +namespace Tango.PPC.UI.Converters +{ + public class ComapareModulNameConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + if (values.Count() == 2) + { + IPPCModule CurrentModule = values[0] as IPPCModule; + string name = System.Convert.ToString(values[1]); + + if (CurrentModule != null) + { + bool compare = String.Compare(CurrentModule.Name, name, true) == 0; + return compare; + } + } + + return "false"; + } + catch + { + return "false"; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 1534d8a73..bb67015e9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -141,6 +141,7 @@ </Compile> <Compile Include="Converters\AppBarItemConverter.cs" /> <Compile Include="Converters\CollectionToCountConverter.cs" /> + <Compile Include="Converters\ComapareModulNameConverter.cs" /> <Compile Include="Converters\ItemBaseConverter.cs" /> <Compile Include="Converters\LengthToWeightConverter.cs" /> <Compile Include="Converters\LengthWithSpoolsConverter.cs" /> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml index d90ddd962..05e781566 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml @@ -23,6 +23,7 @@ <localConverters:ItemBaseConverter x:Key="NotificationItemConverter" /> <localConverters:AppBarItemConverter x:Key="AppBarItemConverter" /> <localConverters:ItemBaseConverter x:Key="ItemBaseConverter" /> + <localConverters:ComapareModulNameConverter x:Key="ComapareModulNameConverter"/> </UserControl.Resources> @@ -41,7 +42,7 @@ <StackPanel VerticalAlignment="Top"> <Border Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 0" > <Grid > - <Border Height="72" Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <Border Height="71" Background="{StaticResource TangoPrimaryBackgroundBrush}"> <Border.Effect> <DropShadowEffect Color="Silver" ShadowDepth="0" BlurRadius="20" Opacity="1" /> </Border.Effect> @@ -61,16 +62,36 @@ </Grid> </Border> - <ItemsControl ItemsSource="{Binding ModuleLoader.UserModules}" Margin="0 10 0 0"> + <ItemsControl ItemsSource="{Binding ModuleLoader.UserModules}" Margin="0 0 0 0"> <ItemsControl.ItemTemplate> <DataTemplate> <Border Visibility="{Binding DockToBottom,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> - <Border BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 1" Visibility="{Binding IsVisibleInMenu,Converter={StaticResource BooleanToVisibilityConverter}}"> - <touch:TouchButton Margin="0 0 0 0" Padding="10 15" Foreground="{StaticResource TangoDarkForegroundBrush}" Style="{StaticResource TangoFlatButton}" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.ModuleNavigationCommand}" CommandParameter="{Binding Name}" > + <Border BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 0" Visibility="{Binding IsVisibleInMenu,Converter={StaticResource BooleanToVisibilityConverter}}"> + <touch:TouchButton Height="45" Margin="0 0 0 0" Padding="10 0" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.ModuleNavigationCommand}" CommandParameter="{Binding Name}" > <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <Image VerticalAlignment="Center" Source="{Binding Image}" Width="20" Height="20"></Image> - <TextBlock VerticalAlignment="Center" Margin="20 0 0 0" Text="{Binding Name}" Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoComboBoxItemFontSize}" FontWeight="Light"></TextBlock> + <TextBlock VerticalAlignment="Center" Margin="20 0 0 0" Text="{Binding Name}" FontSize="{StaticResource TangoComboBoxItemFontSize}" FontWeight="Light"></TextBlock> </StackPanel> + <touch:TouchButton.Style> + <Style TargetType="touch:TouchButton" BasedOn="{StaticResource TangoFlatButton}" > + <Setter Property="Foreground" Value="{StaticResource TangoLightForegroundBrush}"></Setter> + <Setter Property="Background" Value="Transparent"/> + <Style.Triggers> + <DataTrigger Value="True"> + <DataTrigger.Binding> + <MultiBinding Converter="{StaticResource ComapareModulNameConverter}" Delay="100"> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.NavigationManager.CurrentModule"></Binding> + <Binding Path="Name"></Binding> + </MultiBinding> + </DataTrigger.Binding> + <DataTrigger.Setters> + <Setter Property="Foreground" Value="{StaticResource TangoDarkForegroundBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource TangoMidBackgroundBrush}"></Setter> + </DataTrigger.Setters> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchButton.Style> </touch:TouchButton> </Border> </Border> @@ -79,8 +100,8 @@ </ItemsControl> <StackPanel Margin="0 5 0 0"> - <Border BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 1"> - <touch:TouchButton Style="{StaticResource TangoFlatButton}" Padding="10 15" Foreground="{StaticResource TangoDarkForegroundBrush}" Command="{Binding UpdateCommand}"> + <Border BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 0"> + <touch:TouchButton Style="{StaticResource TangoFlatButton}" Padding="10 0" Height="45" Foreground="{StaticResource TangoDarkForegroundBrush}" Command="{Binding UpdateCommand}"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <Image Source="/Images/Menu/update.png" VerticalAlignment="Center" Width="20" Height="20"></Image> <TextBlock VerticalAlignment="Center" Margin="20 0 0 0" Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoComboBoxItemFontSize}" FontWeight="Light">Update</TextBlock> @@ -89,8 +110,8 @@ </Border> </StackPanel> <StackPanel Margin="0 5 0 0"> - <Border BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 1"> - <touch:TouchButton Style="{StaticResource TangoFlatButton}" Padding="10 15" Foreground="{StaticResource TangoDarkForegroundBrush}" Command="{Binding PowerCommand}"> + <Border BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 0"> + <touch:TouchButton Style="{StaticResource TangoFlatButton}" Padding="10 0" Height="45" Foreground="{StaticResource TangoDarkForegroundBrush}" Command="{Binding PowerCommand}"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <Image Source="/Images/menu/power.png" VerticalAlignment="Center" Width="20" Height="20" ></Image> <TextBlock VerticalAlignment="Center" Margin="20 0 0 0" Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoComboBoxItemFontSize}" FontWeight="Light">Power</TextBlock> |
