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

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

Allow only CreateVifViewModels with unsaved changes to be selected for simulation

parent d3cfa4e0
No related branches found
No related tags found
No related merge requests found
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Windows;
......@@ -88,7 +89,7 @@ namespace VECTO3GUI2020.ViewModel.Implementation.Common
public class AdditionalJobInfoViewModelNewVif : AdditionalJobInfoViewModelBase
{
private ICreateVifViewModel _parent;
private CreateVifViewModel _parent;
public ObservableCollection<string> InvalidEntries { get; set; } = new ObservableCollection<string>();
#region Overrides of AdditionalJobInfoViewModelBase
......@@ -96,13 +97,23 @@ namespace VECTO3GUI2020.ViewModel.Implementation.Common
public override void SetParent(IViewModelBase parent)
{
_parent = parent as CreateVifViewModel;
(_parent as INotifyPropertyChanged).PropertyChanged += AdditionalJobInfoViewModelNewVif_PropertyChanged;
Debug.Assert(_parent != null);
}
private void AdditionalJobInfoViewModelNewVif_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(_parent.CanBeSimulated)) {
}
}
#endregion
}
#endregion
}
public class AdditionalJobInfoViewModelStageInput : AdditionalJobInfoViewModelBase
{
......
......@@ -123,7 +123,9 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
private void CreateVifViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName != nameof(CanBeSimulated)) {
OnPropertyChanged(nameof(CanBeSimulated));
}
switch (e.PropertyName) {
case nameof(DataSource):
case nameof(Completed):
......@@ -475,7 +477,7 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
public bool CanBeSimulated
{
get => PrimaryInputPath != null && StageInputPath != null;
get => PrimaryInputPath != null && StageInputPath != null && !UnsavedChanges;
set => throw new NotImplementedException();
}
......
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