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

Skip to content
Snippets Groups Projects
Commit 015c0136 authored by Harald Martini's avatar Harald Martini
Browse files

Add Manufacturing Stage to Job List when creating new Manufacturing stage and VIF is loaded

parent a995603f
No related branches found
No related tags found
No related merge requests found
......@@ -11,5 +11,6 @@ namespace VECTO3GUI2020.ViewModel.Interfaces
ObservableCollection<IDocumentViewModel> Jobs { get; }
ICommand NewManufacturingStageFileCommand { get; }
Task<IDocumentViewModel> AddJobAsync(string fileName);
void AddJob(IDocumentViewModel jobToAdd);
}
}
......@@ -277,9 +277,8 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
{
get
{
throw new NotImplementedException();
}
set => throw new NotImplementedException();
return true;
} set => throw new NotImplementedException();
}
#endregion
......
......@@ -14,6 +14,7 @@ using VECTO3GUI2020.Helper;
using VECTO3GUI2020.Properties;
using VECTO3GUI2020.Util;
using VECTO3GUI2020.ViewModel.Implementation.Common;
using VECTO3GUI2020.ViewModel.Interfaces;
using VECTO3GUI2020.ViewModel.Interfaces.JobEdit.Vehicle;
using VECTO3GUI2020.ViewModel.Interfaces.JobEdit.Vehicle.Components;
using VECTO3GUI2020.ViewModel.MultiStage.Interfaces;
......@@ -46,11 +47,13 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
public NewMultiStageJobViewModel(IDialogHelper dialogHelper,
IXMLInputDataReader inputDataReader,
IMultiStageViewModelFactory vmFactory)
IMultiStageViewModelFactory vmFactory,
IJobListViewModel jobListViewModel)
{
_inputDataReader = inputDataReader;
_dialogHelper = dialogHelper;
_vmFactory = vmFactory;
_jobListViewModel = jobListViewModel;
Title = "New Multistage File";
VifPath = "Select VIF File";
}
......@@ -87,11 +90,13 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
MultiStageJobViewModel = null;
MultiStageJobViewModel =
_vmFactory.GetMultiStageJobViewModel(inputDataProvider);
_jobListViewModel.AddJob(MultiStageJobViewModel);
VifPath = fileName;
}
private ICommand _closeWindow;
private readonly IJobListViewModel _jobListViewModel;
public ICommand CloseWindow
{
......
......@@ -22,8 +22,9 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
private bool _canBeEdited;
private DataSource _dataSource;
private readonly XmlDocumentType _documentType;
private readonly string _documentName;
private string _documentName;
private bool _selected;
private static uint _newDocumentCounter = 0;
public StageInputViewModel(bool exemptedVehicle, IMultiStageViewModelFactory multiStageViewModelFactory) : base(multiStageViewModelFactory)
{
......@@ -34,6 +35,8 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
Debug.Assert(_vehicleViewModel != null);
Title = "Edit Stage Input - New File";
_documentType = XmlDocumentType.DeclarationJobData;
_documentName = $"New {(exemptedVehicle ? "Exempted " : "")}Stage Input {++_newDocumentCounter}";
Init();
}
......@@ -56,7 +59,8 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
{
DataSource = loadedInputData.DataSource;
UpdateTitle();
DocumentName = loadedInputData.JobInputData.JobName;
}
#endregion
......@@ -81,7 +85,11 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
#region Implementation of IDocumentViewModel
public string DocumentName => _documentName;
public string DocumentName
{
get => _documentName;
set => SetProperty(ref _documentName, value);
}
public XmlDocumentType DocumentType => _documentType;
......
......@@ -7,6 +7,7 @@
xmlns:converter="clr-namespace:VECTO3GUI2020.Helper.Converter" xmlns:implementation="clr-namespace:VECTO3GUI2020.ViewModel.Implementation"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:behavior="clr-namespace:VECTO3GUI2020.Behaviours"
xmlns:document="clr-namespace:VECTO3GUI2020.ViewModel.Interfaces.Document"
d:DataContext="{d:DesignInstance Type=implementation:JobListViewModel}"
mc:Ignorable="d"
AutomationProperties.Name="JobListView"
......@@ -77,15 +78,23 @@
</behavior:AutoScrollDataGridBehaviour>
</i:Interaction.Behaviors>
<DataGrid.Columns>
<DataGridCheckBoxColumn IsReadOnly="False" Header="Simulate" Binding="{Binding Selected}" Width="1*"></DataGridCheckBoxColumn>
<DataGridTemplateColumn Header="Simulate" Width="1*" IsReadOnly="False">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="document:IDocumentViewModel">
<CheckBox HorizontalAlignment="Center" IsEnabled="{Binding CanBeSimulated}"
IsChecked="{Binding Selected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></CheckBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn IsReadOnly="True" Header="Name" Binding="{Binding DocumentName}" Width="4*"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly ="True" Header="Type" Binding="{Binding DocumentType}" Width="4*"></DataGridTextColumn>
</DataGrid.Columns>
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<Label x:Name="label" Content="Filename"/>
<StackPanel Orientation="Vertical" Visibility="{Binding DataSource, Converter={StaticResource NullToVisibilityConverter}}">
<!--<Label x:Name="label" Content="Filename"/>-->
<TextBlock x:Name="textBlock" Text="{Binding DataSource.SourceFile}" TextWrapping="Wrap" Margin="10" />
</StackPanel>
</DataTemplate>
......
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