diff --git a/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs b/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs index 72a6c617ffcffb21622c35e24a5f65be9f591558..c585f453b3cedc8375a678434285db1865248911 100644 --- a/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs +++ b/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs @@ -268,8 +268,6 @@ namespace VECTO3GUI.ViewModel.Impl #region Commands - - public ICommand RunSimulation { get { return _runSimulationCommand ?? (_runSimulationCommand = new RelayCommand(DoRunSimulation, CanRunSimulationCmd)); } diff --git a/VECTO3GUI2020/Behaviours/PopUpHorizontalAlignmentBehavior.cs b/VECTO3GUI2020/Behaviours/PopUpHorizontalAlignmentBehavior.cs new file mode 100644 index 0000000000000000000000000000000000000000..c24414e79c2f6b5f12bf0ae034033a5c3338078b --- /dev/null +++ b/VECTO3GUI2020/Behaviours/PopUpHorizontalAlignmentBehavior.cs @@ -0,0 +1,60 @@ +using System.Windows; +using System.Windows.Controls.Primitives; +using Microsoft.Xaml.Behaviors; + +namespace VECTO3GUI2020.Behaviours +{ + public class PopUpHorizontalAlignmentBehavior : Behavior<Popup> + { + + private FrameworkElement _placementTarget; + private double _initialHorizontalOffset; + private double _popUpWidth; + + + private void _placementTarget_SizeChanged(object sender, SizeChangedEventArgs e) + { + if (e.WidthChanged) { + SetHorizontalAlignment(e.NewSize.Width, this.AssociatedObject.ActualWidth); + } + } + + private void SetHorizontalAlignment(double placeMentTargetActualWidth, double popUpActualWidth) + { + if (popUpActualWidth > placeMentTargetActualWidth) { + this.AssociatedObject.HorizontalOffset = placeMentTargetActualWidth - popUpActualWidth; + } + } + + #region Overrides of Behavior + + + protected override void OnAttached() + { + _placementTarget = this.AssociatedObject.PlacementTarget as FrameworkElement; + _popUpWidth = this.AssociatedObject.MinWidth; + _initialHorizontalOffset = this.AssociatedObject.HorizontalOffset; + _placementTarget.SizeChanged += _placementTarget_SizeChanged; + this.AssociatedObject.SizeChanged += AssociatedObject_SizeChanged; + SetHorizontalAlignment(_placementTarget.ActualWidth, this.AssociatedObject.ActualWidth); + base.OnAttached(); + } + + private void AssociatedObject_SizeChanged(object sender, SizeChangedEventArgs e) + { + _popUpWidth = e.NewSize.Width; + SetHorizontalAlignment(_placementTarget.ActualWidth, e.NewSize.Width); + } + + protected override void OnDetaching() + { + _placementTarget.SizeChanged -= _placementTarget_SizeChanged; + this.AssociatedObject.HorizontalOffset = _initialHorizontalOffset; + base.OnDetaching(); + } + + + + #endregion + } +} \ No newline at end of file diff --git a/VECTO3GUI2020/Ninject/DocumentModule.cs b/VECTO3GUI2020/Ninject/DocumentModule.cs index 8e2f284c2f865e218d820bbef3cef9a0cfdbedcd..cb1116f206515506fbd7bcae0aedf762d2f3618a 100644 --- a/VECTO3GUI2020/Ninject/DocumentModule.cs +++ b/VECTO3GUI2020/Ninject/DocumentModule.cs @@ -18,6 +18,8 @@ namespace VECTO3GUI2020.Ninject Bind<IDocumentViewModel>().To<DeclarationJobViewModel>().Named(XmlDocumentType.DeclarationJobData.ToString()); Bind<IDocumentViewModel>().To<MultiStageJobViewModel_v0_1>() .Named(XmlDocumentType.MultistageOutputData.ToString()); + + //Bind<IDocumentViewModel>().To<MultistageJobViewModel>().Named(XmlDocumentType.MultistageOutputData.ToString()); //Bind<IDocumentViewModel>().To<DeclarationTrailerJobDocumentViewModel>().Named(XmlDocumentType.DeclarationTrailerJobData.ToString()); diff --git a/VECTO3GUI2020/Ninject/FactoryModule.cs b/VECTO3GUI2020/Ninject/FactoryModule.cs index 0dbd346882fdd34eb4f93da2753d447171ed54f6..fa07b41e5527c1f8a45b85fbcd9d79c311ce3a7d 100644 --- a/VECTO3GUI2020/Ninject/FactoryModule.cs +++ b/VECTO3GUI2020/Ninject/FactoryModule.cs @@ -27,9 +27,14 @@ namespace VECTO3GUI2020.Ninject () => new UseFirstArgumentTypeAsNameInstanceProvider(true)); - Bind<IMultiStageViewModelFactory>().To<MultiStageViewModelFactory>().InSingletonScope(); - Bind<IMultiStageViewModelFactoryDefaultInstanceProvider>().ToFactory(); - Bind<IMultiStageViewModelFactoryTypeAsNameInstanceProvider>().ToFactory(() => new UseFirstArgumentTypeAsNameInstanceProvider()); + Bind<IMultiStageViewModelFactory>().To<MultiStageViewModelFactory>(). + InSingletonScope(); + Bind<IMultiStageViewModelFactoryDefaultInstanceProvider>(). + ToFactory(); + Bind<IMultiStageViewModelFactoryTypeAsNameInstanceProvider>(). + ToFactory(() => new UseFirstArgumentTypeAsNameInstanceProvider()); + Bind<IMultistageViewModelFactoryFirstParameterAsNameInstanceProvider>().ToFactory(() => + new UseFirstArgumentAsNameInstanceProvider(skipFirstArgument: false)); } } diff --git a/VECTO3GUI2020/Ninject/MultiStageViewModelFactory.cs b/VECTO3GUI2020/Ninject/MultiStageViewModelFactory.cs index 376f9c1696a857e92d5e96042622b0816a52e560..8741423d25995d259ed9aa0a37974de46a218fcf 100644 --- a/VECTO3GUI2020/Ninject/MultiStageViewModelFactory.cs +++ b/VECTO3GUI2020/Ninject/MultiStageViewModelFactory.cs @@ -11,17 +11,27 @@ namespace VECTO3GUI2020.Ninject public class MultiStageViewModelFactory : IMultiStageViewModelFactory { private IMultiStageViewModelFactoryDefaultInstanceProvider _multiStageVmFactoryDefaultInstanceProvider; - private IMultiStageViewModelFactoryTypeAsNameInstanceProvider _multiStageViewModelFactoryImplementation; + private IMultiStageViewModelFactoryTypeAsNameInstanceProvider _multiStageViewModelFactoryTypeAsNameInstanceProvider; + private IMultistageViewModelFactoryFirstParameterAsNameInstanceProvider + _multistageViewModelFactoryFirstParameterAsNameInstanceProvider; - public MultiStageViewModelFactory(IMultiStageViewModelFactoryDefaultInstanceProvider multiStageVmFactoryDefaultInstanceProvider, IMultiStageViewModelFactoryTypeAsNameInstanceProvider multiStageViewModelFactoryImplementation1) + + public MultiStageViewModelFactory(IMultiStageViewModelFactoryDefaultInstanceProvider multiStageVmFactoryDefaultInstanceProvider, + IMultiStageViewModelFactoryTypeAsNameInstanceProvider multiStageViewModelFactoryTypeAsNameInstanceProvider, IMultistageViewModelFactoryFirstParameterAsNameInstanceProvider multistageViewModelFactoryFirstParameterAsNameInstanceProvider) { _multiStageVmFactoryDefaultInstanceProvider = multiStageVmFactoryDefaultInstanceProvider; - _multiStageViewModelFactoryImplementation = multiStageViewModelFactoryImplementation1; + _multiStageViewModelFactoryTypeAsNameInstanceProvider = multiStageViewModelFactoryTypeAsNameInstanceProvider; + _multistageViewModelFactoryFirstParameterAsNameInstanceProvider = multistageViewModelFactoryFirstParameterAsNameInstanceProvider; } #region Implementation of IMultiStageViewModelFactoryDefaultInstanceProvider + public IDocumentViewModel GetStageInputViewModel(bool exemptedVehicle) + { + return _multiStageVmFactoryDefaultInstanceProvider.GetStageInputViewModel(exemptedVehicle); + } + public IViewModelBase GetNewMultistageJobViewModel() { return _multiStageVmFactoryDefaultInstanceProvider.GetNewMultistageJobViewModel(); @@ -69,9 +79,9 @@ namespace VECTO3GUI2020.Ninject return _multiStageVmFactoryDefaultInstanceProvider.GetAuxiliariesViewModel(consolidatedAuxiliariesInputData); } - public ICreateVifViewModel GetCreateVifViewModel() + public ICreateVifViewModel GetCreateNewVifViewModel() { - return _multiStageVmFactoryDefaultInstanceProvider.GetCreateVifViewModel(); + return _multiStageVmFactoryDefaultInstanceProvider.GetCreateNewVifViewModel(); } #endregion @@ -80,12 +90,22 @@ namespace VECTO3GUI2020.Ninject public IDocumentViewModel CreateDocumentViewModel(IDeclarationInputDataProvider inputData) { - return _multiStageViewModelFactoryImplementation.CreateDocumentViewModel(inputData); + return _multiStageViewModelFactoryTypeAsNameInstanceProvider.CreateDocumentViewModel(inputData); } public IVehicleViewModel CreateStageInputVehicleViewModel(IVehicleDeclarationInputData inputData) { - return _multiStageViewModelFactoryImplementation.CreateStageInputVehicleViewModel(inputData); + return _multiStageViewModelFactoryTypeAsNameInstanceProvider.CreateStageInputVehicleViewModel(inputData); + } + + #endregion + + + #region Implementation of IMultistageViewModelFactoryFirstParameterAsNameInstanceProvider + + public IVehicleViewModel CreateStageInputVehicleViewModel(string inputProviderType) + { + return _multistageViewModelFactoryFirstParameterAsNameInstanceProvider.CreateStageInputVehicleViewModel(inputProviderType); } #endregion diff --git a/VECTO3GUI2020/Ninject/MultistageModule.cs b/VECTO3GUI2020/Ninject/MultistageModule.cs index 868c1c624f873774c54161f2f5a136547e03f044..1a465218e223c2a6c68417d179d4936bff3ecdad 100644 --- a/VECTO3GUI2020/Ninject/MultistageModule.cs +++ b/VECTO3GUI2020/Ninject/MultistageModule.cs @@ -45,14 +45,15 @@ namespace VECTO3GUI2020.Ninject Bind<IMultistageDependencies>().To<MultistageLazyDependencies>(); Bind<ICreateVifViewModel>().To<CreateVifViewModel>(). - NamedLikeFactoryMethod((IMultiStageViewModelFactory f) => f.GetCreateVifViewModel()); - + NamedLikeFactoryMethod((IMultiStageViewModelFactory f) => f.GetCreateNewVifViewModel()); + Bind<IDocumentViewModel>().To<StageInputViewModel>() + .Named(typeof(XMLDeclarationInputDataProviderV20).ToString()); + Bind<IDocumentViewModel>().To<StageInputViewModel>() + .NamedLikeFactoryMethod((IMultiStageViewModelFactory f) => f.GetStageInputViewModel(default(bool))); - Bind<IDocumentViewModel>().To<StageInputViewModel>() - .Named(typeof(XMLDeclarationInputDataProviderV20).ToString()); } } diff --git a/VECTO3GUI2020/VECTO3GUI2020.csproj b/VECTO3GUI2020/VECTO3GUI2020.csproj index 2271a2ac1a9f74bd0f99db030ab44cfcef3ee764..8c98bff11ba639e68f99334ed01cdfc36ed2d76e 100644 --- a/VECTO3GUI2020/VECTO3GUI2020.csproj +++ b/VECTO3GUI2020/VECTO3GUI2020.csproj @@ -155,6 +155,7 @@ <SubType>Designer</SubType> </ApplicationDefinition> <Compile Include="Behaviours\AutoScrollDataGridBehaviour.cs" /> + <Compile Include="Behaviours\PopUpHorizontalAlignmentBehavior.cs" /> <Compile Include="Helper\ConvertedSIDummyCreator.cs" /> <Compile Include="Helper\Converter\AlwaysVisibleConverter.cs" /> <Compile Include="Helper\Converter\BoolToVisibilityConverter.cs" /> @@ -329,7 +330,7 @@ <Compile Include="ViewModel\MultiStage\Implementation\StageInputViewModel.cs" /> <Compile Include="ViewModel\MultiStage\Implementation\StageViewModelBase.cs" /> <Compile Include="ViewModel\MultiStage\Interfaces\IMultistageAirdragViewModel.cs" /> - <Compile Include="ViewModel\MultiStage\Interfaces\IMultiStageViewModelFactoryDefaultInstanceProvider.cs" /> + <Compile Include="ViewModel\MultiStage\Interfaces\IMultiStageViewModelFactory.cs" /> <Compile Include="ViewModel\Implementation\OutputViewModel.cs" /> <Compile Include="Views\AboutView.xaml.cs"> <DependentUpon>AboutView.xaml</DependentUpon> diff --git a/VECTO3GUI2020/ViewModel/Implementation/JobListViewModel.cs b/VECTO3GUI2020/ViewModel/Implementation/JobListViewModel.cs index b82b439484ff0a113ca776b3db0641ff6254051c..b2c163aaafcabd5ce9efb16c73dce9aa74847a66 100644 --- a/VECTO3GUI2020/ViewModel/Implementation/JobListViewModel.cs +++ b/VECTO3GUI2020/ViewModel/Implementation/JobListViewModel.cs @@ -203,6 +203,14 @@ namespace VECTO3GUI2020.ViewModel.Implementation #endregion + private bool _newFilePopUpIsOpen = false; + public bool NewFilePopUpIsOpen + { + get => _newFilePopUpIsOpen; + set => SetProperty(ref _newFilePopUpIsOpen, value); + } + + #region Simulation @@ -604,6 +612,19 @@ namespace VECTO3GUI2020.ViewModel.Implementation private IAsyncRelayCommand _simulationCommand; private IRelayCommand _newVifCommand; private ICommand _newMultiStageFileCommand; + private ICommand _openNewFilePopUpCommand; + private ICommand _newCompletedInputCommand; + private ICommand _newExemptedCompletedInputCommand; + + + public ICommand OpenPopUpCommand + { + get => _openNewFilePopUpCommand ?? + (_openNewFilePopUpCommand = new RelayCommand(() => { + NewFilePopUpIsOpen = true; + })); + } + public ICommand CancelSimulation @@ -621,12 +642,32 @@ namespace VECTO3GUI2020.ViewModel.Implementation } } + public ICommand NewCompletedInputCommand + { + get + { + return _newCompletedInputCommand ?? (_newCompletedInputCommand = new RelayCommand(() => { + _windowHelper.ShowWindow(_multiStageViewModelFactory.GetStageInputViewModel(false)); + })); + } + } + + public ICommand NewExemptedCompletedInputCommand + { + get + { + return _newExemptedCompletedInputCommand ?? (_newExemptedCompletedInputCommand = new RelayCommand(() => { + _windowHelper.ShowWindow(_multiStageViewModelFactory.GetStageInputViewModel(true)); + })); + } + } + public IRelayCommand NewVifCommand { get { return _newVifCommand ?? (_newVifCommand = new Microsoft.Toolkit.Mvvm.Input.RelayCommand(() => { - _windowHelper.ShowWindow(_multiStageViewModelFactory.GetCreateVifViewModel()); + _windowHelper.ShowWindow(_multiStageViewModelFactory.GetCreateNewVifViewModel()); })); } } @@ -642,7 +683,7 @@ namespace VECTO3GUI2020.ViewModel.Implementation - public ICommand NewManufacturingStageFile + public ICommand NewManufacturingStageFileCommand { get { diff --git a/VECTO3GUI2020/ViewModel/Implementation/MainWindowViewModel.cs b/VECTO3GUI2020/ViewModel/Implementation/MainWindowViewModel.cs index 98d114dc65c5c2b58ed75f39e4f41e406432627c..a6d27e7152610eff4d63f56bceb36d47013cbd59 100644 --- a/VECTO3GUI2020/ViewModel/Implementation/MainWindowViewModel.cs +++ b/VECTO3GUI2020/ViewModel/Implementation/MainWindowViewModel.cs @@ -132,7 +132,7 @@ namespace VECTO3GUI2020.ViewModel.Implementation #region newMultiStage - public ICommand NewInterimFile => _jobListVm.NewManufacturingStageFile; + public ICommand NewInterimFile => _jobListVm.NewManufacturingStageFileCommand; diff --git a/VECTO3GUI2020/ViewModel/Interfaces/IJobListViewModel.cs b/VECTO3GUI2020/ViewModel/Interfaces/IJobListViewModel.cs index c9669f027a7d16d8696f9631eee0895c9c489989..12982d3c8642da40fa8cdc90abbd2240d390fff0 100644 --- a/VECTO3GUI2020/ViewModel/Interfaces/IJobListViewModel.cs +++ b/VECTO3GUI2020/ViewModel/Interfaces/IJobListViewModel.cs @@ -9,7 +9,7 @@ namespace VECTO3GUI2020.ViewModel.Interfaces public interface IJobListViewModel : IMainViewModel { ObservableCollection<IDocumentViewModel> Jobs { get; } - ICommand NewManufacturingStageFile { get; } + ICommand NewManufacturingStageFileCommand { get; } Task<IDocumentViewModel> AddJobAsync(string fileName); } } diff --git a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/InterimStageBusVehicleViewModel_v2_8.cs b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/InterimStageBusVehicleViewModel_v2_8.cs index d0a43a03588249d793f203e95fefbd49cc64cc8f..09ccb4d641ca647caacbdb180410c89f27176a3a 100644 --- a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/InterimStageBusVehicleViewModel_v2_8.cs +++ b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/InterimStageBusVehicleViewModel_v2_8.cs @@ -84,9 +84,11 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation public class InterimStageBusVehicleViewModel_v2_8 : ViewModelBase, IMultistageVehicleViewModel, IVehicleComponentsDeclaration, IAdvancedDriverAssistantSystemDeclarationInputData, IDataErrorInfo { + public static readonly Type INPUTPROVIDERTYPE = typeof(XMLDeclarationInterimStageBusDataProviderV28); + public static readonly Type INPUTPROVIDERTYPEEXEMPTED = typeof(XMLDeclarationExemptedInterimStageBusDataProviderV28); + public static string VERSION = INPUTPROVIDERTYPE.ToString(); + public static string VERSION_EXEMPTED = INPUTPROVIDERTYPEEXEMPTED.ToString(); - public static string VERSION = typeof(XMLDeclarationInterimStageBusDataProviderV28).ToString(); - public static string VERSION_EXEMPTED = typeof(XMLDeclarationExemptedInterimStageBusDataProviderV28).ToString(); private readonly IMultiStageViewModelFactory _multiStageViewModelFactory; @@ -125,8 +127,7 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation #endregion - public static readonly string INPUTPROVIDERTYPE = - typeof(XMLDeclarationInterimStageBusDataProviderV28).ToString(); + public string Name => "Vehicle"; @@ -163,26 +164,28 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation } } - public InterimStageBusVehicleViewModel_v2_8(IVehicleDeclarationInputData inputData, IMultiStageViewModelFactory multistageViewModelFactory) + public InterimStageBusVehicleViewModel_v2_8(string inputProviderType, IMultiStageViewModelFactory multiStageViewModelFactory) { - if (inputData.GetType().ToString() == VERSION_EXEMPTED) { + if (inputProviderType == VERSION_EXEMPTED) + { _exemptedVehicle = true; - Debug.Assert(inputData.ExemptedVehicle); } - _multiStageViewModelFactory = multistageViewModelFactory; + _multiStageViewModelFactory = multiStageViewModelFactory; - if (!_exemptedVehicle) { + if (!_exemptedVehicle) + { MultistageAirdragViewModel = _multiStageViewModelFactory.GetMultistageAirdragViewModel(); MultistageAuxiliariesViewModel = _multiStageViewModelFactory.GetAuxiliariesViewModel(); } CreateParameterViewModels(); - SetVehicleInputData(inputData); ShowConsolidatedData = false; - - - + } + public InterimStageBusVehicleViewModel_v2_8(IVehicleDeclarationInputData inputData, IMultiStageViewModelFactory multiStageViewModelFactory) : + this(inputData.GetType().ToString(), multiStageViewModelFactory) + { + SetVehicleInputData(inputData); } public InterimStageBusVehicleViewModel_v2_8(IVehicleDeclarationInputData consolidatedVehicleData, diff --git a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/StageInputViewModel.cs b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/StageInputViewModel.cs index 7a71a2b9705a0f3ad5f3c78a26701d912851d960..51f2ff8f33f5265e599492ca788647d588e7840a 100644 --- a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/StageInputViewModel.cs +++ b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/StageInputViewModel.cs @@ -1,4 +1,5 @@ -using System.IO; +using System.Diagnostics; +using System.IO; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Utils; @@ -21,11 +22,21 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation private readonly string _documentName; private bool _selected; + public StageInputViewModel(bool exemptedVehicle, IMultiStageViewModelFactory multiStageViewModelFactory) : base(multiStageViewModelFactory) + { + _vehicleViewModel = _viewModelFactory.CreateStageInputVehicleViewModel( + exemptedVehicle + ? InterimStageBusVehicleViewModel_v2_8.VERSION_EXEMPTED + : InterimStageBusVehicleViewModel_v2_8.VERSION) as IMultistageVehicleViewModel; + + Debug.Assert(_vehicleViewModel != null); + Init(); + } + public StageInputViewModel(IDeclarationInputDataProvider inputData, IMultiStageViewModelFactory multiStageViewModelFactory) : base(multiStageViewModelFactory) { _documentName = inputData.JobInputData.JobName; - _viewModelFactory = multiStageViewModelFactory; _vehicleViewModel = _viewModelFactory.CreateStageInputVehicleViewModel(inputData.JobInputData.Vehicle) as IMultistageVehicleViewModel; (_vehicleViewModel as InterimStageBusVehicleViewModel_v2_8).ShowConsolidatedData = false; @@ -33,6 +44,11 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation _documentType = XmlDocumentType.DeclarationJobData; Title = $"Edit Stage Input - {Path.GetFileNameWithoutExtension(_dataSource.SourceFile)}"; + Init(); + } + + private void Init() + { Components.Add("vehicle", VehicleViewModel as IViewModelBase); Components.Add("auxiliaries", VehicleViewModel.MultistageAuxiliariesViewModel as IViewModelBase); Components.Add("airdrag", VehicleViewModel.MultistageAirdragViewModel as IViewModelBase); diff --git a/VECTO3GUI2020/ViewModel/MultiStage/Interfaces/IMultiStageViewModelFactoryDefaultInstanceProvider.cs b/VECTO3GUI2020/ViewModel/MultiStage/Interfaces/IMultiStageViewModelFactory.cs similarity index 82% rename from VECTO3GUI2020/ViewModel/MultiStage/Interfaces/IMultiStageViewModelFactoryDefaultInstanceProvider.cs rename to VECTO3GUI2020/ViewModel/MultiStage/Interfaces/IMultiStageViewModelFactory.cs index 659e4016f541c38f9d829b0c10eeb1eb682125f0..68eff4b9dd55f0103d3862c29f32fa3489fe6c6c 100644 --- a/VECTO3GUI2020/ViewModel/MultiStage/Interfaces/IMultiStageViewModelFactoryDefaultInstanceProvider.cs +++ b/VECTO3GUI2020/ViewModel/MultiStage/Interfaces/IMultiStageViewModelFactory.cs @@ -15,7 +15,10 @@ using VECTO3GUI2020.ViewModel.MultiStage.Implementation; namespace VECTO3GUI2020.ViewModel.MultiStage.Interfaces { - public interface IMultiStageViewModelFactory : IMultiStageViewModelFactoryDefaultInstanceProvider, IMultiStageViewModelFactoryTypeAsNameInstanceProvider + public interface IMultiStageViewModelFactory : + IMultiStageViewModelFactoryDefaultInstanceProvider, + IMultiStageViewModelFactoryTypeAsNameInstanceProvider, + IMultistageViewModelFactoryFirstParameterAsNameInstanceProvider { } @@ -27,10 +30,16 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Interfaces IVehicleViewModel CreateStageInputVehicleViewModel(IVehicleDeclarationInputData inputData); } + public interface IMultistageViewModelFactoryFirstParameterAsNameInstanceProvider + { + IVehicleViewModel CreateStageInputVehicleViewModel(string inputProviderType); + } + public interface IMultiStageViewModelFactoryDefaultInstanceProvider { + IDocumentViewModel GetStageInputViewModel(bool exemptedVehicle); IViewModelBase GetNewMultistageJobViewModel(); IMultiStageJobViewModel GetMultiStageJobViewModel(IMultistageBusInputDataProvider inputData); @@ -49,7 +58,7 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Interfaces IMultistageAuxiliariesViewModel GetAuxiliariesViewModel( IBusAuxiliariesDeclarationData consolidatedAuxiliariesInputData); - ICreateVifViewModel GetCreateVifViewModel(); + ICreateVifViewModel GetCreateNewVifViewModel(); //IViewModelBase CreateNewMultiStageJobViewModel(); diff --git a/VECTO3GUI2020/Views/JoblistView.xaml b/VECTO3GUI2020/Views/JoblistView.xaml index 6f4edd13a08a1b6d8119cc53e919eff61534bcfa..6da05e9e0ffb49f39b180ba86fcd19c22740a8c2 100644 --- a/VECTO3GUI2020/Views/JoblistView.xaml +++ b/VECTO3GUI2020/Views/JoblistView.xaml @@ -106,21 +106,40 @@ <Button x:Name="button3" Margin="4" HorizontalAlignment="Stretch" Style="{StaticResource MultiStageButtonStyle1}" Command="{Binding AddJobAsyncCommand, IsAsync=True}" Background="#FFDDDDDD"> - Add Job</Button> + Load File</Button> <Button x:Name="button4" Margin ="4" HorizontalAlignment="Stretch" Style="{StaticResource MultiStageButtonStyle1}" Command="{Binding EditDocument}" CommandParameter="{Binding ElementName=JobDataGrid, Path=SelectedItem}">Edit Job</Button> - <Button x:Name="button5" Margin="4" HorizontalAlignment="Stretch" + <Button x:Name="newFileButton" Margin="4" HorizontalAlignment="Stretch" Style="{StaticResource MultiStageButtonStyle1}" - Command="{Binding NewManufacturingStageFile}">New Multistage Job</Button> - <Button Margin="4" HorizontalAlignment="Stretch" - Style="{StaticResource MultiStageButtonStyle1}" - Command="{Binding NewVifCommand}">Create VIF</Button> + Command="{Binding OpenPopUpCommand}">New File</Button> + <Popup HorizontalAlignment="Center" + x:Name="newFilePopup" + PlacementTarget="{Binding ElementName=newFileButton, Path=.}" + Margin="{Binding ElementName=newFileButton, Path=Margin}" + MinWidth="{Binding ElementName=newFileButton, Path=ActualWidth}" + IsOpen="{Binding NewFilePopUpIsOpen, Mode=TwoWay}" + StaysOpen="False"> + + <!--<i:Interaction.Behaviors> + <behavior:PopUpHorizontalAlignmentBehavior/> + </i:Interaction.Behaviors>--> + <Border BorderThickness="1px" BorderBrush="{StaticResource AccentColorButton}"> + <StackPanel Background="White"> + <Button Style="{StaticResource MultiStageButtonStyle1}" Command="{Binding NewManufacturingStageFileCommand}">New Manufacturing Stage</Button> + <Button Style="{StaticResource MultiStageButtonStyle1}" Command="{Binding NewVifCommand}">New VIF</Button> + <Button Style="{StaticResource MultiStageButtonStyle1}" Command="{Binding NewCompletedInputCommand}">New Completed Input</Button> + <Button Style="{StaticResource MultiStageButtonStyle1}" Command="{Binding NewExemptedCompletedInputCommand}">New Exempted Completed Input</Button> + </StackPanel> + </Border> + </Popup> <Button x:Name="button6" Margin="4" HorizontalAlignment="Stretch" Style="{StaticResource MultiStageButtonStyle1}" Command="{Binding RemoveJob, IsAsync=True}" CommandParameter="{Binding ElementName=JobDataGrid, Path=SelectedItem}">Remove Job</Button> + + </StackPanel> </Border> </Grid> diff --git a/VECTO3GUI2020/Views/JoblistView.xaml.cs b/VECTO3GUI2020/Views/JoblistView.xaml.cs index 7c73729a88b51a056385b4ff2d869788ecf2f51f..99cca39297e9963e13f3f4ffdb75a9e8d89f23c1 100644 --- a/VECTO3GUI2020/Views/JoblistView.xaml.cs +++ b/VECTO3GUI2020/Views/JoblistView.xaml.cs @@ -3,7 +3,7 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Input; using VECTO3GUI2020.ViewModel.Implementation; -using VECTO3GUI2020.ViewModel.Interfaces; + namespace VECTO3GUI2020.Views {