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

Skip to content
Snippets Groups Projects
Commit 99b7ac84 authored by Harald MARTINI's avatar Harald MARTINI
Browse files

Added Simulation Settings

parent f6c85e1f
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,22 @@ ...@@ -20,7 +20,22 @@
<value>False</value> <value>False</value>
</setting> </setting>
<setting name="DefaultFilePath" serializeAs="String"> <setting name="DefaultFilePath" serializeAs="String">
<value>../../../VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration</value> <value />
</setting>
<setting name="WriteModalResults" serializeAs="String">
<value>True</value>
</setting>
<setting name="ModalResults1Hz" serializeAs="String">
<value>True</value>
</setting>
<setting name="Validate" serializeAs="String">
<value>True</value>
</setting>
<setting name="ActualModalData" serializeAs="String">
<value>True</value>
</setting>
<setting name="SerializeVectoRunData" serializeAs="String">
<value>True</value>
</setting> </setting>
</VECTO3GUI2020.Properties.Settings> </VECTO3GUI2020.Properties.Settings>
</userSettings> </userSettings>
......
using System.Windows; using System;
using System.Windows;
using Ninject; using Ninject;
using Ninject.Extensions.ChildKernel; using Ninject.Extensions.ChildKernel;
using VECTO3GUI2020.ViewModel.Interfaces; using VECTO3GUI2020.ViewModel.Interfaces;
...@@ -10,7 +11,9 @@ using VECTO3GUI2020.Helper; ...@@ -10,7 +11,9 @@ using VECTO3GUI2020.Helper;
using VECTO3GUI2020.Model.Implementation; using VECTO3GUI2020.Model.Implementation;
using VECTO3GUI2020.Ninject; using VECTO3GUI2020.Ninject;
using VECTO3GUI2020.Ninject.Vehicle; using VECTO3GUI2020.Ninject.Vehicle;
using VECTO3GUI2020.Properties;
using VECTO3GUI2020.ViewModel; using VECTO3GUI2020.ViewModel;
using Application = System.Windows.Application;
namespace VECTO3GUI2020 namespace VECTO3GUI2020
{ {
...@@ -22,6 +25,11 @@ namespace VECTO3GUI2020 ...@@ -22,6 +25,11 @@ namespace VECTO3GUI2020
protected override void OnStartup(StartupEventArgs e) protected override void OnStartup(StartupEventArgs e)
{ {
base.OnStartup(e); base.OnStartup(e);
if (Settings.Default.DefaultFilePath == null) {
Settings.Default.DefaultFilePath = Environment.CurrentDirectory;
Settings.Default.Save();
}
ConfigureContainer(); ConfigureContainer();
ConfigureMainWindow(); ConfigureMainWindow();
...@@ -51,6 +59,8 @@ namespace VECTO3GUI2020 ...@@ -51,6 +59,8 @@ namespace VECTO3GUI2020
container.Bind<IDialogHelper>().To<DialogHelper>().InSingletonScope(); container.Bind<IDialogHelper>().To<DialogHelper>().InSingletonScope();
container.Bind<IWindowHelper>().To<WindowHelper>(); container.Bind<IWindowHelper>().To<WindowHelper>();
} }
private void ConfigureMainWindow() private void ConfigureMainWindow()
......
...@@ -12,7 +12,7 @@ namespace VECTO3GUI2020.Properties { ...@@ -12,7 +12,7 @@ namespace VECTO3GUI2020.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.7.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
...@@ -37,7 +37,7 @@ namespace VECTO3GUI2020.Properties { ...@@ -37,7 +37,7 @@ namespace VECTO3GUI2020.Properties {
[global::System.Configuration.UserScopedSettingAttribute()] [global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("../../../VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration")] [global::System.Configuration.DefaultSettingValueAttribute("")]
public string DefaultFilePath { public string DefaultFilePath {
get { get {
return ((string)(this["DefaultFilePath"])); return ((string)(this["DefaultFilePath"]));
...@@ -46,5 +46,65 @@ namespace VECTO3GUI2020.Properties { ...@@ -46,5 +46,65 @@ namespace VECTO3GUI2020.Properties {
this["DefaultFilePath"] = value; this["DefaultFilePath"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool WriteModalResults {
get {
return ((bool)(this["WriteModalResults"]));
}
set {
this["WriteModalResults"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool ModalResults1Hz {
get {
return ((bool)(this["ModalResults1Hz"]));
}
set {
this["ModalResults1Hz"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool Validate {
get {
return ((bool)(this["Validate"]));
}
set {
this["Validate"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool ActualModalData {
get {
return ((bool)(this["ActualModalData"]));
}
set {
this["ActualModalData"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool SerializeVectoRunData {
get {
return ((bool)(this["SerializeVectoRunData"]));
}
set {
this["SerializeVectoRunData"] = value;
}
}
} }
} }
...@@ -6,7 +6,22 @@ ...@@ -6,7 +6,22 @@
<Value Profile="(Default)">False</Value> <Value Profile="(Default)">False</Value>
</Setting> </Setting>
<Setting Name="DefaultFilePath" Type="System.String" Scope="User"> <Setting Name="DefaultFilePath" Type="System.String" Scope="User">
<Value Profile="(Default)">../../../VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration</Value> <Value Profile="(Default)" />
</Setting>
<Setting Name="WriteModalResults" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="ModalResults1Hz" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="Validate" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="ActualModalData" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="SerializeVectoRunData" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting> </Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>
\ No newline at end of file
...@@ -289,13 +289,13 @@ namespace VECTO3GUI2020.ViewModel.Implementation ...@@ -289,13 +289,13 @@ namespace VECTO3GUI2020.ViewModel.Implementation
var fileWriter = new FileOutputWriter(GetOutputDirectory(fullFileName)); var fileWriter = new FileOutputWriter(GetOutputDirectory(fullFileName));
var runsFactory = new SimulatorFactory(mode, input, fileWriter) var runsFactory = new SimulatorFactory(mode, input, fileWriter)
{/* {
WriteModalResults = true, WriteModalResults = Settings.Default.WriteModalResults,
ModalResults1Hz = true, ModalResults1Hz = Settings.Default.ModalResults1Hz,
Validate = true, Validate = Settings.Default.Validate,
ActualModalData = true, ActualModalData = Settings.Default.ActualModalData,
SerializeVectoRunData = true SerializeVectoRunData = Settings.Default.SerializeVectoRunData,
*/
}; };
foreach (var runId in jobContainer.AddRuns(runsFactory)) foreach (var runId in jobContainer.AddRuns(runsFactory))
{ {
......
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Windows;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Input; using System.Windows.Input;
using VECTO3GUI2020.Helper; using VECTO3GUI2020.Helper;
...@@ -22,7 +23,13 @@ namespace VECTO3GUI2020.ViewModel.Implementation ...@@ -22,7 +23,13 @@ namespace VECTO3GUI2020.ViewModel.Implementation
private String _defaultFilePath; private String _defaultFilePath;
public String DefaultFilePath private bool _writeModalResults;
private bool _modalResults1Hz;
private bool _validate;
private bool _actualModalData;
private bool _serializeVectoRunData;
public String DefaultFilePath
{ {
get => _defaultFilePath; get => _defaultFilePath;
set set
...@@ -32,16 +39,41 @@ namespace VECTO3GUI2020.ViewModel.Implementation ...@@ -32,16 +39,41 @@ namespace VECTO3GUI2020.ViewModel.Implementation
SetProperty(ref _defaultFilePath, value, "DefaultFilePath"); SetProperty(ref _defaultFilePath, value, "DefaultFilePath");
} }
} }
public SettingsViewModel(IDialogHelper dialogHelper)
public SettingsViewModel(IDialogHelper dialogHelper)
{ {
base.Title = "Settings"; base.Title = "Settings";
_settings = Settings.Default; _settings = Settings.Default;
_defaultFilePath = _settings.DefaultFilePath; _defaultFilePath = _settings.DefaultFilePath;
_writeModalResults = _settings.WriteModalResults;
_modalResults1Hz = _settings.ModalResults1Hz;
_validate = _settings.Validate;
_actualModalData = _settings.ActualModalData;
_serializeVectoRunData = _settings.SerializeVectoRunData;
_dialogHelper = dialogHelper; _dialogHelper = dialogHelper;
} }
private ICommand _closeWindowCommand;
public ICommand CloseWindowCommand
{
get
{
return _closeWindowCommand ?? new RelayCommand<Window>(window => CloseWindow(window, _dialogHelper), window => true);
}
}
private void CloseWindow(Window window, bool ask)
{
}
public ICommand ChangeFilePath public ICommand ChangeFilePath
{ {
get get
{ {
...@@ -69,6 +101,71 @@ namespace VECTO3GUI2020.ViewModel.Implementation ...@@ -69,6 +101,71 @@ namespace VECTO3GUI2020.ViewModel.Implementation
} }
} }
public bool SerializeVectoRunData
{
get => _serializeVectoRunData;
set
{
if (SetProperty(ref _serializeVectoRunData, value)) {
_settings.SerializeVectoRunData = value;
_settings.Save();
}
}
}
} public bool ActualModalData
{
get => _actualModalData;
set
{
if (SetProperty(ref _actualModalData, value)) {
_settings.ActualModalData = value;
_settings.Save();
}
}
}
public bool Validate
{
get => _validate;
set
{
if (SetProperty(ref _validate, value))
{
_settings.Validate = value;
_settings.Save();
}
}
}
public bool ModalResults1Hz
{
get => _modalResults1Hz;
set
{
if (SetProperty(ref _modalResults1Hz, value))
{
_settings.ModalResults1Hz = value;
_settings.Save();
}
}
}
public bool WriteModalResults
{
get => _writeModalResults;
set
{
if (SetProperty(ref _writeModalResults, value))
{
_settings.WriteModalResults = value;
_settings.Save();
}
}
}
}
} }
...@@ -7,9 +7,64 @@ ...@@ -7,9 +7,64 @@
xmlns:customControls="clr-namespace:VECTO3GUI2020.Views.Multistage.CustomControls" xmlns:customControls="clr-namespace:VECTO3GUI2020.Views.Multistage.CustomControls"
xmlns:implementation="clr-namespace:VECTO3GUI2020.ViewModel.Implementation" xmlns:implementation="clr-namespace:VECTO3GUI2020.ViewModel.Implementation"
mc:Ignorable="d" Height="450" Width="800" d:DataContext="{d:DesignInstance implementation:SettingsViewModel }"> mc:Ignorable="d" Height="450" Width="800" d:DataContext="{d:DesignInstance implementation:SettingsViewModel }">
<UserControl.Resources>
<Style TargetType="Label">
<Setter Property="Margin" Value="4 4 4 4"></Setter>
<Setter Property="Padding" Value="4 4 4 4"></Setter>
</Style>
<Style TargetType="CheckBox">
<Setter Property="Margin" Value="4 4 4 4"></Setter>
<Setter Property="Padding" Value="4 4 4 4"></Setter>
<Setter Property="VerticalAlignment" Value="Center"></Setter>
</Style>
</UserControl.Resources>
<Grid> <Grid>
<StackPanel> <DockPanel LastChildFill="False">
<customControls:FilePicker Width="450" MinWidth="400" Text="{Binding DefaultFilePath}" HorizontalAlignment="Stretch" Command="{Binding ChangeFilePath}"/> <Grid DockPanel.Dock="Top">
</StackPanel> <Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="1*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" DockPanel.Dock="Left">Default Path</Label>
<customControls:FilePicker Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="3" DockPanel.Dock="Right"
Text="{Binding DefaultFilePath}"
HorizontalAlignment="Stretch" Command="{Binding ChangeFilePath}"/>
<Label Grid.Row="1" Grid.Column="0">Serialize Vecto Run Data</Label>
<CheckBox Grid.Row="1" Grid.Column="1" IsChecked="{Binding SerializeVectoRunData}"></CheckBox>
<Label Grid.Row="1" Grid.Column="2">Write Modal Results</Label>
<CheckBox Grid.Row="1" Grid.Column="3" IsChecked="{Binding WriteModalResults}"></CheckBox>
<Label Grid.Row="2" Grid.Column="0">Validate</Label>
<CheckBox Grid.Row="2" Grid.Column="1" IsChecked="{Binding Validate}"></CheckBox>
<Label Grid.Row="2" Grid.Column="2">Actual Modal Data</Label>
<CheckBox Grid.Row="2" Grid.Column="3" IsChecked="{Binding ActualModalData}"></CheckBox>
<Label Grid.Row="3" Grid.Column="0">ModalResults1Hz</Label>
<CheckBox Grid.Row="3" Grid.Column="1" IsChecked="{Binding ModalResults1Hz}"></CheckBox>
</Grid>
<!--<DockPanel DockPanel.Dock="Bottom" LastChildFill="False">
<Button DockPanel.Dock="Right"
Width="100"
Command="{Binding CloseWindowCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
Style="{DynamicResource MultiStageButtonStyle1}"
Margin="4"
Padding="4">Close</Button>
</DockPanel>-->
</DockPanel>
</Grid> </Grid>
</UserControl> </UserControl>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment