diff --git a/VECTO3GUI2020/Helper/Converter/SIValueToStringConverter.cs b/VECTO3GUI2020/Helper/Converter/SIValueToStringConverter.cs index 7ed47de2dde5fcc675e1072cdb9be68f339cf7b1..e571910c613edca7407366c48b34dc31e38ef120 100644 --- a/VECTO3GUI2020/Helper/Converter/SIValueToStringConverter.cs +++ b/VECTO3GUI2020/Helper/Converter/SIValueToStringConverter.cs @@ -35,21 +35,21 @@ namespace VECTO3GUI2020.Helper.Converter public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { try { - var hackedString = value as string; - hackedString = hackedString.Replace(",", "."); - //if (!hackedString.Contains(".")) { - // hackedString = hackedString + ".0"; - //} - var doubleVal = Double.Parse(hackedString, CultureInfo.InvariantCulture); - if (_convertedSI != null) { - return new ConvertedSI(doubleVal, _convertedSI.Units); - } - if (_si != null) - { - var newSi = SIUtils.CreateSIValue(_si.GetType(), doubleVal); - return newSi; - } + if (_si != null || _convertedSI != null) { + var hackedString = value as string; + hackedString = hackedString.Replace(",", "."); + var doubleVal = Double.Parse(hackedString, CultureInfo.InvariantCulture); + if (_convertedSI != null) + { + return new ConvertedSI(doubleVal, _convertedSI.Units); + } + if (_si != null) + { + var newSi = SIUtils.CreateSIValue(_si.GetType(), doubleVal); + return newSi; + } + } } catch (Exception e) { return value; diff --git a/VECTO3GUI2020/MainWindow.xaml b/VECTO3GUI2020/MainWindow.xaml index 842bfa24aed0b4a9a5633d020a9ececf2031e69d..73a0a4efb0ecca551477ec3772aa586d54540eff 100644 --- a/VECTO3GUI2020/MainWindow.xaml +++ b/VECTO3GUI2020/MainWindow.xaml @@ -8,7 +8,8 @@ mc:Ignorable="d" Title="Vecto" Height="450" Width="820" WindowStartupLocation="CenterScreen" - AutomationProperties.Name="MainWindow"> + AutomationProperties.Name="=" + x:Name="MainView"> @@ -24,8 +25,8 @@ </Grid.RowDefinitions> <StackPanel Grid.Row="0" Orientation="Vertical"> - <Menu x:Name="menu" IsMainMenu="True"> - <MenuItem Header="File" VerticalAlignment="Stretch"> + <Menu x:Name="menu" AutomationProperties.Name="-" AutomationProperties.AutomationId="Test" IsMainMenu="True"> + <MenuItem Header="File" x:Name="MenuItemFile" AutomationProperties.Name="=" VerticalAlignment="Stretch"> <MenuItem Header="Settings" Command="{Binding OpenSettings}"/> <MenuItem Header="New File" Command="{Binding NewInterimFile}"/> <MenuItem Header="Open File" Command="{Binding AddJob}"/> diff --git a/VECTO3GUI2020/ViewModel/Implementation/JobListViewModel.cs b/VECTO3GUI2020/ViewModel/Implementation/JobListViewModel.cs index 02fa7b5a68fa649b879d4cd27e2ef14c0bc40ee7..8b001c0ecdb1484a2ddcf1c8d0ba42655157409f 100644 --- a/VECTO3GUI2020/ViewModel/Implementation/JobListViewModel.cs +++ b/VECTO3GUI2020/ViewModel/Implementation/JobListViewModel.cs @@ -25,6 +25,8 @@ using TUGraz.VectoCore; using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.InputData.FileIO.JSON; using TUGraz.VectoCore.InputData.FileIO.XML; +using TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider; +using TUGraz.VectoCore.InputData.FileIO.XML.Declaration.Interfaces; using TUGraz.VectoCore.InputData.Impl; using TUGraz.VectoCore.Models.Simulation.Impl; using TUGraz.VectoCore.OutputData; @@ -164,13 +166,13 @@ namespace VECTO3GUI2020.ViewModel.Implementation private async Task RunSimulationAsync(CancellationToken ct, IProgress<MessageEntry> outputMessages, IProgress<int> progress) { progress.Report(0); - for (int i = 0; i <= 100; i++) { - await Task.Delay(0); - progress.Report(i); - if (ct.IsCancellationRequested) { - return; - } - } + //for (int i = 0; i <= 100; i++) { + // await Task.Delay(0); + // progress.Report(i); + // if (ct.IsCancellationRequested) { + // return; + // } + //} IDocumentViewModel[] jobs; lock (_jobsLock) { @@ -186,6 +188,7 @@ namespace VECTO3GUI2020.ViewModel.Implementation //TODO add output path to settings var outputPath = Settings.Default.DefaultFilePath; + var sumFileWriter = new FileOutputWriter(outputPath); @@ -231,34 +234,46 @@ namespace VECTO3GUI2020.ViewModel.Implementation var extension = Path.GetExtension(jobEntry.DataSource.SourceFile); IInputDataProvider input = null; - switch (extension) - { + IXMLMultistageInputDataProvider multistageInput = null; + + var FileWriter = new FileOutputWriter(fullFileName); + switch (extension) { case Constants.FileExtensions.VectoJobFile: input = JSONInputDataFactory.ReadJsonJob(fullFileName); var tmp = input as IDeclarationInputDataProvider; - mode = tmp?.JobInputData.SavedInDeclarationMode ?? false ? ExecutionMode.Declaration : ExecutionMode.Engineering; + mode = tmp?.JobInputData.SavedInDeclarationMode ?? false + ? ExecutionMode.Declaration + : ExecutionMode.Engineering; break; case ".xml": var xdoc = XDocument.Load(fullFileName); var rootNode = xdoc.Root?.Name.LocalName ?? ""; - if (XMLNames.VectoInputEngineering.Equals(rootNode, StringComparison.InvariantCultureIgnoreCase)) - { + if (XMLNames.VectoInputEngineering.Equals(rootNode, + StringComparison.InvariantCultureIgnoreCase)) { input = xmlReader.CreateEngineering(fullFileName); mode = ExecutionMode.Engineering; - } - else if (XMLNames.VectoInputDeclaration.Equals(rootNode, StringComparison.InvariantCultureIgnoreCase) - || XMLNames.VectoOutputMultistage.Equals(rootNode, StringComparison.InvariantCultureIgnoreCase)) - { - using (var reader = XmlReader.Create(fullFileName)) - { + } else if (XMLNames.VectoInputDeclaration.Equals(rootNode, + StringComparison.InvariantCultureIgnoreCase)) { + using (var reader = XmlReader.Create(fullFileName)) { input = xmlReader.CreateDeclaration(reader); } + + mode = ExecutionMode.Declaration; + } else if (XMLNames.VectoOutputMultistage.Equals(rootNode, + StringComparison.InvariantCultureIgnoreCase)) { + using (var reader = XmlReader.Create(fullFileName)) { + input = new XMLDeclarationVIFInputData(xmlReader.Create(fullFileName) as IMultistageBusInputDataProvider, null); + FileWriter = new FileOutputVIFWriter(fullFileName, + (jobEntry as MultiStageJobViewModel_v0_1).ManufacturingStages?.Count ?? 0); + } + mode = ExecutionMode.Declaration; } + break; } - if (input == null) + if (input == null && multistageInput == null) { outputMessages.Report( new MessageEntry() @@ -271,13 +286,13 @@ namespace VECTO3GUI2020.ViewModel.Implementation var fileWriter = new FileOutputWriter(GetOutputDirectory(fullFileName)); var runsFactory = new SimulatorFactory(mode, input, fileWriter) - { + {/* WriteModalResults = true, ModalResults1Hz = true, Validate = true, ActualModalData = true, SerializeVectoRunData = true - + */ }; foreach (var runId in jobContainer.AddRuns(runsFactory)) { diff --git a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/InterimStageBusVehicleViewModel_v2_8.cs b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/InterimStageBusVehicleViewModel_v2_8.cs index f139399557404b86ca8d9d4a89e1ff91c8812868..49c18a55e6d5d9490180550c09ceae84c1965521 100644 --- a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/InterimStageBusVehicleViewModel_v2_8.cs +++ b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/InterimStageBusVehicleViewModel_v2_8.cs @@ -31,7 +31,7 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation { public enum AIRDRAGMODIFIED { - [GuiLabel("Unknown")] + [GuiLabel("")] UNKNOWN = 0, [GuiLabel("True")] TRUE = 1, @@ -382,7 +382,12 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation public bool NumberOfPassengersEditingEnabled { get { return _numberOfPassengersEditingEnabled; } - set { SetProperty(ref _numberOfPassengersEditingEnabled, value); } + set + { + SetProperty(ref _numberOfPassengersEditingEnabled, value); + //OnPropertyChanged(nameof(NumberOfPassengersUpperDeck)); + //OnPropertyChanged(nameof(NumberOfPassengersLowerDeck)); + } } diff --git a/VECTO3GUI2020/Views/Multistage/CustomControls/MultiStageParameter.xaml.cs b/VECTO3GUI2020/Views/Multistage/CustomControls/MultiStageParameter.xaml.cs index b73b9868210361aa3e18f276c167d13760a43a69..4eac5fc6f5dec49a8a2d2be4b10577866007355c 100644 --- a/VECTO3GUI2020/Views/Multistage/CustomControls/MultiStageParameter.xaml.cs +++ b/VECTO3GUI2020/Views/Multistage/CustomControls/MultiStageParameter.xaml.cs @@ -171,7 +171,7 @@ namespace VECTO3GUI2020.Views.Multistage.CustomControls set { SetCurrentValue(EditingEnabledProperty, value); - OnPropertyChanged(nameof(EditingEnabled)); + //OnPropertyChanged(nameof(EditingEnabled)); } }