diff --git a/VECTO3GUI/App.xaml b/VECTO3GUI/App.xaml index 9b382c086101d86a1e5153e31ea2afceeac0bfec..f5680c761579f90937bb84f549d7fb7880721b2a 100644 --- a/VECTO3GUI/App.xaml +++ b/VECTO3GUI/App.xaml @@ -45,6 +45,7 @@ <ResourceDictionary Source="Resources/GlobalStyles.xaml"/> + <ResourceDictionary Source="Resources/StringResources.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> diff --git a/VECTO3GUI/Helper/ComponentTitleConverter.cs b/VECTO3GUI/Helper/ComponentTitleConverter.cs new file mode 100644 index 0000000000000000000000000000000000000000..a32ba20a5ba6f2fe5d3f7ee2c62f7e8d76c48d93 --- /dev/null +++ b/VECTO3GUI/Helper/ComponentTitleConverter.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using VECTO3GUI.Util; + +namespace VECTO3GUI.Helper +{ + public class ComponentTitleConverter : BaseConverter, IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is Component) { + var component = (Component)value; + switch (component) { + case Component.Vehicle: + case Component.PrimaryBusVehicle: + case Component.CompleteBusVehicle: + return nameof(Component.Vehicle); + case Component.Engine: + return nameof(Component.Engine); + case Component.Gearbox: + return nameof(Component.Gearbox); + case Component.TorqueConverter: + return "Torque Converter"; + case Component.Retarder: + return "Retarder"; + case Component.Angledrive: + return "Angle Drive"; + case Component.Axlegear: + return "Axle Gear"; + case Component.PTO: + return "Power Take Off"; + case Component.Airdrag: + return "Air Drag"; + case Component.Axles: + return "Axle"; + case Component.Auxiliaries: + case Component.BusAuxiliaries: + return "Auxiliary"; + case Component.Cycle: + return nameof(Component.Cycle); + } + } + + return value; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/VECTO3GUI/Resources/GlobalStyles.xaml b/VECTO3GUI/Resources/GlobalStyles.xaml index 42b63c4ea4f6d891261d8336cd419d4e07c2bbc7..166caa4c9258a963cb92bdbed96be514acdb5374 100644 --- a/VECTO3GUI/Resources/GlobalStyles.xaml +++ b/VECTO3GUI/Resources/GlobalStyles.xaml @@ -9,5 +9,27 @@ <Style TargetType="{x:Type Button}" BasedOn="{StaticResource MetroButton}"> <Setter Property="mah:ControlsHelper.ContentCharacterCasing" Value="Normal"/> + <Setter Property="VerticalAlignment" Value="Center"/> </Style> + + <Style TargetType="TabControl" BasedOn="{StaticResource MetroTabControl}"> + <!-- <Setter Property="BorderThickness" Value="0,1,0,0"/> --> + <!-- <Setter Property="BorderBrush" Value="Black"/> --> + <!-- <Setter Property="ClipToBounds" Value="True"></Setter> --> + </Style> + + <Style TargetType="TabItem" BasedOn="{StaticResource MetroTabItem}" > + <Setter Property="ClipToBounds" Value="True"/> + <Setter Property="BorderThickness" Value="0,0,0,4"/> + <Setter Property="BorderBrush" Value="Gray"/> + <Setter Property="Margin" Value="1"/> + + <Style.Triggers> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="BorderBrush" Value="Black"/> + </Trigger> + </Style.Triggers> + </Style> + + </ResourceDictionary> \ No newline at end of file diff --git a/VECTO3GUI/Resources/StringResources.xaml b/VECTO3GUI/Resources/StringResources.xaml new file mode 100644 index 0000000000000000000000000000000000000000..999f46672a90f1ff4e00822834ab3da8bd1f23f2 --- /dev/null +++ b/VECTO3GUI/Resources/StringResources.xaml @@ -0,0 +1,11 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:VECTO3GUI.Resources" + xmlns:system="clr-namespace:System;assembly=mscorlib"> + + + + + <system:String x:Key="close">Close</system:String> + +</ResourceDictionary> \ No newline at end of file diff --git a/VECTO3GUI/VECTO3GUI.csproj b/VECTO3GUI/VECTO3GUI.csproj index 08846c3577846508f334cb67c0c1c143c01951bb..baa684ba4750939f1cfcf430a30b16b28797bc98 100644 --- a/VECTO3GUI/VECTO3GUI.csproj +++ b/VECTO3GUI/VECTO3GUI.csproj @@ -154,6 +154,7 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </ApplicationDefinition> + <Compile Include="Helper\ComponentTitleConverter.cs" /> <Compile Include="Helper\FileDialogHelper.cs" /> <Compile Include="Helper\OutputWindowHelper.cs" /> <Compile Include="Model\InterfacesImpl.cs" /> @@ -376,6 +377,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Resources\StringResources.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Resources\ViewModelMappings.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> diff --git a/VECTO3GUI/Views/JoblistTabView.xaml b/VECTO3GUI/Views/JoblistTabView.xaml index 1400c048c2424d5b6a5be0e4ec1ad4575218a5cc..a8a54e59bbfb8c6a30fedc6fd77b2df478f36eb3 100644 --- a/VECTO3GUI/Views/JoblistTabView.xaml +++ b/VECTO3GUI/Views/JoblistTabView.xaml @@ -7,6 +7,7 @@ xmlns:interfaces="clr-namespace:VECTO3GUI.ViewModel.Interfaces" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:impl="clr-namespace:VECTO3GUI.ViewModel.Impl" + xmlns:helper="clr-namespace:VECTO3GUI.Helper" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> @@ -26,7 +27,7 @@ <Grid Grid.Row="1"> - <TabControl ItemsSource="{Binding Components}" x:Name="ComponentsTab" SelectedIndex="0"> + <TabControl TabStripPlacement="Top" ItemsSource="{Binding Components}" x:Name="ComponentsTab" SelectedIndex="0"> <i:Interaction.Triggers> <i:EventTrigger EventName="SelectionChanged"> @@ -39,7 +40,7 @@ <TabControl.ItemTemplate> <DataTemplate> - <TextBlock Text="{Binding}"/> + <TextBlock Text="{Binding Converter={helper:ComponentTitleConverter}}" /> </DataTemplate> </TabControl.ItemTemplate> @@ -47,7 +48,7 @@ <DataTemplate> <ScrollViewer DockPanel.Dock="Top"> <ContentControl Content="{Binding DataContext.CurrentComponent, - RelativeSource={RelativeSource AncestorType=local:JoblistTabView}}" MinHeight="100"/> + RelativeSource={RelativeSource AncestorType=local:JoblistTabView}}" Margin="0,20,0,10"/> </ScrollViewer> </DataTemplate> </TabControl.ContentTemplate>