diff --git a/VECTO.sln b/VECTO.sln index 948e8abe09ae5fef55514360b2ae737d0a57e0cf..5ce3d1062feba5c31379bdfaba7b39a8f276f81e 100644 --- a/VECTO.sln +++ b/VECTO.sln @@ -66,6 +66,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VECTO-GIT", "VECTO-GIT", "{ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VECTO_GIT_TEST", "..\STUDENTEN_PROJEKTE\Kober_VectoGIT\VECTO_GIT\VECTO_GIT_TEST\VECTO_GIT_TEST.csproj", "{52430C51-892A-4D8E-9189-B6C9D09791C0}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VECTO3GUI", "VECTO3GUI\VECTO3GUI.csproj", "{A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug PerformanceStats|Any CPU = Debug PerformanceStats|Any CPU @@ -774,6 +776,48 @@ Global {52430C51-892A-4D8E-9189-B6C9D09791C0}.ReleaseTUG|x64.Build.0 = Release|Any CPU {52430C51-892A-4D8E-9189-B6C9D09791C0}.ReleaseTUG|x86.ActiveCfg = Release|Any CPU {52430C51-892A-4D8E-9189-B6C9D09791C0}.ReleaseTUG|x86.Build.0 = Release|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Debug PerformanceStats|Any CPU.ActiveCfg = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Debug PerformanceStats|Any CPU.Build.0 = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Debug PerformanceStats|x64.ActiveCfg = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Debug PerformanceStats|x64.Build.0 = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Debug PerformanceStats|x86.ActiveCfg = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Debug PerformanceStats|x86.Build.0 = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Debug PerformanceTrace|Any CPU.ActiveCfg = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Debug PerformanceTrace|Any CPU.Build.0 = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Debug PerformanceTrace|x64.ActiveCfg = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Debug PerformanceTrace|x64.Build.0 = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Debug PerformanceTrace|x86.ActiveCfg = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Debug PerformanceTrace|x86.Build.0 = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Debug|x64.ActiveCfg = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Debug|x64.Build.0 = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Debug|x86.ActiveCfg = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Debug|x86.Build.0 = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.DebugTUG|Any CPU.ActiveCfg = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.DebugTUG|Any CPU.Build.0 = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.DebugTUG|x64.ActiveCfg = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.DebugTUG|x64.Build.0 = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.DebugTUG|x86.ActiveCfg = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.DebugTUG|x86.Build.0 = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Deploy|Any CPU.Build.0 = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Deploy|x64.ActiveCfg = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Deploy|x64.Build.0 = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Deploy|x86.ActiveCfg = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Deploy|x86.Build.0 = Debug|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Release|Any CPU.Build.0 = Release|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Release|x64.ActiveCfg = Release|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Release|x64.Build.0 = Release|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Release|x86.ActiveCfg = Release|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.Release|x86.Build.0 = Release|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.ReleaseTUG|Any CPU.ActiveCfg = Release|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.ReleaseTUG|Any CPU.Build.0 = Release|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.ReleaseTUG|x64.ActiveCfg = Release|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.ReleaseTUG|x64.Build.0 = Release|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.ReleaseTUG|x86.ActiveCfg = Release|Any CPU + {A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}.ReleaseTUG|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/VECTO3GUI/App.config b/VECTO3GUI/App.config new file mode 100644 index 0000000000000000000000000000000000000000..c6ccae7ec482e6c84f79edd8e080d4b42e06a111 --- /dev/null +++ b/VECTO3GUI/App.config @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> + </startup> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration> \ No newline at end of file diff --git a/VECTO3GUI/App.xaml b/VECTO3GUI/App.xaml new file mode 100644 index 0000000000000000000000000000000000000000..fb5901ef6cc436829a31273e0bea7182e5096299 --- /dev/null +++ b/VECTO3GUI/App.xaml @@ -0,0 +1,39 @@ +<Application x:Class="VECTO3GUI.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> + <Application.Resources> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="Resources/ViewModelMappings.xaml"/> + <ResourceDictionary> + <Style TargetType="{x:Type Control}"> + <Setter Property="Focusable" Value="False"/> + </Style> + <Style TargetType="{x:Type TextBox}"> + <Setter Property="Validation.ErrorTemplate"> + <Setter.Value> + <ControlTemplate> + <DockPanel> + <Grid DockPanel.Dock="Left" Width="16" Height="16" VerticalAlignment="Center" Margin="0 0 3 0"> + <Ellipse Width="16" Height="16" Fill="Red"/> + <Ellipse Width="3" Height="8" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0 2 0 0" Fill="White"/> + <Ellipse Width="2" Height="2" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0 0 0 2" Fill="White"/> + </Grid> + <Border BorderBrush="Red" BorderThickness="2" CornerRadius="2"> + <AdornedElementPlaceholder/> + </Border> + </DockPanel> + </ControlTemplate> + </Setter.Value> + </Setter> + <Style.Triggers> + <Trigger Property="Validation.HasError" Value="true"> + <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}"/> + </Trigger> + </Style.Triggers> + </Style> + </ResourceDictionary> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </Application.Resources> +</Application> diff --git a/VECTO3GUI/App.xaml.cs b/VECTO3GUI/App.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..8340f6247f4044f91d8f1de3d80b22a464acf224 --- /dev/null +++ b/VECTO3GUI/App.xaml.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using Ninject; +using Ninject.Extensions.Factory; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCore; +using VECTO3.ViewModel.Adapter; +using VECTO3.ViewModel.Adapter.Declaration; +using VECTO3.ViewModel.Impl; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3GUI +{ + /// <summary> + /// Interaction logic for App.xaml + /// </summary> + public partial class App : Application + { + private IKernel container; + + #region Overrides of Application + + protected override void OnStartup(StartupEventArgs e) + { + ConfigureContainer(); + base.OnStartup(e); + } + + private void ConfigureContainer() + { + container = new StandardKernel(new VectoNinjectModule()); + + container.Bind<IAdapterFactory>().ToFactory(); + + container.Bind<IMainWindowViewModel>().To<MainWindowViewModel>(); + container.Bind<IJoblistViewModel>().To<JoblistViewModel>(); + container.Bind<IJobEditViewModel>().To<DeclarationJobViewModel>(); + container.Bind<INoneViewModel>().To<NoneViewModel>(); + container.Bind<IVehicleViewModel>().To<VehicleViewModel>(); + + container.Bind<IAirdragViewModel>().To<AirdragViewModel>(); + container.Bind<IAngledriveViewModel>().To<AngledriveViewModel>(); + container.Bind<IAxlegearViewModel>().To<AxlegearViewModel>(); + container.Bind<IEngineViewModel>().To<EngineViewModel>(); + container.Bind<IGearboxViewModel>().To<GearboxViewModel>(); + container.Bind<IRetarderViewModel>().To<RetarderViewModel>(); + container.Bind<ITorqueConverterViewModel>().To<TorqueConverterViewModel>(); + container.Bind<ICyclesViewModel>().To<CyclesViewModel>(); + container.Bind<IAuxiliariesViewModel>().To<AuxiliariesViewModel>(); + + container.Bind<IAxlesViewModel>().To<AxlesViewModel>(); + container.Bind<IAxleViewModel>().To<AxleViewModel>(); + container.Bind<ITyreViewModel>().To<TyreViewModel>(); + + + container.Bind<IAirdragDeclarationInputData>().To<AirdragDeclarationAdapter>(); + container.Bind<IAngledriveInputData>().To<AngledriveDeclarationAdapter>(); + container.Bind<IAuxiliariesDeclarationInputData>().To<AuxiliariesDeclarationAdapter>(); + container.Bind<IAxleDeclarationInputData>().To<AxleDeclarationAdapter>(); + container.Bind<IAxleGearInputData>().To<AxlegearDeclarationAdapter>(); + container.Bind<IEngineDeclarationInputData>().To<EngineDeclarationAdapter>(); + container.Bind<IGearboxDeclarationInputData>().To<GearboxDeclarationAdapter>(); + container.Bind<IRetarderInputData>().To<RetarderDeclarationAdapter>(); + container.Bind<ITorqueConverterDeclarationInputData>().To<TorqueConverterDeclarationAdapter>(); + container.Bind<ITyreDeclarationInputData>().To<TyreDeclarationAdapter>(); + container.Bind<IVehicleDeclarationInputData>().To<VehicleDeclarationAdapter>(); + + var mainWindow = container.Get<MainWindow>(); + mainWindow.Show(); + } + + #endregion + } +} diff --git a/VECTO3GUI/Helper/BaseConverter.cs b/VECTO3GUI/Helper/BaseConverter.cs new file mode 100644 index 0000000000000000000000000000000000000000..64c42d61991ccdedff792df0dc4845fcdb6d3996 --- /dev/null +++ b/VECTO3GUI/Helper/BaseConverter.cs @@ -0,0 +1,16 @@ +using System; +using System.Windows.Markup; + +namespace VECTO3.Helper { + public class BaseConverter : MarkupExtension + { + #region Overrides of MarkupExtension + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } + + #endregion + } +} \ No newline at end of file diff --git a/VECTO3GUI/Helper/DataContextBaseExtension.cs b/VECTO3GUI/Helper/DataContextBaseExtension.cs new file mode 100644 index 0000000000000000000000000000000000000000..a7e09adca9ad1f61006eb88c42169d9292b396bd --- /dev/null +++ b/VECTO3GUI/Helper/DataContextBaseExtension.cs @@ -0,0 +1,105 @@ +using System; +using System.ComponentModel; +using System.Windows; +using System.Windows.Markup; + +namespace VECTO3.Helper +{ + public abstract class DataContextBaseExtension : MarkupExtension + { + /// <summary> + /// Gets or sets the target object from the service provider + /// </summary> + protected object TargetObject { get; set; } + + /// <summary> + /// Gets or sets the target property from the service provider + /// </summary> + protected object TargetProperty { get; set; } + + /// <summary> + /// Gets or sets the target Dependency Object from the service provider + /// </summary> + protected DependencyObject TargetObjectDependencyObject { get; set; } + + /// <summary> + /// Gets or sets the target Dependency Property from the service provider; + /// </summary> + protected DependencyProperty TargetObjectDependencyProperty { get; set; } + + /// <summary> + /// Gets or sets the DataContext that this extension is hooking into. + /// </summary> + protected object DataContext { get; private set; } + + + /// <summary> + /// By sealing this method, we guarantee that the developer will always + /// have to use this implementation. + /// </summary> + public sealed override object ProvideValue(IServiceProvider serviceProvider) + { + IProvideValueTarget target = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget; + + if (target != null) { + TargetObject = target.TargetObject; + TargetProperty = target.TargetProperty; + + // Convert to DP and DO if possible... + TargetObjectDependencyProperty = TargetProperty as DependencyProperty; + TargetObjectDependencyObject = TargetObject as DependencyObject; + + if (!FindDataContext()) { + SubscribeToDataContextChangedEvent(); + } + } + + return OnProvideValue(serviceProvider); + } + + + protected abstract object OnProvideValue(IServiceProvider serviceProvider); + + private void SubscribeToDataContextChangedEvent() + { + if (TargetObjectDependencyObject == null) { + return; + } + DependencyPropertyDescriptor.FromProperty(FrameworkElement.DataContextProperty, + TargetObjectDependencyObject.GetType()) + .AddValueChanged(TargetObjectDependencyObject, DataContextChanged); + } + + private void DataContextChanged(object sender, EventArgs e) + { + if (FindDataContext()) { + UnsubscribeFromDataContextChangedEvent(); + } + } + + private bool FindDataContext() + { + if (TargetObjectDependencyObject == null) { + return false; + } + var dc = TargetObjectDependencyObject.GetValue(FrameworkElement.DataContextProperty) ?? + TargetObjectDependencyObject.GetValue(FrameworkContentElement.DataContextProperty); + if (dc != null) { + DataContext = dc; + + OnDataContextFound(); + } + + return dc != null; + } + + private void UnsubscribeFromDataContextChangedEvent() + { + DependencyPropertyDescriptor.FromProperty(FrameworkElement.DataContextProperty, + TargetObjectDependencyObject.GetType()) + .RemoveValueChanged(TargetObjectDependencyObject, DataContextChanged); + } + + protected abstract void OnDataContextFound(); + } +} diff --git a/VECTO3GUI/Helper/JobEntrySelectedConverter.cs b/VECTO3GUI/Helper/JobEntrySelectedConverter.cs new file mode 100644 index 0000000000000000000000000000000000000000..277a690576b4c9e3cfd17bb027e690aad79a6203 --- /dev/null +++ b/VECTO3GUI/Helper/JobEntrySelectedConverter.cs @@ -0,0 +1,25 @@ +using System; +using System.Globalization; +using System.Windows.Controls; +using System.Windows.Data; + +namespace VECTO3.Helper +{ + public class JobEntrySelectedConverter : IValueConverter + { + #region Implementation of IValueConverter + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var jobEntry = (ViewModel.Impl.JobEntry)((ListViewItem)value)?.Content; + return jobEntry != null && jobEntry.Selected; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + + #endregion + } +} diff --git a/VECTO3GUI/Helper/SIUnit.cs b/VECTO3GUI/Helper/SIUnit.cs new file mode 100644 index 0000000000000000000000000000000000000000..6cd4e3329554207bd54535a5c05a253efb8d7071 --- /dev/null +++ b/VECTO3GUI/Helper/SIUnit.cs @@ -0,0 +1,68 @@ +using System; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; + +using SIUtils = VECTO3.Util.SIUtils; + +namespace VECTO3.Helper { + public class SIUnit : DataContextBaseExtension + { + + protected PropertyInfo targetProperty; + + protected readonly string Param; + + public SIUnit(string param) + { + Param = param; + } + + + #region Overrides of DataContextBaseExtension + + protected override object OnProvideValue(IServiceProvider serviceProvider) + { + if (TargetProperty != null) { + targetProperty = TargetProperty as PropertyInfo; + + } + return "Unit"; + } + + protected override void OnDataContextFound() + { + var properties = DataContext?.GetType().GetProperties().Where(x => x.Name == Param).ToArray(); + if (properties?.Length != 1) { + return; + } + + var targetType = properties.First().GetMethod.ReturnType; + var val = SIUtils.CreateSIValue(targetType, 0); + UpdateProperty(val.UnitString); + } + + private void UpdateProperty(object value) + { + if (TargetObjectDependencyObject != null) { + if (TargetObjectDependencyProperty != null) { + Action update = () => TargetObjectDependencyObject + .SetValue(TargetObjectDependencyProperty, value); + + if (TargetObjectDependencyObject.CheckAccess()) { + update(); + } else { + TargetObjectDependencyObject.Dispatcher.Invoke(update); + } + } else { + if (targetProperty != null) { + targetProperty.SetValue(TargetObject, value, null); + } + } + } + } + + + #endregion + } +} \ No newline at end of file diff --git a/VECTO3GUI/Helper/SIValueConverter.cs b/VECTO3GUI/Helper/SIValueConverter.cs new file mode 100644 index 0000000000000000000000000000000000000000..9c7fd96a1304a502324f5dd90f4e912d7f3d6d44 --- /dev/null +++ b/VECTO3GUI/Helper/SIValueConverter.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Reflection; +using System.Windows; +using System.Windows.Data; +using TUGraz.VectoCommon.Utils; + +using Expression = System.Linq.Expressions.Expression; +using SIUtils = VECTO3.Util.SIUtils; + +namespace VECTO3.Helper +{ + public class SIValueConverter : BaseConverter, IValueConverter + { + protected const double ToRpm = 60 / (2 * Math.PI); + protected const double ToCubicCentimeter = 1e6; + + #region Implementation of IValueConverter + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null) { + return DependencyProperty.UnsetValue; + } + if (!(value is SI)) { + throw new Exception("Can only convert SI types!"); + } + + var siValue = value as SI; + var doubleVal = siValue.Value(); + + var conversionFactor = 1.0; + var stringParam = parameter as string; + int? decimals = null; + if (!string.IsNullOrEmpty(stringParam)) { + var args = stringParam.Split('|'); + foreach (var arg in args) { + GetDecimals(arg, ref decimals); + GetConversionFactor(ref conversionFactor, arg); + } + } + doubleVal *= conversionFactor; + return decimals == null ? doubleVal.ToString(culture) : doubleVal.ToString("F" + decimals.Value, culture); + } + + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + if (!typeof(SI).IsAssignableFrom(targetType)) { + return DependencyProperty.UnsetValue; + + //throw new Exception("Can only convert SI types!"); + } + + if(value == null) { + return DependencyProperty.UnsetValue; + } + + var stringParam = parameter as string; + int? decimals = null; + var conversionFactor = 1.0; + if (!string.IsNullOrEmpty(stringParam)) { + var args = stringParam.Split('|'); + foreach (var arg in args) { + GetDecimals(arg, ref decimals); + GetConversionFactor(ref conversionFactor, arg); + } + } + + double doubleVal; + var success = double.TryParse(value.ToString(), NumberStyles.Float, culture, out doubleVal); + if (!success) { + return DependencyProperty.UnsetValue; + } + + if (decimals != null) { + doubleVal = Math.Round(doubleVal, decimals.Value, MidpointRounding.AwayFromZero); + } + doubleVal /= conversionFactor; + + return SIUtils.CreateSIValue(targetType, doubleVal); + } + + private void GetConversionFactor(ref double factor, string convertId) + { + switch (convertId.ToLower()) { + case "asrpm": factor = ToRpm; + break; + case "ascubiccentimeter": factor = ToCubicCentimeter; + break; + } + } + + private void GetDecimals(string arg, ref int? decimals) + { + switch (arg.ToLower()) { + case "int": + decimals = 0; + break; + case "double2": + decimals = 2; + break; + case "double3": + decimals = 3; + break; + case "double4": + decimals = 4; + break; + } + } + #endregion + } +} diff --git a/VECTO3GUI/Helper/VehicleClassConverter.cs b/VECTO3GUI/Helper/VehicleClassConverter.cs new file mode 100644 index 0000000000000000000000000000000000000000..acede650cf830e964ce17c9b56dbc1b782c05658 --- /dev/null +++ b/VECTO3GUI/Helper/VehicleClassConverter.cs @@ -0,0 +1,33 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using TUGraz.VectoCore.Models.Declaration; + +namespace VECTO3.Helper +{ + public class VehicleClassConverter : BaseConverter, IValueConverter + { + #region Implementation of IValueConverter + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var vehicleClass = value as VehicleClass?; + return vehicleClass == null ? string.Empty : vehicleClass.Value.GetClassNumber(); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null) { + return null; + } + + try { + return VehicleClassHelper.Parse(value.ToString()); + } catch (Exception) { + return null; + } + } + + #endregion + } +} diff --git a/VECTO3GUI/MainWindow.xaml b/VECTO3GUI/MainWindow.xaml new file mode 100644 index 0000000000000000000000000000000000000000..1b2cb3e5cd6d8ff41e64126f7fd31e49f07abe46 --- /dev/null +++ b/VECTO3GUI/MainWindow.xaml @@ -0,0 +1,27 @@ +<Window x:Class="VECTO3GUI.MainWindow" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:local="clr-namespace:VECTO3GUI" + xmlns:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + mc:Ignorable="d" + Title="VECTO 3" Height="515.36" Width="972.48" > + + <!--<d:MainWindow.DataContext> + <x:Type Type="interfaces:IMainWindowViewModel"/> + </d:MainWindow.DataContext>--> + + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="150"/> + <ColumnDefinition Width="*"/> + </Grid.ColumnDefinitions> + <StackPanel Orientation="Vertical" Background="Gray" Grid.Column="0"> + <Button Name="BtnHome" Background="Gray" Foreground="White" FontSize="16pt" Margin="0,20,0,0" BorderBrush="Gray" Width="150" Padding="10,0,0,0">Home</Button> + <Button Name="BtnSettings" Width="150" Background="Gray" Foreground="White" FontSize="16pt" Margin="0,5,0,0" BorderBrush="Gray" HorizontalAlignment="Left" Padding="10,0,0,0">Settings</Button> + <Button Name="BtnHelp" Width="150" Background="Gray" Foreground="White" FontSize="16pt" Margin="0,5,0,0" BorderBrush="Gray" HorizontalAlignment="Left" Padding="10,0,0,0">Help</Button> + </StackPanel> + <ContentControl Content="{Binding CurrentViewModel}" Grid.Column="1"/> + </Grid> +</Window> diff --git a/VECTO3GUI/MainWindow.xaml.cs b/VECTO3GUI/MainWindow.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..2a20034f48414d455003eae9186ed7cc550dfd36 --- /dev/null +++ b/VECTO3GUI/MainWindow.xaml.cs @@ -0,0 +1,37 @@ +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; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3GUI +{ + /// <summary> + /// Interaction logic for MainWindow.xaml + /// </summary> + public partial class MainWindow : Window + { + + public MainWindow() + { + InitializeComponent(); + + } + + public MainWindow(IMainWindowViewModel viewModel) + { + InitializeComponent(); + DataContext = viewModel; + } + } +} diff --git a/VECTO3GUI/Properties/AssemblyInfo.cs b/VECTO3GUI/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000000000000000000000000000000000..df45d8dc832a5e7d1c398bce15b7adc6350a303c --- /dev/null +++ b/VECTO3GUI/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("VECTO3GUI")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("VECTO3GUI")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file +//inside a <PropertyGroup>. For example, if you are using US english +//in your source files, set the <UICulture> to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/VECTO3GUI/Properties/Resources.Designer.cs b/VECTO3GUI/Properties/Resources.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..e9fa4ad167402d1757e4df52748fcc83cf1e8b7e --- /dev/null +++ b/VECTO3GUI/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace VECTO3GUI.Properties +{ + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("VECTO3GUI.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/VECTO3GUI/Properties/Resources.resx b/VECTO3GUI/Properties/Resources.resx new file mode 100644 index 0000000000000000000000000000000000000000..af7dbebbacef595e3089c01c05671016c21a8304 --- /dev/null +++ b/VECTO3GUI/Properties/Resources.resx @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> \ No newline at end of file diff --git a/VECTO3GUI/Properties/Settings.Designer.cs b/VECTO3GUI/Properties/Settings.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..a674648cefa45a4b8e59c7cbc549026ccbb2805b --- /dev/null +++ b/VECTO3GUI/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace VECTO3GUI.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/VECTO3GUI/Properties/Settings.settings b/VECTO3GUI/Properties/Settings.settings new file mode 100644 index 0000000000000000000000000000000000000000..033d7a5e9e2266753180f4e3a9299f575046701e --- /dev/null +++ b/VECTO3GUI/Properties/Settings.settings @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile> \ No newline at end of file diff --git a/VECTO3GUI/Resources/ViewModelMappings.xaml b/VECTO3GUI/Resources/ViewModelMappings.xaml new file mode 100644 index 0000000000000000000000000000000000000000..5c5b155246612aad448305a0d84030c450a5590c --- /dev/null +++ b/VECTO3GUI/Resources/ViewModelMappings.xaml @@ -0,0 +1,256 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:impl="clr-namespace:VECTO3.ViewModel.Impl" + xmlns:views="clr-namespace:VECTO3.Views" + xmlns:engineering="clr-namespace:VECTO3.Views.ComponentViews.Engineering" + xmlns:declaration="clr-namespace:VECTO3.Views.ComponentViews.Declaration" + xmlns:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces"> + + <DataTemplate DataType="{x:Type impl:JoblistViewModel}"> + <views:JoblistView /> + </DataTemplate> + <DataTemplate DataType="{x:Type impl:DeclarationJobViewModel}"> + <views:JobEditView/> + </DataTemplate> + <DataTemplate DataType="{x:Type impl:EngineOnlyJobViewModel}"> + <views:JobEditView/> + </DataTemplate> + <DataTemplate DataType="{x:Type impl:NoneViewModel}"> + <views:EditComponentNoneView/> + </DataTemplate> + + + <DataTemplate x:Key="EditAirdragDeclaration"> + <declaration:AirdragDeclarationView/> + </DataTemplate> + <DataTemplate x:Key="EditAirdragEngineering"> + <engineering:AirdragEngineeringView/> + </DataTemplate> + <DataTemplate DataType="{x:Type impl:AirdragViewModel}"> + <ContentPresenter x:Name="EditAirdrag"></ContentPresenter> + <DataTemplate.Triggers> + <DataTrigger Binding="{Binding DeclarationMode}" Value="true"> + <Setter TargetName="EditAirdrag" Property="ContentTemplate" Value="{StaticResource EditAirdragDeclaration}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding DeclarationMode}" Value="false"> + <Setter TargetName="EditAirdrag" Property="ContentTemplate" Value="{StaticResource EditAirdragEngineering}"></Setter> + </DataTrigger> + </DataTemplate.Triggers> + </DataTemplate> + + <DataTemplate x:Key="EditAngledriveDeclaration"> + <declaration:AngledriveDeclarationView/> + </DataTemplate> + <DataTemplate x:Key="EditAngledriveEngineering"> + <engineering:AngledriveEngineeringView/> + </DataTemplate> + <DataTemplate DataType="{x:Type impl:AngledriveViewModel}"> + <ContentPresenter x:Name="EditAngledrive"></ContentPresenter> + <DataTemplate.Triggers> + <DataTrigger Binding="{Binding DeclarationMode}" Value="true"> + <Setter TargetName="EditAngledrive" Property="ContentTemplate" Value="{StaticResource EditAngledriveDeclaration}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding DeclarationMode}" Value="false"> + <Setter TargetName="EditAngledrive" Property="ContentTemplate" Value="{StaticResource EditAngledriveEngineering}"></Setter> + </DataTrigger> + </DataTemplate.Triggers> + </DataTemplate> + + <DataTemplate x:Key="EditAxlegearDeclaration"> + <declaration:AxlegearDeclarationView/> + </DataTemplate> + <DataTemplate x:Key="EditAxlegearEngineering"> + <engineering:AxlegearEngineeringView/> + </DataTemplate> + <DataTemplate DataType="{x:Type impl:AxlegearViewModel}"> + <ContentPresenter x:Name="EditAxlegear"></ContentPresenter> + <DataTemplate.Triggers> + <DataTrigger Binding="{Binding DeclarationMode}" Value="true"> + <Setter TargetName="EditAxlegear" Property="ContentTemplate" Value="{StaticResource EditAxlegearDeclaration}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding DeclarationMode}" Value="false"> + <Setter TargetName="EditAxlegear" Property="ContentTemplate" Value="{StaticResource EditAxlegearEngineering}"></Setter> + </DataTrigger> + </DataTemplate.Triggers> + </DataTemplate> + + <DataTemplate x:Key="EditCyclesDeclaration"> + <declaration:CyclesDeclarationView/> + </DataTemplate> + <DataTemplate x:Key="EditCyclesEngineering"> + <engineering:CyclesEngineeringView/> + </DataTemplate> + <DataTemplate DataType="{x:Type impl:CyclesViewModel}"> + <ContentPresenter x:Name="EditCycles"></ContentPresenter> + <DataTemplate.Triggers> + <DataTrigger Binding="{Binding DeclarationMode}" Value="true"> + <Setter TargetName="EditCycles" Property="ContentTemplate" Value="{StaticResource EditCyclesDeclaration}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding DeclarationMode}" Value="false"> + <Setter TargetName="EditCycles" Property="ContentTemplate" Value="{StaticResource EditCyclesEngineering}"></Setter> + </DataTrigger> + </DataTemplate.Triggers> + </DataTemplate> + + <DataTemplate x:Key="EditEngineDeclaration"> + <declaration:EngineDeclarationView/> + </DataTemplate> + <DataTemplate x:Key="EditEngineEngineering"> + <engineering:EngineEngineeringView/> + </DataTemplate> + <DataTemplate DataType="{x:Type impl:EngineViewModel}"> + <ContentPresenter x:Name="EditEngine"></ContentPresenter> + <DataTemplate.Triggers> + <DataTrigger Binding="{Binding DeclarationMode}" Value="true"> + <Setter TargetName="EditEngine" Property="ContentTemplate" Value="{StaticResource EditEngineDeclaration}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding DeclarationMode}" Value="false"> + <Setter TargetName="EditEngine" Property="ContentTemplate" Value="{StaticResource EditEngineEngineering}"></Setter> + </DataTrigger> + </DataTemplate.Triggers> + </DataTemplate> + + <DataTemplate x:Key="EditGearboxDeclaration"> + <declaration:GearboxDeclarationView/> + </DataTemplate> + <DataTemplate x:Key="EditGearboxEngineering"> + <engineering:GearboxEngineeringView/> + </DataTemplate> + <DataTemplate DataType="{x:Type impl:GearboxViewModel}"> + <ContentPresenter x:Name="EditGearbox"></ContentPresenter> + <DataTemplate.Triggers> + <DataTrigger Binding="{Binding DeclarationMode}" Value="true"> + <Setter TargetName="EditGearbox" Property="ContentTemplate" Value="{StaticResource EditGearboxDeclaration}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding DeclarationMode}" Value="false"> + <Setter TargetName="EditGearbox" Property="ContentTemplate" Value="{StaticResource EditGearboxEngineering}"></Setter> + </DataTrigger> + </DataTemplate.Triggers> + </DataTemplate> + + <DataTemplate x:Key="EditRetarderDeclaration"> + <declaration:RetarderDeclarationView/> + </DataTemplate> + <DataTemplate x:Key="EditRetarderEngineering"> + <engineering:RetarderEngineeringView/> + </DataTemplate> + <DataTemplate DataType="{x:Type impl:RetarderViewModel}"> + <ContentPresenter x:Name="EditRetarder"></ContentPresenter> + <DataTemplate.Triggers> + <DataTrigger Binding="{Binding DeclarationMode}" Value="true"> + <Setter TargetName="EditRetarder" Property="ContentTemplate" Value="{StaticResource EditRetarderDeclaration}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding DeclarationMode}" Value="false"> + <Setter TargetName="EditRetarder" Property="ContentTemplate" Value="{StaticResource EditRetarderEngineering}"></Setter> + </DataTrigger> + </DataTemplate.Triggers> + </DataTemplate> + + <DataTemplate x:Key="EditTorqueConverterDeclaration"> + <declaration:TorqueConverterDeclarationView/> + </DataTemplate> + <DataTemplate x:Key="EditTorqueConverterEngineering"> + <engineering:TorqueConverterEngineeringView/> + </DataTemplate> + <DataTemplate DataType="{x:Type impl:TorqueConverterViewModel}"> + <ContentPresenter x:Name="EditTorqueConverter"></ContentPresenter> + <DataTemplate.Triggers> + <DataTrigger Binding="{Binding DeclarationMode}" Value="true"> + <Setter TargetName="EditTorqueConverter" Property="ContentTemplate" Value="{StaticResource EditTorqueConverterDeclaration}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding DeclarationMode}" Value="false"> + <Setter TargetName="EditTorqueConverter" Property="ContentTemplate" Value="{StaticResource EditTorqueConverterEngineering}"></Setter> + </DataTrigger> + </DataTemplate.Triggers> + </DataTemplate> + + <DataTemplate x:Key="EditVehicleDeclaration"> + <declaration:VehicleDeclarationView/> + </DataTemplate> + <DataTemplate x:Key="EditVehicleEngineering"> + <engineering:VehicleEngineeringView/> + </DataTemplate> + <DataTemplate DataType="{x:Type impl:VehicleViewModel}"> + <ContentPresenter x:Name="EditVehicle"></ContentPresenter> + <DataTemplate.Triggers> + <DataTrigger Binding="{Binding DeclarationMode}" Value="true"> + <Setter TargetName="EditVehicle" Property="ContentTemplate" Value="{StaticResource EditVehicleDeclaration}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding DeclarationMode}" Value="false"> + <Setter TargetName="EditVehicle" Property="ContentTemplate" Value="{StaticResource EditVehicleEngineering}"></Setter> + </DataTrigger> + </DataTemplate.Triggers> + </DataTemplate> + + <DataTemplate x:Key="EditAuxiliariesDeclaration"> + <declaration:AuxiliariesDeclarationView/> + </DataTemplate> + <DataTemplate x:Key="EditAuxiliariesEngineering"> + <engineering:AuxiliariesEngineerngView/> + </DataTemplate> + <DataTemplate DataType="{x:Type impl:AuxiliariesViewModel}"> + <ContentPresenter x:Name="EditAuxiliaries"></ContentPresenter> + <DataTemplate.Triggers> + <DataTrigger Binding="{Binding DeclarationMode}" Value="true"> + <Setter TargetName="EditAuxiliaries" Property="ContentTemplate" Value="{StaticResource EditAuxiliariesDeclaration}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding DeclarationMode}" Value="false"> + <Setter TargetName="EditAuxiliaries" Property="ContentTemplate" Value="{StaticResource EditAuxiliariesEngineering}"></Setter> + </DataTrigger> + </DataTemplate.Triggers> + </DataTemplate> + + <DataTemplate x:Key="EditAxlesDeclaration"> + <declaration:AxlesDeclarationView/> + </DataTemplate> + <DataTemplate x:Key="EditAxlesEngineering"> + <engineering:AxlesEngineeringView/> + </DataTemplate> + <DataTemplate DataType="{x:Type impl:AxlesViewModel}"> + <ContentPresenter x:Name="EditAxles"></ContentPresenter> + <DataTemplate.Triggers> + <DataTrigger Binding="{Binding DeclarationMode}" Value="true"> + <Setter TargetName="EditAxles" Property="ContentTemplate" Value="{StaticResource EditAxlesDeclaration}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding DeclarationMode}" Value="false"> + <Setter TargetName="EditAxles" Property="ContentTemplate" Value="{StaticResource EditAxlesEngineering}"></Setter> + </DataTrigger> + </DataTemplate.Triggers> + </DataTemplate> + + <DataTemplate x:Key="EditAxleDeclaration"> + <declaration:AxleDeclarationView/> + </DataTemplate> + <DataTemplate x:Key="EditAxleEngineering"> + <engineering:AxleEngineeringView/> + </DataTemplate> + <DataTemplate DataType="{x:Type interfaces:AxleViewModel}"> + <ContentPresenter x:Name="EditAxle"></ContentPresenter> + <DataTemplate.Triggers> + <DataTrigger Binding="{Binding DeclarationMode}" Value="true"> + <Setter TargetName="EditAxle" Property="ContentTemplate" Value="{StaticResource EditAxleDeclaration}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding DeclarationMode}" Value="false"> + <Setter TargetName="EditAxle" Property="ContentTemplate" Value="{StaticResource EditAxleEngineering}"></Setter> + </DataTrigger> + </DataTemplate.Triggers> + </DataTemplate> + + <DataTemplate x:Key="EditTyreDeclaration"> + <declaration:TyreDeclarationView/> + </DataTemplate> + <DataTemplate x:Key="EditTyreEngineering"> + <engineering:TyreEngineeringView/> + </DataTemplate> + <DataTemplate DataType="{x:Type impl:TyreViewModel}"> + <ContentPresenter x:Name="EditTyre"></ContentPresenter> + <DataTemplate.Triggers> + <DataTrigger Binding="{Binding DeclarationMode}" Value="true"> + <Setter TargetName="EditTyre" Property="ContentTemplate" Value="{StaticResource EditTyreDeclaration}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding DeclarationMode}" Value="false"> + <Setter TargetName="EditTyre" Property="ContentTemplate" Value="{StaticResource EditTyreEngineering}"></Setter> + </DataTrigger> + </DataTemplate.Triggers> + </DataTemplate> +</ResourceDictionary> \ No newline at end of file diff --git a/VECTO3GUI/Util/AllowedEntry.cs b/VECTO3GUI/Util/AllowedEntry.cs new file mode 100644 index 0000000000000000000000000000000000000000..2d7c5d55bccba9033e2daba267e4b0dd2d1a799f --- /dev/null +++ b/VECTO3GUI/Util/AllowedEntry.cs @@ -0,0 +1,18 @@ +namespace VECTO3.Util { + + public class AllowedEntry + { + public static AllowedEntry<T> Create<T>(T label, string description) + { + return new AllowedEntry<T> { + Value = label, + Label = description + }; + } + } + public class AllowedEntry<T> + { + public string Label { get; set; } + public T Value { get; set; } + } +} \ No newline at end of file diff --git a/VECTO3GUI/Util/Component.cs b/VECTO3GUI/Util/Component.cs new file mode 100644 index 0000000000000000000000000000000000000000..7facdbbf0a5108863116c2fa6d0507cd19e4d835 --- /dev/null +++ b/VECTO3GUI/Util/Component.cs @@ -0,0 +1,18 @@ +namespace VECTO3.Util { + public enum Component + { + Vehicle = 1, + Engine, + Gearbox, + TorqueConverter, + Retarder, + Angledrive, + Axlegear, + PTO, + Airdrag, + Axles, + Auxiliaries, + BusAuxiliaries, + Cycle, + } +} \ No newline at end of file diff --git a/VECTO3GUI/Util/RelayCommand.cs b/VECTO3GUI/Util/RelayCommand.cs new file mode 100644 index 0000000000000000000000000000000000000000..4b59d810f1bca21c1e0db522a5a7cfe634479607 --- /dev/null +++ b/VECTO3GUI/Util/RelayCommand.cs @@ -0,0 +1,155 @@ + + +using System; +using System.Diagnostics; +using System.Windows.Input; + +namespace VECTO3.Util +{ + /// <summary> + /// A command whose sole purpose is to relay its functionality to other objects by invoking delegates. The default return value for the CanExecute method is 'true'. + /// </summary> + public class RelayCommand<T> : ICommand + { + #region Declarations + + readonly Predicate<T> _canExecute; + readonly Action<T> _execute; + + #endregion + + #region Constructors + + /// <summary> + /// Initializes a new instance of the <see cref="RelayCommand<T>"/> class. + /// </summary> + /// <param name="execute">The execution logic.</param> + /// <param name="canExecute">The execution status logic.</param> + public RelayCommand(Action<T> execute, Predicate<T> canExecute = null) + { + if (execute == null) { + throw new ArgumentNullException("execute"); + } + _execute = execute; + _canExecute = canExecute; + } + + #endregion + + #region ICommand Members + + public event EventHandler CanExecuteChanged + { + add { + if (_canExecute != null) { + CommandManager.RequerySuggested += value; + } + } + remove { + if (_canExecute != null) { + CommandManager.RequerySuggested -= value; + } + } + } + + public void RaiseCanExecuteChanged() + { + CommandManager.InvalidateRequerySuggested(); + } + + + [DebuggerStepThrough] + public bool CanExecute(Object parameter) + { + if (_canExecute == null) { + return true; + } + + try { + return _canExecute((T)parameter); + } catch (Exception) { + return false; + } + } + + public void Execute(Object parameter) + { + _execute((T)parameter); + } + + #endregion + } + + /// <summary> + /// A command whose sole purpose is to relay its functionality to other objects by invoking delegates. The default return value for the CanExecute method is 'true'. + /// </summary> + public class RelayCommand : ICommand + { + #region Declarations + + readonly Func<Boolean> _canExecute; + readonly Action _execute; + + #endregion + + #region Constructors + + /// <summary> + /// Initializes a new instance of the <see cref="RelayCommand<T>"/> class. + /// </summary> + /// <param name="execute">The execution logic.</param> + /// <param name="canExecute">The execution status logic.</param> + public RelayCommand(Action execute, Func<Boolean> canExecute = null) + { + if (execute == null) { + throw new ArgumentNullException("execute"); + } + _execute = execute; + _canExecute = canExecute; + } + + #endregion + + #region ICommand Members + + public event EventHandler CanExecuteChanged + { + add { + if (_canExecute != null) { + CommandManager.RequerySuggested += value; + } + } + remove { + if (_canExecute != null) { + CommandManager.RequerySuggested -= value; + } + } + } + + public void RaiseCanExecuteChanged() + { + CommandManager.InvalidateRequerySuggested(); + } + + [DebuggerStepThrough] + public Boolean CanExecute(Object parameter) + { + if (_canExecute == null) { + return true; + } + + try { + return _canExecute(); + } catch (Exception) { + return false; + } + } + + public void Execute(Object parameter) + { + _execute(); + } + + #endregion + } +} diff --git a/VECTO3GUI/Util/SIUtils.cs b/VECTO3GUI/Util/SIUtils.cs new file mode 100644 index 0000000000000000000000000000000000000000..ec70b098244114088cf31c24371080f2e282e331 --- /dev/null +++ b/VECTO3GUI/Util/SIUtils.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Reflection; +using TUGraz.VectoCommon.Utils; + +namespace VECTO3.Util +{ + public static class SIUtils + { + static readonly Dictionary<Type, Func<double, object>> Constructors = new Dictionary<Type, Func<double, object>>(); + + public static SI CreateSIValue(Type targetType, double value) + { + if (!typeof(SI).IsAssignableFrom(targetType)) { + return null; + } + + if (!Constructors.ContainsKey(targetType)) { + const BindingFlags bindingFlags = BindingFlags.NonPublic | BindingFlags.Instance; + var constructorInfo = targetType.GetConstructor(bindingFlags, null, new[] { typeof(double) }, null); + var param = Expression.Parameter(typeof(double)); + var expr = Expression.Lambda<Func<double, object>>(Expression.New(constructorInfo, param), param); + var constr = expr.Compile(); + Constructors[targetType] = constr; + } + return (SI)Constructors[targetType](value); + } + } +} diff --git a/VECTO3GUI/Util/TableDataConverter.cs b/VECTO3GUI/Util/TableDataConverter.cs new file mode 100644 index 0000000000000000000000000000000000000000..01fd60fde2828517a9d1bee02458ffdddd3e5942 --- /dev/null +++ b/VECTO3GUI/Util/TableDataConverter.cs @@ -0,0 +1,113 @@ +using System.Collections.Generic; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Reader.ComponentData; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.Util { + public static class TableDataConverter { + + public static TableData Convert(IEnumerable<GearLossMapEntry> viewModelLossMap) + { + var retVal = new TableData(); + var columns = new[] { + TransmissionLossMapReader.Fields.InputSpeed, + TransmissionLossMapReader.Fields.InputTorque, + TransmissionLossMapReader.Fields.TorqeLoss + }; + foreach (var colName in columns) { + retVal.Columns.Add(colName); + } + foreach (var entry in viewModelLossMap) { + var row = retVal.NewRow(); + row[TransmissionLossMapReader.Fields.InputSpeed] = entry.InputSpeed.AsRPM; + row[TransmissionLossMapReader.Fields.InputTorque] = entry.InputTorque.Value(); + row[TransmissionLossMapReader.Fields.TorqeLoss] = entry.TorqueLoss.Value(); + retVal.Rows.Add(row); + } + return retVal; + } + + public static TableData Convert(IEnumerable<RetarderLossMapEntry> viewModelLossMap) + { + var retVal = new TableData(); + var columns = new[] { + RetarderLossMapReader.Fields.RetarderSpeed, + RetarderLossMapReader.Fields.TorqueLoss + }; + foreach (var colName in columns) { + retVal.Columns.Add(colName); + } + foreach (var entry in viewModelLossMap) { + var row = retVal.NewRow(); + row[RetarderLossMapReader.Fields.RetarderSpeed] = entry.RetarderSpeed.AsRPM; + row[RetarderLossMapReader.Fields.TorqueLoss] = entry.TorqueLoss.Value(); + retVal.Rows.Add(row); + } + return retVal; + } + + public static TableData Convert(IEnumerable<TorqueConverterCharacteristics> viewModelLossMap) + { + var retVal = new TableData(); + var columns = new[] { + TorqueConverterDataReader.Fields.SpeedRatio, + TorqueConverterDataReader.Fields.TorqueRatio, + TorqueConverterDataReader.Fields.CharacteristicTorque + }; + foreach (var colName in columns) { + retVal.Columns.Add(colName); + } + foreach (var entry in viewModelLossMap) { + var row = retVal.NewRow(); + row[TorqueConverterDataReader.Fields.SpeedRatio] = entry.SpeedRatio; + row[TorqueConverterDataReader.Fields.TorqueRatio] = entry.TorqueRatio; + row[TorqueConverterDataReader.Fields.CharacteristicTorque] = entry.InputTorqueRef.Value(); + retVal.Rows.Add(row); + } + return retVal; + } + + public static TableData Convert(IEnumerable<FuelConsumptionEntry> fcMap) + { + var retVal = new TableData(); + var columns = new[] { + FuelConsumptionMapReader.Fields.EngineSpeed, + FuelConsumptionMapReader.Fields.Torque, + FuelConsumptionMapReader.Fields.FuelConsumption + }; + foreach (var colName in columns) { + retVal.Columns.Add(colName); + } + foreach (var entry in fcMap) { + var row = retVal.NewRow(); + row[FuelConsumptionMapReader.Fields.EngineSpeed] = entry.EngineSpeed.AsRPM; + row[FuelConsumptionMapReader.Fields.Torque] = entry.Torque.Value(); + row[FuelConsumptionMapReader.Fields.FuelConsumption] = entry.FuelConsumption.ConvertToGrammPerHour().Value; + retVal.Rows.Add(row); + } + return retVal; + } + + public static TableData Convert(IEnumerable<FullLoadEntry> fullLoadCurve) + { + var retVal = new TableData(); + var columns = new[] { + FullLoadCurveReader.Fields.EngineSpeed, + FullLoadCurveReader.Fields.TorqueFullLoad, + FullLoadCurveReader.Fields.TorqueDrag + }; + foreach (var colName in columns) { + retVal.Columns.Add(colName); + } + foreach (var entry in fullLoadCurve) { + var row = retVal.NewRow(); + row[FullLoadCurveReader.Fields.EngineSpeed] = entry.EngineSpeed.AsRPM; + row[FullLoadCurveReader.Fields.TorqueFullLoad] = entry.MaxTorque.Value(); + row[FullLoadCurveReader.Fields.TorqueDrag] = entry.DragTorque.Value(); + retVal.Rows.Add(row); + } + return retVal; + } + } +} \ No newline at end of file diff --git a/VECTO3GUI/Util/VectoParameterAttribute.cs b/VECTO3GUI/Util/VectoParameterAttribute.cs new file mode 100644 index 0000000000000000000000000000000000000000..1a41a27bac8fdcc743687f6300530ba6a3a7c76a --- /dev/null +++ b/VECTO3GUI/Util/VectoParameterAttribute.cs @@ -0,0 +1,17 @@ +using System; + +namespace VECTO3.Util { + [AttributeUsage(AttributeTargets.Property)] + public class VectoParameterAttribute : Attribute + { + public VectoParameterAttribute(Type type, string property) + { + Type = type; + PropertyName = property; + } + + public Type Type { get; } + + public string PropertyName { get; } + } +} \ No newline at end of file diff --git a/VECTO3GUI/Util/ViewModelFactory.cs b/VECTO3GUI/Util/ViewModelFactory.cs new file mode 100644 index 0000000000000000000000000000000000000000..d5395d4e75e513403997de7cc5b9ca2cacfc0ae9 --- /dev/null +++ b/VECTO3GUI/Util/ViewModelFactory.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using Ninject; +using VECTO3.ViewModel.Impl; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.Util +{ + public static class ViewModelFactory + { + + public static Dictionary<Component, Type> ComponentViewModelMapping = new Dictionary<Component, Type>() + { + { Component.Vehicle, typeof(IVehicleViewModel)}, + { Component.Engine ,typeof(IEngineViewModel) }, + { Component.Gearbox ,typeof(IGearboxViewModel) }, + { Component.TorqueConverter ,typeof(ITorqueConverterViewModel) }, + { Component.Retarder ,typeof(IRetarderViewModel) }, + { Component.Angledrive ,typeof(IAngledriveViewModel) }, + { Component.Axlegear ,typeof(IAxlegearViewModel) }, + { Component.Auxiliaries, typeof(IAuxiliariesViewModel) }, + { Component.Airdrag ,typeof(IAirdragViewModel) }, + { Component.Cycle ,typeof(ICyclesViewModel) }, + { Component.Axles, typeof(IAxlesViewModel) } + + }; + + //public static IComponentViewModel CreateViewModel(IKernel kernel, Component component, DeclarationJobViewModel jobEditViewModel) + //{ + // throw new System.NotImplementedException(); + //} + } +} diff --git a/VECTO3GUI/VECTO3GUI.csproj b/VECTO3GUI/VECTO3GUI.csproj new file mode 100644 index 0000000000000000000000000000000000000000..4e7ac88d227323bbd0e9f628ee5ce82fdcd51452 --- /dev/null +++ b/VECTO3GUI/VECTO3GUI.csproj @@ -0,0 +1,459 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{A17C6067-4DD9-41FC-B335-39F3DE1DE6B3}</ProjectGuid> + <OutputType>WinExe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>VECTO3GUI</RootNamespace> + <AssemblyName>VECTO3GUI</AssemblyName> + <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> + <HintPath>..\packages\Castle.Core.4.2.0\lib\net45\Castle.Core.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Ninject, Version=3.3.4.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL"> + <HintPath>..\packages\Ninject.3.3.4\lib\net45\Ninject.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Ninject.Extensions.Factory, Version=3.3.2.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL"> + <HintPath>..\packages\Ninject.Extensions.Factory.3.3.2\lib\net45\Ninject.Extensions.Factory.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="System" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> + <Reference Include="System.Configuration" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xaml"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + <Reference Include="WindowsBase" /> + <Reference Include="PresentationCore" /> + <Reference Include="PresentationFramework" /> + </ItemGroup> + <ItemGroup> + <ApplicationDefinition Include="App.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </ApplicationDefinition> + <Compile Include="Util\AllowedEntry.cs" /> + <Compile Include="Util\Component.cs" /> + <Compile Include="Util\RelayCommand.cs" /> + <Compile Include="Util\SIUtils.cs" /> + <Compile Include="Util\TableDataConverter.cs" /> + <Compile Include="Util\VectoParameterAttribute.cs" /> + <Compile Include="Util\ViewModelFactory.cs" /> + <Compile Include="ViewModel\Adapter\Declaration\AbstractDeclarationAdapter.cs" /> + <Compile Include="ViewModel\Adapter\Declaration\AirdragDeclarationAdapter.cs" /> + <Compile Include="ViewModel\Adapter\Declaration\AngledriveDeclarationAdapter.cs" /> + <Compile Include="ViewModel\Adapter\Declaration\AuxiliariesDeclarationAdapter.cs" /> + <Compile Include="ViewModel\Adapter\Declaration\AxleDeclarationAdapter.cs" /> + <Compile Include="ViewModel\Adapter\Declaration\AxlegearDeclarationAdapter.cs" /> + <Compile Include="ViewModel\Adapter\Declaration\DeclarationJobAdapter.cs" /> + <Compile Include="ViewModel\Adapter\Declaration\EngineDeclarationAdapter.cs" /> + <Compile Include="ViewModel\Adapter\Declaration\GearboxDeclarationAdapter.cs" /> + <Compile Include="ViewModel\Adapter\Declaration\RetarderDeclarationAdapter.cs" /> + <Compile Include="ViewModel\Adapter\Declaration\TorqueConverterDeclarationAdapter.cs" /> + <Compile Include="ViewModel\Adapter\Declaration\TyreDeclarationAdapter.cs" /> + <Compile Include="ViewModel\Adapter\Declaration\VehicleDeclarationAdapter.cs" /> + <Compile Include="ViewModel\Adapter\IAdapterFactory.cs" /> + <Compile Include="ViewModel\Impl\AbstractComponentViewModel.cs" /> + <Compile Include="ViewModel\Impl\AbstractJobViewModel.cs" /> + <Compile Include="ViewModel\Impl\AbstractViewModel.cs" /> + <Compile Include="ViewModel\Impl\AirdragViewModel.cs" /> + <Compile Include="ViewModel\Impl\AngledriveViewModel.cs" /> + <Compile Include="ViewModel\Impl\AuxiliariesViewModel.cs" /> + <Compile Include="ViewModel\Impl\AxlegearViewModel.cs" /> + <Compile Include="ViewModel\Impl\AxlesViewModel.cs" /> + <Compile Include="ViewModel\Impl\AxleViewModel.cs" /> + <Compile Include="ViewModel\Impl\CyclesViewModel.cs" /> + <Compile Include="ViewModel\Impl\DeclarationJobViewModel.cs" /> + <Compile Include="ViewModel\Impl\EngineOnlyJobViewModel.cs" /> + <Compile Include="ViewModel\Impl\EngineViewModel.cs" /> + <Compile Include="ViewModel\Impl\GearboxViewModel.cs" /> + <Compile Include="ViewModel\Impl\JobEntry.cs" /> + <Compile Include="ViewModel\Impl\JoblistViewModel.cs" /> + <Compile Include="ViewModel\Impl\MainWindowViewModel.cs" /> + <Compile Include="ViewModel\Impl\NoneViewModel.cs" /> + <Compile Include="ViewModel\Impl\ObservableObject.cs" /> + <Compile Include="ViewModel\Impl\RetarderViewModel.cs" /> + <Compile Include="ViewModel\Impl\TorqueConverterViewModel.cs" /> + <Compile Include="ViewModel\Impl\TyreViewModel.cs" /> + <Compile Include="ViewModel\Impl\ValidatingViewModel.cs" /> + <Compile Include="ViewModel\Impl\VehicleViewModel.cs" /> + <Compile Include="ViewModel\Interfaces\FuelConsumptionEntry.cs" /> + <Compile Include="ViewModel\Interfaces\FullLoadEntry.cs" /> + <Compile Include="ViewModel\Interfaces\Gear.cs" /> + <Compile Include="ViewModel\Interfaces\GearLossMapEntry.cs" /> + <Compile Include="ViewModel\Interfaces\IAirdragViewModel.cs" /> + <Compile Include="ViewModel\Interfaces\IAngledriveViewModel.cs" /> + <Compile Include="ViewModel\Interfaces\IAuxiliariesViewModel.cs" /> + <Compile Include="ViewModel\Interfaces\IAxlegearViewModel.cs" /> + <Compile Include="ViewModel\Interfaces\IAxlesViewModel.cs" /> + <Compile Include="ViewModel\Interfaces\IAxleViewModel.cs" /> + <Compile Include="ViewModel\Interfaces\ICommonComponentParameters.cs" /> + <Compile Include="ViewModel\Interfaces\IComponentViewModel.cs" /> + <Compile Include="ViewModel\Interfaces\ICyclesViewModel.cs" /> + <Compile Include="ViewModel\Interfaces\IEngineViewModel.cs" /> + <Compile Include="ViewModel\Interfaces\IGearboxViewModel.cs" /> + <Compile Include="ViewModel\Interfaces\IJobEditViewModel.cs" /> + <Compile Include="ViewModel\Interfaces\IJoblistViewModel.cs" /> + <Compile Include="ViewModel\Interfaces\IMainView.cs" /> + <Compile Include="ViewModel\Interfaces\IMainWindowViewModel.cs" /> + <Compile Include="ViewModel\Interfaces\INoneViewModel.cs" /> + <Compile Include="ViewModel\Interfaces\IRetarderViewModel.cs" /> + <Compile Include="ViewModel\Interfaces\ITorqueConverterViewModel.cs" /> + <Compile Include="ViewModel\Interfaces\ITyreViewModel.cs" /> + <Compile Include="ViewModel\Interfaces\IVehicleViewModel.cs" /> + <Compile Include="ViewModel\Interfaces\RetarderLossMapEntry.cs" /> + <Compile Include="ViewModel\Interfaces\SteeringPumpEntry.cs" /> + <Compile Include="ViewModel\Interfaces\TorqueConverterCharacteristics.cs" /> + <Compile Include="ViewModel\Interfaces\TorqueEntry.cs" /> + <Compile Include="Views\ComponentViews\Declaration\AirdragDeclarationView.xaml.cs"> + <DependentUpon>AirdragDeclarationView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Declaration\AngledriveDeclarationView.xaml.cs"> + <DependentUpon>AngledriveDeclarationView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Declaration\AuxiliariesDeclarationView.xaml.cs"> + <DependentUpon>AuxiliariesDeclarationView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Declaration\AxleDeclarationView.xaml.cs"> + <DependentUpon>AxleDeclarationView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Declaration\AxlegearDeclarationView.xaml.cs"> + <DependentUpon>AxlegearDeclarationView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Declaration\AxlesDeclarationView.xaml.cs"> + <DependentUpon>AxlesDeclarationView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Declaration\CyclesDeclarationView.xaml.cs"> + <DependentUpon>CyclesDeclarationView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Declaration\EngineDeclarationView.xaml.cs"> + <DependentUpon>EngineDeclarationView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Declaration\GearboxDeclarationView.xaml.cs"> + <DependentUpon>GearboxDeclarationView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Declaration\RetarderDeclarationView.xaml.cs"> + <DependentUpon>RetarderDeclarationView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Declaration\TorqueConverterDeclarationView.xaml.cs"> + <DependentUpon>TorqueConverterDeclarationView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Declaration\TyreDeclarationView.xaml.cs"> + <DependentUpon>TyreDeclarationView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Declaration\VehicleDeclarationView.xaml.cs"> + <DependentUpon>VehicleDeclarationView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\EditComponentNoneView.xaml.cs"> + <DependentUpon>EditComponentNoneView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Engineering\AirdragEngineeringView.xaml.cs"> + <DependentUpon>AirdragEngineeringView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Engineering\AngledriveEngineeringView.xaml.cs"> + <DependentUpon>AngledriveEngineeringView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Engineering\AuxiliariesEngineerngView.xaml.cs"> + <DependentUpon>AuxiliariesEngineerngView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Engineering\AxleEngineeringView.xaml.cs"> + <DependentUpon>AxleEngineeringView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Engineering\AxlegearEngineeringView.xaml.cs"> + <DependentUpon>AxlegearEngineeringView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Engineering\AxlesEngineeringView.xaml.cs"> + <DependentUpon>AxlesEngineeringView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Engineering\CyclesEngineeringView.xaml.cs"> + <DependentUpon>CyclesEngineeringView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Engineering\EngineEngineeringView.xaml.cs"> + <DependentUpon>EngineEngineeringView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Engineering\GearboxEngineeringView.xaml.cs"> + <DependentUpon>GearboxEngineeringView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Engineering\RetarderEngineeringView.xaml.cs"> + <DependentUpon>RetarderEngineeringView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Engineering\TorqueConverterEngineeringView.xaml.cs"> + <DependentUpon>TorqueConverterEngineeringView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Engineering\TyreEngineeringView.xaml.cs"> + <DependentUpon>TyreEngineeringView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ComponentViews\Engineering\VehicleEngineeringView.xaml.cs"> + <DependentUpon>VehicleEngineeringView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\CustomControls\CheckboxParameter.xaml.cs"> + <DependentUpon>CheckboxParameter.xaml</DependentUpon> + </Compile> + <Compile Include="Views\CustomControls\ComboParameter.xaml.cs"> + <DependentUpon>ComboParameter.xaml</DependentUpon> + </Compile> + <Compile Include="Views\CustomControls\CommonDeclarationComponentData.xaml.cs"> + <DependentUpon>CommonDeclarationComponentData.xaml</DependentUpon> + </Compile> + <Compile Include="Views\CustomControls\VectoParameterControl.xaml.cs"> + <DependentUpon>VectoParameterControl.xaml</DependentUpon> + </Compile> + <Compile Include="Views\EngineeringEngineView.xaml.cs"> + <DependentUpon>EngineeringEngineView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\JobEditView.xaml.cs"> + <DependentUpon>JobEditView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\JoblistView.xaml.cs"> + <DependentUpon>JoblistView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\JobView.xaml.cs"> + <DependentUpon>JobView.xaml</DependentUpon> + </Compile> + <Page Include="MainWindow.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Compile Include="App.xaml.cs"> + <DependentUpon>App.xaml</DependentUpon> + <SubType>Code</SubType> + </Compile> + <Compile Include="Helper\BaseConverter.cs" /> + <Compile Include="Helper\DataContextBaseExtension.cs" /> + <Compile Include="Helper\JobEntrySelectedConverter.cs" /> + <Compile Include="Helper\SIUnit.cs" /> + <Compile Include="Helper\SIValueConverter.cs" /> + <Compile Include="Helper\VehicleClassConverter.cs" /> + <Compile Include="MainWindow.xaml.cs"> + <DependentUpon>MainWindow.xaml</DependentUpon> + <SubType>Code</SubType> + </Compile> + <Page Include="Resources\ViewModelMappings.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Declaration\AirdragDeclarationView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Declaration\AngledriveDeclarationView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Declaration\AuxiliariesDeclarationView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Declaration\AxleDeclarationView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Declaration\AxlegearDeclarationView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Declaration\AxlesDeclarationView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Declaration\CyclesDeclarationView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Declaration\EngineDeclarationView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Declaration\GearboxDeclarationView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Declaration\RetarderDeclarationView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Declaration\TorqueConverterDeclarationView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Declaration\TyreDeclarationView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Declaration\VehicleDeclarationView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\EditComponentNoneView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Engineering\AirdragEngineeringView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Engineering\AngledriveEngineeringView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Engineering\AuxiliariesEngineerngView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Engineering\AxleEngineeringView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Engineering\AxlegearEngineeringView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Engineering\AxlesEngineeringView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Engineering\CyclesEngineeringView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Engineering\EngineEngineeringView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Engineering\GearboxEngineeringView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Engineering\RetarderEngineeringView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Engineering\TorqueConverterEngineeringView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Engineering\TyreEngineeringView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ComponentViews\Engineering\VehicleEngineeringView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\CustomControls\CheckboxParameter.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\CustomControls\ComboParameter.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\CustomControls\CommonDeclarationComponentData.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\CustomControls\VectoParameterControl.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\EngineeringEngineView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\JobEditView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\JoblistView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\JobView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="packages.config" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + <AppDesigner Include="Properties\" /> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\VectoCommon\VectoCommon\VectoCommon.csproj"> + <Project>{79a066ad-69a9-4223-90f6-6ed5d2d084f4}</Project> + <Name>VectoCommon</Name> + </ProjectReference> + <ProjectReference Include="..\VectoCore\VectoCore\VectoCore.csproj"> + <Project>{cd36938a-add9-4c65-96da-b397cdeea90a}</Project> + <Name>VectoCore</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Adapter/Declaration/AbstractDeclarationAdapter.cs b/VECTO3GUI/ViewModel/Adapter/Declaration/AbstractDeclarationAdapter.cs new file mode 100644 index 0000000000000000000000000000000000000000..beb58b5e5a3c9a84e9346e7350460781f5f375f7 --- /dev/null +++ b/VECTO3GUI/ViewModel/Adapter/Declaration/AbstractDeclarationAdapter.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Ninject; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Reader; +using TUGraz.VectoCore.InputData.Reader.ComponentData; +using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Adapter.Declaration +{ + public abstract class AbstractDeclarationAdapter + { + private ICommonComponentParameters _vm; + + public AbstractDeclarationAdapter(ICommonComponentParameters vm) + { + _vm = vm; + } + + public string Manufacturer { get { return _vm.Manufacturer; } } + public string Model { get { return _vm.Model; } } + public string Date { get { return _vm.Date.ToString(); } } + public bool SavedInDeclarationMode { get { return true; } } + public string CertificationNumber { get { return _vm.CertificationNumber; } } + public DataSourceType SourceType { get { return DataSourceType.Embedded; } } + public DigestData DigestValue { get { return null;} } + } +} diff --git a/VECTO3GUI/ViewModel/Adapter/Declaration/AirdragDeclarationAdapter.cs b/VECTO3GUI/ViewModel/Adapter/Declaration/AirdragDeclarationAdapter.cs new file mode 100644 index 0000000000000000000000000000000000000000..210df05cf9627476ce43b2b03abf0d7696455cb3 --- /dev/null +++ b/VECTO3GUI/ViewModel/Adapter/Declaration/AirdragDeclarationAdapter.cs @@ -0,0 +1,52 @@ +using System; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using VECTO3.ViewModel.Impl; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Adapter.Declaration +{ + public class AirdragDeclarationAdapter : AbstractDeclarationAdapter, IAirdragDeclarationInputData + { + protected IAirdragViewModel ViewModel; + + public AirdragDeclarationAdapter(IAirdragViewModel viewModel) : base(viewModel) + { + ViewModel = viewModel; + } + + #region Implementation of IComponentInputData + + public DataSource DataSource { get; } + + public DateTime Date { get; } + public string AppVersion { get; } + + public CertificationMethod CertificationMethod + { + get { return ViewModel.UseMeasuredValues ? CertificationMethod.Measured : CertificationMethod.StandardValues; } + } + + #endregion + + #region Implementation of IAirdragDeclarationInputData + + public SquareMeter AirDragArea + { + get { return ViewModel.UseMeasuredValues ? ViewModel.DeclaredCdxA : null; } + } + + public SquareMeter TransferredAirDragArea + { + get { return ViewModel.UseMeasuredValues ? ViewModel.TransferredCdxA : null; } + } + + public SquareMeter AirdragArea_0 + { + get { return ViewModel.UseMeasuredValues ? ViewModel.CdxA_0 : null; } + } + + #endregion + } +} diff --git a/VECTO3GUI/ViewModel/Adapter/Declaration/AngledriveDeclarationAdapter.cs b/VECTO3GUI/ViewModel/Adapter/Declaration/AngledriveDeclarationAdapter.cs new file mode 100644 index 0000000000000000000000000000000000000000..949cdddb1ae6bc3d878f318251a6b4830163e207 --- /dev/null +++ b/VECTO3GUI/ViewModel/Adapter/Declaration/AngledriveDeclarationAdapter.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.ObjectModel; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Reader.ComponentData; +using VECTO3.Util; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Adapter.Declaration { + public class AngledriveDeclarationAdapter : AbstractDeclarationAdapter, IAngledriveInputData + { + protected IAngledriveViewModel ViewModel; + public AngledriveDeclarationAdapter(IAngledriveViewModel angledriveViewModel) :base(angledriveViewModel) + { + ViewModel = angledriveViewModel; + } + + #region Implementation of IComponentInputData + + public DataSource DataSource { get; } + public DateTime Date { get; } + public string AppVersion { get; } + public CertificationMethod CertificationMethod { get { return ViewModel.CertificationMethod; } } + + #endregion + + #region Implementation of IAngledriveInputData + + public AngledriveType Type { get { return ViewModel.AngledriveType; } } + public double Ratio { get { return ViewModel.Ratio; } } + + public TableData LossMap + { + get { return TableDataConverter.Convert(ViewModel.LossMap); } + } + + public double Efficiency { get { throw new NotImplementedException(); } } + + #endregion + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Adapter/Declaration/AuxiliariesDeclarationAdapter.cs b/VECTO3GUI/ViewModel/Adapter/Declaration/AuxiliariesDeclarationAdapter.cs new file mode 100644 index 0000000000000000000000000000000000000000..f402496bccfce649bfb6b95a700fe429f0ff8f5c --- /dev/null +++ b/VECTO3GUI/ViewModel/Adapter/Declaration/AuxiliariesDeclarationAdapter.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.InputData.Impl; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Adapter.Declaration { + public class AuxiliariesDeclarationAdapter : IAuxiliariesDeclarationInputData + { + protected IAuxiliariesViewModel ViewModel; + + public AuxiliariesDeclarationAdapter(IAuxiliariesViewModel auxiliariesViewModel) + { + ViewModel = auxiliariesViewModel; + } + + #region Implementation of IAuxiliariesDeclarationInputData + + public bool SavedInDeclarationMode { get { return true; } } + + public IList<IAuxiliaryDeclarationInputData> Auxiliaries + { + get { + var retVal = new List<IAuxiliaryDeclarationInputData>(); + + retVal.Add( + new AuxiliaryDataInputData { + Type = AuxiliaryType.Fan, + Technology = new List<string> { ViewModel.FanTechnology } + }); + retVal.Add(new AuxiliaryDataInputData { + Type = AuxiliaryType.ElectricSystem, + Technology = new List<string> { ViewModel.ElectricSystemTechnology } + }); + retVal.Add(new AuxiliaryDataInputData { + Type = AuxiliaryType.HVAC, + Technology = new List<string> { ViewModel.HVACTechnology } + }); + retVal.Add(new AuxiliaryDataInputData { + Type = AuxiliaryType.PneumaticSystem, + Technology = new List<string> { ViewModel.PneumaticSystemTechnology } + }); + retVal.Add(new AuxiliaryDataInputData { + Type = AuxiliaryType.SteeringPump, + Technology = ViewModel.SteeringPumpTechnologies + //.OrderBy(x => x.SteeredAxle) + .Select(x => x.SteeringPumpTechnology).ToList() + }); + return retVal; + } + } + + #endregion + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Adapter/Declaration/AxleDeclarationAdapter.cs b/VECTO3GUI/ViewModel/Adapter/Declaration/AxleDeclarationAdapter.cs new file mode 100644 index 0000000000000000000000000000000000000000..b2cc57edda57d2db7fc88cd095394831b94e7c5e --- /dev/null +++ b/VECTO3GUI/ViewModel/Adapter/Declaration/AxleDeclarationAdapter.cs @@ -0,0 +1,24 @@ +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Adapter.Declaration { + public class AxleDeclarationAdapter : IAxleDeclarationInputData + { + protected IAxleViewModel ViewModel; + public AxleDeclarationAdapter(IAxleViewModel axleViewModel) + { + ViewModel = axleViewModel; + } + + #region Implementation of IAxleDeclarationInputData + + public bool TwinTyres { get { return ViewModel.TwinTyres; } } + public bool Steered { get { return ViewModel.Steered; } } + public AxleType AxleType { get { return ViewModel.AxleType; } } + public ITyreDeclarationInputData Tyre { get { return ViewModel.Tyre.ModelData; } } + public DataSource DataSource { get; } + + #endregion + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Adapter/Declaration/AxlegearDeclarationAdapter.cs b/VECTO3GUI/ViewModel/Adapter/Declaration/AxlegearDeclarationAdapter.cs new file mode 100644 index 0000000000000000000000000000000000000000..e97d7fd4e9ec24f27d37e5387baf0268c3182cb8 --- /dev/null +++ b/VECTO3GUI/ViewModel/Adapter/Declaration/AxlegearDeclarationAdapter.cs @@ -0,0 +1,35 @@ +using System; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using VECTO3.Util; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Adapter.Declaration { + public class AxlegearDeclarationAdapter : AbstractDeclarationAdapter, IAxleGearInputData + { + protected IAxlegearViewModel ViewModel; + + public AxlegearDeclarationAdapter(IAxlegearViewModel axlegearViewModel):base(axlegearViewModel) + { + ViewModel = axlegearViewModel; + } + + #region Implementation of IComponentInputData + + public DataSource DataSource { get; } + public DateTime Date { get; } + public string AppVersion { get; } + public CertificationMethod CertificationMethod { get { return ViewModel.CertificationMethod; } } + + #endregion + + #region Implementation of IAxleGearInputData + + public double Ratio { get { return ViewModel.Ratio; } } + public TableData LossMap { get { return TableDataConverter.Convert(ViewModel.LossMap); } } + public double Efficiency { get { throw new NotImplementedException();} } + public AxleLineType LineType { get { return ViewModel.LineType; } } + + #endregion + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Adapter/Declaration/DeclarationJobAdapter.cs b/VECTO3GUI/ViewModel/Adapter/Declaration/DeclarationJobAdapter.cs new file mode 100644 index 0000000000000000000000000000000000000000..782d8d1f91b96873a78c11118d5c613ac39e5dff --- /dev/null +++ b/VECTO3GUI/ViewModel/Adapter/Declaration/DeclarationJobAdapter.cs @@ -0,0 +1,50 @@ +using System.Xml.Linq; +using TUGraz.VectoCommon.InputData; +using VECTO3.Util; +using VECTO3.ViewModel.Impl; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Adapter.Declaration { + public class DeclarationJobAdapter : IDeclarationInputDataProvider, IDeclarationJobInputData + { + protected readonly DeclarationJobViewModel Model; + public DeclarationJobAdapter(DeclarationJobViewModel declarationJobViewModel) + { + Model = declarationJobViewModel; + } + + #region Implementation of IDeclarationInputDataProvider + + public IDeclarationJobInputData JobInputData + { + get { return this; } + } + + public XElement XMLHash { get { return null; } } + + #endregion + + #region Implementation of IDeclarationJobInputData + + public bool SavedInDeclarationMode { get { return Model.DeclarationMode; } } + + public IVehicleDeclarationInputData Vehicle + { + get { + var vehiclevm = Model.GetComponentViewModel(Component.Vehicle) as IVehicleViewModel; + return vehiclevm?.ModelData; + } + } + + public string JobName { get { return Model.JobFile; } } + public string ShiftStrategy { get; } + + #endregion + + #region Implementation of IInputDataProvider + + public DataSource DataSource { get; } + + #endregion + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Adapter/Declaration/EngineDeclarationAdapter.cs b/VECTO3GUI/ViewModel/Adapter/Declaration/EngineDeclarationAdapter.cs new file mode 100644 index 0000000000000000000000000000000000000000..c2f0a88c931afbd43c15b84db84ca4f114181396 --- /dev/null +++ b/VECTO3GUI/ViewModel/Adapter/Declaration/EngineDeclarationAdapter.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Declaration; +using VECTO3.Util; +using VECTO3.ViewModel.Impl; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Adapter.Declaration { + public class EngineDeclarationAdapter : AbstractDeclarationAdapter, IEngineDeclarationInputData + { + private IEngineViewModel ViewModel; + + public EngineDeclarationAdapter(EngineViewModel viewModel) : base(viewModel) + { + ViewModel = viewModel; + } + + #region Implementation of IComponentInputData + + public DataSource DataSource { get; } + public DateTime Date { get; } + public string AppVersion { get; } + public CertificationMethod CertificationMethod { get { return CertificationMethod.Measured; } } + + #endregion + + #region Implementation of IEngineDeclarationInputData + + public CubicMeter Displacement { get { return ViewModel.Displacement; } } + public PerSecond IdleSpeed { get { return ViewModel.IdlingSpeed; } } + public double WHTCMotorway { get { return ViewModel.WHTCMotorway; } } + public double WHTCRural { get { return ViewModel.WHTCRural; } } + public double WHTCUrban { get { return ViewModel.WHTCUrban; } } + public double ColdHotBalancingFactor { get { return ViewModel.BFColdHot; } } + public double CorrectionFactorRegPer { get { return ViewModel.CFRegPer; } } + public double CorrectionFactorNCV { get { return ViewModel.CFNCV; } } + public FuelType FuelType { get { return ViewModel.FuelType; } } + public TableData FuelConsumptionMap { get { return TableDataConverter.Convert(ViewModel.FCMap); } } + public TableData FullLoadCurve { get { return TableDataConverter.Convert(ViewModel.FullLoadCurve); } } + public Watt RatedPowerDeclared { get { return ViewModel.RatedPower; } } + public PerSecond RatedSpeedDeclared { get { return ViewModel.RatedSpeed; } } + public NewtonMeter MaxTorqueDeclared { get { return ViewModel.MaxEngineTorque; } } + public IList<IEngineModeDeclarationInputData> EngineModes { get; } + public WHRType WHRType { get; } + + #endregion + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Adapter/Declaration/GearboxDeclarationAdapter.cs b/VECTO3GUI/ViewModel/Adapter/Declaration/GearboxDeclarationAdapter.cs new file mode 100644 index 0000000000000000000000000000000000000000..03639f0de2822bae8737c3aa05a71e4f3770ed92 --- /dev/null +++ b/VECTO3GUI/ViewModel/Adapter/Declaration/GearboxDeclarationAdapter.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCore.InputData.Impl; +using VECTO3.Util; +using VECTO3.ViewModel.Impl; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Adapter.Declaration { + public class GearboxDeclarationAdapter : AbstractDeclarationAdapter, IGearboxDeclarationInputData + { + protected IGearboxViewModel ViewModel; + public GearboxDeclarationAdapter(GearboxViewModel viewModel) : base(viewModel) + { + ViewModel = viewModel; + } + + #region Implementation of IComponentInputData + + public DataSource DataSource { get; } + public DateTime Date { get; } + public string AppVersion { get; } + public CertificationMethod CertificationMethod { get { return ViewModel.CertificationMethod; } } + + #endregion + + #region Implementation of IGearboxDeclarationInputData + + public GearboxType Type { get { return ViewModel.TransmissionType; } } + + public IList<ITransmissionInputData> Gears + { + get + { + return null; + //ToDo + //return ViewModel.Gears.OrderBy(x => x.GearNumber).Select( + // g => new TransmissionInputData { + // Gear = g.GearNumber, + // Ratio = g.Ratio, + // MaxTorque = g.MaxTorque, + // MaxInputSpeed = g.MaxSpeed, + // LossMap = TableDataConverter.Convert(g.LossMap) + // }).Cast<ITransmissionInputData>().ToArray(); + } + } + + public bool DifferentialIncluded { get; } + public double AxlegearRatio { get; } + + public ITorqueConverterDeclarationInputData TorqueConverter + { + get { return (ViewModel.ParentViewModel as IVehicleViewModel)?.ModelData.Components.TorqueConverterInputData; } + } + + #endregion + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Adapter/Declaration/RetarderDeclarationAdapter.cs b/VECTO3GUI/ViewModel/Adapter/Declaration/RetarderDeclarationAdapter.cs new file mode 100644 index 0000000000000000000000000000000000000000..faa7df3cd9b098583648920d769bd94f8550f288 --- /dev/null +++ b/VECTO3GUI/ViewModel/Adapter/Declaration/RetarderDeclarationAdapter.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.ObjectModel; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using VECTO3.Util; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Adapter.Declaration { + public class RetarderDeclarationAdapter : AbstractDeclarationAdapter, IRetarderInputData + { + protected IRetarderViewModel ViewModel; + + public RetarderDeclarationAdapter(IRetarderViewModel retarderViewModel) :base(retarderViewModel) + { + ViewModel = retarderViewModel; + } + + #region Implementation of IComponentInputData + + + public DataSource DataSource { get; } + public DateTime Date { get; } + public string AppVersion { get; } + public CertificationMethod CertificationMethod { get { return ViewModel.CertificationMethod; } } + + #endregion + + #region Implementation of IRetarderInputData + + public RetarderType Type { get { return ViewModel.Type; } } + public double Ratio { get { return ViewModel.Ratio; } } + public TableData LossMap { get { return TableDataConverter.Convert(ViewModel.LossMap); } } + + #endregion + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Adapter/Declaration/TorqueConverterDeclarationAdapter.cs b/VECTO3GUI/ViewModel/Adapter/Declaration/TorqueConverterDeclarationAdapter.cs new file mode 100644 index 0000000000000000000000000000000000000000..f34922184721fb924c7ba68fabed8ffcd420538d --- /dev/null +++ b/VECTO3GUI/ViewModel/Adapter/Declaration/TorqueConverterDeclarationAdapter.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.ObjectModel; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using VECTO3.Util; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Adapter.Declaration { + public class TorqueConverterDeclarationAdapter : AbstractDeclarationAdapter, ITorqueConverterDeclarationInputData + { + protected ITorqueConverterViewModel ViewModel; + + public TorqueConverterDeclarationAdapter(ITorqueConverterViewModel torqueConverterViewModel):base(torqueConverterViewModel) + { + ViewModel = torqueConverterViewModel; + } + + #region Implementation of IComponentInputData + + public DataSource DataSource { get; } + public DateTime Date { get; } + public string AppVersion { get; } + public CertificationMethod CertificationMethod { get { return ViewModel.CertificationMethod; } } + + + #endregion + + #region Implementation of ITorqueConverterDeclarationInputData + + public TableData TCData { get { return TableDataConverter.Convert(ViewModel.Characteristics); } } + + #endregion + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Adapter/Declaration/TyreDeclarationAdapter.cs b/VECTO3GUI/ViewModel/Adapter/Declaration/TyreDeclarationAdapter.cs new file mode 100644 index 0000000000000000000000000000000000000000..29a9cc1cb821ee3addc09090c89eb3ff7c3e7ad1 --- /dev/null +++ b/VECTO3GUI/ViewModel/Adapter/Declaration/TyreDeclarationAdapter.cs @@ -0,0 +1,35 @@ +using System; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using VECTO3.ViewModel.Adapter.Declaration; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Impl { + public class TyreDeclarationAdapter : AbstractDeclarationAdapter, ITyreDeclarationInputData + { + protected ITyreViewModel ViewModel; + + public TyreDeclarationAdapter(ITyreViewModel tyreViewModel) :base(tyreViewModel) + { + ViewModel = tyreViewModel; + } + + #region Implementation of IComponentInputData + + public DataSource DataSource { get; } + public DateTime Date { get; } + public string AppVersion { get; } + public CertificationMethod CertificationMethod { get { return CertificationMethod.Measured; } } + + #endregion + + #region Implementation of ITyreDeclarationInputData + + public string Dimension { get { return ViewModel.Dimension; } } + public double RollResistanceCoefficient { get { return ViewModel.RollingResistanceCoefficient; } } + public Newton TyreTestLoad { get { return ViewModel.FzISO; } } + + #endregion + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Adapter/Declaration/VehicleDeclarationAdapter.cs b/VECTO3GUI/ViewModel/Adapter/Declaration/VehicleDeclarationAdapter.cs new file mode 100644 index 0000000000000000000000000000000000000000..a12e233b2bf0e91dd658572c5151936574167465 --- /dev/null +++ b/VECTO3GUI/ViewModel/Adapter/Declaration/VehicleDeclarationAdapter.cs @@ -0,0 +1,179 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml; +using Ninject; +using TUGraz.VectoCommon.BusAuxiliaries; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Impl; +using VECTO3.Util; +using VECTO3.ViewModel.Impl; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Adapter.Declaration +{ + public class VehicleDeclarationAdapter : IVehicleDeclarationInputData, IPTOTransmissionInputData, IVehicleComponentsDeclaration, IAxlesDeclarationInputData + { + protected IVehicleViewModel ViewModel; + private DateTime _date; + private IAuxiliariesDeclarationInputData _auxiliaryInputData; + + [Inject] public IAdapterFactory AdapterFactory { set; protected get; } + + public VehicleDeclarationAdapter(IVehicleViewModel vehicleViewModel) + { + ViewModel = vehicleViewModel; + } + + #region Implementation of IComponentInputData + + public DataSource DataSource { get; } + public bool SavedInDeclarationMode { get; } + + public string Manufacturer + { + get { return ViewModel.Manufacturer; } + } + + public string Model + { + get { return ViewModel.Model; } + } + + DateTime IComponentInputData.Date => _date; + + public string AppVersion { get; } + + public string Date + { + get { return ViewModel.Date.ToString(); } + } + + public CertificationMethod CertificationMethod + { + get { throw new NotImplementedException(); } + } + + public string CertificationNumber + { + get { throw new NotImplementedException(); } + } + + public DigestData DigestValue + { + get { throw new NotImplementedException(); } + } + + #endregion + + #region Implementation of IVehicleDeclarationInputData + + public string Identifier { get; } + public bool ExemptedVehicle { get; } + + public string VIN + { + get { return ViewModel.VIN; } + } + + public LegislativeClass LegislativeClass { get {return ViewModel.LegislativeClass; } } + public VehicleCategory VehicleCategory { get { return ViewModel.VehicleCategory; } } + public AxleConfiguration AxleConfiguration { get { return ViewModel.AxleConfiguration;} } + public Kilogram CurbMassChassis { get { return ViewModel.CurbMassChassis; } } + public Kilogram GrossVehicleMassRating { get { return ViewModel.GrossVehicleMass; } } + public IList<ITorqueLimitInputData> TorqueLimits { get { + return ViewModel.TorqueLimits.Select(x => new TorqueLimitInputData() + { + //Gear = x.Gear, MaxTorque = x.MaxTorque + }) + .Cast<ITorqueLimitInputData>().ToList(); + } } + + public IList<IAxleDeclarationInputData> AxlesDeclaration + { + get { return GetComponentViewModel<IAxlesViewModel>(Component.Axles)?.ModelData; } + } + + public string ManufacturerAddress { get { return ViewModel.ManufacturerAddress; } } + public PerSecond EngineIdleSpeed { get { return ViewModel.IdlingSpeed; } } + public bool VocationalVehicle { get; } + public bool SleeperCab { get; } + public TankSystem? TankSystem { get; } + public IAdvancedDriverAssistantSystemDeclarationInputData ADAS { get; } + public bool ZeroEmissionVehicle { get; } + public bool HybridElectricHDV { get; } + public bool DualFuelVehicle { get; } + public Watt MaxNetPower1 { get; } + public Watt MaxNetPower2 { get; } + public string RegisteredClass { get; } + public int NuberOfPassengersUpperDeck { get; } + public int NumberOfPassengersLowerDeck { get; } + public VehicleCode VehicleCode { get; } + public FloorType FloorType { get; } + public bool Articulated { get; } + public Meter Height { get; } + public Meter Length { get; } + public Meter Width { get; } + public Meter EntranceHeight { get; } + + public IAirdragDeclarationInputData AirdragInputData { get { + return GetComponentViewModel<IAirdragViewModel>(Component.Airdrag)?.ModelData; + } } + + public IVehicleComponentsDeclaration Components { get { return this; } } + public XmlNode XMLSource { get; } + + public IGearboxDeclarationInputData GearboxInputData { get { + return GetComponentViewModel<IGearboxViewModel>(Component.Gearbox)?.ModelData; + } } + public ITorqueConverterDeclarationInputData TorqueConverterInputData { get { + return GetComponentViewModel<ITorqueConverterViewModel>(Component.TorqueConverter)?.ModelData; + } } + public IAxleGearInputData AxleGearInputData { get { + return GetComponentViewModel<IAxlegearViewModel>(Component.Axlegear)?.ModelData; + } } + public IAngledriveInputData AngledriveInputData { get { + var vm = GetComponentViewModel<IAngledriveViewModel>(Component.Angledrive); + return vm != null? vm.ModelData : AdapterFactory.AngledriveDeclarationAdapter(new AngledriveViewModel {ParentViewModel = ViewModel}); + } } + public IEngineDeclarationInputData EngineInputData { get { + return GetComponentViewModel<IEngineViewModel>(Component.Engine)?.ModelData; + } } + + IAuxiliariesDeclarationInputData IVehicleComponentsDeclaration.AuxiliaryInputData => _auxiliaryInputData; + + public IAuxiliariesDeclarationInputData AuxiliaryInputData() + { + return GetComponentViewModel<IAuxiliariesViewModel>(Component.Auxiliaries)?.ModelData; + } + + public IRetarderInputData RetarderInputData { get { + var vm = GetComponentViewModel<IRetarderViewModel>(Component.Retarder); + return vm != null ? vm.ModelData : new RetarderViewModel {ParentViewModel = ViewModel}.ModelData; + } } + public IPTOTransmissionInputData PTOTransmissionInputData { get { return this; } } + + public IAxlesDeclarationInputData AxleWheels { get { return this; } } + public IBusAuxiliariesDeclarationData BusAuxiliaries { get; } + + #endregion + + private T GetComponentViewModel<T>(Component component) where T : class + { + var vm = ViewModel.GetComponentViewModel(component); + var cvm = vm as T; + return cvm; + } + + #region Implementation of IPTOTransmissionInputData + + public string PTOTransmissionType { get { return ViewModel.PTOTechnology; } } + public TableData PTOLossMap { get { throw new NotImplementedException(); } } + public TableData PTOCycle { get { throw new NotImplementedException(); } } + + #endregion + } + +} diff --git a/VECTO3GUI/ViewModel/Adapter/IAdapterFactory.cs b/VECTO3GUI/ViewModel/Adapter/IAdapterFactory.cs new file mode 100644 index 0000000000000000000000000000000000000000..feba7bf3316f7a359297937225bf90592dcf6805 --- /dev/null +++ b/VECTO3GUI/ViewModel/Adapter/IAdapterFactory.cs @@ -0,0 +1,32 @@ +using TUGraz.VectoCommon.InputData; +using VECTO3.ViewModel.Impl; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Adapter +{ + public interface IAdapterFactory + { + IAirdragDeclarationInputData AirdragDeclarationAdapter(AirdragViewModel viewModel); + + IAngledriveInputData AngledriveDeclarationAdapter(IAngledriveViewModel angledriveViewModel); + + IAuxiliariesDeclarationInputData AuxiliariesDeclarationAdapter(IAuxiliariesViewModel auxiliariesViewModel); + + IAxleDeclarationInputData AxleDeclarationAdapter(IAxleViewModel axleViewModel); + + IAxleGearInputData AxlegearDeclarationAdapter(IAxlegearViewModel axlegearViewModel); + + IEngineDeclarationInputData EngineDeclarationAdapter(EngineViewModel viewModel); + + IGearboxDeclarationInputData GearboxDeclarationAdapter(GearboxViewModel viewModel); + + IRetarderInputData RetarderDeclarationAdapter(IRetarderViewModel retarderViewModel); + + ITorqueConverterDeclarationInputData TorqueConverterDeclarationAdapter( + ITorqueConverterViewModel torqueConverterViewModel); + + ITyreDeclarationInputData TyreDeclarationAdapter(ITyreViewModel tyreViewModel); + + IVehicleDeclarationInputData VehicleDeclarationAdapter(IVehicleViewModel vehicleViewModel); + } +} diff --git a/VECTO3GUI/ViewModel/Impl/AbstractComponentViewModel.cs b/VECTO3GUI/ViewModel/Impl/AbstractComponentViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..b911ad49db9198355fcbcf04681f07e8995a0618 --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/AbstractComponentViewModel.cs @@ -0,0 +1,44 @@ +using System; +using Ninject; +using VECTO3.ViewModel.Adapter; + +namespace VECTO3.ViewModel.Impl { + public abstract class AbstractComponentViewModel : AbstractViewModel + { + private string _manufacturer; + private string _model; + private string _certificationNumber; + private DateTime? _date; + + [Inject] public IAdapterFactory AdapterFactory { set; protected get; } + + + #region Implementation of ICommonComponentParameters + + public string Manufacturer + { + get { return _manufacturer; } + set { _manufacturer = value; } + } + + public string Model + { + get { return _model; } + set { _model = value; } + } + + public string CertificationNumber + { + get { return _certificationNumber; } + set { _certificationNumber = value; } + } + + public DateTime? Date + { + get { return _date; } + set { _date = value; } + } + + #endregion + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Impl/AbstractJobViewModel.cs b/VECTO3GUI/ViewModel/Impl/AbstractJobViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..922f44df6a40b4f56f2cb4b4fec460e0444160fc --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/AbstractJobViewModel.cs @@ -0,0 +1,66 @@ +using System; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using Ninject; +using VECTO3.Util; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Impl +{ + public abstract class AbstractJobViewModel : AbstractViewModel + { + protected bool IsDeclarationMode; + private IComponentViewModel _currentComponent; + + public override bool DeclarationMode + { + get { return IsDeclarationMode; } + } + + public IComponentViewModel CurrentComponent + { + get { return _currentComponent; } + protected set { + SetProperty(ref _currentComponent, value); + } + } + + public ICommand SaveJob { get { return new RelayCommand(DoSaveJob); } } + + protected abstract void DoSaveJob(); + + public ICommand CloseJob { get { return new RelayCommand<UserControl>(DoCloseJob);} } + + protected virtual void DoCloseJob(UserControl ctl) + { + Window.GetWindow(ctl).Close(); + } + + + public ICommand EditComponent { get { return new RelayCommand<Component>(DoEditComponent); } } + + protected virtual void DoEditComponent(Component component) + { + var nextView = GetComponentViewModel(component); + + CurrentComponent = nextView ?? Kernel.Get<INoneViewModel>(); + + } + + protected void CreateComponentModel(Component component) + { + var viewModelType = ViewModelFactory.ComponentViewModelMapping[component]; + if (!typeof(IComponentViewModel).IsAssignableFrom(viewModelType)) { + throw new Exception("Invalid entry in ViewModel Mapping"); + } + + var subModels = GetSubmodels().ToArray(); + if (!subModels.Contains(component)) { + var viewModel = (IComponentViewModel)Kernel.Get(viewModelType); + RegisterSubmodel(component, viewModel); + } + } + } +} diff --git a/VECTO3GUI/ViewModel/Impl/AbstractViewModel.cs b/VECTO3GUI/ViewModel/Impl/AbstractViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..ad45b5b1e1d210fe3a83cd5d616ae959b8e193e3 --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/AbstractViewModel.cs @@ -0,0 +1,111 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.ComponentModel; +using System.Linq; +using TUGraz.VectoCommon.InputData; +using VECTO3.ViewModel.Interfaces; +using Component = VECTO3.Util.Component; + +namespace VECTO3.ViewModel.Impl +{ + public abstract class AbstractViewModel : ValidatingViewModel, IComponentViewModel + { + private IJobEditViewModel _jobViewModel; + + private readonly ObservableCollection<Component> _components = new ObservableCollection<Component>(); + + private readonly Dictionary<Component, IComponentViewModel> _subModels = new Dictionary<Component, IComponentViewModel>(); + + + public IJobEditViewModel JobViewModel + { + protected get { return _jobViewModel; } + set { + _jobViewModel = value; + if (_jobViewModel is ObservableObject) { + ((ObservableObject)_jobViewModel).PropertyChanged += (sender, args) => { + if (args.PropertyName == "InputDataProvider") { + InputDataChanged(); + } + }; + } + JobViewModelChanged(); + InputDataChanged(); + } + } + + protected virtual void InputDataChanged() {} + + protected virtual void JobViewModelChanged() { } + + public virtual bool DeclarationMode { get { return JobViewModel.DeclarationMode; } } + + public ObservableCollection<Component> Components + { + get { return _components; } + } + + public IComponentViewModel ParentViewModel { get; set; } + + public virtual IComponentViewModel GetComponentViewModel(Component component) + { + if (_subModels.ContainsKey(component)) { + return _subModels[component]; + } + + foreach (var entry in _subModels) { + if (entry.Value.Components.Contains(component)) { + return entry.Value.GetComponentViewModel(component); + } + } + + return null; + } + + #region Submodule Handling + protected IEnumerable<Component> GetSubmodels() + { + return _subModels.Keys.ToArray(); + } + + protected bool RegisterSubmodel(Component component, IComponentViewModel model) + { + if (_subModels.ContainsKey(component)) { + return false; + } + + _subModels[component] = model; + model.ParentViewModel = this; + model.JobViewModel = JobViewModel; + model.Components.CollectionChanged += (sender, args) => UpdateSubModules(); + UpdateSubModules(); + return true; + } + + private void UpdateSubModules() + { + _components.Clear(); + foreach (var entry in _subModels) { + _components.Add(entry.Key); + foreach (var component in entry.Value.Components) { + _components.Add(component); + } + } + } + + protected IComponentViewModel UnregisterSubmodel(Component component) + { + if (!_subModels.ContainsKey(component)) { + return null; + } + + var retVal = _subModels[component]; + _subModels.Remove(component); + UpdateSubModules(); + return retVal; + } + + #endregion + } +} diff --git a/VECTO3GUI/ViewModel/Impl/AirdragViewModel.cs b/VECTO3GUI/ViewModel/Impl/AirdragViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..25494d710387f76808367b8b99bd094fc0b6f226 --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/AirdragViewModel.cs @@ -0,0 +1,71 @@ +using System; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Utils; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Impl +{ + public class AirdragViewModel : AbstractComponentViewModel, IAirdragViewModel + { + private SquareMeter _cdxA0; + private SquareMeter _transferredCdxA; + private SquareMeter _declaredCdxA; + private bool _useStandardValues; + + #region Implementation of IAirdragViewModel + + public IAirdragDeclarationInputData ModelData { + get { return AdapterFactory.AirdragDeclarationAdapter(this); } + } + + public bool UseMeasuredValues + { + get { return _useStandardValues; } + set { SetProperty(ref _useStandardValues, value); } + } + + public SquareMeter CdxA_0 + { + get { return _cdxA0; } + set { SetProperty(ref _cdxA0, value); } + } + + public SquareMeter TransferredCdxA + { + get { return _transferredCdxA; } + set { SetProperty(ref _transferredCdxA, value); } + } + + public SquareMeter DeclaredCdxA + { + get { return _declaredCdxA; } + set { SetProperty(ref _declaredCdxA, value); } + } + + #endregion + + protected override void InputDataChanged() + { + JobViewModel.InputDataProvider.Switch() + .If<IDeclarationInputDataProvider>(d => SetValues(d.JobInputData.Vehicle.Components.AirdragInputData)) + .If<IEngineeringInputDataProvider>(e => SetValues(e.JobInputData.Vehicle.Components.AirdragInputData)); + } + + private void SetValues(IAirdragDeclarationInputData airdrag) + { + UseMeasuredValues = airdrag != null; + if (airdrag == null) { + return; + } + + Model = airdrag.Model; + Manufacturer = airdrag.Manufacturer; + CertificationNumber = airdrag.CertificationNumber; + //ToDo + //Date = DateTime.Parse(airdrag.Date); + + DeclaredCdxA = airdrag.AirDragArea; + } + } +} diff --git a/VECTO3GUI/ViewModel/Impl/AngledriveViewModel.cs b/VECTO3GUI/ViewModel/Impl/AngledriveViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..24d2b863e1b4dbaf564750e30c0f9d4dfc49da31 --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/AngledriveViewModel.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.ObjectModel; +using System.Linq; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCore.InputData.Reader.ComponentData; +using TUGraz.VectoCore.Models.Declaration; +using TUGraz.VectoCore.Utils; +using VECTO3.Util; +using VECTO3.ViewModel.Adapter.Declaration; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Impl { + public class AngledriveViewModel : AbstractComponentViewModel, IAngledriveViewModel + { + private CertificationMethod _certificationMethod; + private readonly ObservableCollection<GearLossMapEntry> _lossMap = new ObservableCollection<GearLossMapEntry>(); + private double _ratio; + + #region Implementation of IAngledriveViewModel + + public IAngledriveInputData ModelData { get { return AdapterFactory.AngledriveDeclarationAdapter(this); } } + + public CertificationMethod CertificationMethod + { + get { return _certificationMethod; } + set { SetProperty(ref _certificationMethod, value); } + } + + public AllowedEntry<CertificationMethod>[] AllowedCertificationMethods + { + get + { + return null; + //ToDo + //return DeclarationData.AngledriveCertificationMethods.Select(x => AllowedEntry.Create(x, x.GetLabel())).ToArray(); + } + } + + public double Ratio + { + get { return _ratio; } + set { SetProperty(ref _ratio, value); } + } + + public ObservableCollection<GearLossMapEntry> LossMap + { + get { return _lossMap; } + } + + public AngledriveType AngledriveType + { + get { return (ParentViewModel as IVehicleViewModel).AngledriveType; } + set { (ParentViewModel as IVehicleViewModel).AngledriveType = value; } + } + + #endregion + + protected override void InputDataChanged() + { + JobViewModel.InputDataProvider.Switch() + .If<IDeclarationInputDataProvider>(d => SetValues(d.JobInputData.Vehicle.Components.AngledriveInputData)) + .If<IEngineeringInputDataProvider>(e => SetValues(e.JobInputData.Vehicle.Components.AngledriveInputData)); + } + + private void SetValues(IAngledriveInputData angledrive) + { + Model = angledrive.Model; + Manufacturer = angledrive.Manufacturer; + CertificationNumber = angledrive.CertificationNumber; + CertificationMethod = angledrive.CertificationMethod; + //ToDo + //Date = DateTime.Parse(angledrive.Date); + Ratio = angledrive.Ratio; + //ToDo + //var lossMap = TransmissionLossMapReader.Create(angledrive.LossMap, angledrive.Ratio, "Angledirve").Entries.OrderBy(x => x.InputSpeed).ThenBy(x => x.InputTorque); + //foreach (var entry in lossMap) { + // LossMap.Add(new GearLossMapEntry(entry)); + //} + } + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Impl/AuxiliariesViewModel.cs b/VECTO3GUI/ViewModel/Impl/AuxiliariesViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..547781cb98afd35687c790f96264c9fe7969b9e5 --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/AuxiliariesViewModel.cs @@ -0,0 +1,143 @@ +using System; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using Ninject; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCore.InputData.Reader.ComponentData; +using TUGraz.VectoCore.Models.Declaration; +using TUGraz.VectoCore.Utils; +using VECTO3.Util; +using VECTO3.ViewModel.Adapter; +using VECTO3.ViewModel.Adapter.Declaration; +using VECTO3.ViewModel.Interfaces; +using Component = VECTO3.Util.Component; + +namespace VECTO3.ViewModel.Impl { + public class AuxiliariesViewModel : AbstractViewModel, IAuxiliariesViewModel + { + [Inject] public IAdapterFactory AdapterFactory { set; protected get; } + + private string _pneumaticSystemTechnology; + private string _fanTechnology; + private string _electricSystemTechnology; + private string _hvacTechnology; + private readonly ObservableCollection<SteeringPumpEntry> _steeringPumpTechnologies = new ObservableCollection<SteeringPumpEntry>(); + private IAxlesViewModel axlesViewModel; + + #region Implementation of IAuxiliariesViewModel + + public IAuxiliariesDeclarationInputData ModelData { get { return AdapterFactory.AuxiliariesDeclarationAdapter(this); } } + + public string PneumaticSystemTechnology + { + get { return _pneumaticSystemTechnology; } + set { SetProperty(ref _pneumaticSystemTechnology, value); } + } + + public AllowedEntry<string>[] AllowedPneumaticSystemTechnologies + { + get { return DeclarationData.PneumaticSystem.GetTechnologies().Select(t => AllowedEntry.Create(t, t)).ToArray(); } + } + + public string FanTechnology + { + get { return _fanTechnology; } + set { SetProperty(ref _fanTechnology, value); } + } + + public AllowedEntry<string>[] AllowedFanTechnologies { get { return DeclarationData.Fan.GetTechnologies().Select(t => AllowedEntry.Create(t, t)).ToArray(); } } + + public ObservableCollection<SteeringPumpEntry> SteeringPumpTechnologies + { + get { + if (axlesViewModel == null) { + ConnectAxleViewModel(); + } + + return _steeringPumpTechnologies; + } + } + + public AllowedEntry<string>[] AllowedSteeringPumpTechnologies { get { return DeclarationData.SteeringPump.GetTechnologies().Select(t => AllowedEntry.Create(t, t)).ToArray(); } } + + public string ElectricSystemTechnology + { + get { return _electricSystemTechnology; } + set { SetProperty(ref _electricSystemTechnology, value); } + } + + public AllowedEntry<string>[] AllowedElectricSystemTechnologies { get { return DeclarationData.ElectricSystem.GetTechnologies().Select(t => AllowedEntry.Create(t, t)).ToArray(); } } + + public string HVACTechnology + { + get { return _hvacTechnology; } + set { SetProperty(ref _hvacTechnology, value); } + } + + public AllowedEntry<string>[] AllowedHVACTechnologies { get { return DeclarationData.HeatingVentilationAirConditioning.GetTechnologies().Select(t => AllowedEntry.Create(t, t)).ToArray(); } } + + #endregion + + protected override void InputDataChanged() + { + //ToDo + //JobViewModel.InputDataProvider.Switch() + // .If<IDeclarationInputDataProvider>(d => SetValues(d.JobInputData.Vehicle.Components.AuxiliaryInputData())) + // .If<IEngineeringInputDataProvider>(e => SetValues(e.JobInputData.Vehicle.Components.AuxiliaryInputData())); + ConnectAxleViewModel(); + } + + private void ConnectAxleViewModel() + { + var axlesVm = ParentViewModel.GetComponentViewModel(Component.Axles); + + if (axlesVm == null) { + return; + } + + axlesViewModel = axlesVm as IAxlesViewModel; + (axlesViewModel as AxlesViewModel).PropertyChanged += UpdateSteeringPump; + DoUpdateSteeringPumpTechnologies(); + } + + private void UpdateSteeringPump(object sender, PropertyChangedEventArgs e) + { + if (e.PropertyName == "NumSteeredAxles") { + DoUpdateSteeringPumpTechnologies(); + } + } + + private void DoUpdateSteeringPumpTechnologies() + { + if (axlesViewModel == null) { + return; + } + + while (_steeringPumpTechnologies.Count > axlesViewModel.NumSteeredAxles) { + _steeringPumpTechnologies.RemoveAt(_steeringPumpTechnologies.Count - 1); + } + while (_steeringPumpTechnologies.Count < axlesViewModel.NumSteeredAxles) { + _steeringPumpTechnologies.Add(new SteeringPumpEntry(_steeringPumpTechnologies.Count + 1, AllowedSteeringPumpTechnologies.First().Label)); + } + } + + private void SetValues(IAuxiliariesEngineeringInputData aux) + { + throw new NotImplementedException(); + } + + private void SetValues(IAuxiliariesDeclarationInputData aux) + { + FanTechnology = aux.Auxiliaries.First(x => x.Type == AuxiliaryType.Fan).Technology.FirstOrDefault(); + ElectricSystemTechnology = aux.Auxiliaries.First(x => x.Type == AuxiliaryType.ElectricSystem).Technology.FirstOrDefault(); + HVACTechnology = aux.Auxiliaries.First(x => x.Type == AuxiliaryType.HVAC).Technology.FirstOrDefault(); + PneumaticSystemTechnology = aux.Auxiliaries.First(x => x.Type == AuxiliaryType.PneumaticSystem).Technology.FirstOrDefault(); + SteeringPumpTechnologies.Clear(); + foreach (var tech in aux.Auxiliaries.First(x => x.Type == AuxiliaryType.SteeringPump).Technology) { + SteeringPumpTechnologies.Add(new SteeringPumpEntry(SteeringPumpTechnologies.Count + 1, tech)); + } + } + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Impl/AxleViewModel.cs b/VECTO3GUI/ViewModel/Impl/AxleViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..124a1493d6896cd91113007cf8daed5d400de95f --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/AxleViewModel.cs @@ -0,0 +1,92 @@ +using System; +using System.Linq; +using Ninject; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCore.Models.Declaration; +using VECTO3.Util; +using VECTO3.ViewModel.Adapter; +using VECTO3.ViewModel.Adapter.Declaration; +using VECTO3.ViewModel.Impl; + +namespace VECTO3.ViewModel.Interfaces { + public class AxleViewModel : AbstractViewModel, IAxleViewModel + { + [Inject] public IAdapterFactory AdapterFactory { set; protected get; } + + private AxleType _axleType; + private bool _twinTyres; + private bool _steered; + private int _axleIndex; + + + public IAxleDeclarationInputData ModelData + { + get { return AdapterFactory.AxleDeclarationAdapter(this); } + } + + public int AxleIndex + { + get { return _axleIndex; } + private set { SetProperty(ref _axleIndex, value);} + } + + public AxleType AxleType + { + get { return _axleType; } + set { SetProperty(ref _axleType, value); } + } + + public bool TwinTyres + { + get { return _twinTyres; } + set { SetProperty(ref _twinTyres, value); } + } + + public bool Steered + { + get { return _steered; } + set { SetProperty(ref _steered, value); } + } + + public ITyreViewModel Tyre { get; private set; } + + public AllowedEntry<AxleType>[] AllowedAxleTypes + { + get + { + return null; + //ToDo + //var axletypes = DeclarationMode + // ? DeclarationData.AllowedTruckAxleTypes + // : Enum.GetValues(typeof(AxleType)).Cast<AxleType>(); + //return axletypes.Select(a => AllowedEntry.Create(a, a.GetLabel())).ToArray(); + } + } + + public void SetValues(int i, IAxleDeclarationInputData axle) + { + AxleIndex = i; + AxleType = axle.AxleType; + TwinTyres = axle.TwinTyres; + //ToDo + //Steered = axle.Steered; + Tyre = Kernel.Get<ITyreViewModel>(); + Tyre.JobViewModel = JobViewModel; + + var tyre = Tyre as TyreViewModel; + if (tyre == null) { + throw new Exception("Unknown Tyre ViewModel"); + } + + tyre.SetValues(axle.Tyre); + } + + internal void SetValues(int i) + { + AxleIndex = i; + Tyre = Kernel.Get<ITyreViewModel>(); + Tyre.JobViewModel = JobViewModel; + } + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Impl/AxlegearViewModel.cs b/VECTO3GUI/ViewModel/Impl/AxlegearViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..7963114f1b9522d37e9341fdbbf0bc3e47e58fa1 --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/AxlegearViewModel.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.ObjectModel; +using System.Linq; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCore.InputData.Reader.ComponentData; +using TUGraz.VectoCore.Models.Declaration; +using TUGraz.VectoCore.Utils; +using VECTO3.Util; +using VECTO3.ViewModel.Adapter.Declaration; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Impl { + public class AxlegearViewModel : AbstractComponentViewModel, IAxlegearViewModel + { + private double _ratio; + private AxleLineType _lineType; + private readonly ObservableCollection<GearLossMapEntry> _lossMap = new ObservableCollection<GearLossMapEntry>(); + private CertificationMethod _certificationMethod; + + #region Implementation of IEditComponentAxlegearViewModel + + public IAxleGearInputData ModelData { get { return AdapterFactory.AxlegearDeclarationAdapter(this); } } + + public CertificationMethod CertificationMethod + { + get { return _certificationMethod; } + set { SetProperty(ref _certificationMethod, value); } + } + + public AllowedEntry<CertificationMethod>[] AllowedCertificationMethods + { + get + { + return null; + //ToDo + //return DeclarationData.AxlegearCertificationMethods.Select(x => AllowedEntry.Create(x, x.GetLabel())).ToArray(); + } + } + + public double Ratio + { + get { return _ratio; } + set { SetProperty(ref _ratio, value); } + } + + public AxleLineType LineType + { + get { return _lineType; } + set {SetProperty(ref _lineType, value); } + } + + public AllowedEntry<AxleLineType>[] AllowedLineTypes + { + get { + //ToDo + return null; + //return Enum.GetValues(typeof(AxleLineType)).Cast<AxleLineType>().Select(x => AllowedEntry.Create(x, x.GetLabel())) + // .ToArray(); + } + } + + public ObservableCollection<GearLossMapEntry> LossMap + { + get { return _lossMap; } + } + + #endregion + + protected override void InputDataChanged() + { + JobViewModel.InputDataProvider.Switch() + .If<IDeclarationInputDataProvider>(d => SetValues(d.JobInputData.Vehicle.Components.AxleGearInputData)) + .If<IEngineeringInputDataProvider>(e => SetValues(e.JobInputData.Vehicle.Components.AxleGearInputData)); + } + + private void SetValues(IAxleGearInputData axle) + { + Model = axle.Model; + Manufacturer = axle.Manufacturer; + CertificationNumber = axle.CertificationNumber; + CertificationMethod = axle.CertificationMethod; + //ToDo + //Date = DateTime.Parse(axle.Date); + LineType = axle.LineType; + Ratio = axle.Ratio; + + //ToDo + //var lossMap = TransmissionLossMapReader.Create(axle.LossMap, axle.Ratio, "Axlegear").Entries.OrderBy(x => x.InputSpeed).ThenBy(x => x.InputTorque); + //foreach (var entry in lossMap) { + // LossMap.Add(new GearLossMapEntry(entry)); + //} + } + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Impl/AxlesViewModel.cs b/VECTO3GUI/ViewModel/Impl/AxlesViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..bb24fb46e0e10aa53ef787b87ca439cd36bc3655 --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/AxlesViewModel.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using Ninject; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Declaration; +using TUGraz.VectoCore.Utils; +using VECTO3.ViewModel.Interfaces; +using Component = VECTO3.Util.Component; + +namespace VECTO3.ViewModel.Impl +{ + public class AxlesViewModel : AbstractViewModel, IAxlesViewModel + { + private readonly ObservableCollection<IAxleViewModel> _axles = new ObservableCollection<IAxleViewModel>(); + + protected VehicleViewModel vehicleViewModel; + private IAxleViewModel _currentAxle; + private int _numSteeredAxles; + + #region Implementation of IAxlesViewModel + + public IList<IAxleDeclarationInputData> ModelData { get { + return Axles.OrderBy(a => a.AxleIndex).Select(a => a.ModelData).ToArray(); + } } + + public AxleConfiguration AxleConfiguration + { + get { return vehicleViewModel != null ? vehicleViewModel.AxleConfiguration : AxleConfiguration.AxleConfig_4x2; } + set { } + } + + public IAxleViewModel CurrentAxle + { + get { return _currentAxle; } + set { SetProperty(ref _currentAxle, value); } + } + + public ObservableCollection<IAxleViewModel> Axles + { + get { return _axles; } + } + + public int NumSteeredAxles + { + get { return _numSteeredAxles; } + protected set { SetProperty(ref _numSteeredAxles, value); } + } + + #endregion + + protected override void InputDataChanged() + { + JobViewModel.InputDataProvider.Switch() + .If<IDeclarationInputDataProvider>(d => SetValues(d.JobInputData.Vehicle.Components.AxleWheels.AxlesDeclaration)) + .If<IEngineeringInputDataProvider>(e => SetValues(e.JobInputData.Vehicle.Components.AxleWheels.AxlesEngineering)); + + + vehicleViewModel = ParentViewModel as VehicleViewModel; + if (vehicleViewModel == null) { + return; + } + + vehicleViewModel.PropertyChanged += UpdateAxles; + DoUpdateSteeredAxles(); + DoUpdateAxles(); + } + + private void UpdateAxles(object sender, PropertyChangedEventArgs e) + { + var dependentProperties = new[] { "AxleConfiguration" }; + if (!dependentProperties.Contains(e.PropertyName)) { + return; + } + DoUpdateAxles(); + } + + private void SetValues(IList<IAxleEngineeringInputData> axles) + { + throw new NotImplementedException(); + } + + private void SetValues(IList<IAxleDeclarationInputData> axles) + { + Axles.Clear(); + foreach (var axle in axles) { + var entry = Kernel.Get<IAxleViewModel>(); + entry.JobViewModel = JobViewModel; + + var axleEntry = (entry as AxleViewModel); + if (axleEntry == null) { + throw new Exception("Unknown Axle ViewModel!"); + } + + axleEntry.SetValues(Axles.Count + 1, axle); + axleEntry.PropertyChanged += (sender, args) => DoUpdateSteeredAxles(); + Axles.Add(entry); + } + + if (Axles.Count > 0) { + CurrentAxle = Axles.First(); + } + DoUpdateSteeredAxles(); + } + + private void DoUpdateAxles() + { + if (!DeclarationMode) { + return; + } + if (vehicleViewModel == null) { + return; + } + + var numAxles = vehicleViewModel.AxleConfiguration.NumAxles(); + while (Axles.Count > numAxles) { + Axles.RemoveAt(Axles.Count - 1); + } + while (Axles.Count < numAxles) { + var entry = Kernel.Get<IAxleViewModel>(); + entry.JobViewModel = JobViewModel; + var axle = (entry as AxleViewModel); + if (axle == null) { + throw new Exception("Unknown Axle ViewModel!"); + } + axle.SetValues(Axles.Count + 1); + axle.PropertyChanged += (sender, args) => DoUpdateSteeredAxles(); + Axles.Add(entry); + } + DoUpdateSteeredAxles(); + OnPropertyChanged("Axles"); + } + + private void DoUpdateSteeredAxles() + { + NumSteeredAxles = _axles.Count(a => a.Steered); + } + } + +} diff --git a/VECTO3GUI/ViewModel/Impl/CyclesViewModel.cs b/VECTO3GUI/ViewModel/Impl/CyclesViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..14054692089c7dd0d8f363bd78292f440720ee27 --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/CyclesViewModel.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Declaration; +using VECTO3.ViewModel.Interfaces; +using Component = VECTO3.Util.Component; + +namespace VECTO3.ViewModel.Impl +{ + public class CyclesViewModel : AbstractViewModel, ICyclesViewModel + { + private readonly ObservableCollection<string> _cycles = new ObservableCollection<string>(); + + private IVehicleViewModel _vehicleViewModel; + + #region Implementation of ICyclesViewModel + + public ObservableCollection<string> Cycles + { + get { return _cycles; } + } + + #endregion + + protected override void InputDataChanged() + { + var model = JobViewModel as DeclarationJobViewModel; + if (model == null) { + return; + } + + _vehicleViewModel = model.GetComponentViewModel(Component.Vehicle) as IVehicleViewModel; + if (_vehicleViewModel == null) { + return; + } + + if (_vehicleViewModel is ObservableObject) { + (_vehicleViewModel as ObservableObject).PropertyChanged += UpdateDeclarationCycles; + } + DoUpdateDeclarationCycles(); + } + + private void UpdateDeclarationCycles(object sender, PropertyChangedEventArgs e) + { + var dependentProperties = new[] { "VehicleCategory", "AxleConfiguration", "GrossVehicleMass" }; + if (!dependentProperties.Contains(e.PropertyName)) { + return; + } + DoUpdateDeclarationCycles(); + } + + private void DoUpdateDeclarationCycles() + { + if (!DeclarationMode) { + return; + } + if (_vehicleViewModel == null) { + return; + } + + + try { + + //ToDo + //var seg = DeclarationData.Segments.Lookup( + // _vehicleViewModel.VehicleCategory, _vehicleViewModel.AxleConfiguration, _vehicleViewModel.GrossVehicleMass, 0.SI<Kilogram>(), false); + //_cycles.Clear(); + //foreach (var mission in seg.Missions.Where(m => !m.MissionType.IsEMS())) { + // _cycles.Add(mission.MissionType.GetLabel()); + //} + } catch (Exception) { + _cycles.Clear(); + } + + OnPropertyChanged("Cycles"); + } + } +} diff --git a/VECTO3GUI/ViewModel/Impl/DeclarationJobViewModel.cs b/VECTO3GUI/ViewModel/Impl/DeclarationJobViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..6707f47a3bff51fcf3d40739350517ca6b8dcdbd --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/DeclarationJobViewModel.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.ComponentModel; +using System.IO; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using Ninject; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.InputData.FileIO.JSON; +using TUGraz.VectoCore.InputData.FileIO.XML.Declaration; +using TUGraz.VectoCore.Models.Declaration; +using TUGraz.VectoCore.Models.Simulation.Impl; +using TUGraz.VectoCore.OutputData.XML; +using TUGraz.VectoCore.Utils; +using VECTO3.Util; +using VECTO3.ViewModel.Adapter.Declaration; +using VECTO3.ViewModel.Interfaces; +using Component = VECTO3.Util.Component; + +namespace VECTO3.ViewModel.Impl +{ + public class DeclarationJobViewModel : AbstractJobViewModel, IJobEditViewModel + { + private IDeclarationInputDataProvider _inputData; + + + public DeclarationJobViewModel(IKernel kernel, IDeclarationInputDataProvider inputData) + { + Kernel = kernel; + InputDataProvider = inputData; + JobViewModel = this; + CreateComponentModel(Component.Vehicle); + CreateComponentModel(Component.Cycle); + CurrentComponent = GetComponentViewModel(Component.Vehicle); + } + + #region Implementation of IJobEditViewModel + + public string JobFile + { + get { return _inputData.JobInputData.JobName; } + } + + + #endregion + + public IDeclarationInputDataProvider ModelData + { + get { return new DeclarationJobAdapter(this); } + } + + + protected override void DoSaveJob() + { + var writer = new XMLDeclarationWriter("TEST"); + var tmp = writer.GenerateVectoJob(ModelData); + } + + + public IInputDataProvider InputDataProvider + { + get { return _inputData; } + set { + value.Switch() + .If<IDeclarationInputDataProvider>( + d => { + SetProperty(ref IsDeclarationMode, true); + SetProperty(ref _inputData, d); + } + ); + } + } + + + } +} diff --git a/VECTO3GUI/ViewModel/Impl/EngineOnlyJobViewModel.cs b/VECTO3GUI/ViewModel/Impl/EngineOnlyJobViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..a46c06fb0d8aa1e58a06a233f5acbecf59fc4836 --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/EngineOnlyJobViewModel.cs @@ -0,0 +1,57 @@ +using System.Windows.Input; +using Ninject; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCore.Utils; +using VECTO3.Util; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Impl +{ + public class EngineOnlyJobViewModel : AbstractJobViewModel, IJobEditViewModel + { + private IEngineeringInputDataProvider _inputData; + + public EngineOnlyJobViewModel(IKernel kernel, IEngineeringInputDataProvider inputData) + { + Kernel = kernel; + InputDataProvider = inputData; + JobViewModel = this; + CreateComponentModel(Component.Engine); + CreateComponentModel(Component.Cycle); + CurrentComponent = GetComponentViewModel(Component.Engine); + } + + + #region Implementation of IJobEditViewModel + + public string JobFile + { + get { return _inputData.JobInputData.JobName; } + } + + public IInputDataProvider InputDataProvider + { + get { return _inputData; } + set { + value.Switch() + .If<IEngineeringInputDataProvider>( + d => { + SetProperty(ref IsDeclarationMode, false); + SetProperty(ref _inputData, d); + } + ); + } + } + + #endregion + + #region Overrides of AbstractJobViewModel + + protected override void DoSaveJob() + { + throw new System.NotImplementedException(); + } + + #endregion + } +} diff --git a/VECTO3GUI/ViewModel/Impl/EngineViewModel.cs b/VECTO3GUI/ViewModel/Impl/EngineViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..5773d54032b2a64d4e63f1ff63a641c8bb6eea1b --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/EngineViewModel.cs @@ -0,0 +1,200 @@ +using System; +using System.Collections.ObjectModel; +using System.Data; +using System.Linq; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Reader; +using TUGraz.VectoCore.InputData.Reader.ComponentData; +using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; +using TUGraz.VectoCore.Utils; +using VECTO3.Util; +using VECTO3.ViewModel.Adapter.Declaration; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Impl +{ + public class EngineViewModel : AbstractComponentViewModel, IEngineViewModel + { + private CubicMeter _displacement; + private PerSecond _idlingSpeed; + private PerSecond _ratedSpeed; + private Watt _ratedPower; + private NewtonMeter _maxEngineTorque; + private double _whtcUrban; + private double _whctRural; + private double _whtcMotorway; + private double _bfColdHot; + private double _cfRegPer; + private double _cfncv; + private FuelType _fuelType; + private double _engineeringCf; + + public EngineViewModel() + { + FCMap = new ObservableCollection<FuelConsumptionEntry>(); + FullLoadCurve = new ObservableCollection<FullLoadEntry>(); + } + + #region Implementation of IEditComponentEngineViewModel + + public CubicMeter Displacement + { + get { return _displacement; } + set { SetProperty(ref _displacement, value); } + } + + public PerSecond IdlingSpeed + { + get { return _idlingSpeed; } + set { SetProperty(ref _idlingSpeed, value); } + } + + public PerSecond RatedSpeed + { + get { return _ratedSpeed; } + set { SetProperty(ref _ratedSpeed, value); } + } + + public Watt RatedPower + { + get { return _ratedPower; } + set { SetProperty(ref _ratedPower, value); } + } + + public NewtonMeter MaxEngineTorque + { + get { return _maxEngineTorque; } + set { SetProperty(ref _maxEngineTorque, value); } + } + + public double WHTCUrban + { + get { return _whtcUrban; } + set { SetProperty(ref _whtcUrban, value); } + } + + public double WHTCRural + { + get { return _whctRural; } + set { SetProperty(ref _whctRural, value); } + } + + public double WHTCMotorway + { + get { return _whtcMotorway; } + set { SetProperty(ref _whtcMotorway, value); } + } + + public double BFColdHot + { + get { return _bfColdHot; } + set { SetProperty(ref _bfColdHot, value); } + } + + public double CFRegPer + { + get { return _cfRegPer; } + set { SetProperty(ref _cfRegPer, value); } + } + + public double CFNCV + { + get { return _cfncv; } + set { SetProperty(ref _cfncv, value); } + } + + public FuelType FuelType + { + get { return _fuelType; } + set { SetProperty(ref _fuelType, value); } + } + + public AllowedEntry<FuelType>[] AllowedFuelTypes + { + get { + var types = //DeclarationMode ? : + Enum.GetValues(typeof(FuelType)).Cast<FuelType>(); + return types.Select(ft => AllowedEntry.Create(ft, ft.GetLabel())).ToArray(); + } + } + + public ObservableCollection<FuelConsumptionEntry> FCMap { get; } + public ObservableCollection<FullLoadEntry> FullLoadCurve { get; } + + public double EngineeringCF + { + get { return _engineeringCf; } + set { SetProperty(ref _engineeringCf, value); } + } + + public IEngineDeclarationInputData ModelData + { + get { return AdapterFactory.EngineDeclarationAdapter(this); } + } + + #endregion + + #region Overrides of AbstractEditComponentViewModel + + protected override void InputDataChanged() + { + JobViewModel.InputDataProvider.Switch() + .If<IDeclarationInputDataProvider>( + d => { + if (d.JobInputData.SavedInDeclarationMode) { + // there are input data provider implementing both interfaces... + LoadValues(d.JobInputData.Vehicle.Components.EngineInputData); + } + }) + .If<IEngineeringInputDataProvider>( + e => LoadValues( + e.JobInputData.EngineOnlyMode ? e.JobInputData.EngineOnly : e.JobInputData.Vehicle.Components.EngineInputData)); + } + + private void LoadValues(IEngineDeclarationInputData engine) + { + Manufacturer = engine.Manufacturer; + Model = engine.Model; + CertificationNumber = engine.CertificationNumber; + DateTime date; + //ToDo + //var success = DateTime.TryParse(engine.Date, out date); + //Date = success ? date : (DateTime?)null; + Displacement = engine.Displacement; + //ToDo + //IdlingSpeed = engine.IdleSpeed; + RatedSpeed = engine.RatedSpeedDeclared; + RatedPower = engine.RatedPowerDeclared; + MaxEngineTorque = engine.MaxTorqueDeclared; + + //ToDo + //WHTCUrban = engine.WHTCUrban; + //WHTCRural = engine.WHTCRural; + //WHTCMotorway = engine.WHTCMotorway; + //BFColdHot = engine.ColdHotBalancingFactor; + //CFRegPer = engine.CorrectionFactorRegPer; + //CFNCV = engine.CorrectionFactorNCV; + //FuelType = engine.FuelType; + //FullLoadCurve.Clear(); + //foreach (var entry in FullLoadCurveReader.Create(engine.FullLoadCurve, DeclarationMode).Entries) { + // FullLoadCurve.Add(new FullLoadEntry(entry)); + //} + + //FCMap.Clear(); + //foreach (var entry in FuelConsumptionMapReader.Create(engine.FuelConsumptionMap).Entries) { + // FCMap.Add(new FuelConsumptionEntry(entry)); + //} + } + + private void LoadValues(IEngineEngineeringInputData engine) + { + LoadValues(engine as IEngineDeclarationInputData); + //ToDo + //EngineeringCF = engine.WHTCEngineering; + } + + #endregion + } +} diff --git a/VECTO3GUI/ViewModel/Impl/GearboxViewModel.cs b/VECTO3GUI/ViewModel/Impl/GearboxViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..d7ddb8a51ca152b3e3a250a51ca5804e49f971df --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/GearboxViewModel.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCore.Models.Declaration; +using TUGraz.VectoCore.Utils; +using VECTO3.Util; +using VECTO3.ViewModel.Adapter.Declaration; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Impl { + public class GearboxViewModel : AbstractComponentViewModel, IGearboxViewModel + { + + private GearboxType _transmissionType; + private readonly ObservableCollection<Gear> _gears = new ObservableCollection<Gear>(); + private Gear _selectedGear; + private CertificationMethod _certificationMethod; + + private void SetValues(IGearboxDeclarationInputData gbx) + { + Manufacturer = gbx.Manufacturer; + Model = gbx.Model; + CertificationNumber = gbx.CertificationNumber; + CertificationMethod = gbx.CertificationMethod; + //ToDo + //Date = DateTime.Parse(gbx.Date); + TransmissionType = gbx.Type; + Gears.Clear(); + foreach (var entry in gbx.Gears.OrderBy(g => g.Gear)) { + Gears.Add(new Gear(Gears, entry)); + } + + if (Gears.Count > 0) { + SelectedGear = Gears.First(); + } + } + + #region Implementation of IEditComponentGearboxViewModel + + public IGearboxDeclarationInputData ModelData { get { return AdapterFactory.GearboxDeclarationAdapter(this); } } + + public CertificationMethod CertificationMethod + { + get { return _certificationMethod; } + set { SetProperty(ref _certificationMethod, value); } + } + + public AllowedEntry<CertificationMethod>[] AllowedCertificationMethods + { + get + { + return null; + //ToDo + //return DeclarationData.GearboxCertificationMethods.Select(x => AllowedEntry.Create(x, x.GetLabel())).ToArray(); + } + } + + public GearboxType TransmissionType + { + get { return _transmissionType; } + set { SetProperty(ref _transmissionType, value); } + } + + public AllowedEntry<GearboxType>[] AllowedTransmissionTypes + { + get + { + return null; + //ToDo + //var gears = DeclarationMode ? + // DeclarationData.Gearbox.GearboxTypes() + // : Enum.GetValues(typeof(GearboxType)).Cast<GearboxType>(); + //return gears.Select(g => AllowedEntry.Create(g, g.GetLabel())).ToArray(); + } + } + + [CustomValidation(typeof(GearboxViewModel), "ValidateGears")] + public ObservableCollection<Gear> Gears + { + get { return _gears; } + } + + public Gear SelectedGear + { + get { return _selectedGear; } + set { SetProperty(ref _selectedGear, value); } + } + + #endregion + + + #region Overrides of AbstractEditComponentViewModel + + protected override void InputDataChanged() + { + JobViewModel.InputDataProvider.Switch() + .If<IDeclarationInputDataProvider>(d => SetValues(d.JobInputData.Vehicle.Components.GearboxInputData)) + .If<IEngineeringInputDataProvider>(e => SetValues(e.JobInputData.Vehicle.Components.GearboxInputData)); + } + + #endregion + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Impl/JobEntry.cs b/VECTO3GUI/ViewModel/Impl/JobEntry.cs new file mode 100644 index 0000000000000000000000000000000000000000..65eb6ade8c4ff7fd7336226351acda1484a9f854 --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/JobEntry.cs @@ -0,0 +1,11 @@ +namespace VECTO3.ViewModel.Impl { + public class JobEntry : ObservableObject + { + private bool _selected; + private string _filename; + + public int Sorting; + public bool Selected { get { return _selected; } set { SetProperty(ref _selected, value); } } + public string Filename { get { return _filename; } set { SetProperty(ref _filename, value); } } + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs b/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..c619e922bd4a520fec3fb438aa831e9581461c1b --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs @@ -0,0 +1,172 @@ +using System; +using System.Collections; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using Ninject; +using Ninject.Parameters; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.InputData.FileIO.JSON; +using TUGraz.VectoCore.InputData.FileIO.XML; +using TUGraz.VectoCore.InputData.FileIO.XML.Declaration; +using TUGraz.VectoCore.InputData.FileIO.XML.Engineering; +using TUGraz.VectoCore.Utils; +using VECTO3.Util; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Impl +{ + public class JoblistViewModel : ObservableObject, IJoblistViewModel + { + protected readonly ObservableCollection<JobEntry> _jobs = new ObservableCollection<JobEntry>(); + + + public JoblistViewModel() + { + AddJobEntry(@"~\..\..\..\..\Generic Vehicles\Declaration Mode\Class5_Tractor_4x2\Class5_Tractor_DECL.xml"); + AddJobEntry("DummyEntry"); + AddJobEntry(@"~\..\..\..\..\Generic Vehicles\Declaration Mode\Class5_Tractor_4x2\Class5_Tractor_ENG.vecto"); + AddJobEntry(@"~\..\..\..\..\Generic Vehicles\Engineering Mode\EngineOnly\EngineOnly.vecto"); + } + + private void AddJobEntry(string jobFile) + { + _jobs.Add(new JobEntry() { + Filename = jobFile, + Selected = false, + Sorting = _jobs.Count + }); + } + + public ObservableCollection<JobEntry> Jobs + { + get { return _jobs; } + } + + public ICommand AddJob { get { return new RelayCommand(() => {}, () => false); } } + + + public ICommand RemoveJob { get { return new RelayCommand<object>(DoRemoveJob, CanRemoveJob);} } + + private void DoRemoveJob(object selected) + { + var list = (IList)selected; + var selectedEntries = list.Cast<JobEntry>().ToArray(); + + foreach (var entry in selectedEntries) { + _jobs.Remove(entry); + } + } + + private bool CanRemoveJob(object selected) + { + var list = (IList)selected; + return list.Count > 0; + } + + public ICommand MoveJobUp { get { return new RelayCommand(() => { }, () => false); } } + + + public ICommand MoveJobDown { get { return new RelayCommand(() => { }, () => false); } } + + + public ICommand StartSimulation { get { return new RelayCommand(DoStartSimulation, CanStartSimulation); } } + + private void DoStartSimulation() + { + + } + private bool CanStartSimulation() + { + return false; + } + + public ICommand EditJob { get { return new RelayCommand<object>(DoEditJob, CanEditJob);} } + + public ICommand JobEntrySetActive { get {return new RelayCommand<object>(DoJobEntrySetActive);} } + + private void DoJobEntrySetActive(object obj) + { + var jobEntry = (JobEntry)((ListViewItem)obj).Content; + jobEntry.Selected = !jobEntry.Selected; + } + + private void DoEditJob(object selected) + { + var entry = (JobEntry)selected; + if (entry == null) { + return; + } + + try { + var jobEditView = ReadJob(entry.Filename); //Kernel.Get<IJobEditViewModel>(); + + var wnd = new Window { Content = jobEditView }; + wnd.Show(); + } catch (Exception e) { + MessageBox.Show( + "Failed to read selected job: " + Environment.NewLine + Environment.NewLine + e.Message, "Failed reading Job", + MessageBoxButton.OK); + } + } + + private IJobEditViewModel ReadJob(string jobFile) + { + IInputDataProvider inputData = null; + var ext = Path.GetExtension(jobFile); + switch (ext) { + case Constants.FileExtensions.VectoJobFile: + inputData = JSONInputDataFactory.ReadJsonJob(jobFile); + break; + case Constants.FileExtensions.VectoXMLDeclarationFile: + //ToDo + //case Constants.FileExtensions.VectoXMLJobFile: + //inputData = Kernel.Get<IXMLInputDataReader>().CreateDeclaration(jobFile); + //break; + default: + throw new UnsupportedFileVersionException(jobFile); + } + + var retVal = CreateJobEditViewModel(inputData); + + if (retVal == null) { + throw new Exception("Unsupported job type"); + } + return retVal; + } + + private IJobEditViewModel CreateJobEditViewModel(IInputDataProvider inputData) + { + IJobEditViewModel retVal = null; + if (inputData is JSONInputDataV2) { + var jsoninputData = inputData as JSONInputDataV2; + if (jsoninputData.SavedInDeclarationMode) { + retVal = new DeclarationJobViewModel(Kernel, jsoninputData); + } else { + if (jsoninputData.EngineOnlyMode) { + retVal = new EngineOnlyJobViewModel(Kernel, jsoninputData); + } else { + // TODO! + } + } + } + //ToDo + //if (inputData is XMLDeclarationInputDataProvider) { + // var declInput = inputData as IDeclarationInputDataProvider; + // retVal = new DeclarationJobViewModel(Kernel, declInput); + //} + return retVal; + } + + private bool CanEditJob(object selected) + { + var list = (IList)selected; + return list.Count == 1; + } + } +} diff --git a/VECTO3GUI/ViewModel/Impl/MainWindowViewModel.cs b/VECTO3GUI/ViewModel/Impl/MainWindowViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..8be75d7aa191e4a7424a061cfaa8847fbe544ab6 --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/MainWindowViewModel.cs @@ -0,0 +1,28 @@ +using Ninject; +using VECTO3.ViewModel.Interfaces; +using VECTO3.Views; + +namespace VECTO3.ViewModel.Impl +{ + public class MainWindowViewModel : ObservableObject, IMainWindowViewModel + { + + private IMainView _currentViewModel; + + public MainWindowViewModel(IKernel kernel) + { + Kernel = kernel; + CurrentViewModel = Kernel.Get<IJoblistViewModel>(); + } + + + + public IMainView CurrentViewModel + { + get { return _currentViewModel; } + set { SetProperty(ref _currentViewModel, value); } + } + + + } +} diff --git a/VECTO3GUI/ViewModel/Impl/NoneViewModel.cs b/VECTO3GUI/ViewModel/Impl/NoneViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..5cb7254e744c15b4888ca1ced0b1875caed0f931 --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/NoneViewModel.cs @@ -0,0 +1,7 @@ +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Impl { + internal class NoneViewModel : AbstractViewModel, INoneViewModel { + + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Impl/ObservableObject.cs b/VECTO3GUI/ViewModel/Impl/ObservableObject.cs new file mode 100644 index 0000000000000000000000000000000000000000..c8c0da64fcb74a02d960c3c07bfca94a64e23731 --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/ObservableObject.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using Ninject; + +namespace VECTO3.ViewModel.Impl { + public abstract class ObservableObject : INotifyPropertyChanged + { + + [Inject] public IKernel Kernel { set; protected get; } + + public event PropertyChangedEventHandler PropertyChanged; + + + protected virtual bool SetProperty<T>(ref T field, T value, [CallerMemberName]string proptertyName = null) + { + bool propertyChanged = false; + + if (!EqualityComparer<T>.Default.Equals(field, value)) { + field = value; + OnPropertyChanged(proptertyName); + propertyChanged = true; + } + return propertyChanged; + } + + protected void OnPropertyChanged([CallerMemberName]string propterty = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propterty)); + } + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Impl/RetarderViewModel.cs b/VECTO3GUI/ViewModel/Impl/RetarderViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..377cbb767fa7967ee0d1835e1496637f61fac202 --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/RetarderViewModel.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.ObjectModel; +using System.Linq; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCore.InputData.Reader.ComponentData; +using TUGraz.VectoCore.Models.Declaration; +using TUGraz.VectoCore.Utils; +using VECTO3.Util; +using VECTO3.ViewModel.Adapter.Declaration; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Impl +{ + public class RetarderViewModel : AbstractComponentViewModel, IRetarderViewModel + { + private readonly ObservableCollection<RetarderLossMapEntry> _lossMap = + new ObservableCollection<RetarderLossMapEntry>(); + + private CertificationMethod _certificationMethod; + + + #region Implementation of IEditComponentRetarderViewModel + + public IRetarderInputData ModelData + { + get { return AdapterFactory.RetarderDeclarationAdapter(this); } + } + + public CertificationMethod CertificationMethod + { + get { return _certificationMethod; } + set { SetProperty(ref _certificationMethod, value); } + } + + public AllowedEntry<CertificationMethod>[] AllowedCertificationMethods + { + get + { + return null; + //ToDo + //return DeclarationData.RetarderCertificationMethods.Select(x => AllowedEntry.Create(x, x.GetLabel())).ToArray(); + } + } + + public ObservableCollection<RetarderLossMapEntry> LossMap + { + get { return _lossMap; } + } + + public RetarderType Type + { + get { return (ParentViewModel as IVehicleViewModel).RetarderType; } + set { (ParentViewModel as IVehicleViewModel).RetarderType = value; } + } + + public double Ratio + { + get { return (ParentViewModel as IVehicleViewModel).RetarderRatio; } + set { (ParentViewModel as IVehicleViewModel).RetarderRatio = value; } + } + + #endregion + + protected override void InputDataChanged() + { + JobViewModel.InputDataProvider.Switch() + .If<IDeclarationInputDataProvider>(d => SetValues(d.JobInputData.Vehicle.Components.RetarderInputData)) + .If<IEngineeringInputDataProvider>(e => SetValues(e.JobInputData.Vehicle.Components.RetarderInputData)); + } + + private void SetValues(IRetarderInputData retarder) + { + Model = retarder.Model; + Manufacturer = retarder.Manufacturer; + CertificationNumber = retarder.CertificationNumber; + CertificationMethod = retarder.CertificationMethod; + //ToDo + //Date = DateTime.Parse(retarder.Date); + //ToDo + //var lossMap = RetarderLossMapReader.Create(retarder.LossMap).Entries.OrderBy(x => x.RetarderSpeed); + //foreach (var entry in lossMap) { + // LossMap.Add(new RetarderLossMapEntry(entry)); + //} + } + } +} diff --git a/VECTO3GUI/ViewModel/Impl/TorqueConverterViewModel.cs b/VECTO3GUI/ViewModel/Impl/TorqueConverterViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..7fae9a9905933beb8c1ebbafa6299cfd712054fb --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/TorqueConverterViewModel.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.ObjectModel; +using System.Linq; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCore.InputData.Reader.ComponentData; +using TUGraz.VectoCore.Models.Declaration; +using TUGraz.VectoCore.Utils; +using VECTO3.Util; +using VECTO3.ViewModel.Adapter.Declaration; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Impl { + public class TorqueConverterViewModel : AbstractComponentViewModel, ITorqueConverterViewModel + { + private readonly ObservableCollection<TorqueConverterCharacteristics> _characteristics = new ObservableCollection<TorqueConverterCharacteristics>(); + private CertificationMethod _certificationMethod; + + #region Implementation of IEditComponentTorqueConverterViewModel + + public ITorqueConverterDeclarationInputData ModelData { get { return AdapterFactory.TorqueConverterDeclarationAdapter(this); } } + + public CertificationMethod CertificationMethod + { + get { return _certificationMethod; } + set { SetProperty(ref _certificationMethod, value); } + } + + public AllowedEntry<CertificationMethod>[] AllowedCertificationMethods + { + get + { + return null; + //ToDo + //return DeclarationData.TorqueConverterCertificationMethods.Select(x => AllowedEntry.Create(x, x.GetLabel())).ToArray(); + } + } + + public ObservableCollection<TorqueConverterCharacteristics> Characteristics + { + get { return _characteristics; } + } + + #endregion + + protected override void InputDataChanged() + { + JobViewModel.InputDataProvider.Switch() + .If<IDeclarationInputDataProvider>(d => SetValues(d.JobInputData.Vehicle.Components.TorqueConverterInputData)) + .If<IEngineeringInputDataProvider>(e => SetValues(e.JobInputData.Vehicle.Components.TorqueConverterInputData)); + } + + private void SetValues(ITorqueConverterDeclarationInputData tc) + { + Model = tc.Model; + Manufacturer = tc.Manufacturer; + CertificationNumber = tc.CertificationNumber; + CertificationMethod = tc.CertificationMethod; + //ToDo + //Date = DateTime.Parse(tc.Date); + + var ratio = 1; // TODO! + + //ToDo + //var lossMap = TorqueConverterDataReader.Create(tc.TCData, + // DeclarationData.TorqueConverter.ReferenceRPM, DeclarationData.TorqueConverter.MaxInputSpeed, + // ExecutionMode.Declaration, ratio, + // DeclarationData.TorqueConverter.CLUpshiftMinAcceleration, DeclarationData.TorqueConverter.CCUpshiftMinAcceleration).Entries.OrderBy(x => x.SpeedRatio); + //foreach (var entry in lossMap) { + // Characteristics.Add(new TorqueConverterCharacteristics(entry)); + //} + } + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Impl/TyreViewModel.cs b/VECTO3GUI/ViewModel/Impl/TyreViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..08d64932c395e6dd1ffc9816282b4e2e73e71d5a --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/TyreViewModel.cs @@ -0,0 +1,59 @@ +using System; +using System.Linq; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Declaration; +using VECTO3.Util; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.ViewModel.Impl +{ + public class TyreViewModel : AbstractComponentViewModel, ITyreViewModel + { + private string _dimension; + private double _rollingResistanceCoefficient; + private Newton _fzIso; + + #region Implementation of ITyreViewModel + + public ITyreDeclarationInputData ModelData { get { return AdapterFactory.TyreDeclarationAdapter(this); } } + + public string Dimension + { + get { return _dimension; } + set { SetProperty(ref _dimension, value); } + } + + public AllowedEntry<string>[] AllowedDimensions + { + get { return DeclarationData.Wheels.GetWheelsDimensions().Select(w => AllowedEntry.Create(w, w)).ToArray(); } + } + + public double RollingResistanceCoefficient + { + get { return _rollingResistanceCoefficient; } + set { SetProperty(ref _rollingResistanceCoefficient, value); } + } + + public Newton FzISO + { + get { return _fzIso; } + set { SetProperty(ref _fzIso, value); } + } + + #endregion + + public void SetValues(ITyreDeclarationInputData tyre) + { + Manufacturer = tyre.Manufacturer; + Model = tyre.Model; + CertificationNumber = tyre.CertificationNumber; + //ToDo + //Date = DateTime.Parse(tyre.Date ?? "1/1/1970"); + + Dimension = tyre.Dimension; + RollingResistanceCoefficient = tyre.RollResistanceCoefficient; + FzISO = tyre.TyreTestLoad; + } + } +} diff --git a/VECTO3GUI/ViewModel/Impl/ValidatingViewModel.cs b/VECTO3GUI/ViewModel/Impl/ValidatingViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..2c489785c872c06bdc8298e6ceaf518dce4e79fa --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/ValidatingViewModel.cs @@ -0,0 +1,174 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Reflection; +using System.Runtime.CompilerServices; +using VECTO3.Util; + +namespace VECTO3.ViewModel.Impl +{ + public class ValidatingViewModel : ObservableObject, INotifyDataErrorInfo + { + private readonly Dictionary<string, List<string>> _errors = new Dictionary<string, List<string>>(); + + private readonly Dictionary<string, ValidationAttribute[]> _validations = new Dictionary<string, ValidationAttribute[]>(); + + public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged; + + private readonly object _lock = new object(); + + protected ValidatingViewModel() + { + const BindingFlags flags = BindingFlags.Instance | BindingFlags.Public; + var properties = GetType().GetProperties(flags); + + //var classValidation = GetType().GetCustomAttributes<ValidationAttribute>().ToList(); + + foreach (var p in properties) { + if (p.PropertyType.IsGenericType && p.PropertyType.GetGenericTypeDefinition() == typeof(ObservableCollection<>)) { + + // var eventInfo = p.PropertyType.GetEvent("CollectionChanged"); + // var methodInfo = GetType().GetMethod("ValidateHandler"); + // var handler = Delegate.CreateDelegate(eventInfo.EventHandlerType, this, + // methodInfo); + + // eventInfo.AddEventHandler(this, handler); + } + + var attributes = p.GetCustomAttributes<VectoParameterAttribute>().ToList(); + var validationAttributes = p.GetCustomAttributes<ValidationAttribute>().ToList(); + if (attributes.Any() || validationAttributes.Any()) { + var validations = new List<ValidationAttribute>(); + validations.AddRange(GetVectoParameterValidation(attributes)); + validations.AddRange(validationAttributes); + //validations.AddRange(classValidation); + _validations[p.Name] = validations.ToArray(); + } + } + } + + protected void ValidateHandler(object sender, NotifyCollectionChangedEventArgs e) + { + //ValidateProperty(sender); + } + + private ValidationAttribute[] GetVectoParameterValidation(List<VectoParameterAttribute> attributes) + { + if (attributes.Count == 0) { + return new ValidationAttribute[0]; + } + if (attributes.Count != 1) { + throw new Exception(string.Format("Exactly one VectoParameter Attribute allowed! found {0}", attributes.Count)); + } + + var a = attributes.First(); + var p = a.Type.GetProperties().Where(x => x.Name == a.PropertyName).ToArray(); + if (p.Length != 1) { + throw new Exception(string.Format("number of properties found: {0}, expected only 1! {1}:{2}", p.Length, a.Type, a.PropertyName)); + } + + return p.First().GetCustomAttributes<ValidationAttribute>().ToArray(); + } + + + public bool HasErrors + { + get { + lock (_lock) { + return _errors.Any(propErrors => propErrors.Value != null && propErrors.Value.Count > 0); + } + } + } + + public bool IsValid + { + get { return HasErrors; } + } + + public IEnumerable GetErrors(string propertyName) + { + if (string.IsNullOrEmpty(propertyName)) { + lock (_lock) { + return _errors.SelectMany(err => err.Value.ToList()); + } + } + + lock (_lock) { + if (_errors.ContainsKey(propertyName) && _errors[propertyName] != null && _errors[propertyName].Count > 0) { + return _errors[propertyName].ToList(); + } + } + + return null; + } + + private void OnErrorsChanged(string propertyName) + { + if (ErrorsChanged != null) { + ErrorsChanged(this, new DataErrorsChangedEventArgs(propertyName)); + } + } + + protected override bool SetProperty<T>(ref T field, T value, [CallerMemberName] string proptertyName = null) + { + ValidateProperty(value, proptertyName); + return base.SetProperty(ref field, value,proptertyName); + } + + protected void ValidateProperty(object value, [CallerMemberName] string propertyName = null) + { + if (propertyName == null || !_validations.ContainsKey(propertyName)) { + return; + } + lock (_lock) { + var validationContext = new ValidationContext(this) { + MemberName = propertyName, + DisplayName = propertyName, + }; + var validationResults = new List<ValidationResult>(); + Validator.TryValidateValue(value, validationContext, validationResults, _validations[propertyName]); + + if (_errors.ContainsKey(propertyName)) { + _errors.Remove(propertyName); + } + OnErrorsChanged(propertyName); + HandleValidationResults(validationResults); + } + } + + public void Validate() + { + lock (_lock) { + var validationContext = new ValidationContext(this, null, null); + var validationResults = new List<ValidationResult>(); + Validator.TryValidateObject(this, validationContext, validationResults, true); + + //clear all previous _errors + var propNames = _errors.Keys.ToList(); + _errors.Clear(); + propNames.ForEach(OnErrorsChanged); + HandleValidationResults(validationResults); + } + } + + private void HandleValidationResults(List<ValidationResult> validationResults) + { + var resultsByPropNames = from result in validationResults + from member in result.MemberNames + group result by member + into g + select g; + + foreach (var prop in resultsByPropNames) { + var messages = prop.Select(r => r.ErrorMessage).ToList(); + _errors.Add(prop.Key, messages); + OnErrorsChanged(prop.Key); + } + } + } +} diff --git a/VECTO3GUI/ViewModel/Impl/VehicleViewModel.cs b/VECTO3GUI/ViewModel/Impl/VehicleViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..00421d757c76de1ebdf1a1a4244ab5e23db1b048 --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/VehicleViewModel.cs @@ -0,0 +1,389 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Windows.Input; +using Ninject; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Declaration; +using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.Utils; +using VECTO3.Util; +using VECTO3.ViewModel.Adapter; +using VECTO3.ViewModel.Adapter.Declaration; +using VECTO3.ViewModel.Interfaces; +using Component = VECTO3.Util.Component; + +namespace VECTO3.ViewModel.Impl +{ + public class VehicleViewModel : AbstractViewModel, IVehicleViewModel + { + private string _manufacturer; + private string _manufacturerAddress; + private string _model; + private string _vin; + private DateTime _date; + private LegislativeClass _legislativeClass; + private VehicleCategory _vehicleCategory; + private AxleConfiguration _axleConfiguration; + private Kilogram _curbMassChassis; + private Kilogram _grossVehicleMass; + private PerSecond _idlingSpeed; + private RetarderType _retarderType; + private double _retarderRatio; + private AngledriveType _angledriveType; + private string _ptoTechnology; + private bool _hasDedicatedRetarder; + private VehicleClass? _vehicleClass; + private readonly ObservableCollection<TorqueEntry> _torqueLimits = new ObservableCollection<TorqueEntry>(); + + [Inject] public IAdapterFactory AdapterFactory { set; protected get; } + + public VehicleViewModel() + { + PropertyChanged += UpdateVehicleClass; + PropertyChanged += UpdateComponents; + } + + private void UpdateComponents(object sender, PropertyChangedEventArgs e) + { + var relevantProperties = new[] { "RetarderType", "AngledriveType", "TransmissionType" }; + if (!relevantProperties.Contains(e.PropertyName)) { + return; + } + + var gbxModel = GetComponentViewModel(Component.Gearbox); + var gearboxType = gbxModel != null && gbxModel is IGearboxViewModel + ? ((IGearboxViewModel)gbxModel).TransmissionType + : GearboxType.MT; + var components = GetComponents(VehicleCategory, + gearboxType, RetarderType, AngledriveType).ToList(); + DoUpdateComponents(components); + } + + private void DoUpdateComponents(IList<Component> components) + { + var currentComponents = GetSubmodels().ToArray(); + foreach (var comp in components) { + if (currentComponents.Contains(comp)) { + continue; + } + + var newModelType = ViewModelFactory.ComponentViewModelMapping[comp]; + var newModel = (IComponentViewModel)Kernel.Get(newModelType); + if (newModel is IGearboxViewModel && newModel is ObservableObject) { + (newModel as ObservableObject).PropertyChanged += UpdateComponents; + } + RegisterSubmodel(comp, newModel); + } + foreach (var comp in currentComponents) { + if (components.Contains(comp)) + continue; + + UnregisterSubmodel(comp); + } + } + + private IEnumerable<Component> GetComponents(VehicleCategory vehicleCategory, GearboxType gbxType, RetarderType retarderType, AngledriveType angledrive) + { + var retVal = new List<Component>() { + Component.Engine, + Component.Gearbox, + Component.Airdrag, + Component.Axlegear, + Component.Axles, + }; + + if (gbxType.AutomaticTransmission()) { + retVal.Add(Component.TorqueConverter); + } + if (retarderType.IsDedicatedComponent()) { + retVal.Add(Component.Retarder); + } + if (angledrive == AngledriveType.SeparateAngledrive) { + retVal.Add(Component.Angledrive); + } + if (vehicleCategory != VehicleCategory.RigidTruck && vehicleCategory != VehicleCategory.Tractor) { + retVal.Add(Component.BusAuxiliaries); + } else { + retVal.Add(Component.Auxiliaries); + } + retVal.Sort(); + return retVal; + } + + private void UpdateVehicleClass(object sender, PropertyChangedEventArgs e) + { + var dependentProperties = new[] { "VehicleCategory", "AxleConfiguration", "GrossVehicleMass" }; + if (!dependentProperties.Contains(e.PropertyName)) { + return; + } + + try { + //ToDo + //var seg = DeclarationData.Segments.Lookup( + // VehicleCategory, AxleConfiguration, GrossVehicleMass, 0.SI<Kilogram>(), false); + //VehicleClass = seg.VehicleClass; + } catch (Exception ) { + VehicleClass = null; + } + } + + public IVehicleDeclarationInputData ModelData + { + get { return AdapterFactory.VehicleDeclarationAdapter(this); } + } + + + private void SetValues(IVehicleDeclarationInputData vehicle) + { + Manufacturer = vehicle.Manufacturer; + ManufacturerAddress = vehicle.ManufacturerAddress; + Model = vehicle.Model; + VIN = vehicle.VIN; + //ToDo + //Date = DateTime.Parse(vehicle.Date); + LegislativeClass = vehicle.LegislativeClass; + VehicleCategory = vehicle.VehicleCategory; + AxleConfiguration = vehicle.AxleConfiguration; + CurbMassChassis = vehicle.CurbMassChassis; + GrossVehicleMass = vehicle.GrossVehicleMassRating; + IdlingSpeed = vehicle.EngineIdleSpeed; + RetarderType = vehicle.Components.RetarderInputData.Type; + if (RetarderType.IsDedicatedComponent()) { + RetarderRatio = vehicle.Components.RetarderInputData.Ratio; + } + PTOTechnology = vehicle.Components.PTOTransmissionInputData.PTOTransmissionType; + AngledriveType = vehicle.Components.AngledriveInputData.Type; + var torqueLimits = vehicle.TorqueLimits.ToList(); + torqueLimits.Sort((entry1, entry2) => entry1.Gear.CompareTo(entry2.Gear)); + TorqueLimits.Clear(); + foreach (var entry in torqueLimits) { + TorqueLimits.Add(new TorqueEntry(TorqueLimits, entry)); + } + } + + public string Manufacturer + { + get { return _manufacturer; } + set { + ValidateProperty(value); + SetProperty(ref _manufacturer, value); + } + } + + public string ManufacturerAddress + { + get { return _manufacturerAddress; } + set { SetProperty(ref _manufacturerAddress, value); } + } + + public string Model + { + get { return _model; } + set { SetProperty(ref _model, value); } + } + + public string VIN + { + get { return _vin; } + set { SetProperty(ref _vin, value); } + } + + public DateTime Date + { + get { return _date; } + set { SetProperty(ref _date, value); } + } + + public LegislativeClass LegislativeClass + { + get { return _legislativeClass; } + set { SetProperty(ref _legislativeClass, value); } + } + + public AllowedEntry<LegislativeClass>[] AllowedLegislativeClasses + { + get + { + return null; + //ToDo + //var allowed = DeclarationMode ? + // DeclarationData.Segments.GetLegislativeClasses() + // : Enum.GetValues(typeof(LegislativeClass)).Cast<LegislativeClass>(); + + //return allowed.Select(vc => AllowedEntry.Create(vc, vc.GetLabel())).ToArray(); + } + } + + public VehicleCategory VehicleCategory + { + get { return _vehicleCategory; } + set { SetProperty(ref _vehicleCategory, value); } + } + + public AllowedEntry<VehicleCategory>[] AllowedVehicleCategories + { + get + { + return null; + //ToDo + //var categories = DeclarationMode ? + // DeclarationData.Segments.GetVehicleCategories() + // : Enum.GetValues(typeof(VehicleCategory)).Cast<VehicleCategory>(); + //return categories.Select(vc => AllowedEntry.Create(vc, vc.GetLabel())).ToArray(); + } + } + + public AxleConfiguration AxleConfiguration + { + get { return _axleConfiguration; } + set { SetProperty(ref _axleConfiguration, value); } + } + + public AllowedEntry<AxleConfiguration>[] AllowedAxleConfigurations + { + get + { + return null; + //ToDo + //var axleConfigs = DeclarationMode + // ? DeclarationData.Segments.GetAxleConfigurations() + // : Enum.GetValues(typeof(AxleConfiguration)).Cast<AxleConfiguration>(); + //return axleConfigs.Select(ac => AllowedEntry.Create(ac, ac.GetName())).ToArray(); + } + } + + public VehicleClass? VehicleClass + { + get { return _vehicleClass; } + private set { SetProperty(ref _vehicleClass, value); } + } + + [VectoParameter(typeof(VehicleData), "CurbWeight")] + public Kilogram CurbMassChassis + { + get { return _curbMassChassis; } + set { SetProperty(ref _curbMassChassis, value); } + } + + [VectoParameter(typeof(VehicleData), "GrossVehicleWeight")] + public Kilogram GrossVehicleMass + { + get { return _grossVehicleMass; } + set { SetProperty(ref _grossVehicleMass, value); } + } + + [VectoParameter(typeof(CombustionEngineData), "IdleSpeed")] + public PerSecond IdlingSpeed + { + get { return _idlingSpeed; } + set { SetProperty(ref _idlingSpeed, value); } + } + + public RetarderType RetarderType + { + get { return _retarderType; } + set { + SetProperty(ref _retarderType, value); + HasDedicatedRetarder = _retarderType.IsDedicatedComponent(); + } + } + + public AllowedEntry<RetarderType>[] AllowedRetarderTypes + { + get { + return Enum.GetValues(typeof(RetarderType)).Cast<RetarderType>() + .Select(rt => AllowedEntry.Create(rt, rt.GetLabel()) ).ToArray(); + } + } + + public bool HasDedicatedRetarder + { + get { return _hasDedicatedRetarder; } + private set { SetProperty(ref _hasDedicatedRetarder, value); } + } + + [VectoParameter(typeof(RetarderData), "Ratio")] + public double RetarderRatio + { + get { return _retarderRatio; } + set { SetProperty(ref _retarderRatio, value); } + } + + public AngledriveType AngledriveType + { + get { return _angledriveType; } + set { SetProperty(ref _angledriveType, value); } + } + + public AllowedEntry<AngledriveType>[] AllowedAngledriveTypes + { + get { + return Enum.GetValues(typeof(AngledriveType)).Cast<AngledriveType>() + .Select(at => AllowedEntry.Create(at, at.GetLabel())).ToArray(); + } + } + + + public string PTOTechnology + { + get { return _ptoTechnology; } + set { SetProperty(ref _ptoTechnology, value); } + } + + public AllowedEntry<string>[] AllowedPTOTechnologies + { + get { return DeclarationData.PTOTransmission.GetTechnologies().Select(pt => AllowedEntry.Create(pt, pt)).ToArray(); } + + } + + public ObservableCollection<TorqueEntry> TorqueLimits + { + get { return _torqueLimits; } + } + + public ICommand AddTorqueLimit { get {return new RelayCommand(DoAddTorqueLimit);} } + + private void DoAddTorqueLimit() + { + TorqueLimits.Add(new TorqueEntry(TorqueLimits, 0, null)); + } + + public ICommand RemoveTorqueLimit { get {return new RelayCommand<object>(DoRemoveTorqueLimit, CanRemoveTorqueLimit);} } + + private void DoRemoveTorqueLimit(object selected) + { + var list = (IList)selected; + var selectedEntries = list.Cast<TorqueEntry>().ToArray(); + + foreach (var entry in selectedEntries) { + TorqueLimits.Remove(entry); + } + } + + private bool CanRemoveTorqueLimit(object selected) + { + var list = (IList)selected; + return list.Count > 0; + } + + + #region Overrides of AbstractEditComponentViewModel + + protected override void InputDataChanged() + { + JobViewModel.InputDataProvider.Switch() + .If<IDeclarationInputDataProvider>(d => SetValues(d.JobInputData.Vehicle)) + .If<IEngineeringInputDataProvider>(e => SetValues(e.JobInputData.Vehicle)); + } + + #endregion + } +} diff --git a/VECTO3GUI/ViewModel/Interfaces/FuelConsumptionEntry.cs b/VECTO3GUI/ViewModel/Interfaces/FuelConsumptionEntry.cs new file mode 100644 index 0000000000000000000000000000000000000000..41d71f3ecb4215d92d946afe192a200553e5ef12 --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/FuelConsumptionEntry.cs @@ -0,0 +1,37 @@ +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; +using VECTO3.ViewModel.Impl; + +namespace VECTO3.ViewModel.Interfaces { + public class FuelConsumptionEntry : ObservableObject + { + private PerSecond _engineSpeed; + private NewtonMeter _torque; + private KilogramPerSecond _fuelConsumption; + + public FuelConsumptionEntry(FuelConsumptionMap.Entry entry) + { + EngineSpeed = entry.EngineSpeed; + Torque = entry.Torque; + FuelConsumption = entry.FuelConsumption; + } + + public PerSecond EngineSpeed + { + get { return _engineSpeed; } + set { SetProperty(ref _engineSpeed, value); } + } + + public NewtonMeter Torque + { + get { return _torque; } + set { SetProperty(ref _torque, value); } + } + + public KilogramPerSecond FuelConsumption + { + get { return _fuelConsumption; } + set { SetProperty(ref _fuelConsumption, value); } + } + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Interfaces/FullLoadEntry.cs b/VECTO3GUI/ViewModel/Interfaces/FullLoadEntry.cs new file mode 100644 index 0000000000000000000000000000000000000000..c4b88e5084e9ec111409ddb5db432ddcbf3ccb11 --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/FullLoadEntry.cs @@ -0,0 +1,43 @@ +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; +using VECTO3.ViewModel.Impl; + +namespace VECTO3.ViewModel.Interfaces { + public class FullLoadEntry : ObservableObject + { + private PerSecond _engineSpeed; + private NewtonMeter _maxTorque; + private NewtonMeter _dragTorque; + + //public FullLoadEntry(EngineFullLoadCurve.FullLoadCurveEntry entry) + //{ + // EngineSpeed = entry.EngineSpeed; + // MaxTorque = entry.TorqueFullLoad; + // DragTorque = entry.TorqueDrag; + //} + public FullLoadEntry(EngineFullLoadCurve entry) + { + //EngineSpeed = entry.EngineSpeed; + //MaxTorque = entry.TorqueFullLoad; + //DragTorque = entry.TorqueDrag; + } + + public PerSecond EngineSpeed + { + get { return _engineSpeed; } + set { SetProperty(ref _engineSpeed, value); } + } + + public NewtonMeter MaxTorque + { + get { return _maxTorque; } + set { SetProperty(ref _maxTorque, value); } + } + + public NewtonMeter DragTorque + { + get { return _dragTorque; } + set { SetProperty(ref _dragTorque, value); } + } + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Interfaces/Gear.cs b/VECTO3GUI/ViewModel/Interfaces/Gear.cs new file mode 100644 index 0000000000000000000000000000000000000000..03034d92c31f000fb478d9b96cb9d8a631ea601a --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/Gear.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.ObjectModel; +using System.Linq; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Reader.ComponentData; +using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; +using VECTO3.Util; +using VECTO3.ViewModel.Impl; + +namespace VECTO3.ViewModel.Interfaces { + public class Gear : ValidatingViewModel + { + private PerSecond _maxSpeed; + private NewtonMeter _maxTorque; + private double _ratio; + private int _gearNumber; + + private ObservableCollection<Gear> _gears; + + public Gear(ObservableCollection<Gear> container) + { + _gears = container; + LossMap = new ObservableCollection<GearLossMapEntry>(); + } + + public Gear(ObservableCollection<Gear> container, ITransmissionInputData gearData) : this(container) + { + GearNumber = gearData.Gear; + Ratio = gearData.Ratio; + MaxTorque = gearData.MaxTorque; + MaxSpeed = gearData.MaxInputSpeed; + LossMap.Clear(); + //ToDo + //var lossMap = TransmissionLossMapReader.Create(gearData.LossMap, Ratio, $"Gear {GearNumber}") + // .Entries.OrderBy(x => x.InputSpeed).ThenBy(x => x.InputTorque); + //foreach (var entry in lossMap) { + // LossMap.Add(new GearLossMapEntry(entry)); + //} + } + + // not required - readonly property! [CustomValidation(typeof(Gear), "ValidateGearNumber")] + public int GearNumber + { + get { return _gearNumber; } + private set { SetProperty(ref _gearNumber, value); } + } + + [VectoParameter(typeof(TransmissionData), "Ratio")] + public double Ratio + { + get { return _ratio; } + set { SetProperty(ref _ratio, value); } + } + + [SIRange(0, Double.MaxValue)] + public NewtonMeter MaxTorque + { + get { return _maxTorque; } + set { SetProperty(ref _maxTorque, value); } + } + + [VectoParameter(typeof(GearData), "MaxSpeed")] + public PerSecond MaxSpeed + { + get { return _maxSpeed; } + set { SetProperty(ref _maxSpeed, value); } + } + + public ObservableCollection<GearLossMapEntry> LossMap { get; } + + //public static ValidationResult ValidateGearNumber(int gearNbr, ValidationContext context) + //{ + // var entry = context.ObjectInstance as Gear; + // if (entry == null) { + // return new ValidationResult("Unknown object instance"); + // } + + // var otherGears = entry._gears.Where(x => x != entry).ToArray(); + + // if (otherGears.Any(x => x.GearNumber == gearNbr)) { + // return new ValidationResult("Gear number has to be unique!", new [] {context.MemberName}); + // } + + // return ValidationResult.Success; + //} + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Interfaces/GearLossMapEntry.cs b/VECTO3GUI/ViewModel/Interfaces/GearLossMapEntry.cs new file mode 100644 index 0000000000000000000000000000000000000000..e8794331d44126e02bbd1a49adfb3be0cf404aa8 --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/GearLossMapEntry.cs @@ -0,0 +1,37 @@ +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; +using VECTO3.ViewModel.Impl; + +namespace VECTO3.ViewModel.Interfaces { + public class GearLossMapEntry : ObservableObject + { + private NewtonMeter _torqueLoss; + private PerSecond _inputSpeed; + private NewtonMeter _inputTorque; + + public GearLossMapEntry(TransmissionLossMap.GearLossMapEntry entry) + { + InputSpeed = entry.InputSpeed; + InputTorque = entry.InputTorque; + TorqueLoss = entry.TorqueLoss; + } + + public PerSecond InputSpeed + { + get { return _inputSpeed; } + set { SetProperty(ref _inputSpeed, value); } + } + + public NewtonMeter InputTorque + { + get { return _inputTorque; } + set { SetProperty( ref _inputTorque, value); } + } + + public NewtonMeter TorqueLoss + { + get { return _torqueLoss; } + set { SetProperty(ref _torqueLoss, value); } + } + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Interfaces/IAirdragViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/IAirdragViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..b6e1f158472a75a9e6676d005e09e79773859b8c --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/IAirdragViewModel.cs @@ -0,0 +1,15 @@ +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Utils; + +namespace VECTO3.ViewModel.Interfaces +{ + public interface IAirdragViewModel : IComponentViewModel, ICommonComponentParameters + { + IAirdragDeclarationInputData ModelData { get; } + + bool UseMeasuredValues { get; set; } + SquareMeter CdxA_0 { get; set; } + SquareMeter TransferredCdxA { get; set; } + SquareMeter DeclaredCdxA { get; set; } + } +} diff --git a/VECTO3GUI/ViewModel/Interfaces/IAngledriveViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/IAngledriveViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..0337a2e40c6a8ebf411efb0a90faeeac17087c99 --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/IAngledriveViewModel.cs @@ -0,0 +1,19 @@ +using System.Collections.ObjectModel; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using VECTO3.Util; + +namespace VECTO3.ViewModel.Interfaces +{ + public interface IAngledriveViewModel : IComponentViewModel, ICommonComponentParameters + { + IAngledriveInputData ModelData { get; } + + CertificationMethod CertificationMethod { get; set; } + AllowedEntry<CertificationMethod>[] AllowedCertificationMethods { get; } + + double Ratio { get; set; } + ObservableCollection<GearLossMapEntry> LossMap { get; } + AngledriveType AngledriveType { get; } + } +} diff --git a/VECTO3GUI/ViewModel/Interfaces/IAuxiliariesViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/IAuxiliariesViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..063ac310827de83f58183d15c66ed3179800a5f9 --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/IAuxiliariesViewModel.cs @@ -0,0 +1,25 @@ +using System.Collections.ObjectModel; +using TUGraz.VectoCommon.InputData; +using VECTO3.Util; + +namespace VECTO3.ViewModel.Interfaces { + public interface IAuxiliariesViewModel : IComponentViewModel + { + IAuxiliariesDeclarationInputData ModelData { get; } + + string PneumaticSystemTechnology { get; set; } + AllowedEntry<string>[] AllowedPneumaticSystemTechnologies { get; } + + string FanTechnology { get; set; } + AllowedEntry<string>[] AllowedFanTechnologies { get; } + + ObservableCollection<SteeringPumpEntry> SteeringPumpTechnologies { get; } + AllowedEntry<string>[] AllowedSteeringPumpTechnologies { get; } + + string ElectricSystemTechnology { get; set; } + AllowedEntry<string>[] AllowedElectricSystemTechnologies { get; } + + string HVACTechnology { get; set; } + AllowedEntry<string>[] AllowedHVACTechnologies { get; } + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Interfaces/IAxleViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/IAxleViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..00d0a7431cd69af5c949a5a267b52f5855904557 --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/IAxleViewModel.cs @@ -0,0 +1,18 @@ +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using VECTO3.Util; + +namespace VECTO3.ViewModel.Interfaces { + public interface IAxleViewModel : IComponentViewModel + { + IAxleDeclarationInputData ModelData { get; } + + int AxleIndex { get; } + AxleType AxleType { get; set; } + bool TwinTyres { get; set; } + bool Steered { get; set; } + ITyreViewModel Tyre { get; } + AllowedEntry<AxleType>[] AllowedAxleTypes { get; } + + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Interfaces/IAxlegearViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/IAxlegearViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..ba29a81a614038aca0524bd7c564e110be127924 --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/IAxlegearViewModel.cs @@ -0,0 +1,21 @@ +using System.Collections.ObjectModel; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using VECTO3.Util; + +namespace VECTO3.ViewModel.Interfaces +{ + public interface IAxlegearViewModel : IComponentViewModel, ICommonComponentParameters + { + IAxleGearInputData ModelData { get; } + + CertificationMethod CertificationMethod { get; set; } + AllowedEntry<CertificationMethod>[] AllowedCertificationMethods { get; } + + double Ratio { get; set; } + AxleLineType LineType { get; set; } + + AllowedEntry<AxleLineType>[] AllowedLineTypes { get; } + ObservableCollection<GearLossMapEntry> LossMap { get; } + } +} diff --git a/VECTO3GUI/ViewModel/Interfaces/IAxlesViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/IAxlesViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..e10dc884936d3e413534a8a4c980014bdff9aba8 --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/IAxlesViewModel.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; + +namespace VECTO3.ViewModel.Interfaces { + public interface IAxlesViewModel : IComponentViewModel + { + IList<IAxleDeclarationInputData> ModelData { get; } + + AxleConfiguration AxleConfiguration { get; } + IAxleViewModel CurrentAxle { get; set; } + + ObservableCollection<IAxleViewModel> Axles { get; } + + int NumSteeredAxles { get; } + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Interfaces/ICommonComponentParameters.cs b/VECTO3GUI/ViewModel/Interfaces/ICommonComponentParameters.cs new file mode 100644 index 0000000000000000000000000000000000000000..a8c566056df2d73f208a88493259877dd648e50a --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/ICommonComponentParameters.cs @@ -0,0 +1,11 @@ +using System; + +namespace VECTO3.ViewModel.Interfaces { + public interface ICommonComponentParameters + { + string Manufacturer { get; set; } + string Model { get; set; } + string CertificationNumber { get; set; } + DateTime? Date { get; set; } + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Interfaces/IComponentViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/IComponentViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..bef22cf8b2c0830d1c794c0a1e5b81a925952c64 --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/IComponentViewModel.cs @@ -0,0 +1,19 @@ +using System.Collections.ObjectModel; +using TUGraz.VectoCommon.InputData; +using VECTO3.Util; +using VECTO3.ViewModel.Impl; + +namespace VECTO3.ViewModel.Interfaces { + public interface IComponentViewModel + { + IJobEditViewModel JobViewModel { set; } + + bool DeclarationMode { get; } + + + ObservableCollection<Component> Components { get; } + IComponentViewModel ParentViewModel { get; set; } + + IComponentViewModel GetComponentViewModel(Component component); + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Interfaces/ICyclesViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/ICyclesViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..317cd920106f02aa58eab324aa4e774848e02619 --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/ICyclesViewModel.cs @@ -0,0 +1,9 @@ +using System.Collections.ObjectModel; + +namespace VECTO3.ViewModel.Interfaces +{ + public interface ICyclesViewModel : IComponentViewModel + { + ObservableCollection<string> Cycles { get; } + } +} diff --git a/VECTO3GUI/ViewModel/Interfaces/IEngineViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/IEngineViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..a22a15d6e7a1bfe547c7fd1dac7a0ffe37f4ba58 --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/IEngineViewModel.cs @@ -0,0 +1,31 @@ +using System.Collections.ObjectModel; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using VECTO3.Util; + +namespace VECTO3.ViewModel.Interfaces +{ + public interface IEngineViewModel : IComponentViewModel, ICommonComponentParameters + { + IEngineDeclarationInputData ModelData { get; } + + + CubicMeter Displacement { get; set; } + PerSecond IdlingSpeed { get; set; } + PerSecond RatedSpeed { get; set; } + Watt RatedPower { get; set; } + NewtonMeter MaxEngineTorque { get; set; } + double WHTCUrban { get; set; } + double WHTCRural { get; set; } + double WHTCMotorway { get; set; } + double BFColdHot { get; set; } + double CFRegPer { get; set; } + double CFNCV { get; set; } + FuelType FuelType { get; set; } + AllowedEntry<FuelType>[] AllowedFuelTypes { get; } + ObservableCollection<FuelConsumptionEntry> FCMap { get; } + ObservableCollection<FullLoadEntry> FullLoadCurve { get; } + double EngineeringCF { get; set; } + } +} diff --git a/VECTO3GUI/ViewModel/Interfaces/IGearboxViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/IGearboxViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..540f821a134f0f552eba124d32e259fe7f2b4bd3 --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/IGearboxViewModel.cs @@ -0,0 +1,21 @@ +using System.Collections.ObjectModel; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using VECTO3.Util; + +namespace VECTO3.ViewModel.Interfaces +{ + public interface IGearboxViewModel : IComponentViewModel, ICommonComponentParameters + { + IGearboxDeclarationInputData ModelData { get; } + + CertificationMethod CertificationMethod { get; set; } + AllowedEntry<CertificationMethod>[] AllowedCertificationMethods { get; } + + GearboxType TransmissionType { get; set; } + AllowedEntry<GearboxType>[] AllowedTransmissionTypes { get; } + ObservableCollection<Gear> Gears { get; } + + Gear SelectedGear { get; set; } + } +} diff --git a/VECTO3GUI/ViewModel/Interfaces/IJobEditViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/IJobEditViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..c563da06119ef9ae92d3eac52f4696ca9df3883b --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/IJobEditViewModel.cs @@ -0,0 +1,24 @@ +using System.Collections.ObjectModel; +using System.Windows.Input; +using TUGraz.VectoCommon.InputData; +using VECTO3.Util; + +namespace VECTO3.ViewModel.Interfaces +{ + public interface IJobEditViewModel + { + + string JobFile { get; } + + IInputDataProvider InputDataProvider { get; set; } + + bool DeclarationMode { get; } + ObservableCollection<Component> Components { get; } + ICommand EditComponent { get; } + IComponentViewModel CurrentComponent { get; } + + ICommand SaveJob { get; } + + ICommand CloseJob { get; } + } +} diff --git a/VECTO3GUI/ViewModel/Interfaces/IJoblistViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/IJoblistViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..5cbfac3644687d14948b4043d3befda44a07856b --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/IJoblistViewModel.cs @@ -0,0 +1,18 @@ +using System.Collections.ObjectModel; +using System.Windows.Input; +using VECTO3.ViewModel.Impl; + +namespace VECTO3.ViewModel.Interfaces +{ + public interface IJoblistViewModel : IMainView + { + ObservableCollection<JobEntry> Jobs { get; } + ICommand AddJob { get; } + ICommand RemoveJob { get; } + ICommand MoveJobUp { get; } + ICommand MoveJobDown { get; } + ICommand StartSimulation { get; } + ICommand EditJob { get; } + ICommand JobEntrySetActive { get; } + } +} diff --git a/VECTO3GUI/ViewModel/Interfaces/IMainView.cs b/VECTO3GUI/ViewModel/Interfaces/IMainView.cs new file mode 100644 index 0000000000000000000000000000000000000000..a6ef58bf0469d7eef1bfa87e6fb6b14bf88e7d1e --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/IMainView.cs @@ -0,0 +1,4 @@ +namespace VECTO3.ViewModel.Interfaces { + public interface IMainView + { } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Interfaces/IMainWindowViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/IMainWindowViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..2b2f971b1a18d5d2d672ca2a35e6a02c5069828d --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/IMainWindowViewModel.cs @@ -0,0 +1,7 @@ +namespace VECTO3.ViewModel.Interfaces +{ + public interface IMainWindowViewModel + { + IMainView CurrentViewModel { get; } + } +} diff --git a/VECTO3GUI/ViewModel/Interfaces/INoneViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/INoneViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..04ab1d1548d04a34815173f26f8e3a001dcb1add --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/INoneViewModel.cs @@ -0,0 +1,3 @@ +namespace VECTO3.ViewModel.Interfaces { + internal interface INoneViewModel : IComponentViewModel { } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Interfaces/IRetarderViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/IRetarderViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..9425add90dcf1060dbf8d97c1de061b30cc80a1a --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/IRetarderViewModel.cs @@ -0,0 +1,19 @@ +using System.Collections.ObjectModel; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using VECTO3.Util; + +namespace VECTO3.ViewModel.Interfaces +{ + public interface IRetarderViewModel : IComponentViewModel, ICommonComponentParameters + { + IRetarderInputData ModelData { get; } + + CertificationMethod CertificationMethod { get; set; } + AllowedEntry<CertificationMethod>[] AllowedCertificationMethods { get; } + + ObservableCollection<RetarderLossMapEntry> LossMap { get; } + RetarderType Type { get; set; } + double Ratio { get; set; } + } +} diff --git a/VECTO3GUI/ViewModel/Interfaces/ITorqueConverterViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/ITorqueConverterViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..6b799539abab5048a1f54187469c3cd0a855fd8a --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/ITorqueConverterViewModel.cs @@ -0,0 +1,17 @@ +using System.Collections.ObjectModel; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using VECTO3.Util; + +namespace VECTO3.ViewModel.Interfaces +{ + public interface ITorqueConverterViewModel : IComponentViewModel, ICommonComponentParameters + { + ITorqueConverterDeclarationInputData ModelData { get; } + + CertificationMethod CertificationMethod { get; set; } + AllowedEntry<CertificationMethod>[] AllowedCertificationMethods { get; } + + ObservableCollection<TorqueConverterCharacteristics> Characteristics { get; } + } +} diff --git a/VECTO3GUI/ViewModel/Interfaces/ITyreViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/ITyreViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..fae23eabcad3b2821574231576ed434b5563c15b --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/ITyreViewModel.cs @@ -0,0 +1,15 @@ +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Utils; +using VECTO3.Util; + +namespace VECTO3.ViewModel.Interfaces { + public interface ITyreViewModel : IComponentViewModel, ICommonComponentParameters + { + ITyreDeclarationInputData ModelData { get; } + + string Dimension { get; set; } + AllowedEntry<string>[] AllowedDimensions { get; } + double RollingResistanceCoefficient { get; set; } + Newton FzISO { get; set; } + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Interfaces/IVehicleViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/IVehicleViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..5233bc1bd672e515667737a21cf0c37709af6f3e --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/IVehicleViewModel.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.ObjectModel; +using System.Windows.Input; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Declaration; +using VECTO3.Util; + +namespace VECTO3.ViewModel.Interfaces { + public interface IVehicleViewModel : IComponentViewModel + { + IVehicleDeclarationInputData ModelData { get; } + + string Manufacturer { get; set; } + string ManufacturerAddress { get; set; } + string Model { get; set; } + string VIN { get; set; } + DateTime Date { get; set; } + LegislativeClass LegislativeClass { get; set; } + VehicleCategory VehicleCategory { get; set; } + AxleConfiguration AxleConfiguration { get; set; } + VehicleClass? VehicleClass { get; } + Kilogram CurbMassChassis { get; set; } + Kilogram GrossVehicleMass { get; set; } + PerSecond IdlingSpeed { get; set; } + RetarderType RetarderType { get; set; } + double RetarderRatio { get; set; } + AngledriveType AngledriveType { get; set; } + string PTOTechnology { get; set; } + AllowedEntry<string>[] AllowedPTOTechnologies { get; } + AllowedEntry<LegislativeClass>[] AllowedLegislativeClasses { get; } + AllowedEntry<VehicleCategory>[] AllowedVehicleCategories { get; } + AllowedEntry<AxleConfiguration>[] AllowedAxleConfigurations { get; } + AllowedEntry<RetarderType>[] AllowedRetarderTypes { get; } + AllowedEntry<AngledriveType>[] AllowedAngledriveTypes { get; } + bool HasDedicatedRetarder { get; } + ObservableCollection<TorqueEntry> TorqueLimits { get; } + + ICommand AddTorqueLimit { get; } + ICommand RemoveTorqueLimit { get; } + } + + +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Interfaces/RetarderLossMapEntry.cs b/VECTO3GUI/ViewModel/Interfaces/RetarderLossMapEntry.cs new file mode 100644 index 0000000000000000000000000000000000000000..b6fdf574eee12d68b7a832e3e63a1a3e7a6fc6f1 --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/RetarderLossMapEntry.cs @@ -0,0 +1,29 @@ +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.SimulationComponent.Data; +using VECTO3.ViewModel.Impl; + +namespace VECTO3.ViewModel.Interfaces { + public class RetarderLossMapEntry : ObservableObject + { + private NewtonMeter _torqueLoss; + private PerSecond _retarderSpeed; + + public RetarderLossMapEntry(RetarderLossMap.RetarderLossEntry entry) + { + RetarderSpeed = entry.RetarderSpeed; + TorqueLoss = entry.TorqueLoss; + } + + public PerSecond RetarderSpeed + { + get { return _retarderSpeed; } + set { SetProperty(ref _retarderSpeed, value); } + } + + public NewtonMeter TorqueLoss + { + get { return _torqueLoss; } + set {SetProperty(ref _torqueLoss, value); } + } + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Interfaces/SteeringPumpEntry.cs b/VECTO3GUI/ViewModel/Interfaces/SteeringPumpEntry.cs new file mode 100644 index 0000000000000000000000000000000000000000..897f7dd29c2f7aa1656e65deaff82bcb84e6e0a3 --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/SteeringPumpEntry.cs @@ -0,0 +1,27 @@ +using VECTO3.ViewModel.Impl; + +namespace VECTO3.ViewModel.Interfaces { + public class SteeringPumpEntry : ObservableObject + { + private string _steeringPumpTechnology; + private int _steeredAxle; + + public SteeringPumpEntry(int idx, string tech) + { + _steeredAxle = idx; + _steeringPumpTechnology = tech; + } + + public int SteeredAxle + { + get { return _steeredAxle; } + set { SetProperty(ref _steeredAxle, value); } + } + + public string SteeringPumpTechnology + { + get { return _steeringPumpTechnology; } + set { SetProperty(ref _steeringPumpTechnology, value); } + } + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Interfaces/TorqueConverterCharacteristics.cs b/VECTO3GUI/ViewModel/Interfaces/TorqueConverterCharacteristics.cs new file mode 100644 index 0000000000000000000000000000000000000000..d851c580d2725d79b2742ffdb72b78c261418c88 --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/TorqueConverterCharacteristics.cs @@ -0,0 +1,20 @@ +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; + +namespace VECTO3.ViewModel.Interfaces { + public class TorqueConverterCharacteristics + { + public TorqueConverterCharacteristics(TorqueConverterEntry entry) + { + SpeedRatio = entry.SpeedRatio; + TorqueRatio = entry.TorqueRatio; + InputTorqueRef = entry.Torque; + } + + public double SpeedRatio { get; set; } + + public double TorqueRatio { get; set; } + + public NewtonMeter InputTorqueRef { get; set; } + } +} \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Interfaces/TorqueEntry.cs b/VECTO3GUI/ViewModel/Interfaces/TorqueEntry.cs new file mode 100644 index 0000000000000000000000000000000000000000..f048c1064bc66c7b5096deda01dbbed6cf4fd65b --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/TorqueEntry.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Utils; +using VECTO3.ViewModel.Impl; + +namespace VECTO3.ViewModel.Interfaces { + + + public class TorqueEntry : ValidatingViewModel + { + private int _gear; + private NewtonMeter _maxTorque; + + private ObservableCollection<TorqueEntry> _parent; + + public TorqueEntry(ObservableCollection<TorqueEntry> parent, int gear, NewtonMeter maxTorque) + { + _parent = parent; + Gear = gear; + MaxTorque = maxTorque; + } + + public TorqueEntry(ObservableCollection<TorqueEntry> parent, ITorqueLimitInputData entry) + { + _parent = parent; + Gear = entry.Gear; + MaxTorque = entry.MaxTorque; + } + + [CustomValidation(typeof(TorqueEntry), "ValidateUniqueGear"), + Range(1, 99)] + public int Gear + { + get { return _gear; } + set { SetProperty(ref _gear, value); } + } + + [SIRange(double.Epsilon, double.MaxValue)] + public NewtonMeter MaxTorque + { + get { return _maxTorque; } + set { SetProperty(ref _maxTorque, value); } + } + + public static ValidationResult ValidateUniqueGear(int gear, ValidationContext validationContext) + { + var entry = validationContext.ObjectInstance as TorqueEntry; + if (entry == null) { + return new ValidationResult("Unknown object instance"); + } + if (entry._parent.Any(x => x != entry && x.Gear == gear)) { + return new ValidationResult("Gear number has to be uniqe!", new []{ validationContext.MemberName}); + } + return ValidationResult.Success; + } + } +} \ No newline at end of file diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/AirdragDeclarationView.xaml b/VECTO3GUI/Views/ComponentViews/Declaration/AirdragDeclarationView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..d3cf0fd21944b2d2b49df308c8c081ffcba3e7c5 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/AirdragDeclarationView.xaml @@ -0,0 +1,47 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Declaration.AirdragDeclarationView" + 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:viewModel="clr-namespace:VECTO3.ViewModel" + xmlns:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + xmlns:customControls="clr-namespace:VECTO3.Views.CustomControls" + xmlns:helper="clr-namespace:VECTO3.Helper" + mc:Ignorable="d" + d:DesignHeight="800" d:DesignWidth="800"> + <d:AirdragDeclarationView.DataContext> + <x:Type Type="interfaces:IAirdragViewModel"/> + </d:AirdragDeclarationView.DataContext> + + <StackPanel Orientation="Vertical" Width="400" HorizontalAlignment="Left" Grid.IsSharedSizeScope="True"> + <customControls:CheckboxParameter + Caption="Use Measured Values" CaptionWidthGroup="lblWidth" + Value="{Binding UseMeasuredValues}" UnitWidthGroup="unitWidth" + /> + <customControls:CommonDeclarationComponentData + Model="{Binding Model}" + Manufacturer="{Binding Manufacturer}" + Date="{Binding Date}" + CertificationNumber="{Binding CertificationNumber}" + IsEnabled="{Binding UseMeasuredValues}"/> + <customControls:VectoParameterControl + Caption="Cd x A 0" CaptionWidthGroup="lblWidth" + Unit="{helper:SIUnit CdxA_0}" UnitWidthGroup="unitWidth" + Value="{Binding CdxA_0}" + IsEnabled="{Binding UseMeasuredValues}" + /> + <customControls:VectoParameterControl + Caption="Transferred Cd x A 0" CaptionWidthGroup="lblWidth" + Unit="{helper:SIUnit TransferredCdxA}" UnitWidthGroup="unitWidth" + Value="{Binding TransferredCdxA}" + IsEnabled="{Binding UseMeasuredValues}" + /> + <customControls:VectoParameterControl + Caption="DeclaredCd x A 0" CaptionWidthGroup="lblWidth" + Unit="{helper:SIUnit DeclaredCdxA}" UnitWidthGroup="unitWidth" + Value="{Binding DeclaredCdxA}" + IsEnabled="{Binding UseMeasuredValues}" + /> + + </StackPanel> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/AirdragDeclarationView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Declaration/AirdragDeclarationView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..5d69cb697e2c0238406e032e0ece1083c0edda23 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/AirdragDeclarationView.xaml.cs @@ -0,0 +1,15 @@ +using System.Windows.Controls; + +namespace VECTO3.Views.ComponentViews.Declaration +{ + /// <summary> + /// Interaction logic for AirdragDeclarationView.xaml + /// </summary> + public partial class AirdragDeclarationView : UserControl + { + public AirdragDeclarationView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/AngledriveDeclarationView.xaml b/VECTO3GUI/Views/ComponentViews/Declaration/AngledriveDeclarationView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..eb7a4f086970dc3fcd459b4935ba49ae8bc45e4b --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/AngledriveDeclarationView.xaml @@ -0,0 +1,78 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Declaration.AngledriveDeclarationView" + 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:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + xmlns:customControls="clr-namespace:VECTO3.Views.CustomControls" + xmlns:helper="clr-namespace:VECTO3.Helper" + mc:Ignorable="d" + d:DesignHeight="800" d:DesignWidth="800"> +<d:AngledriveDeclarationView.DataContext> + <x:Type Type="interfaces:IAngledriveViewModel"/> +</d:AngledriveDeclarationView.DataContext> + + <StackPanel Orientation="Vertical" Width="400" HorizontalAlignment="Left" Grid.IsSharedSizeScope="True"> + <customControls:CommonDeclarationComponentData + Model="{Binding Model}" + Manufacturer="{Binding Manufacturer}" + Date="{Binding Date, StringFormat=G}" + CertificationNumber="{Binding CertificationNumber}"/> + <customControls:ComboParameter + Caption="Certification Method" CaptionWidthGroup="lblWidth" + Unit="" UnitWidthGroup="unitWidth" + Value="{Binding CertificationMethod}" AllowedValues="{Binding AllowedCertificationMethods}" + /> + <customControls:VectoParameterControl + Caption="Ratio" CaptionWidthGroup="lblWidth" + Unit="-" UnitWidthGroup="unitWidth" + Value="{Binding Ratio}" + /> + <ListView ItemsSource="{Binding LossMap}" Margin="10" MinHeight="150" MaxHeight="300"> + <ListView.ItemContainerStyle> + <Style TargetType="ListViewItem"> + <Setter Property="HorizontalContentAlignment" Value="Stretch" /> + </Style> + </ListView.ItemContainerStyle> + <ListView.View> + <GridView> + <GridViewColumn Width="auto"> + <GridViewColumnHeader MinWidth="100" IsEnabled="False" Foreground="Black">Input Speed</GridViewColumnHeader> + <GridViewColumn.CellTemplate> + <DataTemplate DataType="interfaces:GearLossMapEntry"> + <DockPanel> + <TextBlock DockPanel.Dock="Right" Text="rpm"/> + <TextBox DockPanel.Dock="Right" Text="{Binding InputSpeed, Converter={helper:SIValueConverter}, ConverterParameter=AsRPM|double2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" BorderThickness="0" Background="Transparent" TextAlignment="Right"/> + </DockPanel> + </DataTemplate> + </GridViewColumn.CellTemplate> + </GridViewColumn> + <GridViewColumn Width="auto"> + <GridViewColumnHeader MinWidth="100" IsEnabled="False" Foreground="Black">Input Torque</GridViewColumnHeader> + <GridViewColumn.CellTemplate> + <DataTemplate DataType="interfaces:GearLossMapEntry"> + <DockPanel> + <TextBlock DockPanel.Dock="Right" Text="Nm"/> + <TextBox DockPanel.Dock="Right" Text="{Binding InputTorque, Converter={helper:SIValueConverter}, ConverterParameter=double2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" BorderThickness="0" Background="Transparent" TextAlignment="Right"/> + </DockPanel> + </DataTemplate> + </GridViewColumn.CellTemplate> + </GridViewColumn> + <GridViewColumn Width="auto"> + <GridViewColumnHeader MinWidth="100" IsEnabled="False" Foreground="Black">Torque Loss</GridViewColumnHeader> + <GridViewColumn.CellTemplate> + <DataTemplate DataType="interfaces:GearLossMapEntry"> + <DockPanel> + <TextBlock DockPanel.Dock="Right" Text="Nm"/> + <TextBox DockPanel.Dock="Right" Text="{Binding TorqueLoss, Converter={helper:SIValueConverter}, ConverterParameter=double2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" BorderThickness="0" Background="Transparent" TextAlignment="Right"/> + </DockPanel> + </DataTemplate> + </GridViewColumn.CellTemplate> + </GridViewColumn> + </GridView> + </ListView.View> + </ListView> + + </StackPanel> +</UserControl> + diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/AngledriveDeclarationView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Declaration/AngledriveDeclarationView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..8918f63ac4d2dbccc403415a679e3c9f77fc417e --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/AngledriveDeclarationView.xaml.cs @@ -0,0 +1,15 @@ +using System.Windows.Controls; + +namespace VECTO3.Views.ComponentViews.Declaration +{ + /// <summary> + /// Interaction logic for AngledriveDeclarationView.xaml + /// </summary> + public partial class AngledriveDeclarationView : UserControl + { + public AngledriveDeclarationView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/AuxiliariesDeclarationView.xaml b/VECTO3GUI/Views/ComponentViews/Declaration/AuxiliariesDeclarationView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..5a57e131a1cb670d6f674db2f4d29eb5cf1e9103 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/AuxiliariesDeclarationView.xaml @@ -0,0 +1,47 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Declaration.AuxiliariesDeclarationView" + 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:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + xmlns:customControls="clr-namespace:VECTO3.Views.CustomControls" + mc:Ignorable="d" + d:DesignHeight="800" d:DesignWidth="800"> + <d:EditCyclesView.DataContext> + <x:Type Type="interfaces:IAuxiliariesViewModel"/> + </d:EditCyclesView.DataContext> + <StackPanel Orientation="Vertical" Width="400" HorizontalAlignment="Left" Grid.IsSharedSizeScope="True"> + <customControls:ComboParameter + Caption="Fan Technology" CaptionWidthGroup="lblWidth" + Value="{Binding FanTechnology}" + AllowedValues="{Binding AllowedFanTechnologies}" /> + <DockPanel Margin="0,5"> + <TextBlock Margin="10,0" DockPanel.Dock="Top">Steering Pump Technologies</TextBlock> + <ItemsControl DockPanel.Dock="Bottom" ItemsSource="{Binding SteeringPumpTechnologies}" Name="SteeringPumps"> + <ItemsControl.ItemTemplate> + <DataTemplate DataType="interfaces:SteeringPumpEntry"> + <StackPanel> + <customControls:ComboParameter + Caption="{Binding SteeredAxle, StringFormat='{}{0}. Axle' }" CaptionWidthGroup="lblWidth" + Value="{Binding SteeringPumpTechnology}" + AllowedValues="{Binding Path=DataContext.AllowedSteeringPumpTechnologies, ElementName=SteeringPumps}"/> + + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </DockPanel> + <customControls:ComboParameter + Caption="Electric System Technology" CaptionWidthGroup="lblWidth" + Value="{Binding ElectricSystemTechnology}" + AllowedValues="{Binding AllowedElectricSystemTechnologies}" /> + <customControls:ComboParameter + Caption="Pneumatic System Technology" CaptionWidthGroup="lblWidth" + Value="{Binding PneumaticSystemTechnology}" + AllowedValues="{Binding AllowedPneumaticSystemTechnologies}" /> + <customControls:ComboParameter + Caption="HVAC Technology" CaptionWidthGroup="lblWidth" + Value="{Binding HVACTechnology}" + AllowedValues="{Binding AllowedHVACTechnologies}" /> + </StackPanel> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/AuxiliariesDeclarationView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Declaration/AuxiliariesDeclarationView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..6181a46570539e906b5ee101f43477d7dc9e46e3 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/AuxiliariesDeclarationView.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 VECTO3.Views.ComponentViews.Declaration +{ + /// <summary> + /// Interaction logic for AuxiliariesDeclarationView.xaml + /// </summary> + public partial class AuxiliariesDeclarationView : UserControl + { + public AuxiliariesDeclarationView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/AxleDeclarationView.xaml b/VECTO3GUI/Views/ComponentViews/Declaration/AxleDeclarationView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..782c552e6adf893c4aed9f740d0b47e62b724c31 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/AxleDeclarationView.xaml @@ -0,0 +1,35 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Declaration.AxleDeclarationView" + 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:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + xmlns:customControls="clr-namespace:VECTO3.Views.CustomControls" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <d:AxleDeclarationView.DataContext> + <x:Type Type="interfaces:IAxleViewModel"/> + </d:AxleDeclarationView.DataContext> + <StackPanel Orientation="Vertical" Width="400" HorizontalAlignment="Left" Grid.IsSharedSizeScope="True"> + <customControls:VectoParameterControl + Caption="Axle Number" CaptionWidthGroup="lblWidth" + Value="{Binding AxleIndex}" Unit="" UnitWidthGroup="unitWidth" + ValueAlign="center" IsEnabled="False" + /> + <customControls:ComboParameter + Caption="Axle Type" Value="{Binding AxleType}" AllowedValues="{Binding AllowedAxleTypes}" + CaptionWidthGroup="lblWidth" UnitWidthGroup="unitWidth" + /> + <customControls:CheckboxParameter + Caption="Steered" CaptionWidthGroup="lblWidth" + Unit="" UnitWidthGroup="unitWidth" + Value="{Binding Steered}" + /> + <customControls:CheckboxParameter + Caption="Twin Tyres" CaptionWidthGroup="lblWidth" + Unit="" UnitWidthGroup="unitWidth" + Value="{Binding TwinTyres}" + /> + <ContentControl Content="{Binding Tyre}" MinHeight="100"/> + </StackPanel> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/AxleDeclarationView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Declaration/AxleDeclarationView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..073e08eb1da906a703276944de2f7c2cda96716b --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/AxleDeclarationView.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 VECTO3.Views.ComponentViews.Declaration +{ + /// <summary> + /// Interaction logic for AxleDeclarationView.xaml + /// </summary> + public partial class AxleDeclarationView : UserControl + { + public AxleDeclarationView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/AxlegearDeclarationView.xaml b/VECTO3GUI/Views/ComponentViews/Declaration/AxlegearDeclarationView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..d6b36a3add51ff798c265fa7a796849fdb65fceb --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/AxlegearDeclarationView.xaml @@ -0,0 +1,81 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Declaration.AxlegearDeclarationView" + 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:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + xmlns:helper="clr-namespace:VECTO3.Helper" + xmlns:customControls="clr-namespace:VECTO3.Views.CustomControls" + mc:Ignorable="d" + d:DesignHeight="800" d:DesignWidth="800"> + <d:AxlegearDeclarationView.DataContext> + <x:Type Type="interfaces:IAxlegearViewModel"/> + </d:AxlegearDeclarationView.DataContext> + <StackPanel Orientation="Vertical" Width="400" HorizontalAlignment="Left" Grid.IsSharedSizeScope="True"> + <customControls:CommonDeclarationComponentData + Model="{Binding Model}" + Manufacturer="{Binding Manufacturer}" + Date="{Binding Date, StringFormat=G}" + CertificationNumber="{Binding CertificationNumber}"/> + <customControls:ComboParameter + Caption="Certification Method" CaptionWidthGroup="lblWidth" + Unit="" UnitWidthGroup="unitWidth" + Value="{Binding CertificationMethod}" AllowedValues="{Binding AllowedCertificationMethods}" + /> + <customControls:ComboParameter + Caption="Line Type" CaptionWidthGroup="lblWidth" + Unit="" UnitWidthGroup="unitWidth" + Value="{Binding LineType}" + AllowedValues="{Binding AllowedLineTypes}"/> + <customControls:VectoParameterControl + Caption="Ratio" CaptionWidthGroup="lblWidth" + Unit="-" UnitWidthGroup="unitWidth" + Value="{Binding Ratio}" + /> + <ListView ItemsSource="{Binding LossMap}" Margin="10" MinHeight="150" MaxHeight="300"> + <ListView.ItemContainerStyle> + <Style TargetType="ListViewItem"> + <Setter Property="HorizontalContentAlignment" Value="Stretch" /> + </Style> + </ListView.ItemContainerStyle> + <ListView.View> + <GridView> + <GridViewColumn Width="auto"> + <GridViewColumnHeader MinWidth="100" IsEnabled="False" Foreground="Black">Input Speed</GridViewColumnHeader> + <GridViewColumn.CellTemplate> + <DataTemplate DataType="interfaces:GearLossMapEntry"> + <DockPanel> + <TextBlock DockPanel.Dock="Right" Text="rpm"/> + <TextBox DockPanel.Dock="Right" Text="{Binding InputSpeed, Converter={helper:SIValueConverter}, ConverterParameter=AsRPM|double2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" BorderThickness="0" Background="Transparent" TextAlignment="Right"/> + </DockPanel> + </DataTemplate> + </GridViewColumn.CellTemplate> + </GridViewColumn> + <GridViewColumn Width="auto"> + <GridViewColumnHeader MinWidth="100" IsEnabled="False" Foreground="Black">Input Torque</GridViewColumnHeader> + <GridViewColumn.CellTemplate> + <DataTemplate DataType="interfaces:GearLossMapEntry"> + <DockPanel> + <TextBlock DockPanel.Dock="Right" Text="Nm"/> + <TextBox DockPanel.Dock="Right" Text="{Binding InputTorque, Converter={helper:SIValueConverter}, ConverterParameter=double2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" BorderThickness="0" Background="Transparent" TextAlignment="Right"/> + </DockPanel> + </DataTemplate> + </GridViewColumn.CellTemplate> + </GridViewColumn> + <GridViewColumn Width="auto"> + <GridViewColumnHeader MinWidth="100" IsEnabled="False" Foreground="Black">Torque Loss</GridViewColumnHeader> + <GridViewColumn.CellTemplate> + <DataTemplate DataType="interfaces:GearLossMapEntry"> + <DockPanel> + <TextBlock DockPanel.Dock="Right" Text="Nm"/> + <TextBox DockPanel.Dock="Right" Text="{Binding TorqueLoss, Converter={helper:SIValueConverter}, ConverterParameter=double2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" BorderThickness="0" Background="Transparent" TextAlignment="Right"/> + </DockPanel> + </DataTemplate> + </GridViewColumn.CellTemplate> + </GridViewColumn> + </GridView> + </ListView.View> + </ListView> + + </StackPanel> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/AxlegearDeclarationView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Declaration/AxlegearDeclarationView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..ff55c4f1e41d126f314894798e3c2ca84f7940f8 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/AxlegearDeclarationView.xaml.cs @@ -0,0 +1,15 @@ +using System.Windows.Controls; + +namespace VECTO3.Views.ComponentViews.Declaration +{ + /// <summary> + /// Interaction logic for AxlegearDeclarationView.xaml + /// </summary> + public partial class AxlegearDeclarationView : UserControl + { + public AxlegearDeclarationView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/AxlesDeclarationView.xaml b/VECTO3GUI/Views/ComponentViews/Declaration/AxlesDeclarationView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..f419f2840145aea55ae1e57d288b2fdef3bdbdd5 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/AxlesDeclarationView.xaml @@ -0,0 +1,41 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Declaration.AxlesDeclarationView" + 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:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + mc:Ignorable="d" + d:DesignHeight="800" d:DesignWidth="800"> + <d:AxlesDeclarationView.DataContext> + <x:Type Type="interfaces:IAxlesViewModel"/> + </d:AxlesDeclarationView.DataContext> + <StackPanel Orientation="Vertical" Width="600" HorizontalAlignment="Left" Grid.IsSharedSizeScope="True"> + <TextBlock Margin="10, 5" Text="{Binding AxleConfiguration, Mode=OneWay}"/> + <DockPanel Margin="10, 10"> + <StackPanel DockPanel.Dock="Left"> + <ListView ItemsSource="{Binding Axles}" SelectedItem="{Binding CurrentAxle}" MinHeight="80" MaxHeight="200"> + <ListView.ItemContainerStyle> + <Style TargetType="ListViewItem"> + <Setter Property="HorizontalContentAlignment" Value="Stretch" /> + </Style> + </ListView.ItemContainerStyle> + <ListView.View> + <GridView > + <GridViewColumn Width="auto"> + <GridViewColumnHeader MinWidth="80" IsEnabled="False" Foreground="Black">Axle</GridViewColumnHeader> + <GridViewColumn.CellTemplate> + <DataTemplate DataType="interfaces:AxleViewModel"> + <DockPanel> + <TextBlock TextAlignment="Center" Text="{Binding AxleIndex}"/> + </DockPanel> + </DataTemplate> + </GridViewColumn.CellTemplate> + </GridViewColumn> + </GridView> + </ListView.View> + </ListView> + </StackPanel> + <ContentControl Content="{Binding CurrentAxle}" DockPanel.Dock="Right" Margin="20,0,10,0"/> + </DockPanel> + </StackPanel> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/AxlesDeclarationView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Declaration/AxlesDeclarationView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..b0f1d8ab111340a3568346244de11da5276798ff --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/AxlesDeclarationView.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 VECTO3.Views.ComponentViews.Declaration +{ + /// <summary> + /// Interaction logic for AxlesDeclarationView.xaml + /// </summary> + public partial class AxlesDeclarationView : UserControl + { + public AxlesDeclarationView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/CyclesDeclarationView.xaml b/VECTO3GUI/Views/ComponentViews/Declaration/CyclesDeclarationView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..65ab2bd0f960e1379d290088985a25a6253d0e87 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/CyclesDeclarationView.xaml @@ -0,0 +1,39 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Declaration.CyclesDeclarationView" + 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:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + xmlns:customControls="clr-namespace:VECTO3.Views.CustomControls" + xmlns:helper="clr-namespace:VECTO3.Helper" + mc:Ignorable="d" + d:DesignHeight="800" d:DesignWidth="800"> + <d:EditCyclesView.DataContext> + <x:Type Type="interfaces:ICyclesViewModel"/> + </d:EditCyclesView.DataContext> + <StackPanel Orientation="Vertical" Width="400" HorizontalAlignment="Left" Grid.IsSharedSizeScope="True"> + <ListView ItemsSource="{Binding Cycles}" Margin="10" MinHeight="150" MaxHeight="300"> + <ListView.ItemContainerStyle> + <Style TargetType="ListViewItem"> + <Setter Property="HorizontalContentAlignment" Value="Stretch" /> + </Style> + </ListView.ItemContainerStyle> + <ListView.View> + <GridView> + <GridViewColumn Width="auto"> + <GridViewColumnHeader MinWidth="300" IsEnabled="False" Foreground="Black">Cycle Name</GridViewColumnHeader> + <GridViewColumn.CellTemplate> + <DataTemplate> + <DockPanel> + <TextBlock DockPanel.Dock="Right" Text="{Binding }"/> + </DockPanel> + </DataTemplate> + </GridViewColumn.CellTemplate> + </GridViewColumn> + + </GridView> + </ListView.View> + </ListView> + + </StackPanel> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/CyclesDeclarationView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Declaration/CyclesDeclarationView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..c9db7f961da22e4a3388abb1ceeea793a2e16ec5 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/CyclesDeclarationView.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 VECTO3.Views.ComponentViews.Declaration +{ + /// <summary> + /// Interaction logic for CyclesDeclarationView.xaml + /// </summary> + public partial class CyclesDeclarationView : UserControl + { + public CyclesDeclarationView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/EngineDeclarationView.xaml b/VECTO3GUI/Views/ComponentViews/Declaration/EngineDeclarationView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..1622acc728a66154672aabddc280eab3641cbf9e --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/EngineDeclarationView.xaml @@ -0,0 +1,77 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Declaration.EngineDeclarationView" + 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:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + xmlns:customControls="clr-namespace:VECTO3.Views.CustomControls" + xmlns:helper="clr-namespace:VECTO3.Helper" + mc:Ignorable="d" + d:DesignHeight="800" d:DesignWidth="600"> + <d:EngineDeclarationView.DataContext> + <x:Type Type="interfaces:IEngineViewModel"/> + </d:EngineDeclarationView.DataContext> + + <StackPanel Orientation="Vertical" Width="400" HorizontalAlignment="Left" Grid.IsSharedSizeScope="True"> + <customControls:CommonDeclarationComponentData + Model="{Binding Model}" + Manufacturer="{Binding Manufacturer}" + Date="{Binding Date}" + CertificationNumber="{Binding CertificationNumber}" /> + <customControls:VectoParameterControl + Caption="Displacement" CaptionWidthGroup="lblWidth" + Value="{Binding Displacement, Converter={helper:SIValueConverter}, ConverterParameter=AsCubicCentimeter|int}" + ValueAlign="right" + Unit="cm³" UnitWidthGroup="unitWidth"/> + <customControls:VectoParameterControl + Caption="Idling Speed" CaptionWidthGroup="lblWidth" + Value="{Binding IdlingSpeed, Converter={helper:SIValueConverter}, ConverterParameter=AsRPM|int}" + ValueAlign="right" + Unit="rpm" UnitWidthGroup="unitWidth"/> + <customControls:VectoParameterControl + Caption="Rated Speed" CaptionWidthGroup="lblWidth" + Value="{Binding RatedSpeed, Converter={helper:SIValueConverter}, ConverterParameter=AsRPM|int}" + ValueAlign="right" + Unit="rpm" UnitWidthGroup="unitWidth"/> + <customControls:VectoParameterControl + Caption="Rated Power" CaptionWidthGroup="lblWidth" + Value="{Binding RatedPower, Converter={helper:SIValueConverter}, ConverterParameter=int}" + ValueAlign="right" + Unit="{helper:SIUnit RatedPower}" UnitWidthGroup="unitWidth"/> + <customControls:VectoParameterControl + Caption="Max. Engine Torque" CaptionWidthGroup="lblWidth" + Value="{Binding MaxEngineTorque, Converter={helper:SIValueConverter}, ConverterParameter=int}" + ValueAlign="right" + Unit="{helper:SIUnit MaxEngineTorque}" UnitWidthGroup="unitWidth"/> + <customControls:VectoParameterControl + Caption="WHTC Urban" CaptionWidthGroup="lblWidth" + Value="{Binding WHTCUrban}" ValueAlign="right" + Unit="" UnitWidthGroup="unitWidth" /> + <customControls:VectoParameterControl + Caption="WHTC Rural" CaptionWidthGroup="lblWidth" + Value="{Binding WHTCRural}" ValueAlign="right" + Unit="" UnitWidthGroup="unitWidth" /> + <customControls:VectoParameterControl + Caption="WHTC Motorway" CaptionWidthGroup="lblWidth" + Value="{Binding WHTCMotorway}" ValueAlign="right" + Unit="" UnitWidthGroup="unitWidth" /> + <customControls:VectoParameterControl + Caption="Cold/Hot Balancing Factor" CaptionWidthGroup="lblWidth" + Value="{Binding BFColdHot}" ValueAlign="right" + Unit="" UnitWidthGroup="unitWidth" /> + <customControls:VectoParameterControl + Caption="Correction Factor Reg. Per." CaptionWidthGroup="lblWidth" + Value="{Binding CFRegPer}" ValueAlign="right" + Unit="" UnitWidthGroup="unitWidth" /> + <customControls:VectoParameterControl + Caption="Correction Factor NCV" CaptionWidthGroup="lblWidth" + Value="{Binding CFNCV}" ValueAlign="right" + Unit="" UnitWidthGroup="unitWidth" /> + <customControls:ComboParameter + Caption="Fuel Type" CaptionWidthGroup="lblWidth" + UnitWidthGroup="unitWidth" + Value="{Binding FuelType}" + AllowedValues="{Binding AllowedFuelTypes}" + /> + </StackPanel> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/EngineDeclarationView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Declaration/EngineDeclarationView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..92507fdeae0e08bc03c152079a26d0b1cce30c0e --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/EngineDeclarationView.xaml.cs @@ -0,0 +1,15 @@ +using System.Windows.Controls; + +namespace VECTO3.Views.ComponentViews.Declaration +{ + /// <summary> + /// Interaction logic for EngineDeclarationView.xaml + /// </summary> + public partial class EngineDeclarationView : UserControl + { + public EngineDeclarationView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/GearboxDeclarationView.xaml b/VECTO3GUI/Views/ComponentViews/Declaration/GearboxDeclarationView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..dff1657be80047a62dfea5de7503b92063163090 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/GearboxDeclarationView.xaml @@ -0,0 +1,86 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Declaration.GearboxDeclarationView" + 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:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + xmlns:customControls="clr-namespace:VECTO3.Views.CustomControls" + xmlns:helper="clr-namespace:VECTO3.Helper" + mc:Ignorable="d" + d:DesignHeight="800" d:DesignWidth="800"> + <d:GearboxDeclarationView.DataContext> + <x:Type Type="interfaces:IGearboxViewModel"/> + </d:GearboxDeclarationView.DataContext> + <StackPanel Orientation="Vertical" Width="400" HorizontalAlignment="Left" Grid.IsSharedSizeScope="True"> + <customControls:CommonDeclarationComponentData + Model="{Binding Model}" + Manufacturer="{Binding Manufacturer}" + Date="{Binding Date, StringFormat=G}" + CertificationNumber="{Binding CertificationNumber}"/> + <customControls:ComboParameter + Caption="Certification Method" CaptionWidthGroup="lblWidth" + Unit="" UnitWidthGroup="unitWidth" + Value="{Binding CertificationMethod}" AllowedValues="{Binding AllowedCertificationMethods}" + /> + <customControls:ComboParameter + Caption="Gearbox Type" CaptionWidthGroup="lblWidth" + Unit="" UnitWidthGroup="unitWidth" + Value="{Binding TransmissionType}" + AllowedValues="{Binding AllowedTransmissionTypes}"/> + <DockPanel Margin="10,10"> + <StackPanel Orientation="Vertical" DockPanel.Dock="Left"> + <ListView ItemsSource="{Binding Gears}" SelectedItem="{Binding SelectedGear}" Name="GearList" MinHeight="70" MaxHeight="140"> + <ListView.ItemContainerStyle> + <Style TargetType="ListViewItem"> + <Setter Property="HorizontalContentAlignment" Value="Stretch" /> + </Style> + </ListView.ItemContainerStyle> + <ListView.View> + <GridView> + <GridViewColumn Width="auto"> + <GridViewColumnHeader MinWidth="40" IsEnabled="False" Foreground="Black">Gear</GridViewColumnHeader> + <GridViewColumn.CellTemplate> + <DataTemplate DataType="interfaces:Gear"> + <DockPanel> + <TextBlock TextAlignment="Center" Text="{Binding GearNumber}"/> + </DockPanel> + </DataTemplate> + </GridViewColumn.CellTemplate> + </GridViewColumn> + <GridViewColumn Width="auto"> + <GridViewColumnHeader MinWidth="60" IsEnabled="False" Foreground="Black">Ratio</GridViewColumnHeader> + <GridViewColumn.CellTemplate> + <DataTemplate DataType="interfaces:Gear"> + <DockPanel> + <TextBlock TextAlignment="Right" Text="{Binding Ratio}"/> + </DockPanel> + </DataTemplate> + </GridViewColumn.CellTemplate> + </GridViewColumn> + </GridView> + </ListView.View> + </ListView> + </StackPanel> + <StackPanel Orientation="Vertical" DockPanel.Dock="Right" Margin="10,0,0,0"> + <customControls:VectoParameterControl + Caption="Gear" CaptionWidthGroup="lblGWidth" + Value="{Binding SelectedGear.GearNumber, Mode=OneWay}" ValueAlign="right" IsEnabled="False" + UnitWidthGroup="unitWidth"/> + <customControls:VectoParameterControl + Caption="Ratio" CaptionWidthGroup="lblGWidth" + Value="{Binding SelectedGear.Ratio}" ValueAlign="right" + Unit="-" UnitWidthGroup="unitWidth"/> + <customControls:VectoParameterControl + Caption="Max Torque" CaptionWidthGroup="lblGWidth" + Value="{Binding SelectedGear.MaxTorque, Converter={helper:SIValueConverter}, ConverterParameter=int}" ValueAlign="right" + Unit="Nm" UnitWidthGroup="unitWidth"/> + <customControls:VectoParameterControl + Caption="Max Speed" CaptionWidthGroup="lblGWidth" + Value="{Binding SelectedGear.MaxSpeed, Converter={helper:SIValueConverter}, ConverterParameter=AsRPM|int}" + ValueAlign="right" + Unit="rpm" UnitWidthGroup="unitWidth" + /> + </StackPanel> + </DockPanel> + </StackPanel> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/GearboxDeclarationView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Declaration/GearboxDeclarationView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..ea1ec07df7ac9972470893ce0bb848ddf6f11bde --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/GearboxDeclarationView.xaml.cs @@ -0,0 +1,15 @@ +using System.Windows.Controls; + +namespace VECTO3.Views.ComponentViews.Declaration +{ + /// <summary> + /// Interaction logic for GearboxDeclarationView.xaml + /// </summary> + public partial class GearboxDeclarationView : UserControl + { + public GearboxDeclarationView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/RetarderDeclarationView.xaml b/VECTO3GUI/Views/ComponentViews/Declaration/RetarderDeclarationView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..7e4f0241b431d7767ff948b1c57114e7496f4929 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/RetarderDeclarationView.xaml @@ -0,0 +1,62 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Declaration.RetarderDeclarationView" + 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:viewModel="clr-namespace:VECTO3.ViewModel" + xmlns:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + xmlns:customControls="clr-namespace:VECTO3.Views.CustomControls" + xmlns:helper="clr-namespace:VECTO3.Helper" + mc:Ignorable="d" + d:DesignHeight="800" d:DesignWidth="800"> + <d:RetarderDeclarationView.DataContext> + <x:Type Type="interfaces:IRetarderViewModel"/> + </d:RetarderDeclarationView.DataContext> + <StackPanel Orientation="Vertical" Width="400" HorizontalAlignment="Left" Grid.IsSharedSizeScope="True"> + <customControls:CommonDeclarationComponentData + Model="{Binding Model}" + Manufacturer="{Binding Manufacturer}" + Date="{Binding Date}" + CertificationNumber="{Binding CertificationNumber}" /> + <customControls:ComboParameter + Caption="Certification Method" CaptionWidthGroup="lblWidth" + Unit="" UnitWidthGroup="unitWidth" + Value="{Binding CertificationMethod}" AllowedValues="{Binding AllowedCertificationMethods}" + /> + <StackPanel> + <ListView ItemsSource="{Binding LossMap}" Margin="10" MinHeight="150" MaxHeight="300"> + <ListView.ItemContainerStyle> + <Style TargetType="ListViewItem"> + <Setter Property="HorizontalContentAlignment" Value="Stretch" /> + </Style> + </ListView.ItemContainerStyle> + <ListView.View> + <GridView> + <GridViewColumn Width="auto"> + <GridViewColumnHeader MinWidth="100" IsEnabled="False" Foreground="Black">Input Speed</GridViewColumnHeader> + <GridViewColumn.CellTemplate> + <DataTemplate DataType="interfaces:RetarderLossMapEntry"> + <DockPanel> + <TextBlock DockPanel.Dock="Right" Text="rpm"/> + <TextBox DockPanel.Dock="Right" Text="{Binding RetarderSpeed, Converter={helper:SIValueConverter}, ConverterParameter=AsRPM|double2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" BorderThickness="0" Background="Transparent" TextAlignment="Right"/> + </DockPanel> + </DataTemplate> + </GridViewColumn.CellTemplate> + </GridViewColumn> + <GridViewColumn Width="auto"> + <GridViewColumnHeader MinWidth="100" IsEnabled="False" Foreground="Black">Torque Loss</GridViewColumnHeader> + <GridViewColumn.CellTemplate> + <DataTemplate DataType="interfaces:RetarderLossMapEntry"> + <DockPanel> + <TextBlock DockPanel.Dock="Right" Text="Nm"/> + <TextBox DockPanel.Dock="Right" Text="{Binding TorqueLoss, Converter={helper:SIValueConverter}, ConverterParameter=double2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" BorderThickness="0" Background="Transparent" TextAlignment="Right"/> + </DockPanel> + </DataTemplate> + </GridViewColumn.CellTemplate> + </GridViewColumn> + </GridView> + </ListView.View> + </ListView> + </StackPanel> + </StackPanel> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/RetarderDeclarationView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Declaration/RetarderDeclarationView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..fef896aab4c0bd2a2fb5633e0af9b99ef798aff6 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/RetarderDeclarationView.xaml.cs @@ -0,0 +1,15 @@ +using System.Windows.Controls; + +namespace VECTO3.Views.ComponentViews.Declaration +{ + /// <summary> + /// Interaction logic for RetarderDeclarationView.xaml + /// </summary> + public partial class RetarderDeclarationView : UserControl + { + public RetarderDeclarationView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/TorqueConverterDeclarationView.xaml b/VECTO3GUI/Views/ComponentViews/Declaration/TorqueConverterDeclarationView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..4f58548c1e83e0f4dc418d01c53e94fe0bbb4302 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/TorqueConverterDeclarationView.xaml @@ -0,0 +1,69 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Declaration.TorqueConverterDeclarationView" + 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:viewModel="clr-namespace:VECTO3.ViewModel" + xmlns:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + xmlns:customControls="clr-namespace:VECTO3.Views.CustomControls" + xmlns:helper="clr-namespace:VECTO3.Helper" + mc:Ignorable="d" + d:DesignHeight="800" d:DesignWidth="800"> + <d:TorqueConverterDeclarationView.DataContext> + <x:Type Type="interfaces:ITorqueConverterViewModel"/> + </d:TorqueConverterDeclarationView.DataContext> + <StackPanel Orientation="Vertical" Width="400" HorizontalAlignment="Left" Grid.IsSharedSizeScope="True"> + <customControls:CommonDeclarationComponentData + Model="{Binding Model}" + Manufacturer="{Binding Manufacturer}" + Date="{Binding Date}" + CertificationNumber="{Binding CertificationNumber}" /> + <customControls:ComboParameter + Caption="Certification Method" CaptionWidthGroup="lblWidth" + Unit="" UnitWidthGroup="unitWidth" + Value="{Binding CertificationMethod}" AllowedValues="{Binding AllowedCertificationMethods}" + /> + <ListView ItemsSource="{Binding Characteristics}" MinHeight="50" MaxHeight="200" Margin="10,10"> + <ListView.ItemContainerStyle> + <Style TargetType="ListViewItem"> + <Setter Property="HorizontalContentAlignment" Value="Stretch" /> + </Style> + </ListView.ItemContainerStyle> + <ListView.View> + <GridView> + <GridViewColumn Width="auto"> + <GridViewColumnHeader MinWidth="60" IsEnabled="False" Foreground="Black">Speed Ratio</GridViewColumnHeader> + <GridViewColumn.CellTemplate> + <DataTemplate DataType="interfaces:TorqueConverterCharacteristics"> + <DockPanel> + <TextBox TextAlignment="Center" Text="{Binding SpeedRatio, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" BorderThickness="0" Background="Transparent" Margin="20,0,0,0"/> + </DockPanel> + </DataTemplate> + </GridViewColumn.CellTemplate> + </GridViewColumn> + <GridViewColumn Width="auto"> + <GridViewColumnHeader MinWidth="80" IsEnabled="False" Foreground="Black">Torque Ratio</GridViewColumnHeader> + <GridViewColumn.CellTemplate> + <DataTemplate DataType="interfaces:TorqueConverterCharacteristics"> + <DockPanel> + <TextBox TextAlignment="Right" Text="{Binding TorqueRatio, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" BorderThickness="0" Background="Transparent" Margin="20,0,0,0"/> + </DockPanel> + </DataTemplate> + </GridViewColumn.CellTemplate> + </GridViewColumn> + <GridViewColumn Width="auto"> + <GridViewColumnHeader MinWidth="80" IsEnabled="False" Foreground="Black">Input Torque Ref</GridViewColumnHeader> + <GridViewColumn.CellTemplate> + <DataTemplate DataType="interfaces:TorqueConverterCharacteristics"> + <DockPanel> + <TextBlock DockPanel.Dock="Right" TextAlignment="Right" Text="{helper:SIUnit InputTorqueRef}"></TextBlock> + <TextBox DockPanel.Dock="Right" TextAlignment="Right" Text="{Binding InputTorqueRef, Converter={helper:SIValueConverter}, ConverterParameter=double2, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" BorderThickness="0" Background="Transparent"/> + </DockPanel> + </DataTemplate> + </GridViewColumn.CellTemplate> + </GridViewColumn> + </GridView> + </ListView.View> + </ListView> + </StackPanel> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/TorqueConverterDeclarationView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Declaration/TorqueConverterDeclarationView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..6258dc94979b8e1f5bf6e7e08a37572a8caaeaad --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/TorqueConverterDeclarationView.xaml.cs @@ -0,0 +1,15 @@ +using System.Windows.Controls; + +namespace VECTO3.Views.ComponentViews.Declaration +{ + /// <summary> + /// Interaction logic for TorqueConverterDeclarationView.xaml + /// </summary> + public partial class TorqueConverterDeclarationView : UserControl + { + public TorqueConverterDeclarationView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/TyreDeclarationView.xaml b/VECTO3GUI/Views/ComponentViews/Declaration/TyreDeclarationView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..16ce8215396157daaf23cd4cfb08ab7c4dad7e1a --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/TyreDeclarationView.xaml @@ -0,0 +1,37 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Declaration.TyreDeclarationView" + 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:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + xmlns:customControls="clr-namespace:VECTO3.Views.CustomControls" + xmlns:helper="clr-namespace:VECTO3.Helper" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <d:TyreDeclarationView.DataContext> + <x:Type Type="interfaces:ITyreViewModel"/> + </d:TyreDeclarationView.DataContext> + <StackPanel Orientation="Vertical" Width="400" HorizontalAlignment="Left" Grid.IsSharedSizeScope="True"> + <TextBlock Padding="10,5" FontWeight="Bold">Tyre</TextBlock> + <customControls:CommonDeclarationComponentData + Model="{Binding Model}" + Manufacturer="{Binding Manufacturer}" + Date="{Binding Date}" + CertificationNumber="{Binding CertificationNumber}" /> + <customControls:ComboParameter + Caption="Dimension" CaptionWidthGroup="lblWidth" + Unit="" UnitWidthGroup="unitWidth" + Value="{Binding Dimension}" AllowedValues="{Binding AllowedDimensions}" + /> + <customControls:VectoParameterControl + Caption="RRC" CaptionWidthGroup="lblWidth" + Unit="N/N" UnitWidthGroup="unitWidth" + Value="{Binding RollingResistanceCoefficient}" + /> + <customControls:VectoParameterControl + Caption="Fz ISO" CaptionWidthGroup="lblWidth" + Unit="{helper:SIUnit FzISO}" UnitWidthGroup="unitWidth" + Value="{Binding FzISO, Converter={helper:SIValueConverter}}" + /> + </StackPanel> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/TyreDeclarationView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Declaration/TyreDeclarationView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..7e918d8ad51a09403821a60541c271d9cb41ee82 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/TyreDeclarationView.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 VECTO3.Views.ComponentViews.Declaration +{ + /// <summary> + /// Interaction logic for TyreDeclarationView.xaml + /// </summary> + public partial class TyreDeclarationView : UserControl + { + public TyreDeclarationView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/VehicleDeclarationView.xaml b/VECTO3GUI/Views/ComponentViews/Declaration/VehicleDeclarationView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..a577384bb690fafd0a8a539a76658d0be33a8820 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/VehicleDeclarationView.xaml @@ -0,0 +1,141 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Declaration.VehicleDeclarationView" + 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:viewModel="clr-namespace:VECTO3.ViewModel" + xmlns:helper="clr-namespace:VECTO3.Helper" + xmlns:customControls="clr-namespace:VECTO3.Views.CustomControls" + xmlns:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + xmlns:impl="clr-namespace:VECTO3.ViewModel.Impl" + mc:Ignorable="d" + d:DesignHeight="800" d:DesignWidth="800"> + <d:VehicleDeclarationView.DataContext> + <x:Type Type="interfaces:IVehicleViewModel" /> + </d:VehicleDeclarationView.DataContext> + + <StackPanel Orientation="Vertical" Width="400" HorizontalAlignment="Left" Grid.IsSharedSizeScope="True"> + <StackPanel Orientation="Vertical" DockPanel.Dock="Top" Grid.IsSharedSizeScope="True"> + <customControls:VectoParameterControl + Caption="Manufacturer" Unit="" CaptionWidthGroup="vehicleLbl" UnitWidthGroup="unitWidth" + Value="{Binding Manufacturer}" /> + <customControls:VectoParameterControl + Caption="Manufacturer Address" Unit="" CaptionWidthGroup="vehicleLbl" UnitWidthGroup="unitWidth" + Value="{Binding ManufacturerAddress}" /> + <customControls:VectoParameterControl + Caption="Model" Unit="" CaptionWidthGroup="vehicleLbl" UnitWidthGroup="unitWidth" + Value="{Binding Model}" /> + <customControls:VectoParameterControl + Caption="VIN" Unit="" CaptionWidthGroup="vehicleLbl" UnitWidthGroup="unitWidth" + Value="{Binding VIN}" /> + <customControls:VectoParameterControl + Caption="Date" Unit="" CaptionWidthGroup="vehicleLbl" UnitWidthGroup="unitWidth" + Value="{Binding Date}" /> + </StackPanel> + <DockPanel Margin="0, 10, 0, 0" Grid.IsSharedSizeScope="True"> + <StackPanel Orientation="Vertical" DockPanel.Dock="top" Grid.IsSharedSizeScope="True"> + <customControls:ComboParameter + Caption="Legislative Class" + CaptionWidthGroup="vehicleLbl" + UnitWidthGroup="unitWidth" + Value="{Binding LegislativeClass}" + AllowedValues="{Binding AllowedLegislativeClasses}"/> + <customControls:ComboParameter + Caption="Vehicle Category" + CaptionWidthGroup="vehicleLbl" UnitWidthGroup="unitWidth" + Value="{Binding VehicleCategory}" + AllowedValues="{Binding AllowedVehicleCategories}" /> + <customControls:ComboParameter + Caption="Axle Configuration" + CaptionWidthGroup="vehicleLbl" UnitWidthGroup="unitWidth" + Value="{Binding AxleConfiguration}" + AllowedValues="{Binding AllowedAxleConfigurations}" /> + + </StackPanel> + <StackPanel Orientation="Vertical" DockPanel.Dock="Top" Grid.IsSharedSizeScope="True"> + <customControls:VectoParameterControl ValueAlign="right" CaptionWidthGroup="vehicleLbl" + UnitWidthGroup="unitWidth" + Caption="Gross Vehicle Mass" + Unit="{helper:SIUnit GrossVehicleMass}" + Value="{Binding GrossVehicleMass, Converter={helper:SIValueConverter}, ConverterParameter=int}" /> + <customControls:VectoParameterControl ValueAlign="center" CaptionWidthGroup="vehicleLbl" + UnitWidthGroup="unitWidth" + Caption="HDV Group" + Value="{Binding VehicleClass, Converter={helper:VehicleClassConverter}}" IsEnabled="False" /> + <customControls:VectoParameterControl ValueAlign="right" CaptionWidthGroup="vehicleLbl" + UnitWidthGroup="unitWidth" + Caption="Curb Mass Chassis" + Unit="{helper:SIUnit CurbMassChassis}" + Value="{Binding CurbMassChassis, Converter={helper:SIValueConverter}, ConverterParameter=int}" /> + <customControls:VectoParameterControl + Caption="Engine Idling Speed" Unit="rpm" ValueAlign="right" CaptionWidthGroup="vehicleLbl" + UnitWidthGroup="unitWidth" + Value="{Binding IdlingSpeed, Converter={helper:SIValueConverter}, ConverterParameter=AsRPM|int}" /> + + + </StackPanel> + <StackPanel Orientation="Vertical" DockPanel.Dock="Top" Grid.IsSharedSizeScope="True"> + <customControls:ComboParameter + Caption="Retarder Type" + CaptionWidthGroup="vehicleLbl" UnitWidthGroup="unitWidth" + Value="{Binding RetarderType}" + AllowedValues="{Binding AllowedRetarderTypes}"/> + <customControls:VectoParameterControl ValueAlign="right" CaptionWidthGroup="vehicleLbl" + UnitWidthGroup="unitWidth" + Caption="Retarder Ratio" + Value="{Binding RetarderRatio}" + IsEnabled="{Binding HasDedicatedRetarder}"/> + <customControls:ComboParameter + Caption="Power Take Off" + CaptionWidthGroup="vehicleLbl" UnitWidthGroup="unitWidth" + Value="{Binding PTOTechnology}" + AllowedValues="{Binding AllowedPTOTechnologies}" + /> + <customControls:ComboParameter + Caption="Angledrive" + CaptionWidthGroup="vehicleLbl" UnitWidthGroup="unitWidth" + Value="{Binding AngledriveType}" + AllowedValues="{Binding AllowedAngledriveTypes}"/> + </StackPanel> + <StackPanel Orientation="Vertical"> + <ListView Height="156" Margin="10,10,10,0" VerticalAlignment="Top" Name="TorqueLimitList" + ItemsSource="{Binding TorqueLimits}" > + <ListView.ItemContainerStyle> + <Style TargetType="ListViewItem"> + <Setter Property="HorizontalContentAlignment" Value="Stretch" /> + </Style> + </ListView.ItemContainerStyle> + <ListView.View> + <GridView> + <GridViewColumn Width="auto"> + <GridViewColumnHeader MinWidth="80" IsEnabled="False" Foreground="Black">Gear</GridViewColumnHeader> + <GridViewColumn.CellTemplate> + <DataTemplate DataType="interfaces:TorqueEntry"> + <DockPanel> + <TextBox Margin="20,0,0,0" Text="{Binding Gear, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" BorderThickness="0" Background="Transparent" TextAlignment="Center"/> + </DockPanel> + </DataTemplate> + </GridViewColumn.CellTemplate> + </GridViewColumn> + <GridViewColumn Width="auto"> + <GridViewColumnHeader MinWidth="130" IsEnabled="False" Foreground="Black">Max. Torque</GridViewColumnHeader> + <GridViewColumn.CellTemplate> + <DataTemplate DataType="interfaces:TorqueEntry"> + <DockPanel> + <TextBlock DockPanel.Dock="Right" Text="{helper:SIUnit MaxTorque}" Margin="5,0,0,0"/> + <TextBox DockPanel.Dock="Right" Margin="20,0,0,0" Text="{Binding MaxTorque, Converter={helper:SIValueConverter}, ConverterParameter=int, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" BorderThickness="0" Background="Transparent" TextAlignment="Right"/> + </DockPanel> + </DataTemplate> + </GridViewColumn.CellTemplate> + </GridViewColumn> + </GridView> + </ListView.View> + </ListView> + <StackPanel Orientation="Horizontal" Margin="10,7"> + <Button DockPanel.Dock="Left" Margin="0,0,10,0" Padding="5,2" Command="{Binding AddTorqueLimit}">Add</Button> + <Button DockPanel.Dock="Left" Margin="0,0,10,0" Padding="5,2" Command="{Binding RemoveTorqueLimit}" CommandParameter="{Binding SelectedItems, ElementName=TorqueLimitList}">Remove</Button> + </StackPanel> + </StackPanel> + </DockPanel> + </StackPanel> +</UserControl> \ No newline at end of file diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/VehicleDeclarationView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Declaration/VehicleDeclarationView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..f9216180fda270ed4c2c90b06f020fd2df01b420 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Declaration/VehicleDeclarationView.xaml.cs @@ -0,0 +1,15 @@ +using System.Windows.Controls; + +namespace VECTO3.Views.ComponentViews.Declaration +{ + /// <summary> + /// Interaction logic for EditComponentVehicleDeclarationView.xaml + /// </summary> + public partial class VehicleDeclarationView : UserControl + { + public VehicleDeclarationView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/EditComponentNoneView.xaml b/VECTO3GUI/Views/ComponentViews/EditComponentNoneView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..4d0deca78a430d192411b2949667f5ab46b7ef97 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/EditComponentNoneView.xaml @@ -0,0 +1,11 @@ +<UserControl x:Class="VECTO3.Views.EditComponentNoneView" + 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" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <Grid HorizontalAlignment="Center" VerticalAlignment="Center"> + <TextBlock>Choose component to edit</TextBlock> + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/EditComponentNoneView.xaml.cs b/VECTO3GUI/Views/ComponentViews/EditComponentNoneView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..c124f298261af035ff3c8ee8c229ab74ea977b7d --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/EditComponentNoneView.xaml.cs @@ -0,0 +1,15 @@ +using System.Windows.Controls; + +namespace VECTO3.Views +{ + /// <summary> + /// Interaction logic for EditComponentNoneView.xaml + /// </summary> + public partial class EditComponentNoneView : UserControl + { + public EditComponentNoneView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/AirdragEngineeringView.xaml b/VECTO3GUI/Views/ComponentViews/Engineering/AirdragEngineeringView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..def7c86e1e0149e7e262b364caac5853c2709fe1 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/AirdragEngineeringView.xaml @@ -0,0 +1,16 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Engineering.AirdragEngineeringView" + 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:viewModel="clr-namespace:VECTO3.ViewModel" + xmlns:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <d:AirdragDeclarationView.DataContext> + <x:Type Type="interfaces:IAirdragViewModel"/> + </d:AirdragDeclarationView.DataContext> + <Grid HorizontalAlignment="Center" VerticalAlignment="Center"> + <TextBlock>Airdrag - Engineering</TextBlock> + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/AirdragEngineeringView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Engineering/AirdragEngineeringView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..2cd4b39c796c334c5601fdca79a71171abbcbf91 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/AirdragEngineeringView.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 VECTO3.Views.ComponentViews.Engineering +{ + /// <summary> + /// Interaction logic for AirdragDeclarationView.xaml + /// </summary> + public partial class AirdragEngineeringView : UserControl + { + public AirdragEngineeringView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/AngledriveEngineeringView.xaml b/VECTO3GUI/Views/ComponentViews/Engineering/AngledriveEngineeringView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..39d91a6fbfe3f79c8fa4628765facb8000011628 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/AngledriveEngineeringView.xaml @@ -0,0 +1,16 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Engineering.AngledriveEngineeringView" + 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:viewModel="clr-namespace:VECTO3.ViewModel" + xmlns:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <d:AngledriveDeclarationView.DataContext> + <x:Type Type="interfaces:IAngledriveViewModel"/> + </d:AngledriveDeclarationView.DataContext> + <Grid HorizontalAlignment="Center" VerticalAlignment="Center"> + <TextBlock>Angledrive - Engineering</TextBlock> + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/AngledriveEngineeringView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Engineering/AngledriveEngineeringView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..2079a87e0498e815596e971b99bcf1cbc472f47f --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/AngledriveEngineeringView.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 VECTO3.Views.ComponentViews.Engineering +{ + /// <summary> + /// Interaction logic for AngledriveEngineeringView.xaml + /// </summary> + public partial class AngledriveEngineeringView : UserControl + { + public AngledriveEngineeringView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/AuxiliariesEngineerngView.xaml b/VECTO3GUI/Views/ComponentViews/Engineering/AuxiliariesEngineerngView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..37fee2d45b4fe3595d274f2926a83a4a91305174 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/AuxiliariesEngineerngView.xaml @@ -0,0 +1,16 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Engineering.AuxiliariesEngineerngView" + 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:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <d:EditCyclesView.DataContext> + <x:Type Type="interfaces:IAuxiliariesViewModel"/> + </d:EditCyclesView.DataContext> + <Grid HorizontalAlignment="Center" VerticalAlignment="Center"> + <TextBlock>Auxiliaries - Engineering</TextBlock> + </Grid> + +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/AuxiliariesEngineerngView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Engineering/AuxiliariesEngineerngView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..5f392f27a049e8ed99552c28cf1cf9dcaec0525a --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/AuxiliariesEngineerngView.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 VECTO3.Views.ComponentViews.Engineering +{ + /// <summary> + /// Interaction logic for AuxiliariesEngineerngView.xaml + /// </summary> + public partial class AuxiliariesEngineerngView : UserControl + { + public AuxiliariesEngineerngView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/AxleEngineeringView.xaml b/VECTO3GUI/Views/ComponentViews/Engineering/AxleEngineeringView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..92380174af8d3e45e77f3fc840e7b8485b115b4b --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/AxleEngineeringView.xaml @@ -0,0 +1,12 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Engineering.AxleEngineeringView" + 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:VECTO3.Views.ComponentViews.Engineering" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <Grid> + + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/AxleEngineeringView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Engineering/AxleEngineeringView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..1cc400306298167d3c23069194692d90248165bf --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/AxleEngineeringView.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 VECTO3.Views.ComponentViews.Engineering +{ + /// <summary> + /// Interaction logic for AxleEngineeringView.xaml + /// </summary> + public partial class AxleEngineeringView : UserControl + { + public AxleEngineeringView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/AxlegearEngineeringView.xaml b/VECTO3GUI/Views/ComponentViews/Engineering/AxlegearEngineeringView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..387d300f7810cb6c7cca967a3aae5cf84a4b4375 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/AxlegearEngineeringView.xaml @@ -0,0 +1,16 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Engineering.AxlegearEngineeringView" + 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:viewModel="clr-namespace:VECTO3.ViewModel" + xmlns:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <d:AxlegearDeclarationView.DataContext> + <x:Type Type="interfaces:IAxlegearViewModel"/> + </d:AxlegearDeclarationView.DataContext> + <Grid HorizontalAlignment="Center" VerticalAlignment="Center"> + <TextBlock>Axlegear - Engineering</TextBlock> + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/AxlegearEngineeringView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Engineering/AxlegearEngineeringView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..c432f9143d20df6a2510be57cbc529408f959bee --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/AxlegearEngineeringView.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 VECTO3.Views.ComponentViews.Engineering +{ + /// <summary> + /// Interaction logic for AxlegearEngineeringView.xaml + /// </summary> + public partial class AxlegearEngineeringView : UserControl + { + public AxlegearEngineeringView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/AxlesEngineeringView.xaml b/VECTO3GUI/Views/ComponentViews/Engineering/AxlesEngineeringView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..4bc26b31371e252ef25fa91a17d8e9ace83b77fe --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/AxlesEngineeringView.xaml @@ -0,0 +1,12 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Engineering.AxlesEngineeringView" + 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:VECTO3.Views.ComponentViews.Engineering" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <Grid> + + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/AxlesEngineeringView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Engineering/AxlesEngineeringView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..668092b4e7865390917156f0fa7b39220a723a66 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/AxlesEngineeringView.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 VECTO3.Views.ComponentViews.Engineering +{ + /// <summary> + /// Interaction logic for AxlesEngineeringView.xaml + /// </summary> + public partial class AxlesEngineeringView : UserControl + { + public AxlesEngineeringView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/CyclesEngineeringView.xaml b/VECTO3GUI/Views/ComponentViews/Engineering/CyclesEngineeringView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..844eab390bb1788b20a309de539a8736672204ef --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/CyclesEngineeringView.xaml @@ -0,0 +1,17 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Engineering.CyclesEngineeringView" + 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:VECTO3.Views" + xmlns:viewModel="clr-namespace:VECTO3.ViewModel" + xmlns:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="600"> + <d:EditCyclesView.DataContext> + <x:Type Type="interfaces:ICyclesViewModel"/> + </d:EditCyclesView.DataContext> + <Grid HorizontalAlignment="Center" VerticalAlignment="Center"> + <TextBlock>Cycles - Engineering</TextBlock> + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/CyclesEngineeringView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Engineering/CyclesEngineeringView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..cd413a499523c001519ae2d68e2f9b003ed1810d --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/CyclesEngineeringView.xaml.cs @@ -0,0 +1,15 @@ +using System.Windows.Controls; + +namespace VECTO3.Views.ComponentViews.Engineering +{ + /// <summary> + /// Interaction logic for EditCyclesView.xaml + /// </summary> + public partial class CyclesEngineeringView : UserControl + { + public CyclesEngineeringView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/EngineEngineeringView.xaml b/VECTO3GUI/Views/ComponentViews/Engineering/EngineEngineeringView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..12d79a8767bd121da0a9d695222750b2ce867dcf --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/EngineEngineeringView.xaml @@ -0,0 +1,42 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Engineering.EngineEngineeringView" + 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:viewModel="clr-namespace:VECTO3.ViewModel" + xmlns:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + xmlns:customControls="clr-namespace:VECTO3.Views.CustomControls" + xmlns:helper="clr-namespace:VECTO3.Helper" + mc:Ignorable="d" + d:DesignHeight="500" d:DesignWidth="500"> + <d:EngineDeclarationView.DataContext> + <x:Type Type="interfaces:IEngineViewModel"/> + </d:EngineDeclarationView.DataContext> + <StackPanel Orientation="Vertical" Width="400" HorizontalAlignment="Left" Grid.IsSharedSizeScope="True"> + <customControls:CommonDeclarationComponentData + Model="{Binding Model}" + Manufacturer="{Binding Manufacturer}" + Date="{Binding Date}" + CertificationNumber="{Binding CertificationNumber}" /> + <customControls:VectoParameterControl + Caption="Displacement" CaptionWidthGroup="lblWidth" + Value="{Binding Displacement, Converter={helper:SIValueConverter}, ConverterParameter=AsCubicCentimeter|int}" + ValueAlign="right" + Unit="cm³" UnitWidthGroup="unitWidth"/> + <customControls:VectoParameterControl + Caption="Idling Speed" CaptionWidthGroup="lblWidth" + Value="{Binding IdlingSpeed, Converter={helper:SIValueConverter}, ConverterParameter=AsRPM|int}" + ValueAlign="right" + Unit="rpm" UnitWidthGroup="unitWidth"/> + <customControls:VectoParameterControl + Caption="Correction Factor" CaptionWidthGroup="lblWidth" + Value="{Binding EngineeringCF}" ValueAlign="right" + Unit="" UnitWidthGroup="unitWidth" /> + <customControls:ComboParameter + Caption="Fuel Type" CaptionWidthGroup="lblWidth" + UnitWidthGroup="unitWidth" + Value="{Binding FuelType}" + AllowedValues="{Binding AllowedFuelTypes}" + /> + </StackPanel> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/EngineEngineeringView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Engineering/EngineEngineeringView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..af6b36c9a234e85f8dc82cd41ac738caaafc18ac --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/EngineEngineeringView.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 VECTO3.Views.ComponentViews.Engineering +{ + /// <summary> + /// Interaction logic for EngineEngineeringView.xaml + /// </summary> + public partial class EngineEngineeringView : UserControl + { + public EngineEngineeringView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/GearboxEngineeringView.xaml b/VECTO3GUI/Views/ComponentViews/Engineering/GearboxEngineeringView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..ec112ac06ab21e49ba061aa51b28823ff74098f3 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/GearboxEngineeringView.xaml @@ -0,0 +1,16 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Engineering.GearboxEngineeringView" + 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:viewModel="clr-namespace:VECTO3.ViewModel" + xmlns:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <d:GearboxDeclarationView.DataContext> + <x:Type Type="interfaces:IGearboxViewModel"/> + </d:GearboxDeclarationView.DataContext> + <Grid HorizontalAlignment="Center" VerticalAlignment="Center"> + <TextBlock>Gearbox - Engineering</TextBlock> + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/GearboxEngineeringView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Engineering/GearboxEngineeringView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..cbae26dd4b7fa363e23e929ca23f2ea538ea7b81 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/GearboxEngineeringView.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 VECTO3.Views.ComponentViews.Engineering +{ + /// <summary> + /// Interaction logic for GearboxEngineeringView.xaml + /// </summary> + public partial class GearboxEngineeringView : UserControl + { + public GearboxEngineeringView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/RetarderEngineeringView.xaml b/VECTO3GUI/Views/ComponentViews/Engineering/RetarderEngineeringView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..395b1f0f9bf77ce5bbf56e36f7845fa5a7d97b5d --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/RetarderEngineeringView.xaml @@ -0,0 +1,18 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Engineering.RetarderEngineeringView" + 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:viewModel="clr-namespace:VECTO3.ViewModel" + xmlns:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + + <d:RetarderDeclarationView.DataContext> + <x:Type Type="interfaces:IRetarderViewModel"/> + </d:RetarderDeclarationView.DataContext> + + <Grid HorizontalAlignment="Center" VerticalAlignment="Center"> + <TextBlock>Retarder - Engineering</TextBlock> + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/RetarderEngineeringView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Engineering/RetarderEngineeringView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..a4ee05e70b1dae05aed5de3152623414685c7055 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/RetarderEngineeringView.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 VECTO3.Views.ComponentViews.Engineering +{ + /// <summary> + /// Interaction logic for RetarderEngineeringView.xaml + /// </summary> + public partial class RetarderEngineeringView : UserControl + { + public RetarderEngineeringView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/TorqueConverterEngineeringView.xaml b/VECTO3GUI/Views/ComponentViews/Engineering/TorqueConverterEngineeringView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..35cb089b60cf298ba54160bd47542e4990b14b85 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/TorqueConverterEngineeringView.xaml @@ -0,0 +1,16 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Engineering.TorqueConverterEngineeringView" + 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:viewModel="clr-namespace:VECTO3.ViewModel" + xmlns:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <d:TorqueConverterDeclarationView.DataContext> + <x:Type Type="interfaces:ITorqueConverterViewModel"/> + </d:TorqueConverterDeclarationView.DataContext> + <Grid HorizontalAlignment="Center" VerticalAlignment="Center"> + <TextBlock>TorqueConverter - Engineering</TextBlock> + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/TorqueConverterEngineeringView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Engineering/TorqueConverterEngineeringView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..f7a07ab9f265b4a1f7c1c1e442de938a2f0ce54c --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/TorqueConverterEngineeringView.xaml.cs @@ -0,0 +1,15 @@ +using System.Windows.Controls; + +namespace VECTO3.Views.ComponentViews.Engineering +{ + /// <summary> + /// Interaction logic for TorqueConverterEngineeringView.xaml + /// </summary> + public partial class TorqueConverterEngineeringView : UserControl + { + public TorqueConverterEngineeringView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/TyreEngineeringView.xaml b/VECTO3GUI/Views/ComponentViews/Engineering/TyreEngineeringView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..9fecd85d5c017e3ea87f3b9acb33be9184863a4d --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/TyreEngineeringView.xaml @@ -0,0 +1,12 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Engineering.TyreEngineeringView" + 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:VECTO3.Views.ComponentViews.Engineering" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <Grid> + + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/TyreEngineeringView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Engineering/TyreEngineeringView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..7c216d7ebb93275cd1a7812a4910c2fae01ef324 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/TyreEngineeringView.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 VECTO3.Views.ComponentViews.Engineering +{ + /// <summary> + /// Interaction logic for TyreEngineeringView.xaml + /// </summary> + public partial class TyreEngineeringView : UserControl + { + public TyreEngineeringView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/VehicleEngineeringView.xaml b/VECTO3GUI/Views/ComponentViews/Engineering/VehicleEngineeringView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..9f1d421f7517a321fa33087cb5198d275b5b1773 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/VehicleEngineeringView.xaml @@ -0,0 +1,16 @@ +<UserControl x:Class="VECTO3.Views.ComponentViews.Engineering.VehicleEngineeringView" + 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:viewModel="clr-namespace:VECTO3.ViewModel" + xmlns:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <d:VehicleEngineeringView.DataContext> + <x:Type Type="interfaces:IVehicleViewModel"/> + </d:VehicleEngineeringView.DataContext> + <Grid HorizontalAlignment="Center" VerticalAlignment="Center"> + <TextBlock>Vehicle - Engineering</TextBlock> + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/ComponentViews/Engineering/VehicleEngineeringView.xaml.cs b/VECTO3GUI/Views/ComponentViews/Engineering/VehicleEngineeringView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..b911203a8fcef663b19d3551860ddff505be22c6 --- /dev/null +++ b/VECTO3GUI/Views/ComponentViews/Engineering/VehicleEngineeringView.xaml.cs @@ -0,0 +1,15 @@ +using System.Windows.Controls; + +namespace VECTO3.Views.ComponentViews.Engineering +{ + /// <summary> + /// Interaction logic for EditComponentVehicleView.xaml + /// </summary> + public partial class VehicleEngineeringView : UserControl + { + public VehicleEngineeringView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/CustomControls/CheckboxParameter.xaml b/VECTO3GUI/Views/CustomControls/CheckboxParameter.xaml new file mode 100644 index 0000000000000000000000000000000000000000..885c7adcad5b1e26b0d9167bc3eaf37f3772f261 --- /dev/null +++ b/VECTO3GUI/Views/CustomControls/CheckboxParameter.xaml @@ -0,0 +1,24 @@ +<UserControl x:Class="VECTO3.Views.CustomControls.CheckboxParameter" + 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:VECTO3.Views.CustomControls" + mc:Ignorable="d" + d:DesignHeight="30" d:DesignWidth="300" d:DataContext="{d:DesignInstance {x:Type local:CheckboxParameter}}"> + <Grid Margin="5"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" SharedSizeGroup="{Binding CaptionWidthGroup}"/> + <ColumnDefinition Width="*"/> + <ColumnDefinition Width="Auto" SharedSizeGroup="{Binding UnitWidthGroup}"/> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + <TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Caption}" Margin="0,0,10,0"/> + <CheckBox Grid.Column="1" + Margin="20,0,0,0" + IsChecked="{Binding Value}"/> + <TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding Unit}" Margin="5,0,5,0"/> + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/CustomControls/CheckboxParameter.xaml.cs b/VECTO3GUI/Views/CustomControls/CheckboxParameter.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..d6d5efc559647494282b5f8b50512f89ab47ec19 --- /dev/null +++ b/VECTO3GUI/Views/CustomControls/CheckboxParameter.xaml.cs @@ -0,0 +1,96 @@ +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 VECTO3.Views.CustomControls +{ + /// <summary> + /// Interaction logic for CheckboxParameter.xaml + /// </summary> + public partial class CheckboxParameter : UserControl + { + public CheckboxParameter() + { + InitializeComponent(); + Validation.SetErrorTemplate(this, null); + (Content as FrameworkElement).DataContext = this; + } + + + + public string Caption + { + get { return (string)GetValue(CaptionProperty); } + set { SetValue(CaptionProperty, value); } + } + + // Using a DependencyProperty as the backing store for Caption. This enables animation, styling, binding, etc... + public static readonly DependencyProperty CaptionProperty = + DependencyProperty.Register("Caption", typeof(string), typeof(CheckboxParameter), new PropertyMetadata("")); + + + + + public bool Value + { + get { return (bool)GetValue(ValueProperty); } + set { SetValue(ValueProperty, value); } + } + + // Using a DependencyProperty as the backing store for Value. This enables animation, styling, binding, etc... + public static readonly DependencyProperty ValueProperty = + DependencyProperty.Register("Value", typeof(bool), typeof(CheckboxParameter), new FrameworkPropertyMetadata() {BindsTwoWayByDefault = true}); + + + + public string Unit + { + get { return (string)GetValue(UnitProperty); } + set { SetValue(UnitProperty, value); } + } + + // Using a DependencyProperty as the backing store for Unit. This enables animation, styling, binding, etc... + public static readonly DependencyProperty UnitProperty = + DependencyProperty.Register("Unit", typeof(string), typeof(CheckboxParameter), new PropertyMetadata("")); + + + + + public string CaptionWidthGroup + { + get { return (string)GetValue(CaptionWidthGroupProperty); } + set { SetValue(CaptionWidthGroupProperty, value); } + } + + // Using a DependencyProperty as the backing store for CaptionWidthGroup. This enables animation, styling, binding, etc... + public static readonly DependencyProperty CaptionWidthGroupProperty = + DependencyProperty.Register("CaptionWidthGroup", typeof(string), typeof(CheckboxParameter), new PropertyMetadata("")); + + + + + public string UnitWidthGroup + { + get { return (string)GetValue(UnitWidthGroupProperty); } + set { SetValue(UnitWidthGroupProperty, value); } + } + + // Using a DependencyProperty as the backing store for UnitWidthGroup. This enables animation, styling, binding, etc... + public static readonly DependencyProperty UnitWidthGroupProperty = + DependencyProperty.Register("UnitWidthGroup", typeof(string), typeof(CheckboxParameter), new PropertyMetadata("")); + + + + } +} diff --git a/VECTO3GUI/Views/CustomControls/ComboParameter.xaml b/VECTO3GUI/Views/CustomControls/ComboParameter.xaml new file mode 100644 index 0000000000000000000000000000000000000000..22448b008d9eb0d426f4045c12cae89ca2b7505f --- /dev/null +++ b/VECTO3GUI/Views/CustomControls/ComboParameter.xaml @@ -0,0 +1,30 @@ +<UserControl x:Class="VECTO3.Views.CustomControls.ComboParameter" + 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:VECTO3.Views.CustomControls" + mc:Ignorable="d" + d:DesignHeight="50" d:DesignWidth="300" d:DataContext="{d:DesignInstance {x:Type local:ComboParameter}}"> + <Grid Margin="5"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" SharedSizeGroup="{Binding CaptionWidthGroup}"/> + <ColumnDefinition Width="*"/> + <ColumnDefinition Width="Auto" SharedSizeGroup="{Binding UnitWidthGroup}"/> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + <TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Caption}" Margin="0,0,10,0"/> + <!--<TextBox Grid.Row="0" Grid.Column="1" Margin="20,0,0,0" + Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" + TextAlignment="{Binding ValueAlign}"/>--> + <ComboBox Grid.Column="1" + Margin="20,0,0,0" + ItemsSource="{Binding AllowedValues}" + SelectedValue="{Binding Value}" + SelectedValuePath="Value" + DisplayMemberPath="Label"/> + <TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding Unit}" Margin="5,0,5,0"/> + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/CustomControls/ComboParameter.xaml.cs b/VECTO3GUI/Views/CustomControls/ComboParameter.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..83ae752de060f977ab29f142cd37b09fe048f277 --- /dev/null +++ b/VECTO3GUI/Views/CustomControls/ComboParameter.xaml.cs @@ -0,0 +1,98 @@ +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 VECTO3.Views.CustomControls +{ + /// <summary> + /// Interaction logic for ComboParameter.xaml + /// </summary> + public partial class ComboParameter : UserControl + { + public ComboParameter() + { + InitializeComponent(); + Validation.SetErrorTemplate(this, null); + (Content as FrameworkElement).DataContext = this; + } + + public string Caption + { + get { return (string)GetValue(CaptionProperty); } + set { SetValue(CaptionProperty, value); } + } + + //Using a DependencyProperty as the backing store for Caption.This enables animation, styling, binding, etc... + public static readonly DependencyProperty CaptionProperty = + DependencyProperty.Register("Caption", typeof(string), typeof(ComboParameter), new PropertyMetadata(string.Empty)); + + + public object Value + { + get { return (object)GetValue(ValueProperty); } + set { SetValue(ValueProperty, value); } + } + + //Using a DependencyProperty as the backing store for Value.This enables animation, styling, binding, etc... + public static readonly DependencyProperty ValueProperty = + DependencyProperty.Register("Value", typeof(object), typeof(ComboParameter), new FrameworkPropertyMetadata() { BindsTwoWayByDefault = true }); + + + + public IList<object> AllowedValues + { + get { return (object[])GetValue(AllowedValuesProperty); } + set { SetValue(AllowedValuesProperty, value); } + } + + // Using a DependencyProperty as the backing store for AllowedValuesObjects. This enables animation, styling, binding, etc... + public static readonly DependencyProperty AllowedValuesProperty = + DependencyProperty.Register("AllowedValues", typeof(object[]), typeof(ComboParameter), new PropertyMetadata(null)); + + public string Unit + { + get { return (string)GetValue(UnitProperty); } + set { SetValue(UnitProperty, value); } + } + + // Using a DependencyProperty as the backing store for Unit. This enables animation, styling, binding, etc... + public static readonly DependencyProperty UnitProperty = + DependencyProperty.Register("Unit", typeof(string), typeof(ComboParameter), new PropertyMetadata("")); + + + public string CaptionWidthGroup + { + get { return (string)GetValue(CaptionWidthGroupProperty); } + set { SetValue(CaptionWidthGroupProperty, value); } + } + + // Using a DependencyProperty as the backing store for CaptionWidthGroup. This enables animation, styling, binding, etc... + public static readonly DependencyProperty CaptionWidthGroupProperty = + DependencyProperty.Register("CaptionWidthGroup", typeof(string), typeof(ComboParameter), new PropertyMetadata("")); + + + + public string UnitWidthGroup + { + get { return (string)GetValue(UnitWidthGroupProperty); } + set { SetValue(UnitWidthGroupProperty, value); } + } + + // Using a DependencyProperty as the backing store for UnitWidthGroup. This enables animation, styling, binding, etc... + public static readonly DependencyProperty UnitWidthGroupProperty = + DependencyProperty.Register("UnitWidthGroup", typeof(string), typeof(ComboParameter), new PropertyMetadata("")); + + + } +} diff --git a/VECTO3GUI/Views/CustomControls/CommonDeclarationComponentData.xaml b/VECTO3GUI/Views/CustomControls/CommonDeclarationComponentData.xaml new file mode 100644 index 0000000000000000000000000000000000000000..24ed445c7443ff4548912dfaafe4c5d9b60c1c22 --- /dev/null +++ b/VECTO3GUI/Views/CustomControls/CommonDeclarationComponentData.xaml @@ -0,0 +1,33 @@ +<UserControl x:Class="VECTO3.Views.CustomControls.CommonDeclarationComponentData" + 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:VECTO3.Views.CustomControls" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance {x:Type local:CommonDeclarationComponentData}}"> + <Grid IsSharedSizeScope="True"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + <local:VectoParameterControl + Grid.Row="0" + Caption="Manufacturer" Unit="" + Value="{Binding Manufacturer}" CaptionWidthGroup="cddl"/> + <local:VectoParameterControl + Grid.Row="1" + Caption="Model" Unit="" + Value="{Binding Model}" CaptionWidthGroup="cddl"/> + <local:VectoParameterControl + Grid.Row="2" + Caption="Date" Unit="" + Value="{Binding Date}" CaptionWidthGroup="cddl"/> + <local:VectoParameterControl + Grid.Row="3" + Caption="Certification Number" Unit="" + Value="{Binding CertificationNumber}" CaptionWidthGroup="cddl"/> + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/CustomControls/CommonDeclarationComponentData.xaml.cs b/VECTO3GUI/Views/CustomControls/CommonDeclarationComponentData.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..0f4e0e90f8095a2e0a086e31fd60a668a77f23d4 --- /dev/null +++ b/VECTO3GUI/Views/CustomControls/CommonDeclarationComponentData.xaml.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +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 VECTO3.Views.CustomControls +{ + /// <summary> + /// Interaction logic for CommonComponentData.xaml + /// </summary> + public partial class CommonDeclarationComponentData : UserControl, INotifyDataErrorInfo + { + public CommonDeclarationComponentData() + { + InitializeComponent(); + Validation.SetErrorTemplate(this, null); + (Content as FrameworkElement).DataContext = this; + } + + + + public string Manufacturer + { + get { return (string)GetValue(ManufacturerProperty); } + set { SetValue(ManufacturerProperty, value); } + } + + // Using a DependencyProperty as the backing store for Manufacturer. This enables animation, styling, binding, etc... + public static readonly DependencyProperty ManufacturerProperty = + DependencyProperty.Register("Manufacturer", typeof(string), typeof(CommonDeclarationComponentData), new PropertyMetadata("")); + + + + public string Model + { + get { return (string)GetValue(ModelProperty); } + set { SetValue(ModelProperty, value); } + } + + // Using a DependencyProperty as the backing store for Model. This enables animation, styling, binding, etc... + public static readonly DependencyProperty ModelProperty = + DependencyProperty.Register("Model", typeof(string), typeof(CommonDeclarationComponentData), new PropertyMetadata("")); + + + + public string CertificationNumber + { + get { return (string)GetValue(CertificationNumberProperty); } + set { SetValue(CertificationNumberProperty, value); } + } + + // Using a DependencyProperty as the backing store for CertificationNumber. This enables animation, styling, binding, etc... + public static readonly DependencyProperty CertificationNumberProperty = + DependencyProperty.Register("CertificationNumber", typeof(string), typeof(CommonDeclarationComponentData), new PropertyMetadata("")); + + + + public DateTime Date + { + get { return (DateTime)GetValue(DateProperty); } + set { SetValue(DateProperty, value); } + } + + // Using a DependencyProperty as the backing store for Date. This enables animation, styling, binding, etc... + public static readonly DependencyProperty DateProperty = + DependencyProperty.Register("Date", typeof(DateTime), typeof(CommonDeclarationComponentData), new PropertyMetadata(null)); + + + + + + public delegate void ErrorsChangedEventHandler(object sender, DataErrorsChangedEventArgs e); + + public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged; + + public bool HasErrors + { + get { + var validationErrors = Validation.GetErrors(this); + return validationErrors.Any(); + } + } + + public IEnumerable GetErrors(string propertyName) + { + var validationErrors = Validation.GetErrors(this); + var specificValidationErrors = + validationErrors.Where( + error => ((BindingExpression)error.BindingInError).TargetProperty.Name == propertyName).ToList(); + var specificValidationErrorMessages = specificValidationErrors.Select(valError => valError.ErrorContent); + return specificValidationErrorMessages; + } + + public void NotifyErrorsChanged(string propertyName) + { + if (ErrorsChanged != null) { + ErrorsChanged(this, new DataErrorsChangedEventArgs(propertyName)); + } + } + + protected static void ValidatePropertyWhenChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs) + { + ((VectoParameterControl)dependencyObject).NotifyErrorsChanged(dependencyPropertyChangedEventArgs.Property.Name); + } + } +} diff --git a/VECTO3GUI/Views/CustomControls/VectoParameterControl.xaml b/VECTO3GUI/Views/CustomControls/VectoParameterControl.xaml new file mode 100644 index 0000000000000000000000000000000000000000..efb759171c5fc5b65657dbe5713bc3027dcee347 --- /dev/null +++ b/VECTO3GUI/Views/CustomControls/VectoParameterControl.xaml @@ -0,0 +1,24 @@ +<UserControl x:Class="VECTO3.Views.CustomControls.VectoParameterControl" + 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:customControls="clr-namespace:VECTO3.Views.CustomControls" + mc:Ignorable="d" + d:DesignHeight="40" d:DesignWidth="300" d:DataContext="{d:DesignInstance {x:Type customControls:VectoParameterControl}}"> + <Grid Margin="5"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" SharedSizeGroup="{Binding CaptionWidthGroup}"/> + <ColumnDefinition Width="*"/> + <ColumnDefinition Width="Auto" SharedSizeGroup="{Binding UnitWidthGroup}"/> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + <TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Caption}" Margin="0,0,10,0"/> + <TextBox Grid.Row="0" Grid.Column="1" Margin="20,0,0,0" + Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" + TextAlignment="{Binding ValueAlign}"/> + <TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding Unit}" Margin="5,0,5,0"/> + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/CustomControls/VectoParameterControl.xaml.cs b/VECTO3GUI/Views/CustomControls/VectoParameterControl.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..23ee8f9b9d65aa712f2150c3465b2aa4d4198f59 --- /dev/null +++ b/VECTO3GUI/Views/CustomControls/VectoParameterControl.xaml.cs @@ -0,0 +1,138 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using TUGraz.VectoCommon.Utils; + + +namespace VECTO3.Views.CustomControls +{ + /// <summary> + /// Interaction logic for VectoParameterControl.xaml + /// </summary> + public partial class VectoParameterControl : UserControl, INotifyDataErrorInfo + { + + public VectoParameterControl() + { + InitializeComponent(); + Validation.SetErrorTemplate(this, null); + (Content as FrameworkElement).DataContext = this; + } + + + public string Caption + { + get { return (string)GetValue(CaptionProperty); } + set { SetValue(CaptionProperty, value); } + } + + //Using a DependencyProperty as the backing store for Caption.This enables animation, styling, binding, etc... + public static readonly DependencyProperty CaptionProperty = + DependencyProperty.Register("Caption", typeof(string), typeof(VectoParameterControl), new PropertyMetadata(string.Empty)); + + + public string Value + { + get { return (string)GetValue(ValueProperty); } + set { SetValue(ValueProperty, value); } + } + + //Using a DependencyProperty as the backing store for Value.This enables animation, styling, binding, etc... + public static readonly DependencyProperty ValueProperty = + DependencyProperty.Register("Value", typeof(string), typeof(VectoParameterControl), new FrameworkPropertyMetadata() {BindsTwoWayByDefault = true}); + + + + + public string Unit + { + get { return (string)GetValue(UnitProperty); } + set { SetValue(UnitProperty, value); } + } + + // Using a DependencyProperty as the backing store for Unit. This enables animation, styling, binding, etc... + public static readonly DependencyProperty UnitProperty = + DependencyProperty.Register("Unit", typeof(string), typeof(VectoParameterControl), new PropertyMetadata("")); + + + + + public string ValueAlign + { + get { return (string)GetValue(ValueAlignProperty); } + set { SetValue(ValueAlignProperty, value); } + } + + // Using a DependencyProperty as the backing store for ValueAlign. This enables animation, styling, binding, etc... + public static readonly DependencyProperty ValueAlignProperty = + DependencyProperty.Register("ValueAlign", typeof(string), typeof(VectoParameterControl), new PropertyMetadata("left")); + + + + public string CaptionWidthGroup + { + get { return (string)GetValue(CaptionWidthGroupProperty); } + set { SetValue(CaptionWidthGroupProperty, value); } + } + + // Using a DependencyProperty as the backing store for CaptionWidthGroup. This enables animation, styling, binding, etc... + public static readonly DependencyProperty CaptionWidthGroupProperty = + DependencyProperty.Register("CaptionWidthGroup", typeof(string), typeof(VectoParameterControl), new PropertyMetadata("")); + + + + public string UnitWidthGroup + { + get { return (string)GetValue(UnitWidthGroupProperty); } + set { SetValue(UnitWidthGroupProperty, value); } + } + + // Using a DependencyProperty as the backing store for UnitWidthGroup. This enables animation, styling, binding, etc... + public static readonly DependencyProperty UnitWidthGroupProperty = + DependencyProperty.Register("UnitWidthGroup", typeof(string), typeof(VectoParameterControl), new PropertyMetadata("")); + + + + + public delegate void ErrorsChangedEventHandler(object sender, DataErrorsChangedEventArgs e); + + public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged; + + public bool HasErrors + { + get { + var validationErrors = Validation.GetErrors(this); + return validationErrors.Any(); + } + } + + public IEnumerable GetErrors(string propertyName) + { + var validationErrors = Validation.GetErrors(this); + var specificValidationErrors = + validationErrors.Where( + error => ((BindingExpression)error.BindingInError).TargetProperty.Name == propertyName).ToList(); + var specificValidationErrorMessages = specificValidationErrors.Select(valError => valError.ErrorContent); + return specificValidationErrorMessages; + } + + public void NotifyErrorsChanged(string propertyName) + { + if (ErrorsChanged != null) { + ErrorsChanged(this, new DataErrorsChangedEventArgs(propertyName)); + } + } + + protected static void ValidatePropertyWhenChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs) + { + ((VectoParameterControl)dependencyObject).NotifyErrorsChanged(dependencyPropertyChangedEventArgs.Property.Name); + } + + } +} diff --git a/VECTO3GUI/Views/EngineeringEngineView.xaml b/VECTO3GUI/Views/EngineeringEngineView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..47c84b473deb2005ce4537d9e1d3e7c1a840a202 --- /dev/null +++ b/VECTO3GUI/Views/EngineeringEngineView.xaml @@ -0,0 +1,29 @@ +<UserControl x:Class="VECTO3.Views.EngineeringEngineView" + 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:VECTO3.Views" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="400"> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="*"/> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + <Label Grid.Column="0" Grid.Row="0">Manufacturer</Label> + <TextBox Grid.Column="1" Grid.Row="0"/> + <Label Grid.Column="0" Grid.Row="1">Model</Label> + <TextBox Grid.Column="1" Grid.Row="1"/> + <Label Grid.Column="0" Grid.Row="2">Certification Number</Label> + <TextBox Grid.Column="1" Grid.Row="2"/> + <Label Grid.Column="0" Grid.Row="3">Date</Label> + <TextBox Grid.Column="1" Grid.Row="3"/> + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/EngineeringEngineView.xaml.cs b/VECTO3GUI/Views/EngineeringEngineView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..d087f1f001d2ed8446962ac0a4c8430026df2382 --- /dev/null +++ b/VECTO3GUI/Views/EngineeringEngineView.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 VECTO3.Views +{ + /// <summary> + /// Interaction logic for EngineeringEngineView.xaml + /// </summary> + public partial class EngineeringEngineView : UserControl + { + public EngineeringEngineView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/JobEditView.xaml b/VECTO3GUI/Views/JobEditView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..c6134b74a9a1c66f4ca73855caa06496df6da0d6 --- /dev/null +++ b/VECTO3GUI/Views/JobEditView.xaml @@ -0,0 +1,43 @@ +<UserControl x:Class="VECTO3.Views.JobEditView" Name="JobEditForm" + 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:VECTO3.Views" + xmlns:viewModel="clr-namespace:VECTO3.ViewModel" + xmlns:impl="clr-namespace:VECTO3.ViewModel.Impl" + xmlns:util="clr-namespace:VECTO3.Util" + xmlns:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + mc:Ignorable="d" + d:DesignHeight="400" d:DesignWidth="600"> + <d:JobEditView.DataContext> + <x:Type Type="interfaces:IJobEditViewModel"/> + </d:JobEditView.DataContext> + <DockPanel LastChildFill="False"> + <StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Background="Gray"> + <TextBlock Text="{Binding JobFile}" FontSize="14px" FontWeight="Bold" Foreground="White" Margin="120,5,0,5"/> + </StackPanel> + <StackPanel DockPanel.Dock="Left" MinWidth="120" Background="Gray"> + <ItemsControl ItemsSource="{Binding Components}" Margin="0, 20, 0, 0" Name="ComponentButtons"> + <ItemsControl.ItemTemplate> + <DataTemplate DataType="util:Component"> + <Button Background="Gray" BorderBrush="Gray" Foreground="White" HorizontalAlignment="Left" Padding="10,0,0,0" FontSize="16pt" Margin="0,5,0,0" + Content="{Binding}" + Command="{Binding ElementName=ComponentButtons, Path=DataContext.EditComponent}" + CommandParameter="{Binding}"/> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </StackPanel> + <DockPanel DockPanel.Dock="Bottom" Background="Gray" VerticalAlignment="Bottom"> + <StackPanel Orientation="Horizontal" FlowDirection="RightToLeft"> + <Button Command="{Binding SaveJob}" Padding="10,3" HorizontalAlignment="Right" Margin="5">Save</Button> + <Button Command="{Binding CloseJob}" CommandParameter="{Binding ElementName=JobEditForm}" Padding="10,3" HorizontalAlignment="Right" Margin="5">Close</Button> + </StackPanel> + </DockPanel> + <ScrollViewer DockPanel.Dock="Top"> + <ContentControl Content="{Binding CurrentComponent}" MinHeight="100"/> + </ScrollViewer> + </DockPanel> +</UserControl> + diff --git a/VECTO3GUI/Views/JobEditView.xaml.cs b/VECTO3GUI/Views/JobEditView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..32b25943498446cf4b68edb85d78b594cbd75e49 --- /dev/null +++ b/VECTO3GUI/Views/JobEditView.xaml.cs @@ -0,0 +1,38 @@ +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; +using VECTO3.ViewModel; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.Views +{ + /// <summary> + /// Interaction logic for JobEditView.xaml + /// </summary> + public partial class JobEditView : UserControl + { + public JobEditView() + { + InitializeComponent(); + } + + public JobEditView(IJobEditViewModel viewModel) + { + InitializeComponent(); + DataContext = viewModel; + } + + + } +} diff --git a/VECTO3GUI/Views/JobView.xaml b/VECTO3GUI/Views/JobView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..a5d4d955016799be610ac7002bddedc65c782656 --- /dev/null +++ b/VECTO3GUI/Views/JobView.xaml @@ -0,0 +1,25 @@ +<UserControl x:Class="VECTO3.Views.JobView" + 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" + mc:Ignorable="d" + d:DesignHeight="420" d:DesignWidth="650"> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="120"/> + <ColumnDefinition Width="*"/> + </Grid.ColumnDefinitions> + <StackPanel Grid.Column="0" Background="Gray"> + <Button Margin="0,20,0,0" Background="Gray" BorderBrush="Gray" Foreground="White" HorizontalAlignment="Left" Padding="10,0,0,0">Vehicle</Button> + <Button Margin="0,5,0,0" Background="Gray" BorderBrush="Gray" Foreground="White" HorizontalAlignment="Left" Padding="10,0,0,0">Airdrag</Button> + <Button Margin="0,5,0,0" Background="Gray" BorderBrush="Gray" Foreground="White" HorizontalAlignment="Left" Padding="10,0,0,0">Engine</Button> + <Button Margin="0,5,0,0" Background="Gray" BorderBrush="Gray" Foreground="White" HorizontalAlignment="Left" Padding="10,0,0,0">Transmission</Button> + <Button Margin="0,5,0,0" Background="Gray" BorderBrush="Gray" Foreground="White" HorizontalAlignment="Left" Padding="10,0,0,0">Retarder</Button> + <Button Margin="0,5,0,0" Background="Gray" BorderBrush="Gray" Foreground="White" HorizontalAlignment="Left" Padding="10,0,0,0">Axlegear</Button> + <Button Margin="0,5,0,0" Background="Gray" BorderBrush="Gray" Foreground="White" HorizontalAlignment="Left" Padding="10,0,0,0">Tyres</Button> + <Button Margin="0,5,0,0" Background="Gray" BorderBrush="Gray" Foreground="White" HorizontalAlignment="Left" Padding="10,0,0,0">Auxiliaries</Button> + <Button Margin="0,5,0,0" Background="Gray" BorderBrush="Gray" Foreground="White" HorizontalAlignment="Left" Padding="10,0,0,0">Cycles</Button> + </StackPanel> + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/JobView.xaml.cs b/VECTO3GUI/Views/JobView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..49975f50e9e4457bdf0416a7484ba66298a1e685 --- /dev/null +++ b/VECTO3GUI/Views/JobView.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 VECTO3.Views +{ + /// <summary> + /// Interaction logic for JobView.xaml + /// </summary> + public partial class JobView : UserControl + { + public JobView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/JoblistView.xaml b/VECTO3GUI/Views/JoblistView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..3b9d5ae9a0ca2aa2135a407b2418ffece4046638 --- /dev/null +++ b/VECTO3GUI/Views/JoblistView.xaml @@ -0,0 +1,50 @@ +<UserControl x:Class="VECTO3.Views.JoblistView" + 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:viewModel="clr-namespace:VECTO3.ViewModel" + xmlns:helper="clr-namespace:VECTO3.Helper" + xmlns:impl="clr-namespace:VECTO3.ViewModel.Impl" + xmlns:interfaces="clr-namespace:VECTO3.ViewModel.Interfaces" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="600"> + <d:JoblistView.DataContext> + <x:Type Type="interfaces:IJoblistViewModel"/> + </d:JoblistView.DataContext> + <UserControl.Resources> + <helper:JobEntrySelectedConverter x:Key="JobEntrySelectedConverter" /> + + </UserControl.Resources> + <Grid Margin="0,0,10,0"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*"/> + <ColumnDefinition Width="70"/> + </Grid.ColumnDefinitions> + <ListView x:Name="Joblisting" Height="156" Margin="10,10,10,0" VerticalAlignment="Top" Grid.Column="0" + ItemsSource="{Binding Jobs}" MouseDoubleClick="Joblisting_MouseDoubleClick"> + <ListView.View> + <GridView> + <GridViewColumn Width="30"> + <GridViewColumn.CellTemplate> + <DataTemplate DataType="impl:JobEntry"> + <StackPanel Orientation="Horizontal"> + <CheckBox IsChecked="{Binding Path=Selected}"/> + </StackPanel> + </DataTemplate> + </GridViewColumn.CellTemplate> + </GridViewColumn> + <GridViewColumn Header="Filepath" Width="auto" DisplayMemberBinding="{Binding Filename}"/> + </GridView> + </ListView.View> + </ListView> + <StackPanel Grid.Column="1"> + <Button Margin="0,20,0,0" Command="{Binding EditJob}" CommandParameter="{Binding SelectedItems, ElementName=Joblisting}">Edit</Button> + <Button Margin="0,15,0,0" Command="{Binding AddJob}">Add</Button> + <Button Margin="0,5,0,0" Command="{Binding RemoveJob}" CommandParameter="{Binding SelectedItems, ElementName=Joblisting}">Remove</Button> + <Button Margin="0,5,0,0" Command="{Binding MoveJobUp}">Up</Button> + <Button Margin="0,5,0,0" Command="{Binding MoveJobDown}">Down</Button> + <Button Margin="0,20,0,0" Command="{Binding StartSimulation}">Start</Button> + </StackPanel> + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/JoblistView.xaml.cs b/VECTO3GUI/Views/JoblistView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..8730cc2b52e12919d1cfff5deefe130b3bffabc8 --- /dev/null +++ b/VECTO3GUI/Views/JoblistView.xaml.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +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; +using VECTO3.ViewModel; +using VECTO3.ViewModel.Impl; +using VECTO3.ViewModel.Interfaces; + +namespace VECTO3.Views +{ + /// <summary> + /// Interaction logic for HomeView.xaml + /// </summary> + public partial class JoblistView : UserControl + { + public JoblistView() + { + InitializeComponent(); + } + + public JoblistView(IJoblistViewModel viewModel) + { + InitializeComponent(); + DataContext = viewModel; + } + + private void Joblisting_MouseDoubleClick(object sender, MouseButtonEventArgs e) + { + var listView = (ListView)sender; + if (listView.SelectedItems.Count == 0) { + return; + } + + var model = (IJoblistViewModel)DataContext; + model.EditJob.Execute(listView.SelectedItem); + } + } +} diff --git a/VECTO3GUI/packages.config b/VECTO3GUI/packages.config new file mode 100644 index 0000000000000000000000000000000000000000..43303bc4c00822e74d6aa650ac8735e58f4f8893 --- /dev/null +++ b/VECTO3GUI/packages.config @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="Castle.Core" version="4.2.0" targetFramework="net452" /> + <package id="Ninject" version="3.3.4" targetFramework="net452" /> + <package id="Ninject.Extensions.Factory" version="3.3.2" targetFramework="net452" /> +</packages> \ No newline at end of file