91 lines
2.9 KiB
C#
91 lines
2.9 KiB
C#
using DaSaSo.Domain.Model;
|
|
using DaSaSo.ViewModel.Controls;
|
|
using DaSaSo.ViewModel.Interface;
|
|
using Microsoft.Toolkit.Mvvm.Input;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace DaSaSo.ViewModel
|
|
{
|
|
public class SewerDamageEditViewModel : BaseViewModel
|
|
{
|
|
private SewerDamage? _damage;
|
|
|
|
public SewerDamageControllViewModel damageControllViewModel { get; set; }
|
|
//public SewerPreperationControllViewModel preperationControllViewModel { get; set; }
|
|
public IRelayCommand Berechne { get; set; }
|
|
|
|
private string? _entfernung;
|
|
public string Entfernung
|
|
{
|
|
get => _entfernung;
|
|
set
|
|
{
|
|
_entfernung = value;
|
|
_damage.SewerObject.IsChanged = true;
|
|
OnPropertyChanged();
|
|
}
|
|
}
|
|
|
|
public SewerDamage? Damage
|
|
{
|
|
get => _damage;
|
|
set
|
|
{
|
|
_damage = value;
|
|
OnPropertyChanged();
|
|
}
|
|
}
|
|
|
|
public SewerDamageEditViewModel(IActualProject actualProject)
|
|
{
|
|
if (actualProject.AktuellSewerDamage == null) throw new NullReferenceException(nameof(actualProject.AktuellSewerDamage));
|
|
Damage = actualProject.AktuellSewerDamage;
|
|
|
|
damageControllViewModel = new SewerDamageControllViewModel(Damage.DamageType);
|
|
//preperationControllViewModel = new SewerPreperationControllViewModel(Damage.PreparationType);
|
|
|
|
Entfernung = Damage.Distance.ToString();
|
|
|
|
/*Berechne = new RelayCommand(() =>
|
|
{
|
|
//Debugger.Break();
|
|
Damage.DamageType = damageControllViewModel.CalculateDamageFlags();
|
|
Damage.PreparationType = preperationControllViewModel.CalculatePreparationFlags();
|
|
});
|
|
*/
|
|
|
|
}
|
|
~SewerDamageEditViewModel()
|
|
{
|
|
//Debugger.Break();
|
|
}
|
|
|
|
public override void Dispose()
|
|
{
|
|
// Alle Werte Speichern, form wurde geändert (Noch nicht in DB!)
|
|
EDamageType newDamage = damageControllViewModel.CalculateDamageFlags();
|
|
//EPreparationType newPrepartion = preperationControllViewModel.CalculatePreparationFlags();
|
|
if(Damage.DamageType != newDamage)
|
|
{
|
|
Damage.DamageType = newDamage;
|
|
Damage.SewerObject.IsChanged = true;
|
|
}
|
|
/* if(Damage.PreparationType != newPrepartion)
|
|
{
|
|
Damage.PreparationType = newPrepartion;
|
|
Damage.SewerObject.IsChanged = true;
|
|
}
|
|
*/
|
|
damageControllViewModel.Dispose();
|
|
//preperationControllViewModel.Dispose();
|
|
base.Dispose();
|
|
}
|
|
|
|
}
|
|
}
|