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

Skip to content
Snippets Groups Projects
Commit ebcecce7 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

added output path to gui

parent b948f924
No related branches found
No related tags found
No related merge requests found
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
<setting name="SerializeVectoRunData" serializeAs="String"> <setting name="SerializeVectoRunData" serializeAs="String">
<value>True</value> <value>True</value>
</setting> </setting>
<setting name="DefaultOutputPath" serializeAs="String">
<value />
</setting>
</VECTO3GUI2020.Properties.Settings> </VECTO3GUI2020.Properties.Settings>
</userSettings> </userSettings>
<runtime> <runtime>
......
...@@ -106,5 +106,17 @@ namespace VECTO3GUI2020.Properties { ...@@ -106,5 +106,17 @@ namespace VECTO3GUI2020.Properties {
this["SerializeVectoRunData"] = value; this["SerializeVectoRunData"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string DefaultOutputPath {
get {
return ((string)(this["DefaultOutputPath"]));
}
set {
this["DefaultOutputPath"] = value;
}
}
} }
} }
...@@ -23,5 +23,8 @@ ...@@ -23,5 +23,8 @@
<Setting Name="SerializeVectoRunData" Type="System.Boolean" Scope="User"> <Setting Name="SerializeVectoRunData" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value> <Value Profile="(Default)">True</Value>
</Setting> </Setting>
<Setting Name="DefaultOutputPath" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>
\ No newline at end of file
...@@ -187,13 +187,14 @@ namespace VECTO3GUI2020.ViewModel.Implementation ...@@ -187,13 +187,14 @@ namespace VECTO3GUI2020.ViewModel.Implementation
Time = DateTime.Now, Time = DateTime.Now,
Type = MessageType.InfoMessage, Type = MessageType.InfoMessage,
}); });
return;
} }
} }
//TODO add output path to settings //TODO add output path to settings
var outputPath = Settings.Default.DefaultFilePath; var outputPath = Settings.Default.DefaultFilePath;
var sumFileWriter = new FileOutputWriter(outputPath); var sumFileWriter = new FileOutputWriter(GetOutputDirectory(Jobs.First(x => x.Selected).DataSource.SourceFile));
...@@ -453,21 +454,17 @@ namespace VECTO3GUI2020.ViewModel.Implementation ...@@ -453,21 +454,17 @@ namespace VECTO3GUI2020.ViewModel.Implementation
private string GetOutputDirectory(string jobFilePath) private string GetOutputDirectory(string jobFilePath)
{ {
var outFile = jobFilePath; var outFile = jobFilePath;
var OutputDirectory = Settings.Default.DefaultFilePath; var outputDirectory = Settings.Default.DefaultOutputPath;
if (!string.IsNullOrWhiteSpace(OutputDirectory)) if (string.IsNullOrWhiteSpace(outputDirectory)) {
{ return outFile;
if (Path.IsPathRooted(OutputDirectory)) }
{
outFile = Path.Combine(OutputDirectory, Path.GetFileName(jobFilePath) ?? ""); outFile = Path.IsPathRooted(outputDirectory)
} ? Path.Combine(outputDirectory, Path.GetFileName(jobFilePath) ?? "")
else : Path.Combine(Path.GetDirectoryName(jobFilePath) ?? "", outputDirectory,
{ Path.GetFileName(jobFilePath) ?? "");
outFile = Path.Combine(Path.GetDirectoryName(jobFilePath) ?? "", OutputDirectory, Path.GetFileName(jobFilePath) ?? ""); if (!Directory.Exists(Path.GetDirectoryName(outFile))) {
} Directory.CreateDirectory(Path.GetDirectoryName(outFile));
if (!Directory.Exists(Path.GetDirectoryName(outFile)))
{
Directory.CreateDirectory(Path.GetDirectoryName(outFile));
}
} }
return outFile; return outFile;
......
...@@ -17,19 +17,20 @@ namespace VECTO3GUI2020.ViewModel.Implementation ...@@ -17,19 +17,20 @@ namespace VECTO3GUI2020.ViewModel.Implementation
private Settings _settings; private Settings _settings;
private ICommand _changePath; private ICommand _changePath;
private ICommand _changeOutPath;
private IDialogHelper _dialogHelper; private IDialogHelper _dialogHelper;
private String _defaultFilePath; private string _defaultFilePath;
private string _defaultOutputPath;
private bool _writeModalResults; private bool _writeModalResults;
private bool _modalResults1Hz; private bool _modalResults1Hz;
private bool _validate; private bool _validate;
private bool _actualModalData; private bool _actualModalData;
private bool _serializeVectoRunData; private bool _serializeVectoRunData;
public String DefaultFilePath public string DefaultFilePath
{ {
get => _defaultFilePath; get => _defaultFilePath;
set set
...@@ -40,7 +41,14 @@ namespace VECTO3GUI2020.ViewModel.Implementation ...@@ -40,7 +41,14 @@ namespace VECTO3GUI2020.ViewModel.Implementation
} }
} }
public string DefaultOutputPath {
get => _defaultOutputPath;
set {
_settings.DefaultOutputPath = value;
_settings.Save();
SetProperty(ref _defaultOutputPath, value, "DefaultOutputPath");
}
}
public SettingsViewModel(IDialogHelper dialogHelper) public SettingsViewModel(IDialogHelper dialogHelper)
{ {
...@@ -56,6 +64,7 @@ namespace VECTO3GUI2020.ViewModel.Implementation ...@@ -56,6 +64,7 @@ namespace VECTO3GUI2020.ViewModel.Implementation
} }
private ICommand _closeWindowCommand; private ICommand _closeWindowCommand;
public ICommand CloseWindowCommand public ICommand CloseWindowCommand
{ {
get get
...@@ -101,6 +110,21 @@ namespace VECTO3GUI2020.ViewModel.Implementation ...@@ -101,6 +110,21 @@ namespace VECTO3GUI2020.ViewModel.Implementation
} }
} }
public ICommand ChangeOutputPath {
get {
return _changeOutPath ?? new RelayCommand(() => {
var new_path = _dialogHelper.OpenFolderDialog(DefaultFilePath);
if (new_path != null) {
DefaultOutputPath = new_path;
}
}, () => { return true; });
}
private set {
_changeOutPath = value;
OnPropertyChanged();
}
}
public bool SerializeVectoRunData public bool SerializeVectoRunData
{ {
get => _serializeVectoRunData; get => _serializeVectoRunData;
...@@ -167,5 +191,7 @@ namespace VECTO3GUI2020.ViewModel.Implementation ...@@ -167,5 +191,7 @@ namespace VECTO3GUI2020.ViewModel.Implementation
} }
} }
} }
} }
} }
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
<ColumnDefinition Width="1*"></ColumnDefinition> <ColumnDefinition Width="1*"></ColumnDefinition>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition> <RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="30"></RowDefinition> <RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition> <RowDefinition Height="30"></RowDefinition>
...@@ -41,20 +42,42 @@ ...@@ -41,20 +42,42 @@
Text="{Binding DefaultFilePath}" Text="{Binding DefaultFilePath}"
HorizontalAlignment="Stretch" Command="{Binding ChangeFilePath}"/> HorizontalAlignment="Stretch" Command="{Binding ChangeFilePath}"/>
<Label Grid.Row="1" Grid.Column="0">Serialize Vecto Run Data</Label> <Label Grid.Row="1" Grid.Column="0" DockPanel.Dock="Left">Default Path</Label>
<CheckBox Grid.Row="1" Grid.Column="1" IsChecked="{Binding SerializeVectoRunData}"></CheckBox> <Grid Grid.Row="1" Grid.Column="1" Margin="4" VerticalAlignment="Stretch" Grid.ColumnSpan="3" DockPanel.Dock="Right">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="30px"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBox x:Name="textBox" VerticalContentAlignment="Center" Padding="4" Margin = "0 0 0 0" IsReadOnly="false"
Text="{Binding DefaultOutputPath}" HorizontalAlignment="Stretch" TextWrapping="Wrap"
Style="{DynamicResource TextBoxStyle1}"/>
<Button x:Name="button" Padding="4" Margin="4 0 0 0" Grid.Column="1" ContentTemplate="{DynamicResource AddDocumentIcon}"
Command="{Binding ChangeOutputPath}" Style="{DynamicResource FilePickerButtonStyle}">
</Button>
</Grid>
<!--<customControls:FilePicker Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" DockPanel.Dock="Right"
Text="{Binding DefaultOutputPath}"
HorizontalAlignment="Stretch" Command="{Binding ChangeOutputPath}"/>-->
<Label Grid.Row="2" Grid.Column="0">Serialize Vecto Run Data</Label>
<CheckBox Grid.Row="2" Grid.Column="1" IsChecked="{Binding SerializeVectoRunData}"></CheckBox>
<Label Grid.Row="1" Grid.Column="2">Write Modal Results</Label> <Label Grid.Row="3" Grid.Column="2">Write Modal Results</Label>
<CheckBox Grid.Row="1" Grid.Column="3" IsChecked="{Binding WriteModalResults}"></CheckBox> <CheckBox Grid.Row="3" Grid.Column="3" IsChecked="{Binding WriteModalResults}"></CheckBox>
<Label Grid.Row="2" Grid.Column="0">Validate</Label> <Label Grid.Row="3" Grid.Column="0">Validate</Label>
<CheckBox Grid.Row="2" Grid.Column="1" IsChecked="{Binding Validate}"></CheckBox> <CheckBox Grid.Row="3" Grid.Column="1" IsChecked="{Binding Validate}"></CheckBox>
<Label Grid.Row="2" Grid.Column="2">Actual Modal Data</Label> <Label Grid.Row="4" Grid.Column="2">Actual Modal Data</Label>
<CheckBox Grid.Row="2" Grid.Column="3" IsChecked="{Binding ActualModalData}"></CheckBox> <CheckBox Grid.Row="4" Grid.Column="3" IsChecked="{Binding ActualModalData}"></CheckBox>
<Label Grid.Row="3" Grid.Column="0">ModalResults1Hz</Label> <Label Grid.Row="4" Grid.Column="0">ModalResults1Hz</Label>
<CheckBox Grid.Row="3" Grid.Column="1" IsChecked="{Binding ModalResults1Hz}"></CheckBox> <CheckBox Grid.Row="4" Grid.Column="1" IsChecked="{Binding ModalResults1Hz}"></CheckBox>
</Grid> </Grid>
<!--<DockPanel DockPanel.Dock="Bottom" LastChildFill="False"> <!--<DockPanel DockPanel.Dock="Bottom" LastChildFill="False">
<Button DockPanel.Dock="Right" <Button DockPanel.Dock="Right"
......
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