From 6444cb4fb622270b97a27e4e3d1908d06641db46 Mon Sep 17 00:00:00 2001 From: "harald.martini@student.tugraz.at" <harald.martini@student.tugraz.at> Date: Mon, 14 Jun 2021 09:59:50 +0200 Subject: [PATCH] Added View for exempted Vehicles --- VECTO3GUI2020/App.xaml | 3 +- ...MultistageParameterDataTemplateSelector.cs | 2 +- .../MultistageVehicleDataTemplateSelector.cs | 53 ++++++++++++++++ VECTO3GUI2020/Ninject/MultistageModule.cs | 2 +- .../Resources/DataTemplateSelectors.xaml | 7 +++ .../MultistageParameterDataTemplates.xaml | 4 +- VECTO3GUI2020/VECTO3GUI2020.csproj | 14 ++++- .../InterimStageBusVehicleViewModel_v2_8.cs | 43 +++++++------ .../ManufacturingStageViewModel_v0_1.cs | 20 +++--- .../MultistageJobViewModel_v0_1.cs | 16 +++-- .../NewMultiStageJobViewModel.cs | 1 - .../Interfaces/IMultiStageViewModelFactory.cs | 4 +- .../Multistage/ManufacturingStageView.xaml | 2 +- .../Views/Multistage/VehicleView_v2_8.xaml | 11 +--- .../Multistage/VehicleView_v2_8_exempted.xaml | 63 +++++++++++++++++++ .../VehicleView_v2_8_exempted.xaml.cs | 28 +++++++++ .../ViewModelTests/JobListViewModelTests.cs | 13 +++- 17 files changed, 231 insertions(+), 55 deletions(-) rename VECTO3GUI2020/Helper/{ => TemplateSelector}/MultistageParameterDataTemplateSelector.cs (96%) create mode 100644 VECTO3GUI2020/Helper/TemplateSelector/MultistageVehicleDataTemplateSelector.cs create mode 100644 VECTO3GUI2020/Resources/DataTemplateSelectors.xaml create mode 100644 VECTO3GUI2020/Views/Multistage/VehicleView_v2_8_exempted.xaml create mode 100644 VECTO3GUI2020/Views/Multistage/VehicleView_v2_8_exempted.xaml.cs diff --git a/VECTO3GUI2020/App.xaml b/VECTO3GUI2020/App.xaml index 817f5f0b1b..1d6ba658f0 100644 --- a/VECTO3GUI2020/App.xaml +++ b/VECTO3GUI2020/App.xaml @@ -17,7 +17,8 @@ <ResourceDictionary Source="DataGridStyles.xaml"/> <ResourceDictionary Source="Resources/Templates/ErrorTemplates.xaml"/> <ResourceDictionary Source="Resources/ObjectProvider.xaml"/> - <ResourceDictionary Source="Resources/Icons/drawables.xaml"></ResourceDictionary> + <ResourceDictionary Source="Resources/Icons/drawables.xaml"/> + <ResourceDictionary Source="Resources/DataTemplateSelectors.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> diff --git a/VECTO3GUI2020/Helper/MultistageParameterDataTemplateSelector.cs b/VECTO3GUI2020/Helper/TemplateSelector/MultistageParameterDataTemplateSelector.cs similarity index 96% rename from VECTO3GUI2020/Helper/MultistageParameterDataTemplateSelector.cs rename to VECTO3GUI2020/Helper/TemplateSelector/MultistageParameterDataTemplateSelector.cs index 74a73b23be..d0adf39752 100644 --- a/VECTO3GUI2020/Helper/MultistageParameterDataTemplateSelector.cs +++ b/VECTO3GUI2020/Helper/TemplateSelector/MultistageParameterDataTemplateSelector.cs @@ -4,7 +4,7 @@ using System.Windows.Controls; using TUGraz.VectoCommon.Exceptions; using VECTO3GUI2020.Views.Multistage.CustomControls; -namespace VECTO3GUI2020.Helper +namespace VECTO3GUI2020.Helper.TemplateSelector { public class MultistageParameterDataTemplateSelector : DataTemplateSelector { diff --git a/VECTO3GUI2020/Helper/TemplateSelector/MultistageVehicleDataTemplateSelector.cs b/VECTO3GUI2020/Helper/TemplateSelector/MultistageVehicleDataTemplateSelector.cs new file mode 100644 index 0000000000..648db0e189 --- /dev/null +++ b/VECTO3GUI2020/Helper/TemplateSelector/MultistageVehicleDataTemplateSelector.cs @@ -0,0 +1,53 @@ +using System; +using System.Windows; +using System.Windows.Controls; +using TUGraz.VectoCommon.Exceptions; +using VECTO3GUI2020.ViewModel.Interfaces.JobEdit.Vehicle; +using VECTO3GUI2020.ViewModel.MultiStage.Implementation; +using VECTO3GUI2020.Views.Multistage; +using VECTO3GUI2020.Views.Multistage.CustomControls; + +namespace VECTO3GUI2020.Helper.TemplateSelector +{ + public class MultistageVehicleDataTemplateSelector : DataTemplateSelector + { + + /// <summary> + /// Selects a vehicle viewmodel based on the ExemptedVehicleProperty + /// </summary> + /// <param name="item"></param> + /// <param name="container"></param> + /// <returns></returns> + public override DataTemplate SelectTemplate(object item, DependencyObject container) + { + FrameworkElement element = container as FrameworkElement; + IVehicleViewModel vm = item as IVehicleViewModel; + + if (element != null && item != null && vm != null) + { + FrameworkElementFactory factory = null; + Type type = null; + + switch (vm) { + case DeclarationInterimStageBusVehicleViewModel_v2_8 declvm: + if (declvm.ExemptedVehicle) { + type = typeof(VehicleView_v2_8_exempted); + } else { + type = typeof(VehicleView_v2_8); + } + + break; + default: + throw new NotImplementedException($"no template defined for {vm.GetType()}"); + } + + factory = new FrameworkElementFactory(type); + DataTemplate dt = new DataTemplate(); + dt.VisualTree = factory; + return dt; + } + + return base.SelectTemplate(item, container); + } + } +} \ No newline at end of file diff --git a/VECTO3GUI2020/Ninject/MultistageModule.cs b/VECTO3GUI2020/Ninject/MultistageModule.cs index c36e13772f..2037ace012 100644 --- a/VECTO3GUI2020/Ninject/MultistageModule.cs +++ b/VECTO3GUI2020/Ninject/MultistageModule.cs @@ -30,7 +30,7 @@ namespace VECTO3GUI2020.Ninject NamedLikeFactoryMethod((IMultiStageViewModelFactory f)=>f.GetInterimStageVehicleViewModel()); Bind<IManufacturingStageViewModel>().To<ManufacturingStageViewModel_v0_1>(). - NamedLikeFactoryMethod((IMultiStageViewModelFactory f) => f.GetManufacturingStageViewModel(null)); + NamedLikeFactoryMethod((IMultiStageViewModelFactory f) => f.GetManufacturingStageViewModel(null, false)); Bind<IMultistageAirdragViewModel>().To<MultistageAirdragViewModel>(). NamedLikeFactoryMethod((IMultiStageViewModelFactory f) => f.GetMultistageAirdragViewModel()); diff --git a/VECTO3GUI2020/Resources/DataTemplateSelectors.xaml b/VECTO3GUI2020/Resources/DataTemplateSelectors.xaml new file mode 100644 index 0000000000..acb9d8062d --- /dev/null +++ b/VECTO3GUI2020/Resources/DataTemplateSelectors.xaml @@ -0,0 +1,7 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:templateSelector="clr-namespace:VECTO3GUI2020.Helper.TemplateSelector"> + <templateSelector:MultistageParameterDataTemplateSelector x:Key="MultistageParameterTemplateSelector"/> + <templateSelector:MultistageVehicleDataTemplateSelector x:Key="MultistageVehicleDataTemplateSelector"/> + +</ResourceDictionary> \ No newline at end of file diff --git a/VECTO3GUI2020/Resources/MultistageParameterDataTemplates.xaml b/VECTO3GUI2020/Resources/MultistageParameterDataTemplates.xaml index f3499fc795..8cfc734c71 100644 --- a/VECTO3GUI2020/Resources/MultistageParameterDataTemplates.xaml +++ b/VECTO3GUI2020/Resources/MultistageParameterDataTemplates.xaml @@ -1,9 +1,9 @@ <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:customControls="clr-namespace:VECTO3GUI2020.Views.Multistage.CustomControls" - xmlns:helper="clr-namespace:VECTO3GUI2020.Helper"> + xmlns:helper="clr-namespace:VECTO3GUI2020.Helper" + xmlns:templateSelector="clr-namespace:VECTO3GUI2020.Helper.TemplateSelector"> - <helper:MultistageParameterDataTemplateSelector x:Key="MultistageParameterTemplateSelector"/> <customControls:MultistageParameterTextView x:Key="MultistageTextBoxView"/> <customControls:MultistageParameterComboBoxView x:Key="MultistageComboBoxView"/> diff --git a/VECTO3GUI2020/VECTO3GUI2020.csproj b/VECTO3GUI2020/VECTO3GUI2020.csproj index ec9339a403..f00aad07c7 100644 --- a/VECTO3GUI2020/VECTO3GUI2020.csproj +++ b/VECTO3GUI2020/VECTO3GUI2020.csproj @@ -170,10 +170,11 @@ <Compile Include="Helper\IndexedStorage.cs" /> <Compile Include="Helper\IWindowHelper.cs" /> <Compile Include="Helper\DialogHelper.cs" /> - <Compile Include="Helper\MultistageParameterDataTemplateSelector.cs" /> + <Compile Include="Helper\TemplateSelector\MultistageParameterDataTemplateSelector.cs" /> <Compile Include="Helper\MultistageParameterViewModel.cs" /> <Compile Include="Helper\NameOfMarkUpExtension.cs" /> <Compile Include="Helper\NameResolver.cs" /> + <Compile Include="Helper\TemplateSelector\MultistageVehicleDataTemplateSelector.cs" /> <Compile Include="Helper\WindowHelper.cs" /> <Compile Include="Helper\XMLExtension.cs" /> <Compile Include="Helper\XmlHelper.cs" /> @@ -444,6 +445,9 @@ <Compile Include="Views\Multistage\VehicleView_v2_8.xaml.cs"> <DependentUpon>VehicleView_v2_8.xaml</DependentUpon> </Compile> + <Compile Include="Views\Multistage\VehicleView_v2_8_exempted.xaml.cs"> + <DependentUpon>VehicleView_v2_8_exempted.xaml</DependentUpon> + </Compile> <Compile Include="Views\OutputView.xaml.cs"> <DependentUpon>OutputView.xaml</DependentUpon> </Compile> @@ -456,6 +460,10 @@ <Page Include="DataGridStyles.xaml"> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Resources\DataTemplateSelectors.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Resources\Icons\AddDocument_16x.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -691,6 +699,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Views\Multistage\VehicleView_v2_8_exempted.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\OutputView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> diff --git a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/InterimStageBusVehicleViewModel_v2_8.cs b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/InterimStageBusVehicleViewModel_v2_8.cs index 6acdf14367..1b821df28e 100644 --- a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/InterimStageBusVehicleViewModel_v2_8.cs +++ b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/InterimStageBusVehicleViewModel_v2_8.cs @@ -140,27 +140,33 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation public DeclarationInterimStageBusVehicleViewModel_v2_8(IVehicleDeclarationInputData consolidatedVehicleData, - IMultiStageViewModelFactory multistageViewModelFactory) + IMultiStageViewModelFactory multistageViewModelFactory, bool exempted) { ConsolidatedVehicleData = consolidatedVehicleData; - + _exemptedVehicle = exempted; _multiStageViewModelFactory = multistageViewModelFactory; - MultistageAirdragViewModel = _multiStageViewModelFactory.GetMultistageAirdragViewModel(consolidatedVehicleData?.Components?.AirdragInputData); - - MultistageAirdragViewModel.AirdragViewModelChanged += ((sender, args) => { - if (sender is IMultistageAirdragViewModel vm) { - if (AirdragModifiedMultistageMandatory) { - if (vm.AirDragViewModel != null) { - AirdragModifiedMultistage = true; + + if (!exempted) { + MultistageAirdragViewModel = _multiStageViewModelFactory.GetMultistageAirdragViewModel(consolidatedVehicleData?.Components?.AirdragInputData); + + MultistageAirdragViewModel.AirdragViewModelChanged += ((sender, args) => { + if (sender is IMultistageAirdragViewModel vm) + { + if (AirdragModifiedMultistageMandatory) + { + if (vm.AirDragViewModel != null) + { + AirdragModifiedMultistage = true; + } } } - } - }); + }); - MultistageAuxiliariesViewModel = - _multiStageViewModelFactory.GetAuxiliariesViewModel(consolidatedVehicleData?.Components? - .BusAuxiliaries); + MultistageAuxiliariesViewModel = + _multiStageViewModelFactory.GetAuxiliariesViewModel(consolidatedVehicleData?.Components? + .BusAuxiliaries); + } CreateParameterViewModels(); @@ -372,6 +378,8 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation { multistageParameterViewModel.UpdateEditingEnabled(); } + MultistageAirdragViewModel.SetAirdragInputData(vehicleInputData?.Components?.AirdragInputData); + MultistageAuxiliariesViewModel.SetAuxiliariesInputData(vehicleInputData?.Components?.BusAuxiliaries); OnPropertyChanged(string.Empty); } @@ -924,11 +932,11 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation public bool ExemptedVehicle { - get { throw new NotImplementedException(); } + get => _exemptedVehicle; + //set => SetProperty(ref _exemptedVehicle, value); } - public VehicleCategory VehicleCategory { get { throw new NotImplementedException(); } @@ -1140,7 +1148,6 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation private bool _airdragModifiedMultistageMandatory; private int? _numberPassengersStandingLowerDeck; private int? _numberPassengersStandingUpperDeck; - - + private bool _exemptedVehicle; } } \ No newline at end of file diff --git a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/ManufacturingStageViewModel_v0_1.cs b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/ManufacturingStageViewModel_v0_1.cs index a0f8a94210..bb7d149e35 100644 --- a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/ManufacturingStageViewModel_v0_1.cs +++ b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/ManufacturingStageViewModel_v0_1.cs @@ -71,14 +71,14 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation public void SetInputData(IVehicleDeclarationInputData vehicleInputData) { VehicleViewModel.SetVehicleInputData(vehicleInputData); - VehicleViewModel.MultistageAirdragViewModel.SetAirdragInputData(vehicleInputData?.Components?.AirdragInputData); - VehicleViewModel.MultistageAuxiliariesViewModel.SetAuxiliariesInputData(vehicleInputData?.Components?.BusAuxiliaries); + OnPropertyChanged(nameof(CurrentView)); } - public ManufacturingStageViewModel_v0_1(IManufacturingStageInputData consolidatedManufacturingStageInputData, IMultiStageViewModelFactory viewModelFactory) + public ManufacturingStageViewModel_v0_1(IManufacturingStageInputData consolidatedManufacturingStageInputData, bool exempted, + IMultiStageViewModelFactory viewModelFactory) { Title = "Edit Manufacturing Stage"; _viewModelFactory = viewModelFactory; @@ -88,16 +88,12 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation _consolidatedManufacturingStageInputData = consolidatedManufacturingStageInputData; - VehicleViewModel = (IMultistageVehicleViewModel)_viewModelFactory.GetInterimStageVehicleViewModel(consolidatedManufacturingStageInputData?.Vehicle); + VehicleViewModel = (IMultistageVehicleViewModel)_viewModelFactory.GetInterimStageVehicleViewModel(consolidatedManufacturingStageInputData?.Vehicle, exempted); CurrentView = VehicleViewModel as IViewModelBase; Components.Add(VehicleViewModel.Name, VehicleViewModel as IViewModelBase); - - - Components.Add("Airdrag", VehicleViewModel.MultistageAirdragViewModel as IViewModelBase); - Components.Add("Auxiliaries", VehicleViewModel.MultistageAuxiliariesViewModel as IViewModelBase); } @@ -115,7 +111,7 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation public ICommand SwitchComponentViewCommand { get { - return _switchComponentViewCommand ?? new RelayCommand<string>(SwitchViewExecute, (string s) => true); + return _switchComponentViewCommand ?? new RelayCommand<string>(SwitchViewExecute, (string s) => SwitchViewCanExecute(s)); } } @@ -128,6 +124,12 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation } } + private bool SwitchViewCanExecute(string viewToShow) + { + return Components[viewToShow] != null; + + } + #endregion private class ApplicationInformationMultistage : IApplicationInformation diff --git a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageJobViewModel_v0_1.cs b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageJobViewModel_v0_1.cs index b9d1a2a335..baf72977d0 100644 --- a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageJobViewModel_v0_1.cs +++ b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageJobViewModel_v0_1.cs @@ -74,8 +74,11 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation _primaryVehicle = _jobInputData.PrimaryVehicle; _dialogHelper = multistageDependencies.DialogHelperLazy; _inputDataReader = inputDataReader; + + var exempted = true; //= PrimaryVehicle.Vehicle.ExemptedVehicle + _manufacturingStageViewModel = - vmFactory.GetManufacturingStageViewModel(_consolidateManufacturingStage); + vmFactory.GetManufacturingStageViewModel(_consolidateManufacturingStage, exempted); // QUESTION: HEV/PEV ? //var hybridElectric = inputData.PrimaryVehicleData.Vehicle.HybridElectricHDV; @@ -84,6 +87,9 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation } + + + #region Commands @@ -224,9 +230,11 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation var vehicleErrorInfo = vehicleViewModel as IDataErrorInfo; errorMessage += vehicleErrorInfo.Error.Replace(",", "\n"); + var auxiliariesErrorInfo = vehicleViewModel.MultistageAuxiliariesViewModel as IDataErrorInfo; - if (!auxiliariesErrorInfo.Error.IsNullOrEmpty()) + if (auxiliariesErrorInfo != null && + !auxiliariesErrorInfo.Error.IsNullOrEmpty()) { errorMessage += "\n Auxiliaries \n"; errorMessage += auxiliariesErrorInfo.Error.Replace(",", "\n"); @@ -341,10 +349,6 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation } #endregion - - - - #region Implementation of IInputDataProvider public string DocumentName => Path.GetFileNameWithoutExtension(_inputData.DataSource.SourceFile); diff --git a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/NewMultiStageJobViewModel.cs b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/NewMultiStageJobViewModel.cs index 0468834e7d..45318bd812 100644 --- a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/NewMultiStageJobViewModel.cs +++ b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/NewMultiStageJobViewModel.cs @@ -80,7 +80,6 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation } if (inputDataProvider == null) { - _dialogHelper.ShowMessageBox("invalid input file", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } diff --git a/VECTO3GUI2020/ViewModel/MultiStage/Interfaces/IMultiStageViewModelFactory.cs b/VECTO3GUI2020/ViewModel/MultiStage/Interfaces/IMultiStageViewModelFactory.cs index 90e54e4722..53174738cf 100644 --- a/VECTO3GUI2020/ViewModel/MultiStage/Interfaces/IMultiStageViewModelFactory.cs +++ b/VECTO3GUI2020/ViewModel/MultiStage/Interfaces/IMultiStageViewModelFactory.cs @@ -20,9 +20,9 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Interfaces IVehicleViewModel GetInterimStageVehicleViewModel(); - IVehicleViewModel GetInterimStageVehicleViewModel(IVehicleDeclarationInputData consolidatedVehicleData); + IVehicleViewModel GetInterimStageVehicleViewModel(IVehicleDeclarationInputData consolidatedVehicleData, bool exempted); - IManufacturingStageViewModel GetManufacturingStageViewModel(IManufacturingStageInputData consolidatedManufacturingStageInputData); + IManufacturingStageViewModel GetManufacturingStageViewModel(IManufacturingStageInputData consolidatedManufacturingStageInputData, bool exempted); IMultistageAirdragViewModel GetMultistageAirdragViewModel(); IMultistageAirdragViewModel GetMultistageAirdragViewModel( diff --git a/VECTO3GUI2020/Views/Multistage/ManufacturingStageView.xaml b/VECTO3GUI2020/Views/Multistage/ManufacturingStageView.xaml index 9d8137454c..eab0e480c6 100644 --- a/VECTO3GUI2020/Views/Multistage/ManufacturingStageView.xaml +++ b/VECTO3GUI2020/Views/Multistage/ManufacturingStageView.xaml @@ -29,7 +29,7 @@ </StackPanel> </DockPanel> - <ContentControl DockPanel.Dock="Top" Content="{Binding CurrentView}"/> + <ContentControl ContentTemplateSelector="{StaticResource MultistageVehicleDataTemplateSelector}" DockPanel.Dock="Top" Content="{Binding CurrentView}"/> </DockPanel> </Grid> </UserControl> diff --git a/VECTO3GUI2020/Views/Multistage/VehicleView_v2_8.xaml b/VECTO3GUI2020/Views/Multistage/VehicleView_v2_8.xaml index 99ef7e8b6b..5a2e002671 100644 --- a/VECTO3GUI2020/Views/Multistage/VehicleView_v2_8.xaml +++ b/VECTO3GUI2020/Views/Multistage/VehicleView_v2_8.xaml @@ -11,11 +11,6 @@ mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800" BorderBrush="{DynamicResource ButtonHighlightColor}" BorderThickness="2px" Margin="4px"> <UserControl.Resources> - <Style TargetType="custom:MultiStageParameter"> - <Setter Property="NameLookUpResourceManager" Value="{x:Static properties:BusStrings.ResourceManager}"/> - <Setter Property="Validation.ErrorTemplate" Value="{StaticResource multistageParameterControlErrorTemplate}"/> - </Style> - <Style TargetType="ContentControl"> <Setter Property="ContentTemplateSelector" Value="{DynamicResource MultistageParameterTemplateSelector}"/> <Setter Property="IsTabStop" Value="False"></Setter> @@ -32,12 +27,8 @@ Style="{DynamicResource LabelStyle1}"/> - <ContentControl Content="{Binding ParameterViewModels[Manufacturer]}" > - </ContentControl> - - + <ContentControl Content="{Binding ParameterViewModels[Manufacturer]}"/> <ContentControl Content="{Binding ParameterViewModels[ManufacturerAddress]}"/> - <ContentControl Content="{Binding ParameterViewModels[VIN]}"/> diff --git a/VECTO3GUI2020/Views/Multistage/VehicleView_v2_8_exempted.xaml b/VECTO3GUI2020/Views/Multistage/VehicleView_v2_8_exempted.xaml new file mode 100644 index 0000000000..e8d8a44c65 --- /dev/null +++ b/VECTO3GUI2020/Views/Multistage/VehicleView_v2_8_exempted.xaml @@ -0,0 +1,63 @@ +<UserControl x:Class="VECTO3GUI2020.Views.Multistage.VehicleView_v2_8_exempted" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="clr-namespace:VECTO3GUI2020.Views.Multistage" + mc:Ignorable="d" + d:DesignHeight="450" d:DesignWidth="800"> + <UserControl.Resources> + <Style TargetType="ContentControl"> + <Setter Property="ContentTemplateSelector" Value="{DynamicResource MultistageParameterTemplateSelector}"/> + <Setter Property="IsTabStop" Value="False"></Setter> + </Style> + </UserControl.Resources> + <Grid> + <ScrollViewer> + <DockPanel> + <StackPanel> + <Label Content="VEHICLE DATA" HorizontalAlignment="Stretch" FontSize="15" VerticalAlignment="Stretch" + Style="{DynamicResource LabelStyle1}"/> + + + <ContentControl Content="{Binding ParameterViewModels[Manufacturer]}"/> + <ContentControl Content="{Binding ParameterViewModels[ManufacturerAddress]}"/> + <ContentControl Content="{Binding ParameterViewModels[VIN]}"/> + <ContentControl Content="{Binding ParameterViewModels[Model]}"/> + <ContentControl Content="{Binding ParameterViewModels[LegislativeCategory]}"/> + <ContentControl Content="{Binding ParameterViewModels[CurbMassChassis]}"/> + <ContentControl Content="{Binding ParameterViewModels[GrossVehicleMassRating]}"/> + <ContentControl Content="{Binding ParameterViewModels[RegisteredClass]}"/> + + + + <Separator/> + + <ContentControl + Content="{Binding ParameterViewModels[VehicleCode]}"/> + + <ContentControl + Content="{Binding ParameterViewModels[LowEntry]}"/> + <Separator/> + + <ContentControl + Content="{Binding ParameterViewModels[HeightInMm]}"/> + <Separator/> + + <Label Style="{DynamicResource LabelStyle1}">Number of Passengers</Label> + <ContentControl + Content="{Binding ParameterViewModels[NumberPassengerSeatsLowerDeck]}"/> + <ContentControl + Content="{Binding ParameterViewModels[NumberPassengerSeatsUpperDeck]}"/> + <ContentControl + Content="{Binding ParameterViewModels[NumberPassengersStandingLowerDeck]}"/> + <ContentControl + Content="{Binding ParameterViewModels[NumberPassengersStandingUpperDeck]}"/> + + + + </StackPanel> + </DockPanel> + </ScrollViewer> + </Grid> +</UserControl> diff --git a/VECTO3GUI2020/Views/Multistage/VehicleView_v2_8_exempted.xaml.cs b/VECTO3GUI2020/Views/Multistage/VehicleView_v2_8_exempted.xaml.cs new file mode 100644 index 0000000000..56db7aca7d --- /dev/null +++ b/VECTO3GUI2020/Views/Multistage/VehicleView_v2_8_exempted.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace VECTO3GUI2020.Views.Multistage +{ + /// <summary> + /// Interaction logic for VehicleView_v2_8_exempted.xaml + /// </summary> + public partial class VehicleView_v2_8_exempted : UserControl + { + public VehicleView_v2_8_exempted() + { + InitializeComponent(); + } + } +} diff --git a/Vecto3GUI2020Test/ViewModelTests/JobListViewModelTests.cs b/Vecto3GUI2020Test/ViewModelTests/JobListViewModelTests.cs index 231bc7af5a..0358255e58 100644 --- a/Vecto3GUI2020Test/ViewModelTests/JobListViewModelTests.cs +++ b/Vecto3GUI2020Test/ViewModelTests/JobListViewModelTests.cs @@ -1,4 +1,5 @@ -using System.Threading.Tasks; +using System.Diagnostics; +using System.Threading.Tasks; using Ninject; using NUnit.Framework; using NUnit.Framework.Internal; @@ -19,7 +20,8 @@ namespace Vecto3GUI2020Test.ViewModelTests public async Task CancelSimulationWhileLoadingFiles() { var jobListViewModel = _kernel.Get<IJobListViewModel>() as JobListViewModel; - + var watch = new Stopwatch(); + watch.Start(); //load final vif var loadedFile = await jobListViewModel.AddJobAsync(GetFullPath(finalVIF)).ConfigureAwait(false); @@ -39,6 +41,8 @@ namespace Vecto3GUI2020Test.ViewModelTests Assert.That(() => jobListViewModel.SimulationRunning == false, constraint); TestContext.WriteLine("Done!"); + watch.Stop(); + TestContext.WriteLine($"ExecutionTime {watch.Elapsed.TotalSeconds}s"); } @@ -46,6 +50,8 @@ namespace Vecto3GUI2020Test.ViewModelTests public async Task CancelSimulationWhenJobContainerIsRunning() { var jobListViewModel = _kernel.Get<IJobListViewModel>() as JobListViewModel; + var watch = new Stopwatch(); + watch.Start(); //load final vif var loadedFile = await jobListViewModel.AddJobAsync(GetFullPath(finalVIF)).ConfigureAwait(false); @@ -72,6 +78,9 @@ namespace Vecto3GUI2020Test.ViewModelTests jobListViewModel.CancelSimulation.Execute(null); Assert.That(() => jobListViewModel.SimulationRunning == false, constraint); TestContext.WriteLine("Done!"); + + watch.Stop(); + TestContext.WriteLine($"ExecutionTime {watch.Elapsed.TotalSeconds}s"); } } } \ No newline at end of file -- GitLab