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 @@
<setting name="SerializeVectoRunData" serializeAs="String">
<value>True</value>
</setting>
<setting name="DefaultOutputPath" serializeAs="String">
<value />
</setting>
</VECTO3GUI2020.Properties.Settings>
</userSettings>
<runtime>
......
......@@ -106,5 +106,17 @@ namespace VECTO3GUI2020.Properties {
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 @@
<Setting Name="SerializeVectoRunData" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="DefaultOutputPath" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
\ No newline at end of file
......@@ -187,13 +187,14 @@ namespace VECTO3GUI2020.ViewModel.Implementation
Time = DateTime.Now,
Type = MessageType.InfoMessage,
});
return;
}
}
//TODO add output path to settings
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
private string GetOutputDirectory(string jobFilePath)
{
var outFile = jobFilePath;
var OutputDirectory = Settings.Default.DefaultFilePath;
if (!string.IsNullOrWhiteSpace(OutputDirectory))
{
if (Path.IsPathRooted(OutputDirectory))
{
outFile = Path.Combine(OutputDirectory, Path.GetFileName(jobFilePath) ?? "");
}
else
{
outFile = Path.Combine(Path.GetDirectoryName(jobFilePath) ?? "", OutputDirectory, Path.GetFileName(jobFilePath) ?? "");
}
if (!Directory.Exists(Path.GetDirectoryName(outFile)))
{
Directory.CreateDirectory(Path.GetDirectoryName(outFile));
}
var outputDirectory = Settings.Default.DefaultOutputPath;
if (string.IsNullOrWhiteSpace(outputDirectory)) {
return outFile;
}
outFile = Path.IsPathRooted(outputDirectory)
? Path.Combine(outputDirectory, Path.GetFileName(jobFilePath) ?? "")
: Path.Combine(Path.GetDirectoryName(jobFilePath) ?? "", outputDirectory,
Path.GetFileName(jobFilePath) ?? "");
if (!Directory.Exists(Path.GetDirectoryName(outFile))) {
Directory.CreateDirectory(Path.GetDirectoryName(outFile));
}
return outFile;
......
......@@ -17,19 +17,20 @@ namespace VECTO3GUI2020.ViewModel.Implementation
private Settings _settings;
private ICommand _changePath;
private ICommand _changeOutPath;
private IDialogHelper _dialogHelper;
private String _defaultFilePath;
private string _defaultFilePath;
private string _defaultOutputPath;
private bool _writeModalResults;
private bool _modalResults1Hz;
private bool _validate;
private bool _actualModalData;
private bool _serializeVectoRunData;
public String DefaultFilePath
public string DefaultFilePath
{
get => _defaultFilePath;
set
......@@ -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)
{
......@@ -56,6 +64,7 @@ namespace VECTO3GUI2020.ViewModel.Implementation
}
private ICommand _closeWindowCommand;
public ICommand CloseWindowCommand
{
get
......@@ -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
{
get => _serializeVectoRunData;
......@@ -167,5 +191,7 @@ namespace VECTO3GUI2020.ViewModel.Implementation
}
}
}
}
}
......@@ -29,6 +29,7 @@
<ColumnDefinition Width="1*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
......@@ -41,20 +42,42 @@
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="0" DockPanel.Dock="Left">Default Path</Label>
<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>
<CheckBox Grid.Row="1" Grid.Column="3" IsChecked="{Binding WriteModalResults}"></CheckBox>
<Label Grid.Row="3" Grid.Column="2">Write Modal Results</Label>
<CheckBox Grid.Row="3" 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="3" Grid.Column="0">Validate</Label>
<CheckBox Grid.Row="3" 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="4" Grid.Column="2">Actual Modal Data</Label>
<CheckBox Grid.Row="4" 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>
<Label Grid.Row="4" Grid.Column="0">ModalResults1Hz</Label>
<CheckBox Grid.Row="4" Grid.Column="1" IsChecked="{Binding ModalResults1Hz}"></CheckBox>
</Grid>
<!--<DockPanel DockPanel.Dock="Bottom" LastChildFill="False">
<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