Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

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

Updated Additional Job Info View Models and Views

parent 7f9d6760
Branches
Tags
No related merge requests found
...@@ -18,7 +18,7 @@ namespace VECTO3GUI2020.Helper ...@@ -18,7 +18,7 @@ namespace VECTO3GUI2020.Helper
} }
return propertyName + "*"; return propertyName;
} }
} }
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.IO;
using System.Linq; using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Media.TextFormatting; using System.Windows.Media.TextFormatting;
...@@ -27,6 +28,7 @@ namespace VECTO3GUI2020.ViewModel.Implementation.Common ...@@ -27,6 +28,7 @@ namespace VECTO3GUI2020.ViewModel.Implementation.Common
public AdditionalJobInfoViewModelBase() public AdditionalJobInfoViewModelBase()
{ {
Title = "Job Info";
SizeToContent = SizeToContent.WidthAndHeight; SizeToContent = SizeToContent.WidthAndHeight;
MinHeight = 200; MinHeight = 200;
MinWidth = 300; MinWidth = 300;
...@@ -40,9 +42,21 @@ namespace VECTO3GUI2020.ViewModel.Implementation.Common ...@@ -40,9 +42,21 @@ namespace VECTO3GUI2020.ViewModel.Implementation.Common
private IMultiStageJobViewModel _parent; private IMultiStageJobViewModel _parent;
private string _errorInfo; private string _errorInfo;
public ObservableCollection<string> InvalidEntries { get; set; } = new ObservableCollection<string>();
public bool InvalidEntriesPresent => InvalidEntries.Count > 0;
public string ErrorInfo
{
get => _errorInfo;
set => SetProperty(ref _errorInfo, value);
}
public AdditionalJobInfoViewModelMultiStage() public AdditionalJobInfoViewModelMultiStage()
{ {
Title = "Multistage Job Info"; Title = "Multistage Job Info";
InvalidEntries.CollectionChanged += (sender, args) => OnPropertyChanged(nameof(InvalidEntriesPresent));
} }
#region Overrides of AdditionalJobInfoViewModelBase #region Overrides of AdditionalJobInfoViewModelBase
...@@ -68,7 +82,7 @@ namespace VECTO3GUI2020.ViewModel.Implementation.Common ...@@ -68,7 +82,7 @@ namespace VECTO3GUI2020.ViewModel.Implementation.Common
if (_parent.InvalidEntries != null && _parent.InvalidEntries.Count != 0) { if (_parent.InvalidEntries != null && _parent.InvalidEntries.Count != 0) {
ErrorInfo = "This Job cannot be Simulated! The following inputs are missing or invalid"; ErrorInfo = null;
foreach (var parentInvalidEntry in _parent.InvalidEntries) foreach (var parentInvalidEntry in _parent.InvalidEntries)
{ {
InvalidEntries.Add(parentInvalidEntry); InvalidEntries.Add(parentInvalidEntry);
...@@ -76,13 +90,6 @@ namespace VECTO3GUI2020.ViewModel.Implementation.Common ...@@ -76,13 +90,6 @@ namespace VECTO3GUI2020.ViewModel.Implementation.Common
} }
} }
public ObservableCollection<string> InvalidEntries { get; set; } = new ObservableCollection<string>();
public string ErrorInfo
{
get => _errorInfo;
set => SetProperty(ref _errorInfo, value);
}
#endregion #endregion
} }
...@@ -99,19 +106,33 @@ namespace VECTO3GUI2020.ViewModel.Implementation.Common ...@@ -99,19 +106,33 @@ namespace VECTO3GUI2020.ViewModel.Implementation.Common
_parent = parent as CreateVifViewModel; _parent = parent as CreateVifViewModel;
(_parent as INotifyPropertyChanged).PropertyChanged += AdditionalJobInfoViewModelNewVif_PropertyChanged; (_parent as INotifyPropertyChanged).PropertyChanged += AdditionalJobInfoViewModelNewVif_PropertyChanged;
Debug.Assert(_parent != null); Debug.Assert(_parent != null);
UpdateInvalidEntries();
} }
private void AdditionalJobInfoViewModelNewVif_PropertyChanged(object sender, PropertyChangedEventArgs e) private void AdditionalJobInfoViewModelNewVif_PropertyChanged(object sender, PropertyChangedEventArgs e)
{ {
if (e.PropertyName == nameof(_parent.CanBeSimulated)) { if (e.PropertyName == nameof(_parent.CanBeSimulated)) {
UpdateInvalidEntries();
}
}
private void UpdateInvalidEntries()
{
InvalidEntries.Clear();
if (_parent.UnsavedChanges) {
InvalidEntries.Add("This job has unsaved changes");
} }
if (_parent.PrimaryInputPath == null) {
InvalidEntries.Add("No Primary input path specified");
} }
if (_parent.StageInputPath == null) {
InvalidEntries.Add($"No {(_parent.Completed ? "Completed" : "Interim")} input path specified");
}
}
#endregion #endregion
} }
......
...@@ -100,11 +100,8 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation ...@@ -100,11 +100,8 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
_dialogHelper = dialogHelper; _dialogHelper = dialogHelper;
_inputDataReader = inputDataReader; _inputDataReader = inputDataReader;
_additionalJobInfo = additionalJobInfo; _additionalJobInfo = additionalJobInfo;
additionalJobInfo.SetParent(this);
SetupBackingStorage(); SetupBackingStorage();
additionalJobInfo.SetParent(this);
UpdateTitleAndDocumentName(); UpdateTitleAndDocumentName();
......
...@@ -11,7 +11,16 @@ ...@@ -11,7 +11,16 @@
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance common:AdditionalJobInfoViewModelMultiStage }"> d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance common:AdditionalJobInfoViewModelMultiStage }">
<Grid> <Grid>
<StackPanel Margin="10"> <StackPanel Margin="10">
<Label>This Job cannot be Simulated because the following Parameters are invalid:</Label> <Label>This Job cannot be simulated</Label>
<Label Content="{Binding ErrorInfo}"
Visibility="{Binding ErrorInfo,
Converter={StaticResource NullToVisibilityConverter}}"/>
<Border Margin="2" BorderBrush="{DynamicResource ButtonHighlightColor}" BorderThickness="2" Visibility="{Binding InvalidEntriesPresent,
Converter={StaticResource BooleanToVisibilityConverter}}">
<StackPanel>
<Label Style="{StaticResource LabelStyle1}">
Invalid Parameters:
</Label>
<ItemsControl ItemsSource="{Binding InvalidEntries }"> <ItemsControl ItemsSource="{Binding InvalidEntries }">
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate> <DataTemplate>
...@@ -35,7 +44,14 @@ ...@@ -35,7 +44,14 @@
</BulletDecorator> </BulletDecorator>
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Margin="2" Orientation="Vertical" IsItemsHost="True"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl> </ItemsControl>
</StackPanel> </StackPanel>
</Border>
</StackPanel>
</Grid> </Grid>
</UserControl> </UserControl>
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
xmlns:properties="clr-namespace:VECTO3GUI2020.Properties" xmlns:properties="clr-namespace:VECTO3GUI2020.Properties"
xmlns:resources="clr-namespace:System.Resources;assembly=mscorlib" xmlns:resources="clr-namespace:System.Resources;assembly=mscorlib"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance local:AdditionalJobInfoViewNewVIF}">
<Grid> <Grid>
<StackPanel Margin="10"> <StackPanel Margin="10">
<Label>This Job cannot be Simulated</Label> <Label>This Job cannot be Simulated</Label>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment