From 423c4c0cfdf993bc4a33e93da73e97b8bf0f632b Mon Sep 17 00:00:00 2001 From: Harald Martini <harald.martini@student.tugraz.at> Date: Tue, 30 Aug 2022 14:44:48 +0200 Subject: [PATCH] added CompletedBusV7 Viewmodel --- VECTO3GUI2020/Ninject/DocumentModule.cs | 3 + .../Document/CompletedBusV7ViewModel.cs | 67 +++++++++++++++++++ .../Document/SimulationOnlyDeclarationJob.cs | 2 +- .../Implementation/JobListViewModel.cs | 3 + 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 VECTO3GUI2020/ViewModel/Implementation/Document/CompletedBusV7ViewModel.cs diff --git a/VECTO3GUI2020/Ninject/DocumentModule.cs b/VECTO3GUI2020/Ninject/DocumentModule.cs index a89e2a9128..31fd37e953 100644 --- a/VECTO3GUI2020/Ninject/DocumentModule.cs +++ b/VECTO3GUI2020/Ninject/DocumentModule.cs @@ -19,6 +19,9 @@ namespace VECTO3GUI2020.Ninject Bind<IDocumentViewModel>().To<CreateVifViewModel>() .Named(typeof(JSONInputDataV10_PrimaryAndStageInputBus).ToString()); + Bind<IDocumentViewModel>().To<CompletedBusV7ViewModel>() + .Named(typeof(JSONInputDataCompletedBusFactorMethodV7).ToString()); + //Bind<IDocumentViewModel>().To<MultistageJobViewModel>().Named(XmlDocumentType.MultistageOutputData.ToString()); //Bind<IDocumentViewModel>().To<DeclarationTrailerJobDocumentViewModel>().Named(XmlDocumentType.DeclarationTrailerJobData.ToString()); diff --git a/VECTO3GUI2020/ViewModel/Implementation/Document/CompletedBusV7ViewModel.cs b/VECTO3GUI2020/ViewModel/Implementation/Document/CompletedBusV7ViewModel.cs new file mode 100644 index 0000000000..7c29ea1658 --- /dev/null +++ b/VECTO3GUI2020/ViewModel/Implementation/Document/CompletedBusV7ViewModel.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCore.Utils; +using VECTO3GUI2020.ViewModel.Implementation.Common; +using VECTO3GUI2020.ViewModel.Interfaces; +using VECTO3GUI2020.ViewModel.Interfaces.Document; + +namespace VECTO3GUI2020.ViewModel.Implementation.Document +{ + internal class CompletedBusV7ViewModel : ViewModelBase, IJobViewModel + { + private bool _selected; + private DataSource _dataSource; + + private IMultistageVIFInputData _inputData; + private string _documentName; + + #region Implementation of IDocumentViewModel + + public CompletedBusV7ViewModel(IInputDataProvider inputData) + { + _dataSource = inputData.DataSource; + _inputData = inputData as IMultistageVIFInputData; + if (_inputData == null) { + throw new VectoException("Invalid input file"); + } + + _documentName = Path.GetFileNameWithoutExtension(_inputData.DataSource.SourceFile); + } + + public string DocumentName => _documentName; + + public XmlDocumentType? DocumentType => null; + + public string DocumentTypeName => "CompletedBus"; + + public DataSource DataSource => _dataSource; + + public IEditViewModel EditViewModel => null; + + public bool Selected + { + get => _selected; + set => SetProperty(ref _selected, value); + } + + public bool CanBeSimulated + { + get => true; + set => throw new NotImplementedException(); + } + + public IAdditionalJobInfoViewModel AdditionalJobInfoVm + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + #endregion + } +} diff --git a/VECTO3GUI2020/ViewModel/Implementation/Document/SimulationOnlyDeclarationJob.cs b/VECTO3GUI2020/ViewModel/Implementation/Document/SimulationOnlyDeclarationJob.cs index df09dd6096..77f8343fd9 100644 --- a/VECTO3GUI2020/ViewModel/Implementation/Document/SimulationOnlyDeclarationJob.cs +++ b/VECTO3GUI2020/ViewModel/Implementation/Document/SimulationOnlyDeclarationJob.cs @@ -8,7 +8,7 @@ using VECTO3GUI2020.ViewModel.Interfaces.Document; namespace VECTO3GUI2020.ViewModel.Implementation.Document { - public class SimulationOnlyDeclarationJob : ViewModelBase, IDocumentViewModel, IJobViewModel + public class SimulationOnlyDeclarationJob : ViewModelBase, IJobViewModel { #region Implementation of IDocumentViewModel diff --git a/VECTO3GUI2020/ViewModel/Implementation/JobListViewModel.cs b/VECTO3GUI2020/ViewModel/Implementation/JobListViewModel.cs index 7beef48c81..93616a77dc 100644 --- a/VECTO3GUI2020/ViewModel/Implementation/JobListViewModel.cs +++ b/VECTO3GUI2020/ViewModel/Implementation/JobListViewModel.cs @@ -472,6 +472,9 @@ namespace VECTO3GUI2020.ViewModel.Implementation case IMultistagePrimaryAndStageInputDataProvider primaryAndStage: mode = ExecutionMode.Declaration; break; + case IMultistageVIFInputData vifInputData: + mode = ExecutionMode.Declaration; + break; default: input = null; -- GitLab