From 3aa71ba47306920c53aaf19e37d864fae948516d Mon Sep 17 00:00:00 2001 From: "VKMTHD\\franzjosefkober" <franz.josef.kober@ivt.tugraz.at> Date: Thu, 16 Apr 2020 17:03:27 +0200 Subject: [PATCH] added settings window, added component data cache classes, extended main menu behavior, refactoring --- VECTO3GUI/App.config | 15 ++ VECTO3GUI/Helper/OutputWindowHelper.cs | 28 ++-- VECTO3GUI/MainWindow.xaml | 11 +- VECTO3GUI/Model/SettingsModel.cs | 33 ++++ .../TempDataObject/AirdragComponentData.cs | 49 ++++++ .../AuxiliariesBusComponentData.cs | 67 ++++++++ .../TempDataObject/VehicleBusComponentData.cs | 73 +++++++++ VECTO3GUI/Properties/Resources.Designer.cs | 71 --------- VECTO3GUI/Properties/Resources.resx | 117 -------------- VECTO3GUI/Properties/Settings.Designer.cs | 46 ++++-- VECTO3GUI/Properties/Settings.settings | 15 +- VECTO3GUI/Resources/GlobalStyles.xaml | 11 ++ VECTO3GUI/Resources/ViewModelMappings.xaml | 4 +- VECTO3GUI/VECTO3GUI.csproj | 24 +-- .../Impl/CompleteVehicleBusJobViewModel.cs | 6 +- VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs | 107 ++++++++++--- .../ViewModel/Impl/OutputWindowViewModel.cs | 6 +- VECTO3GUI/ViewModel/Impl/SettingsViewModel.cs | 149 ++++++++++++++++++ VECTO3GUI/ViewModel/Interfaces/IAirdrag.cs | 18 +++ .../ViewModel/Interfaces/IAirdragViewModel.cs | 7 +- .../ViewModel/Interfaces/IAuxiliariesBus.cs | 40 +++++ .../Interfaces/IAuxiliariesViewModel.cs | 28 +--- .../Interfaces/ICompleteVehicleBus.cs | 38 +++++ .../ICompleteVehicleBusViewModel.cs | 44 +----- .../ViewModel/Interfaces/IJoblistViewModel.cs | 2 + VECTO3GUI/Views/JoblistView.xaml | 18 ++- VECTO3GUI/Views/SettingsView.xaml | 59 +++++++ VECTO3GUI/Views/SettingsView.xaml.cs | 28 ++++ 28 files changed, 778 insertions(+), 336 deletions(-) create mode 100644 VECTO3GUI/Model/SettingsModel.cs create mode 100644 VECTO3GUI/Model/TempDataObject/AirdragComponentData.cs create mode 100644 VECTO3GUI/Model/TempDataObject/AuxiliariesBusComponentData.cs create mode 100644 VECTO3GUI/Model/TempDataObject/VehicleBusComponentData.cs delete mode 100644 VECTO3GUI/Properties/Resources.Designer.cs delete mode 100644 VECTO3GUI/Properties/Resources.resx create mode 100644 VECTO3GUI/ViewModel/Impl/SettingsViewModel.cs create mode 100644 VECTO3GUI/ViewModel/Interfaces/IAirdrag.cs create mode 100644 VECTO3GUI/ViewModel/Interfaces/IAuxiliariesBus.cs create mode 100644 VECTO3GUI/ViewModel/Interfaces/ICompleteVehicleBus.cs create mode 100644 VECTO3GUI/Views/SettingsView.xaml create mode 100644 VECTO3GUI/Views/SettingsView.xaml.cs diff --git a/VECTO3GUI/App.config b/VECTO3GUI/App.config index 865e48c442..3d1145dfc2 100644 --- a/VECTO3GUI/App.config +++ b/VECTO3GUI/App.config @@ -1,5 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> <configuration> + <configSections> + <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > + <section name="VECTO3GUI.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> + </sectionGroup> + </configSections> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> </startup> @@ -15,4 +20,14 @@ </dependentAssembly> </assemblyBinding> </runtime> + <userSettings> + <VECTO3GUI.Properties.Settings> + <setting name="SavePathFolder" serializeAs="String"> + <value /> + </setting> + <setting name="XMLFilesPathFolder" serializeAs="String"> + <value /> + </setting> + </VECTO3GUI.Properties.Settings> + </userSettings> </configuration> \ No newline at end of file diff --git a/VECTO3GUI/Helper/OutputWindowHelper.cs b/VECTO3GUI/Helper/OutputWindowHelper.cs index 21426c3ec3..c7a7d13d60 100644 --- a/VECTO3GUI/Helper/OutputWindowHelper.cs +++ b/VECTO3GUI/Helper/OutputWindowHelper.cs @@ -1,8 +1,8 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows; using Ninject; using VECTO3GUI.ViewModel.Impl; using VECTO3GUI.Views; @@ -15,21 +15,20 @@ namespace VECTO3GUI.Helper public static OutputWindow CreateOutputWindow(IKernel kernel, object viewModel, double width = default(double), double height= default(double)) { - var window = new OutputWindow { - DataContext = new OutputWindowViewModel(kernel, viewModel) - }; - - if (Math.Abs(width - default(double)) > 0 ) - window.Width = width; - if (Math.Abs(height - default(double)) > 0) - window.Height = height; - - return window; + return CreateWindow(kernel, viewModel, string.Empty, width, height); } - - + public static OutputWindow CreateOutputWindow(IKernel kernel, object viewModel, - string windowName, double width = default(double), double height = default(double)) + string windowName,double width = default(double), double height = default(double), + ResizeMode resizeMode = ResizeMode.CanResize) + { + var window = CreateWindow(kernel, viewModel, windowName, width, height); + window.ResizeMode = resizeMode; + return window; + } + + private static OutputWindow CreateWindow(IKernel kernel, object viewModel, string windowName, + double width, double height) { var window = new OutputWindow { @@ -43,6 +42,5 @@ namespace VECTO3GUI.Helper return window; } - } } diff --git a/VECTO3GUI/MainWindow.xaml b/VECTO3GUI/MainWindow.xaml index 92626265c4..fd649b6f28 100644 --- a/VECTO3GUI/MainWindow.xaml +++ b/VECTO3GUI/MainWindow.xaml @@ -23,17 +23,20 @@ <Menu IsMainMenu="True" Style="{DynamicResource MetroMenu}"> <MenuItem Header="File"> - <MenuItem Header="New" Style="{DynamicResource MetroMenuItem}" Margin="0"/> - <MenuItem Header="Edit" Style="{DynamicResource MetroMenuItem}" Margin="0" Command="{Binding CurrentViewModel.EditJob}"/> + <MenuItem Header="New" Style="{DynamicResource MetroMenuItem}" Margin="0" + Command="{Binding CurrentViewModel.CreateNewJob}"/> + <MenuItem Header="Edit" Style="{DynamicResource MetroMenuItem}" Margin="0" + Command="{Binding CurrentViewModel.EditJob}"/> <Separator HorizontalAlignment="Stretch" Background="Gray"/> - <MenuItem Header="Open" Command="{Binding CurrentViewModel.CreateNewJob}"/> + <MenuItem Header="Open" Command="{Binding CurrentViewModel.AddJob}"/> <MenuItem Header="Open Folder"/> <Separator HorizontalAlignment="Stretch" Background="Gray"/> <MenuItem Header="Exit"/> </MenuItem> <MenuItem Header="Settings"> - <!--<MenuItem Header="New"/>--> + <MenuItem Header="Default Settings" + Command="{Binding CurrentViewModel.OpenSettings}"/> </MenuItem> <MenuItem Header="Help"> diff --git a/VECTO3GUI/Model/SettingsModel.cs b/VECTO3GUI/Model/SettingsModel.cs new file mode 100644 index 0000000000..e9fe0e5bb7 --- /dev/null +++ b/VECTO3GUI/Model/SettingsModel.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VECTO3GUI.Model +{ + public class SettingsModel + { + public string SavePathFolder + { + get { return Properties.Settings.Default.SavePathFolder; } + set + { + Properties.Settings.Default.SavePathFolder = value; + Properties.Settings.Default.Save(); + } + } + + public string XmlFilePathFolder + { + get { return Properties.Settings.Default.XMLFilesPathFolder; } + set + { + Properties.Settings.Default.XMLFilesPathFolder = value; + Properties.Settings.Default.Save(); + } + } + + + } +} diff --git a/VECTO3GUI/Model/TempDataObject/AirdragComponentData.cs b/VECTO3GUI/Model/TempDataObject/AirdragComponentData.cs new file mode 100644 index 0000000000..219eb3ebd7 --- /dev/null +++ b/VECTO3GUI/Model/TempDataObject/AirdragComponentData.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TUGraz.VectoCommon.Utils; +using VECTO3GUI.ViewModel.Interfaces; + +namespace VECTO3GUI.Model.TempDataObject +{ + public class AirdragComponentData : IAirdrag + { + #region Members + + public string Manufacturer { get; set; } + public string Model { get; set; } + public string CertificationNumber { get; set; } + public DateTime? Date { get; set; } + public bool UseMeasuredValues { get; set; } + public SquareMeter CdxA_0 { get; set; } + public SquareMeter TransferredCdxA { get; set; } + public SquareMeter DeclaredCdxA { get; set; } + public string AppVersion { get; set; } + + #endregion + + public AirdragComponentData(IAirdragViewModel airdrag) + { + SetValues(airdrag); + } + + public void UpdateCurrentValues(IAirdragViewModel airdrag) + { + SetValues(airdrag); + } + + private void SetValues(IAirdragViewModel airdrag) + { + Model = airdrag.Model; + Manufacturer = airdrag.Manufacturer; + CertificationNumber = airdrag.CertificationNumber; + Date = airdrag.Date; + AppVersion = airdrag.AppVersion; + DeclaredCdxA = airdrag.DeclaredCdxA; + CdxA_0 = airdrag.CdxA_0; + TransferredCdxA = airdrag.TransferredCdxA; + } + } +} diff --git a/VECTO3GUI/Model/TempDataObject/AuxiliariesBusComponentData.cs b/VECTO3GUI/Model/TempDataObject/AuxiliariesBusComponentData.cs new file mode 100644 index 0000000000..053499506d --- /dev/null +++ b/VECTO3GUI/Model/TempDataObject/AuxiliariesBusComponentData.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TUGraz.VectoCommon.BusAuxiliaries; +using TUGraz.VectoCommon.Utils; +using VECTO3GUI.ViewModel.Interfaces; + +namespace VECTO3GUI.Model.TempDataObject +{ + public class AuxiliariesBusComponentData: IAuxiliariesBus + { + #region Properties + + public ObservableCollection<string> AlternatorTechnologies { get; set; } + public bool DayrunninglightsLED { get; set; } + public bool HeadlightsLED { get; set; } + public bool PositionlightsLED { get; set; } + public bool BrakelightsLED { get; set; } + public bool InteriorLightsLED { get; set; } + public ConsumerTechnology DoorDriveTechnology { get; set; } + public BusHVACSystemConfiguration SystemConfiguration { get; set; } + public ACCompressorType CompressorTypeDriver { get; set; } + public ACCompressorType CompressorTypePassenger { get; set; } + public Watt AuxHeaterPower { get; set; } + public bool DoubleGlasing { get; set; } + public bool HeatPump { get; set; } + public bool AdjustableAuxiliaryHeater { get; set; } + public bool SeparateAirDistributionDucts { get; set; } + + #endregion + + public AuxiliariesBusComponentData(IAuxiliariesViewModel auxiliaries) + { + SetValues(auxiliaries); + } + + public void UpdateCurrentValues(IAuxiliariesViewModel auxiliaries) + { + SetValues(auxiliaries); + } + + private void SetValues(IAuxiliariesViewModel auxiliaries) + { + AlternatorTechnologies = new ObservableCollection<string>(auxiliaries.AlternatorTechnologies); + DayrunninglightsLED = auxiliaries.DayrunninglightsLED; + HeadlightsLED = auxiliaries.HeadlightsLED; + PositionlightsLED = auxiliaries.PositionlightsLED; + BrakelightsLED = auxiliaries.BrakelightsLED; + InteriorLightsLED = auxiliaries.InteriorLightsLED; + + DoorDriveTechnology = auxiliaries.DoorDriveTechnology; + + SystemConfiguration = auxiliaries.SystemConfiguration; + CompressorTypeDriver = auxiliaries.CompressorTypeDriver; + CompressorTypePassenger = auxiliaries.CompressorTypePassenger; + AuxHeaterPower = auxiliaries.AuxHeaterPower; + DoubleGlasing = auxiliaries.DoubleGlasing; + HeatPump = auxiliaries.HeatPump; + AdjustableAuxiliaryHeater = auxiliaries.AdjustableAuxiliaryHeater; + SeparateAirDistributionDucts = auxiliaries.SeparateAirDistributionDucts; + } + + } +} diff --git a/VECTO3GUI/Model/TempDataObject/VehicleBusComponentData.cs b/VECTO3GUI/Model/TempDataObject/VehicleBusComponentData.cs new file mode 100644 index 0000000000..b5989b6f2c --- /dev/null +++ b/VECTO3GUI/Model/TempDataObject/VehicleBusComponentData.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TUGraz.VectoCommon.BusAuxiliaries; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using VECTO3GUI.ViewModel.Interfaces; + +namespace VECTO3GUI.Model.TempDataObject +{ + public class VehicleBusComponentData : ICompleteVehicleBus + { + #region Properties + + public string Manufacturer { get; set; } + public string ManufacturerAddress { get; set; } + public string Model { get; set; } + public string VIN { get; set; } + public DateTime Date { get; set; } + public LegislativeClass LegislativeClass { get; set; } + public RegistrationClass RegisteredClass { get; set; } + public VehicleCode VehicleCode { get; set; } + public Kilogram CurbMassChassis { get; set; } + public Kilogram TechnicalPermissibleMaximumLadenMass { get; set; } + public int NumberOfPassengersLowerDeck { get; set; } + public int NumberOfPassengersUpperDeck { get; set; } + public FloorType FloorType { get; set; } + public Meter HeightIntegratedBody { get; set; } + public Meter VehicleLength { get; set; } + public Meter VehicleWidth { get; set; } + public Meter EntranceHeight { get; set; } + public ConsumerTechnology DoorDriveTechnology { get; set; } + + #endregion + + + public VehicleBusComponentData(ICompleteVehicleBusViewModel vehicleBus) + { + SetCurrentValues(vehicleBus); + } + + public void UpdateCurrentValues(ICompleteVehicleBusViewModel vehicleBus) + { + SetCurrentValues(vehicleBus); + } + + private void SetCurrentValues(ICompleteVehicleBusViewModel vehicleBus) + { + Manufacturer = vehicleBus.Manufacturer; + ManufacturerAddress = vehicleBus.ManufacturerAddress; + Model = vehicleBus.Model; + VIN = vehicleBus.VIN; + Date = vehicleBus.Date; + LegislativeClass = vehicleBus.LegislativeClass; + RegisteredClass = vehicleBus.RegisteredClass; + VehicleCode = vehicleBus.VehicleCode; + CurbMassChassis = vehicleBus.CurbMassChassis; + TechnicalPermissibleMaximumLadenMass = vehicleBus.TechnicalPermissibleMaximumLadenMass; + NumberOfPassengersLowerDeck = vehicleBus.NumberOfPassengersLowerDeck; + NumberOfPassengersUpperDeck = vehicleBus.NumberOfPassengersUpperDeck; + FloorType = vehicleBus.FloorType; + HeightIntegratedBody = vehicleBus.HeightIntegratedBody; + VehicleLength = vehicleBus.VehicleLength; + VehicleWidth = vehicleBus.VehicleWidth; + EntranceHeight = vehicleBus.EntranceHeight; + DoorDriveTechnology = vehicleBus.DoorDriveTechnology; + } + + } +} diff --git a/VECTO3GUI/Properties/Resources.Designer.cs b/VECTO3GUI/Properties/Resources.Designer.cs deleted file mode 100644 index e9fa4ad167..0000000000 --- a/VECTO3GUI/Properties/Resources.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -// <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 deleted file mode 100644 index af7dbebbac..0000000000 --- a/VECTO3GUI/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ -<?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 index a674648cef..72168496e5 100644 --- a/VECTO3GUI/Properties/Settings.Designer.cs +++ b/VECTO3GUI/Properties/Settings.Designer.cs @@ -8,23 +8,43 @@ // </auto-generated> //------------------------------------------------------------------------------ -namespace VECTO3GUI.Properties -{ - - +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 - { - + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.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 - { + + public static Settings Default { + get { return defaultInstance; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string SavePathFolder { + get { + return ((string)(this["SavePathFolder"])); + } + set { + this["SavePathFolder"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string XMLFilesPathFolder { + get { + return ((string)(this["XMLFilesPathFolder"])); + } + set { + this["XMLFilesPathFolder"] = value; + } + } } } diff --git a/VECTO3GUI/Properties/Settings.settings b/VECTO3GUI/Properties/Settings.settings index 033d7a5e9e..a4943eb709 100644 --- a/VECTO3GUI/Properties/Settings.settings +++ b/VECTO3GUI/Properties/Settings.settings @@ -1,7 +1,12 @@ <?xml version='1.0' encoding='utf-8'?> -<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> - <Profiles> - <Profile Name="(Default)" /> - </Profiles> - <Settings /> +<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="VECTO3GUI.Properties" GeneratedClassName="Settings"> + <Profiles /> + <Settings> + <Setting Name="SavePathFolder" Type="System.String" Scope="User"> + <Value Profile="(Default)" /> + </Setting> + <Setting Name="XMLFilesPathFolder" Type="System.String" Scope="User"> + <Value Profile="(Default)" /> + </Setting> + </Settings> </SettingsFile> \ No newline at end of file diff --git a/VECTO3GUI/Resources/GlobalStyles.xaml b/VECTO3GUI/Resources/GlobalStyles.xaml index 166caa4c92..c35ea8b669 100644 --- a/VECTO3GUI/Resources/GlobalStyles.xaml +++ b/VECTO3GUI/Resources/GlobalStyles.xaml @@ -32,4 +32,15 @@ </Style> + <Style TargetType="TextBlock" BasedOn="{StaticResource MetroTextBlock}"> + <Setter Property="VerticalAlignment" Value="Center"/> + </Style> + + <Style TargetType="TextBox" BasedOn="{StaticResource MetroTextBox}"> + <Setter Property="VerticalAlignment" Value="Center"/> + </Style> + + + + </ResourceDictionary> \ No newline at end of file diff --git a/VECTO3GUI/Resources/ViewModelMappings.xaml b/VECTO3GUI/Resources/ViewModelMappings.xaml index ea9b9cfc5a..ef7014a643 100644 --- a/VECTO3GUI/Resources/ViewModelMappings.xaml +++ b/VECTO3GUI/Resources/ViewModelMappings.xaml @@ -19,7 +19,9 @@ <views:XMLView/> </DataTemplate> - + <DataTemplate DataType="{x:Type impl:SettingsViewModel}"> + <views:SettingsView/> + </DataTemplate> diff --git a/VECTO3GUI/VECTO3GUI.csproj b/VECTO3GUI/VECTO3GUI.csproj index 2802da950f..f93827eae6 100644 --- a/VECTO3GUI/VECTO3GUI.csproj +++ b/VECTO3GUI/VECTO3GUI.csproj @@ -162,6 +162,10 @@ <Compile Include="Helper\FileDialogHelper.cs" /> <Compile Include="Helper\OutputWindowHelper.cs" /> <Compile Include="Model\InterfacesImpl.cs" /> + <Compile Include="Model\SettingsModel.cs" /> + <Compile Include="Model\TempDataObject\AirdragComponentData.cs" /> + <Compile Include="Model\TempDataObject\AuxiliariesBusComponentData.cs" /> + <Compile Include="Model\TempDataObject\VehicleBusComponentData.cs" /> <Compile Include="Util\AllowedEntry.cs" /> <Compile Include="Util\Component.cs" /> <Compile Include="Util\RelayCommand.cs" /> @@ -208,6 +212,7 @@ <Compile Include="ViewModel\Impl\PrimaryVehicleBusJobViewModel.cs" /> <Compile Include="ViewModel\Impl\PrimaryVehicleBusViewModel.cs" /> <Compile Include="ViewModel\Impl\RetarderViewModel.cs" /> + <Compile Include="ViewModel\Impl\SettingsViewModel.cs" /> <Compile Include="ViewModel\Impl\TorqueConverterViewModel.cs" /> <Compile Include="ViewModel\Impl\TyreViewModel.cs" /> <Compile Include="ViewModel\Impl\ValidatingViewModel.cs" /> @@ -217,13 +222,16 @@ <Compile Include="ViewModel\Interfaces\FullLoadEntry.cs" /> <Compile Include="ViewModel\Interfaces\Gear.cs" /> <Compile Include="ViewModel\Interfaces\GearLossMapEntry.cs" /> + <Compile Include="ViewModel\Interfaces\IAirdrag.cs" /> <Compile Include="ViewModel\Interfaces\IAirdragViewModel.cs" /> <Compile Include="ViewModel\Interfaces\IAngledriveViewModel.cs" /> + <Compile Include="ViewModel\Interfaces\IAuxiliariesBus.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\ICompleteVehicleBus.cs" /> <Compile Include="ViewModel\Interfaces\ICompleteVehicleBusViewModel.cs" /> <Compile Include="ViewModel\Interfaces\IComponentViewModel.cs" /> <Compile Include="ViewModel\Interfaces\ICyclesViewModel.cs" /> @@ -360,6 +368,9 @@ <Compile Include="Views\OutputWindow.xaml.cs"> <DependentUpon>OutputWindow.xaml</DependentUpon> </Compile> + <Compile Include="Views\SettingsView.xaml.cs"> + <DependentUpon>SettingsView.xaml</DependentUpon> + </Compile> <Compile Include="Views\XMLView.xaml.cs"> <DependentUpon>XMLView.xaml</DependentUpon> </Compile> @@ -549,6 +560,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Views\SettingsView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\XMLView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -558,20 +573,11 @@ <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> diff --git a/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusJobViewModel.cs b/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusJobViewModel.cs index d8a24e24bb..ea9f6eecfc 100644 --- a/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusJobViewModel.cs +++ b/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusJobViewModel.cs @@ -41,7 +41,8 @@ namespace VECTO3GUI.ViewModel.Impl public ICommand SaveComponent { - get { return _saveComponentCommand ?? new RelayCommand<Component>(DoSaveComponent, CanSaveComponent); } + get { return _saveComponentCommand ?? + (_saveComponentCommand = new RelayCommand<Component>(DoSaveComponent, CanSaveComponent)); } } private bool CanSaveComponent(Component component) @@ -57,7 +58,8 @@ namespace VECTO3GUI.ViewModel.Impl public ICommand ResetComponent { - get { return _resetComponentCommand ?? new RelayCommand<Component>(DoResetComponent, CanResetComponent); } + get { return _resetComponentCommand ?? + (_resetComponentCommand = new RelayCommand<Component>(DoResetComponent, CanResetComponent)); } } diff --git a/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs b/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs index 712123e8b2..49f917caca 100644 --- a/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs +++ b/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs @@ -35,7 +35,7 @@ namespace VECTO3GUI.ViewModel.Impl protected readonly ObservableCollection<JobEntry> _jobs = new ObservableCollection<JobEntry>(); private JobEntry _selectedJobEntry; - + #endregion @@ -44,9 +44,11 @@ namespace VECTO3GUI.ViewModel.Impl private ICommand _newJobCommand; private ICommand _editJobCommand; private ICommand _removeJobCommand; + private ICommand _removeAllJobCommand; private ICommand _addJobCommand; private ICommand _openJobCommand; - + private ICommand _openSettingsCommand; + #endregion @@ -91,8 +93,16 @@ namespace VECTO3GUI.ViewModel.Impl #region Implementation IJoblistViewModel - - public ICommand RemoveJob { get { return _removeJobCommand ?? new RelayCommand(DoRemoveJob, CanRemoveJob); } } + + public ICommand RemoveJob + { + get + { + return _removeJobCommand ?? + (_removeJobCommand = new RelayCommand(DoRemoveJob, CanRemoveJob)); + } + } + private void DoRemoveJob() { @@ -100,12 +110,35 @@ namespace VECTO3GUI.ViewModel.Impl SelectedJobEntry = null; } + public ICommand RemoveAllJobs + { + get + { + return _removeAllJobCommand ?? + (_removeAllJobCommand = new RelayCommand(DoRemoveAllJobs)); + } + } + + private void DoRemoveAllJobs() + { + _jobs.Clear(); + SelectedJobEntry = null; + } + + private bool CanRemoveJob() { return SelectedJobEntry != null; } - public ICommand EditJob { get { return _editJobCommand ?? new RelayCommand(DoEditJob, CanEditJob); } } + public ICommand EditJob + { + get + { + return _editJobCommand ?? + (_editJobCommand = new RelayCommand(DoEditJob, CanEditJob)); + } + } private void DoEditJob() { @@ -113,13 +146,11 @@ namespace VECTO3GUI.ViewModel.Impl try { var jobEditView = ReadJob(entry.Filename); //Kernel.Get<IJobEditViewModel>(); - if(jobEditView == null) + if (jobEditView == null) return; - var window = OutputWindowHelper.CreateOutputWindow(Kernel, jobEditView); window.Show(); - } catch (Exception e) { @@ -134,24 +165,35 @@ namespace VECTO3GUI.ViewModel.Impl return SelectedJobEntry != null; } - public ICommand CreateNewJob { get { return _newJobCommand ?? new RelayCommand(DoNewJobCommand); } } + public ICommand CreateNewJob + { + get + { + return _newJobCommand ?? + (_newJobCommand = new RelayCommand(DoNewJobCommand)); + } + } private void DoNewJobCommand() { var jobEditView = new CompleteVehicleBusJobViewModel(Kernel, null); - var wnd = new Window { Content = jobEditView }; - wnd.Show(); + var window = OutputWindowHelper.CreateOutputWindow(Kernel, jobEditView, "New File"); + window.Show(); } public ICommand OpenJob { - get { return _openJobCommand ?? new RelayCommand(DoOpenJobCommand); } + get + { + return _openJobCommand ?? + (_openJobCommand = new RelayCommand(DoOpenJobCommand)); + } } private void DoOpenJobCommand() { - if(SelectedJobEntry == null) + if (SelectedJobEntry == null) return; var xmlViewModel = new XMLViewModel(SelectedJobEntry.Filename); @@ -161,12 +203,20 @@ namespace VECTO3GUI.ViewModel.Impl } - public ICommand AddJob { get { return _addJobCommand ?? new RelayCommand(DoAddJob); } } + public ICommand AddJob + { + get + { + return _addJobCommand ?? + (_addJobCommand = new RelayCommand(DoAddJob)); + } + } private void DoAddJob() { var filePath = FileDialogHelper.ShowSelectFilesDialog(false, @"F:\VECTO\VECTO\bin"); - if (filePath != null) { + if (filePath != null) + { _jobs.Add(new JobEntry() { Filename = filePath.First(), @@ -176,16 +226,33 @@ namespace VECTO3GUI.ViewModel.Impl } } + public ICommand OpenSettings + { + get + { + return _openSettingsCommand ?? + (_openSettingsCommand = new RelayCommand(DoOpenSettingsCommand)); + } + } + + private void DoOpenSettingsCommand() + { + var viewModel = new SettingsViewModel(); + var window = OutputWindowHelper.CreateOutputWindow(Kernel, viewModel, "Settings", 440, 200, + ResizeMode.NoResize); + window.ShowDialog(); + } - public ICommand MoveJobUp { get { return new RelayCommand(() => {}, () => false); } } - public ICommand MoveJobDown { get { return new RelayCommand(() => {}, () => false); } } - public ICommand StartSimulation { get { return new RelayCommand(() => {}, () => false); } } - public ICommand JobEntrySetActive { get { return new RelayCommand(() => {}, () => false); } } + + public ICommand MoveJobUp { get { return new RelayCommand(() => { }, () => false); } } + public ICommand MoveJobDown { get { return new RelayCommand(() => { }, () => false); } } + public ICommand StartSimulation { get { return new RelayCommand(() => { }, () => false); } } + public ICommand JobEntrySetActive { get { return new RelayCommand(() => { }, () => false); } } #endregion - + private IJobEditViewModel ReadJob(string jobFile) { if (jobFile == null) diff --git a/VECTO3GUI/ViewModel/Impl/OutputWindowViewModel.cs b/VECTO3GUI/ViewModel/Impl/OutputWindowViewModel.cs index a81345c931..fd7204317a 100644 --- a/VECTO3GUI/ViewModel/Impl/OutputWindowViewModel.cs +++ b/VECTO3GUI/ViewModel/Impl/OutputWindowViewModel.cs @@ -1,4 +1,5 @@ -using Ninject; +using System.Windows; +using Ninject; namespace VECTO3GUI.ViewModel.Impl { @@ -6,7 +7,7 @@ namespace VECTO3GUI.ViewModel.Impl { private object _viewModel; private string _windowTitle; - + public object ViewModel { @@ -25,6 +26,7 @@ namespace VECTO3GUI.ViewModel.Impl { Kernel = kernel; ViewModel = viewModel; + WindowTitle = string.Empty; } public OutputWindowViewModel(IKernel kernel, object viewModel, string windowTitle) diff --git a/VECTO3GUI/ViewModel/Impl/SettingsViewModel.cs b/VECTO3GUI/ViewModel/Impl/SettingsViewModel.cs new file mode 100644 index 0000000000..5f9b18a948 --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/SettingsViewModel.cs @@ -0,0 +1,149 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Input; +using TUGraz.VectoCore.Configuration; +using VECTO3GUI.Helper; +using VECTO3GUI.Model; +using VECTO3GUI.Util; + +namespace VECTO3GUI.ViewModel.Impl +{ + public class SettingsViewModel : ObservableObject + { + #region Members + + private readonly SettingsModel _settings; + private string _savePathFolder; + private string _xmlFilePath; + + private ICommand _saveCommand; + private ICommand _cancelCommand; + private ICommand _resetCommand; + private ICommand _openSaveFolderCommand; + private ICommand _openXMLFolderCommand; + + #endregion + + + #region Properties + + public string SavePathFolder + { + get { return _savePathFolder; } + set { SetProperty(ref _savePathFolder, value); } + } + + public string XMLFilePath + { + get { return _xmlFilePath; } + set { SetProperty(ref _xmlFilePath, value); } + } + + #endregion + + + public SettingsViewModel() + { + _settings = new SettingsModel(); + SavePathFolder = _settings.SavePathFolder; + XMLFilePath = _settings.XmlFilePathFolder; + } + + #region Commands + public ICommand SaveCommand + { + get + { + return _saveCommand ?? + (_saveCommand = new RelayCommand(DoSaveCommand, CanSaveCommand)); + } + } + + private bool CanSaveCommand() + { + return IsDataChanged(); + } + + private void DoSaveCommand() + { + _settings.SavePathFolder = SavePathFolder; + _settings.XmlFilePathFolder = XMLFilePath; + } + + public ICommand CancelCommand + { + get + { + return _cancelCommand ?? + (_cancelCommand = new RelayCommand<object>(DoCancelCommand)); + } + } + + + private void DoCancelCommand(object obj) + { + var convert = obj as Window; + convert?.Close(); + } + + public ICommand ResetCommand + { + get + { + return _resetCommand ?? + (_resetCommand = new RelayCommand(DoResetCommand)); + } + } + + private void DoResetCommand() + { + SavePathFolder = _settings.SavePathFolder; + XMLFilePath = _settings.XmlFilePathFolder; + } + + + public ICommand OpenSaveFolderCommand + { + get + { + return _openSaveFolderCommand ?? + (_openSaveFolderCommand = new RelayCommand<string>(DoOpenSaveFolderCommand)); + } + } + + private void DoOpenSaveFolderCommand(string path) + { + var pathResult = FileDialogHelper.ShowSelectDirectoryDialog(path); + if (pathResult != null) + SavePathFolder = pathResult; + } + + public ICommand OpenXMLFolderCommand + { + get + { + return _openXMLFolderCommand ?? + (_openXMLFolderCommand = new RelayCommand<string>(DoOpenXMLFolderCommand)); + } + } + + private void DoOpenXMLFolderCommand(string path) + { + var pathResult = FileDialogHelper.ShowSelectDirectoryDialog(path); + if (pathResult != null) + XMLFilePath = pathResult; + } + + #endregion + + private bool IsDataChanged() + { + return SavePathFolder != _settings.SavePathFolder || + XMLFilePath != _settings.XmlFilePathFolder; + } + } +} diff --git a/VECTO3GUI/ViewModel/Interfaces/IAirdrag.cs b/VECTO3GUI/ViewModel/Interfaces/IAirdrag.cs new file mode 100644 index 0000000000..139be64141 --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/IAirdrag.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TUGraz.VectoCommon.Utils; + +namespace VECTO3GUI.ViewModel.Interfaces +{ + public interface IAirdrag : ICommonComponentParameters + { + bool UseMeasuredValues { get; set; } + SquareMeter CdxA_0 { get; set; } + SquareMeter TransferredCdxA { get; set; } + SquareMeter DeclaredCdxA { get; set; } + string AppVersion { get; set; } + } +} diff --git a/VECTO3GUI/ViewModel/Interfaces/IAirdragViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/IAirdragViewModel.cs index 19cbd65c17..13d4fde2b6 100644 --- a/VECTO3GUI/ViewModel/Interfaces/IAirdragViewModel.cs +++ b/VECTO3GUI/ViewModel/Interfaces/IAirdragViewModel.cs @@ -3,13 +3,8 @@ using TUGraz.VectoCommon.Utils; namespace VECTO3GUI.ViewModel.Interfaces { - public interface IAirdragViewModel : IComponentViewModel, ICommonComponentParameters + public interface IAirdragViewModel : IAirdrag, IComponentViewModel { 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/IAuxiliariesBus.cs b/VECTO3GUI/ViewModel/Interfaces/IAuxiliariesBus.cs new file mode 100644 index 0000000000..f85d01d9b4 --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/IAuxiliariesBus.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TUGraz.VectoCommon.BusAuxiliaries; +using TUGraz.VectoCommon.Utils; + +namespace VECTO3GUI.ViewModel.Interfaces +{ + public interface IAuxiliariesBus + { + #region Electric System + + ObservableCollection<string> AlternatorTechnologies { get; set; } + bool DayrunninglightsLED { get; set; } + bool HeadlightsLED { get; set; } + bool PositionlightsLED { get; set; } + bool BrakelightsLED { get; set; } + bool InteriorLightsLED { get; set; } + + #endregion + + ConsumerTechnology DoorDriveTechnology { get; set; } + + #region Havac + + BusHVACSystemConfiguration SystemConfiguration { get; set; } + ACCompressorType CompressorTypeDriver { get; set; } + ACCompressorType CompressorTypePassenger { get; set; } + Watt AuxHeaterPower { get; set; } + bool DoubleGlasing { get; set; } + bool HeatPump { get; set; } + bool AdjustableAuxiliaryHeater { get; set; } + bool SeparateAirDistributionDucts { get; set; } + + #endregion + } +} diff --git a/VECTO3GUI/ViewModel/Interfaces/IAuxiliariesViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/IAuxiliariesViewModel.cs index dfb7ce5cd7..f387099776 100644 --- a/VECTO3GUI/ViewModel/Interfaces/IAuxiliariesViewModel.cs +++ b/VECTO3GUI/ViewModel/Interfaces/IAuxiliariesViewModel.cs @@ -6,7 +6,7 @@ using TUGraz.VectoCommon.Utils; using VECTO3GUI.Util; namespace VECTO3GUI.ViewModel.Interfaces { - public interface IAuxiliariesViewModel : IComponentViewModel + public interface IAuxiliariesViewModel : IAuxiliariesBus, IComponentViewModel { IAuxiliariesDeclarationInputData ModelData { get; } @@ -26,33 +26,7 @@ namespace VECTO3GUI.ViewModel.Interfaces { AllowedEntry<string>[] AllowedHVACTechnologies { get; } #region Bus Auxiliaries - - #region Electric System - ObservableCollection<string> AlternatorTechnologies { get; set; } - bool DayrunninglightsLED { get; set; } - bool HeadlightsLED { get; set; } - bool PositionlightsLED { get; set; } - bool BrakelightsLED { get; set; } - bool InteriorLightsLED { get; set; } - - #endregion - - ConsumerTechnology DoorDriveTechnology { get; set; } - - #region Havac - - BusHVACSystemConfiguration SystemConfiguration { get; set; } - ACCompressorType CompressorTypeDriver { get; set; } - ACCompressorType CompressorTypePassenger { get; set; } - Watt AuxHeaterPower { get; set; } - bool DoubleGlasing { get; set; } - bool HeatPump { get; set; } - bool AdjustableAuxiliaryHeater { get; set; } - bool SeparateAirDistributionDucts { get; set; } - - #endregion - AllowedEntry<BusHVACSystemConfiguration>[] AllowedSystemConfigurations { get; } AllowedEntry<ACCompressorType>[] AllowedDriverACCompressorTypes { get; } AllowedEntry<ACCompressorType>[] AllowedPassengerACCompressorTypes { get; } diff --git a/VECTO3GUI/ViewModel/Interfaces/ICompleteVehicleBus.cs b/VECTO3GUI/ViewModel/Interfaces/ICompleteVehicleBus.cs new file mode 100644 index 0000000000..10049057ff --- /dev/null +++ b/VECTO3GUI/ViewModel/Interfaces/ICompleteVehicleBus.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TUGraz.VectoCommon.BusAuxiliaries; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; + +namespace VECTO3GUI.ViewModel.Interfaces +{ + public interface ICompleteVehicleBus + { + string Manufacturer { get; set; } + string ManufacturerAddress { get; set; } + string Model { get; set; } + string VIN { get; set; } + DateTime Date { get; set; } + LegislativeClass LegislativeClass { get; set; } + RegistrationClass RegisteredClass { get; set; } + VehicleCode VehicleCode { get; set; } + Kilogram CurbMassChassis { get; set; } + Kilogram TechnicalPermissibleMaximumLadenMass { get; set; } + int NumberOfPassengersLowerDeck { get; set; } + int NumberOfPassengersUpperDeck { get; set; } + FloorType FloorType { get; set; } + Meter HeightIntegratedBody { get; set; } + Meter VehicleLength { get; set; } + Meter VehicleWidth { get; set; } + Meter EntranceHeight { get; set; } + + #region CompleteBusDataProviderV26 + + ConsumerTechnology DoorDriveTechnology { get; set; } + + #endregion + } +} diff --git a/VECTO3GUI/ViewModel/Interfaces/ICompleteVehicleBusViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/ICompleteVehicleBusViewModel.cs index aba88c5e9a..7e336b4a34 100644 --- a/VECTO3GUI/ViewModel/Interfaces/ICompleteVehicleBusViewModel.cs +++ b/VECTO3GUI/ViewModel/Interfaces/ICompleteVehicleBusViewModel.cs @@ -6,47 +6,11 @@ using VECTO3GUI.Util; namespace VECTO3GUI.ViewModel.Interfaces { - public interface ICompleteVehicleBusViewModel : IComponentViewModel + public interface ICompleteVehicleBusViewModel : ICompleteVehicleBus, IComponentViewModel { - #region CompleteVehicleBus - - string Manufacturer { get; set; } - string ManufacturerAddress { get; set; } - string Model { get; set; } - string VIN { get; set; } - DateTime Date { get; set; } - LegislativeClass LegislativeClass { get; set; } - RegistrationClass RegisteredClass { get; set; } - VehicleCode VehicleCode { get; set; } - Kilogram CurbMassChassis { get; set; } - Kilogram TechnicalPermissibleMaximumLadenMass { get; set; } - int NumberOfPassengersLowerDeck { get; set; } - int NumberOfPassengersUpperDeck { get; set; } - FloorType FloorType { get;set; } - Meter HeightIntegratedBody { get; set; } - Meter VehicleLength { get; set; } - Meter VehicleWidth { get; set; } - Meter EntranceHeight { get; set; } - - #region CompleteBusDataProviderV26 - - ConsumerTechnology DoorDriveTechnology { get; set; } - - #endregion - - #region MyRegion - - AllowedEntry<LegislativeClass>[] AllowedLegislativeClasses { get;} - AllowedEntry<VehicleCode>[] AllowedVehicleCodes{ get;} + AllowedEntry<LegislativeClass>[] AllowedLegislativeClasses { get; } + AllowedEntry<VehicleCode>[] AllowedVehicleCodes { get; } AllowedEntry<FloorType>[] AllowedFloorTypes { get; } - AllowedEntry<ConsumerTechnology>[] AllowedConsumerTechnologies { get;} - - #endregion - - - - #endregion - - + AllowedEntry<ConsumerTechnology>[] AllowedConsumerTechnologies { get; } } } diff --git a/VECTO3GUI/ViewModel/Interfaces/IJoblistViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/IJoblistViewModel.cs index 0e8f4c51bc..544a35cd74 100644 --- a/VECTO3GUI/ViewModel/Interfaces/IJoblistViewModel.cs +++ b/VECTO3GUI/ViewModel/Interfaces/IJoblistViewModel.cs @@ -9,6 +9,7 @@ namespace VECTO3GUI.ViewModel.Interfaces ObservableCollection<JobEntry> Jobs { get; } ICommand AddJob { get; } ICommand RemoveJob { get; } + ICommand RemoveAllJobs { get; } ICommand MoveJobUp { get; } ICommand MoveJobDown { get; } ICommand StartSimulation { get; } @@ -16,6 +17,7 @@ namespace VECTO3GUI.ViewModel.Interfaces ICommand JobEntrySetActive { get; } ICommand CreateNewJob { get; } ICommand OpenJob { get; } + ICommand OpenSettings { get; } } } diff --git a/VECTO3GUI/Views/JoblistView.xaml b/VECTO3GUI/Views/JoblistView.xaml index 64b7924bf3..a5e952aff5 100644 --- a/VECTO3GUI/Views/JoblistView.xaml +++ b/VECTO3GUI/Views/JoblistView.xaml @@ -38,13 +38,23 @@ <DataGrid.Resources> <ContextMenu x:Key="RowMenu"> - <MenuItem Header="Remove" Command="{Binding DataContext.RemoveJob, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"/> + <MenuItem Header="View File" Command="{Binding DataContext.OpenJob, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"/> <MenuItem Header="Edit File" Command="{Binding DataContext.EditJob, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"/> - <MenuItem Header="Add File" Command="{Binding DataContext.AddJob, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"/> - <MenuItem Header="Open File" Command="{Binding DataContext.OpenJob, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"/> + <Separator HorizontalAlignment="Stretch" Background="Gray"/> + <MenuItem Header="Remove File" Command="{Binding DataContext.RemoveJob, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"/> </ContextMenu> </DataGrid.Resources> + <DataGrid.ContextMenu> + <ContextMenu> + <MenuItem Header="Add File" Command="{Binding AddJob}"/> + <MenuItem Header="New File" Command="{Binding CreateNewJob}"/> + <Separator HorizontalAlignment="Stretch" Background="Gray"/> + <MenuItem Header="Remove All" Command="{Binding RemoveAllJobs}"/> + </ContextMenu> + </DataGrid.ContextMenu> + + <DataGrid.Columns> <DataGridTextColumn Header="File Path" Binding="{Binding Filename}"> <DataGridTextColumn.CellStyle> @@ -60,7 +70,7 @@ <Grid Grid.Row="1" Grid.Column="2" Margin="0,0,10,0"> <StackPanel Orientation="Vertical" Margin="0,30,0,0"> - <Button Margin="0,5,0,0" Command="{Binding EditJob}" Content="Edit" /> + <Button Margin="0,5,0,0" Command="{Binding EditJob}" Content="Edit File" /> <Button Margin="0,5,0,0" Command="{Binding CreateNewJob}" Content="New File" /> <Button Margin="0,5,0,0" Command="{Binding RemoveJob}" Content="Remove File" /> </StackPanel> diff --git a/VECTO3GUI/Views/SettingsView.xaml b/VECTO3GUI/Views/SettingsView.xaml new file mode 100644 index 0000000000..c1d24a7fde --- /dev/null +++ b/VECTO3GUI/Views/SettingsView.xaml @@ -0,0 +1,59 @@ +<UserControl x:Class="VECTO3GUI.Views.SettingsView" + 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:impl="clr-namespace:VECTO3GUI.ViewModel.Impl" + mc:Ignorable="d" + d:DesignHeight="200" d:DesignWidth="440" + d:DataContext="{d:DesignInstance Type=impl:SettingsViewModel, IsDesignTimeCreatable=False}"> + <Grid> + + <Grid.RowDefinitions> + <RowDefinition/> + <RowDefinition Height="40"/> + </Grid.RowDefinitions> + + <Grid Grid.Row="0" > + <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"> + + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <TextBlock Text="Default Save Path Location: " Margin="5,0,0,0"/> + <TextBox Width="200" Margin="0,0,5,0" IsReadOnly="True" IsReadOnlyCaretVisible="True" + Text="{Binding SavePathFolder}"/> + <Button Content="..." Width="30" + Command="{Binding OpenSaveFolderCommand}" + CommandParameter="{Binding SavePathFolder}"/> + </StackPanel> + + <StackPanel Orientation="Horizontal" Margin="0,5,0,0"> + <TextBlock Text="Default XML-Files Location: " Margin="5,0,0,0"/> + <TextBox Width="200" Margin="0,0,5,0" IsReadOnly="True" IsReadOnlyCaretVisible="True" + Text="{Binding XMLFilePath}"/> + <Button Content="..." Width="30" + Command="{Binding OpenXMLFolderCommand}" + CommandParameter="{Binding XMLFilePath}"/> + </StackPanel> + </StackPanel> + </Grid> + + <Grid Grid.Row="1"> + <Grid.ColumnDefinitions> + <ColumnDefinition/> + <ColumnDefinition/> + </Grid.ColumnDefinitions> + + <Button Content="Reset" HorizontalAlignment="Left" Width="80" Margin="10,0,0,0" + Command="{Binding ResetCommand}"/> + + <StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right"> + <Button Content="Save" HorizontalAlignment="Right" Margin="5,0,0,0" VerticalAlignment="Center" Width="70" + Command="{Binding SaveCommand}"/> + <Button Content="Cancel" HorizontalAlignment="Right" Margin="5,0,10,0" Width="70" + Command="{Binding CancelCommand}" + CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"/> + </StackPanel> + </Grid> + + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/SettingsView.xaml.cs b/VECTO3GUI/Views/SettingsView.xaml.cs new file mode 100644 index 0000000000..d2eddb4bb9 --- /dev/null +++ b/VECTO3GUI/Views/SettingsView.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 VECTO3GUI.Views +{ + /// <summary> + /// Interaction logic for SettingsView.xaml + /// </summary> + public partial class SettingsView : UserControl + { + public SettingsView() + { + InitializeComponent(); + } + } +} -- GitLab