Leere Liste nur in GUI
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using FahrzeugDatenBank;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Timers;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace FahzeugWPF;
|
||||
@@ -21,9 +22,11 @@ class MainWindowViewModel : ViewModelBase
|
||||
this._model = modell;
|
||||
this.InitialisiereDasViewModell();
|
||||
this.LoeschenKommando = new RelayCommand(LoescheFahrzeug);
|
||||
this.LeerenKommando = new RelayCommand(LeereListe);
|
||||
}
|
||||
|
||||
public ICommand LoeschenKommando { get; private set; }
|
||||
public ICommand LeerenKommando { get; private set; }
|
||||
|
||||
public string MainWindowTitle
|
||||
{
|
||||
@@ -56,4 +59,15 @@ class MainWindowViewModel : ViewModelBase
|
||||
_model.LoescheFahrzeug((Fahrzeug)fahrzeug);
|
||||
this.Fahrzeuge.Remove((Fahrzeug)fahrzeug);
|
||||
}
|
||||
|
||||
private async void LeereListe(object? o)
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
this.Fahrzeuge.Clear();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user