Imprägnierungen edit
Edit button erst verfügbar wenn ein Imprägnierung ausgewählt wurde
This commit is contained in:
@@ -3,6 +3,7 @@ using DaSaSo.Domain.Services;
|
|||||||
using DaSaSo.ViewModel.Interface;
|
using DaSaSo.ViewModel.Interface;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -15,6 +16,10 @@ namespace DaSaSo.ViewModel.Commands
|
|||||||
private ImpregnierungListViewModel _impregnierungListViewModel;
|
private ImpregnierungListViewModel _impregnierungListViewModel;
|
||||||
private IRenavigator _editRenavigator;
|
private IRenavigator _editRenavigator;
|
||||||
private IActualProject _actualProject;
|
private IActualProject _actualProject;
|
||||||
|
public override bool CanExecute(object? parameter)
|
||||||
|
{
|
||||||
|
return _impregnierungListViewModel.SelectedImpregnation != null;
|
||||||
|
}
|
||||||
|
|
||||||
public EditImpregnationCommand(
|
public EditImpregnationCommand(
|
||||||
IDataService<Impregnation> impregnationService,
|
IDataService<Impregnation> impregnationService,
|
||||||
@@ -26,6 +31,13 @@ namespace DaSaSo.ViewModel.Commands
|
|||||||
_impregnierungListViewModel = impregnierungListViewModel;
|
_impregnierungListViewModel = impregnierungListViewModel;
|
||||||
_actualProject = actualProject;
|
_actualProject = actualProject;
|
||||||
_editRenavigator = editRenavigator;
|
_editRenavigator = editRenavigator;
|
||||||
|
_impregnierungListViewModel.PropertyChanged += _impregnierungListViewModel_PropertyChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void _impregnierungListViewModel_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.PropertyName == nameof(_impregnierungListViewModel.CanSelectImpregnation))
|
||||||
|
OnCanExecuteChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task ExecuteAsync(object? parameter)
|
public override async Task ExecuteAsync(object? parameter)
|
||||||
|
|||||||
@@ -27,9 +27,11 @@ namespace DaSaSo.ViewModel
|
|||||||
{
|
{
|
||||||
_selectedImpregnation = value;
|
_selectedImpregnation = value;
|
||||||
OnPropertyChanged();
|
OnPropertyChanged();
|
||||||
|
OnPropertyChanged(nameof(CanSelectImpregnation));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public bool CanSelectImpregnation => SelectedImpregnation != null;
|
||||||
public ICommand EditImpregnationCommand { get; set; }
|
public ICommand EditImpregnationCommand { get; set; }
|
||||||
public ICommand AddImpregnationCommand { get; set; }
|
public ICommand AddImpregnationCommand { get; set; }
|
||||||
bool _isLoading;
|
bool _isLoading;
|
||||||
|
|||||||
Reference in New Issue
Block a user