Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 8e6ac9f2 authored by Harald Martini's avatar Harald Martini
Browse files

Renamed ManufacturingStageEditViewModel to MultiStageEditViewModel, created Button template

parent 3ecf1711
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
<ResourceDictionary Source="Resources/GlobalStyles.xaml"/> <ResourceDictionary Source="Resources/GlobalStyles.xaml"/>
<ResourceDictionary Source="Resources/Colors.xaml"/> <ResourceDictionary Source="Resources/Colors.xaml"/>
<ResourceDictionary Source="DataGridStyles.xaml"/> <ResourceDictionary Source="DataGridStyles.xaml"/>
<ResourceDictionary Source="ButtonTemplates.xaml"/>
<ResourceDictionary Source="ButtonStyles.xaml"/>
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
</Application.Resources> </Application.Resources>
......
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="Button.Static.Background2" Color="#FFDDDDDD"/>
<SolidColorBrush x:Key="Button.Static.Border2" Color="#FF707070"/>
<SolidColorBrush x:Key="MultiStageButtonMouseOverBackGround" Color="#FFBEE6FD"/>
<Style x:Key="MultiStageButtonStyle1" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="Background" Value="{StaticResource Button.Static.Background2}"/>
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border2}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" BorderBrush="{DynamicResource AccentColorButton}" BorderThickness="0,0,0,1" Background="White" SnapsToDevicePixels="true" Width="80" Height="30">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition From="Normal" GeneratedDuration="0:0:0.3" To="MouseOver">
<VisualTransition.GeneratedEasingFunction>
<BackEase EasingMode="EaseIn"/>
</VisualTransition.GeneratedEasingFunction>
</VisualTransition>
</VisualStateGroup.Transitions>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="1,0,1,6.02" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Bottom"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsDefaulted" Value="true">
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource MultiStageButtonMouseOverBackGround}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource AccentColorButton}"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Pressed.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Disabled.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>
\ No newline at end of file
...@@ -15,7 +15,7 @@ namespace VECTO3GUI2020.Ninject ...@@ -15,7 +15,7 @@ namespace VECTO3GUI2020.Ninject
public override void Load() public override void Load()
{ {
Bind<IViewModelFactory>().ToFactory(); Bind<IViewModelFactory>().ToFactory();
Bind<IManufacturingStageEditViewModel>().To<ManufacturingStageEditViewModel>(); Bind<IMultiStageEditViewModel>().To<MultiStageEditViewModel>();
} }
} }
} }
...@@ -194,7 +194,7 @@ ...@@ -194,7 +194,7 @@
</DataTemplate> </DataTemplate>
<DataTemplate DataType="{x:Type multistageimpl:ManufacturingStageEditViewModel}"> <DataTemplate DataType="{x:Type multistageimpl:MultiStageEditViewModel}">
<multistageviews:ManufacturingStageView/> <multistageviews:ManufacturingStageView/>
</DataTemplate> </DataTemplate>
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
<Compile Include="ViewModel\Interfaces\JobEdit\Vehicle\Components\ITyreViewModel.cs" /> <Compile Include="ViewModel\Interfaces\JobEdit\Vehicle\Components\ITyreViewModel.cs" />
<Compile Include="ViewModel\Interfaces\JobEdit\Vehicle\IVehicleViewModel.cs" /> <Compile Include="ViewModel\Interfaces\JobEdit\Vehicle\IVehicleViewModel.cs" />
<Compile Include="ViewModel\MultiStage\Implementation\DeclarationInterimStageBusVehicleViewModel_v2_8.cs" /> <Compile Include="ViewModel\MultiStage\Implementation\DeclarationInterimStageBusVehicleViewModel_v2_8.cs" />
<Compile Include="ViewModel\MultiStage\Implementation\ManufacturingStageEditViewModel.cs" /> <Compile Include="ViewModel\MultiStage\Implementation\MultiStageEditViewModel.cs" />
<Compile Include="ViewModel\MultiStage\Interfaces\IViewModelFactory.cs" /> <Compile Include="ViewModel\MultiStage\Interfaces\IViewModelFactory.cs" />
<Compile Include="Views\CustomControls\ComboParameter.xaml.cs"> <Compile Include="Views\CustomControls\ComboParameter.xaml.cs">
<DependentUpon>ComboParameter.xaml</DependentUpon> <DependentUpon>ComboParameter.xaml</DependentUpon>
...@@ -349,6 +349,12 @@ ...@@ -349,6 +349,12 @@
<Compile Include="Views\XMLViewer.xaml.cs"> <Compile Include="Views\XMLViewer.xaml.cs">
<DependentUpon>XMLViewer.xaml</DependentUpon> <DependentUpon>XMLViewer.xaml</DependentUpon>
</Compile> </Compile>
<Page Include="ButtonStyles.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ButtonTemplates.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="DataGridStyles.xaml"> <Page Include="DataGridStyles.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
......
using System; using System;
using System.CodeDom;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
...@@ -17,12 +18,12 @@ using VECTO3GUI2020.ViewModel.Interfaces.JobEdit.Vehicle.Components; ...@@ -17,12 +18,12 @@ using VECTO3GUI2020.ViewModel.Interfaces.JobEdit.Vehicle.Components;
namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
{ {
public interface IManufacturingStageEditViewModel public interface IMultiStageEditViewModel
{ {
} }
public class ManufacturingStageEditViewModel : ViewModelBase, IManufacturingStageEditViewModel public class MultiStageEditViewModel : ViewModelBase, IMultiStageEditViewModel
{ {
private readonly Settings _settings = Settings.Default; private readonly Settings _settings = Settings.Default;
private ICommand _addVifCommand; private ICommand _addVifCommand;
...@@ -31,7 +32,13 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation ...@@ -31,7 +32,13 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
private IXMLInputDataReader _inputDataReader; private IXMLInputDataReader _inputDataReader;
private IVehicleViewModel _vehicleViewModel; private IVehicleViewModel _vehicleViewModel;
private IComponentViewModelFactory _componentViewModelFactory; private IComponentViewModelFactory _componentViewModelFactory;
private int _stageCount;
public string VifPath { get => _vifPath; set => SetProperty(ref _vifPath, value); } public string VifPath { get => _vifPath; set => SetProperty(ref _vifPath, value); }
public int StageCount
{
get => _stageCount;
set => SetProperty(ref _stageCount, value);
}
public IVehicleViewModel VehicleViewModel public IVehicleViewModel VehicleViewModel
...@@ -41,7 +48,9 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation ...@@ -41,7 +48,9 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
} }
public ManufacturingStageEditViewModel(IDialogHelper dialogHelper,
public MultiStageEditViewModel(IDialogHelper dialogHelper,
IXMLInputDataReader inputDataReader, IXMLInputDataReader inputDataReader,
IComponentViewModelFactory componentViewModelFactory) IComponentViewModelFactory componentViewModelFactory)
{ {
...@@ -78,10 +87,18 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation ...@@ -78,10 +87,18 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
_dialogHelper.ShowMessageBox("invalid input file", "Error", MessageBoxButton.OK, MessageBoxImage.Error); _dialogHelper.ShowMessageBox("invalid input file", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
return; return;
} }
VifPath = fileName;
var lastManufacturingStageInputData = inputDataProvider.JobInputData.ManufacturingStages.Last(); var lastManufacturingStageInputData = inputDataProvider.JobInputData.ManufacturingStages.Last();
VifPath = fileName;
_stageCount = inputDataProvider.JobInputData.ManufacturingStages.Count + 1;
VehicleViewModel = VehicleViewModel =
_componentViewModelFactory.CreateVehicleViewModel(lastManufacturingStageInputData.Vehicle); _componentViewModelFactory.CreateVehicleViewModel(lastManufacturingStageInputData.Vehicle);
......
...@@ -9,6 +9,6 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Interfaces ...@@ -9,6 +9,6 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Interfaces
{ {
public interface IViewModelFactory public interface IViewModelFactory
{ {
IManufacturingStageEditViewModel createManufacturingStageEditViewModel(); IMultiStageEditViewModel createManufacturingStageEditViewModel();
} }
} }
...@@ -8,23 +8,25 @@ ...@@ -8,23 +8,25 @@
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<Grid MaxWidth="900"> <Grid MaxWidth="900">
<Grid.RowDefinitions> <DockPanel>
<RowDefinition Height="40px"></RowDefinition> <Grid Margin="4" DockPanel.Dock="Top">
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid Margin="4">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition> <ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="30px"></ColumnDefinition> <ColumnDefinition Width="30px"></ColumnDefinition>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBox VerticalContentAlignment="Center" Height="Auto" Padding="4" Margin = "0 0 0 0" IsReadOnly="True" <TextBox VerticalContentAlignment="Center" Height="Auto" Padding="4" Margin = "0 0 0 0" IsReadOnly="True"
Text="{Binding VifPath}" HorizontalAlignment="Stretch"/> Text="{Binding VifPath}" HorizontalAlignment="Stretch"/>
<Button Padding="4" Margin="4 0 0 0" Grid.Column="1" Command="{Binding AddVifFile}"> <Button Padding="4" Margin="4 0 0 0" Grid.Column="1" Command="{Binding AddVifFile}">
<Image Source="../../Resources/folderpicker.ico"> <Image Source="../../Resources/folderpicker.ico">
</Image> </Image>
</Button> </Button>
</Grid>
</Grid> <DockPanel Grid.Row="1" LastChildFill="False" DockPanel.Dock="Top" >
<ContentControl Grid.Row="1" Content="{Binding VehicleViewModel}"></ContentControl> <Button DockPanel.Dock="Left" Style="{DynamicResource MultiStageButtonStyle1}" Margin="4">Vehicle</Button>
<Button DockPanel.Dock="Left" Style="{DynamicResource MultiStageButtonStyle1}" Margin="4">Airdrag</Button>
<Button DockPanel.Dock="Left" Style="{DynamicResource MultiStageButtonStyle1}" Margin="4">Auxiliaries</Button>
</DockPanel>
<ContentControl Grid.Row="2" Content="{Binding VehicleViewModel}"></ContentControl>
</DockPanel>
</Grid> </Grid>
</UserControl> </UserControl>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment