Gui neu angelegt
This commit is contained in:
66
StammGenerator/ViewModel/State/ActualState.cs
Normal file
66
StammGenerator/ViewModel/State/ActualState.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.ViewModel
|
||||
{
|
||||
internal class ActualState : IActualState
|
||||
{
|
||||
// TODO: set auf private set setzen
|
||||
public int ProjektID { get; set; }
|
||||
|
||||
public int SchachtID { get; private set; }
|
||||
public int HaltungID { get; private set; }
|
||||
public Schacht SelectedSchacht { get; private set; }
|
||||
|
||||
public Kanal SelectedHaltung {get; private set; }
|
||||
|
||||
public void SetProjekt(Projekt projekt, bool notification = true)
|
||||
{
|
||||
ProjektID = projekt.Id;
|
||||
if(notification)
|
||||
{
|
||||
OnProjektChanged();
|
||||
}
|
||||
}
|
||||
public void SetSchacht(Schacht schacht, bool notification = true)
|
||||
{
|
||||
SelectedSchacht = schacht;
|
||||
SchachtID = schacht.Id;
|
||||
if(notification)
|
||||
{
|
||||
OnSchachtChanged();
|
||||
}
|
||||
}
|
||||
public void SetHaltung(Kanal haltung, bool notification = true)
|
||||
{
|
||||
SelectedHaltung = haltung;
|
||||
HaltungID = haltung.Id;
|
||||
if(notification)
|
||||
{
|
||||
OnHaltungChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public event EventHandler? ProjektChanged;
|
||||
public event EventHandler? SchachtChanged;
|
||||
public event EventHandler? HaltungChanged;
|
||||
private void OnProjektChanged()
|
||||
{
|
||||
ProjektChanged?.Invoke(this, new EventArgs());
|
||||
}
|
||||
private void OnSchachtChanged()
|
||||
{
|
||||
SchachtChanged?.Invoke(this, new EventArgs());
|
||||
}
|
||||
private void OnHaltungChanged()
|
||||
{
|
||||
HaltungChanged?.Invoke(this, new EventArgs());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user