Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. 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
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@ namespace VECTO3GUI2020.Helper
}
return propertyName + "*";
return propertyName;
}
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Media.TextFormatting;
......@@ -27,6 +28,7 @@ namespace VECTO3GUI2020.ViewModel.Implementation.Common
public AdditionalJobInfoViewModelBase()
{
Title = "Job Info";
SizeToContent = SizeToContent.WidthAndHeight;
MinHeight = 200;
MinWidth = 300;
......@@ -40,9 +42,21 @@ namespace VECTO3GUI2020.ViewModel.Implementation.Common
private IMultiStageJobViewModel _parent;
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()
{
Title = "Multistage Job Info";
InvalidEntries.CollectionChanged += (sender, args) => OnPropertyChanged(nameof(InvalidEntriesPresent));
}
#region Overrides of AdditionalJobInfoViewModelBase
......@@ -68,7 +82,7 @@ namespace VECTO3GUI2020.ViewModel.Implementation.Common
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)
{
InvalidEntries.Add(parentInvalidEntry);
......@@ -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
}
......@@ -99,20 +106,34 @@ namespace VECTO3GUI2020.ViewModel.Implementation.Common
_parent = parent as CreateVifViewModel;
(_parent as INotifyPropertyChanged).PropertyChanged += AdditionalJobInfoViewModelNewVif_PropertyChanged;
Debug.Assert(_parent != null);
UpdateInvalidEntries();
}
private void AdditionalJobInfoViewModelNewVif_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
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
}
public class AdditionalJobInfoViewModelStageInput : AdditionalJobInfoViewModelBase
......
......@@ -100,12 +100,9 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
_dialogHelper = dialogHelper;
_inputDataReader = inputDataReader;
_additionalJobInfo = additionalJobInfo;
additionalJobInfo.SetParent(this);
SetupBackingStorage();
additionalJobInfo.SetParent(this);
UpdateTitleAndDocumentName();
(this as INotifyPropertyChanged).PropertyChanged += CreateVifViewModel_PropertyChanged;
......
......@@ -11,31 +11,47 @@
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance common:AdditionalJobInfoViewModelMultiStage }">
<Grid>
<StackPanel Margin="10">
<Label>This Job cannot be Simulated because the following Parameters are invalid:</Label>
<ItemsControl ItemsSource="{Binding InvalidEntries }">
<ItemsControl.ItemTemplate>
<DataTemplate>
<BulletDecorator>
<BulletDecorator.Bullet>
<Ellipse HorizontalAlignment="Center" VerticalAlignment="Center" Height="5" Width="5" Fill="{DynamicResource AccentColorButton}"/>
</BulletDecorator.Bullet>
<TextBlock Margin="5 0">
<TextBlock.Text>
<Binding Path="." Converter="{StaticResource PropertyNameToLabelConverter}">
<Binding.ConverterParameter>
<x:Array Type="resources:ResourceManager">
<x:Static MemberType="properties:GUILabels" Member="ResourceManager"/>
<x:Static MemberType="properties:BusStrings" Member="ResourceManager"/>
<x:Static MemberType="properties:Strings" Member="ResourceManager"/>
</x:Array>
</Binding.ConverterParameter>
</Binding>
</TextBlock.Text>
</TextBlock>
</BulletDecorator>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<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.ItemTemplate>
<DataTemplate>
<BulletDecorator>
<BulletDecorator.Bullet>
<Ellipse HorizontalAlignment="Center" VerticalAlignment="Center" Height="5" Width="5" Fill="{DynamicResource AccentColorButton}"/>
</BulletDecorator.Bullet>
<TextBlock Margin="5 0">
<TextBlock.Text>
<Binding Path="." Converter="{StaticResource PropertyNameToLabelConverter}">
<Binding.ConverterParameter>
<x:Array Type="resources:ResourceManager">
<x:Static MemberType="properties:GUILabels" Member="ResourceManager"/>
<x:Static MemberType="properties:BusStrings" Member="ResourceManager"/>
<x:Static MemberType="properties:Strings" Member="ResourceManager"/>
</x:Array>
</Binding.ConverterParameter>
</Binding>
</TextBlock.Text>
</TextBlock>
</BulletDecorator>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Margin="2" Orientation="Vertical" IsItemsHost="True"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</StackPanel>
</Border>
</StackPanel>
</Grid>
</UserControl>
......@@ -7,7 +7,7 @@
xmlns:properties="clr-namespace:VECTO3GUI2020.Properties"
xmlns:resources="clr-namespace:System.Resources;assembly=mscorlib"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance local:AdditionalJobInfoViewNewVIF}">
<Grid>
<StackPanel Margin="10">
<Label>This Job cannot be Simulated</Label>
......
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