Umgebaut auf Radiobuttons

This commit is contained in:
Husky
2020-03-19 11:32:59 +01:00
parent 7c475e1c35
commit e056fa5126
2 changed files with 42 additions and 40 deletions

View File

@@ -30,6 +30,7 @@ namespace KanSan
UI.UCProjektList UCProjektList;
UI.UCBaustelleList UCBaustelleList;
public MainWindow()
{
InitializeComponent();
@@ -64,21 +65,7 @@ namespace KanSan
ContentController.Content = UCKundeEdit;
}
private void btnKunden_Click(object sender, RoutedEventArgs e)
{
ContentController.Content = UCKundeList;
}
private void btnProjekte_Click(object sender, RoutedEventArgs e)
{
Kunde client = (DataContext as MainWindowViewModel).SelectedKunde;
if (client == null) return;
UCProjektList = new UI.UCProjektList(client);
UCProjektList.ProjektSelected += UCProjektList_ProjektSelected;
UCProjektList.ProjektAdded += UCProjektList_ProjektAdded;
UCProjektList.ProjektEdited += UCProjektList_ProjektEdited;
ContentController.Content = UCProjektList;
}
private void UCProjektList_ProjektEdited(object sender, UI.SelectProjektEventArgs e)
{
@@ -94,16 +81,6 @@ namespace KanSan
ContentController.Content = "MainView";
}
private void btnBaustellen_Click(object sender, RoutedEventArgs e)
{
Projekt projekt = (DataContext as MainWindowViewModel).SelectedProjekt;
if (projekt == null) return;
UCBaustelleList = new UI.UCBaustelleList(projekt);
UCBaustelleList.BaustelleAdded += UCBaustelleList_BaustelleAdded;
UCBaustelleList.BaustelleEdited += UCBaustelleList_BaustelleEdited;
UCBaustelleList.BaustelleSelected += UCBaustelleList_BaustelleSelected;
ContentController.Content = UCBaustelleList;
}
private void UCBaustelleList_BaustelleSelected(object sender, UI.SelectBaustelleEventArgs e)
{
@@ -128,12 +105,6 @@ namespace KanSan
ContentController.Content = uBaustelleEdit;
}
private void btnObjekte_Click(object sender, RoutedEventArgs e)
{
UI.UCObjekteList uCObjekteList = new UI.UCObjekteList((DataContext as MainWindowViewModel).SelectedBaustelle);
uCObjekteList.ObjektSelected += UCObjekteList_ObjektSelected;
ContentController.Content = uCObjekteList;
}
private void UCObjekteList_ObjektSelected(object sender, UI.ObjektSelectEventArgs e)
{
@@ -143,6 +114,41 @@ namespace KanSan
ContentController.Content = uCObjektEdit;
//Debugger.Break();
}
private void rbKunden_Checked(object sender, RoutedEventArgs e)
{
ContentController.Content = UCKundeList;
}
private void rbProjekte_Checked(object sender, RoutedEventArgs e)
{
Kunde client = (DataContext as MainWindowViewModel).SelectedKunde;
if (client == null) return;
UCProjektList = new UI.UCProjektList(client);
UCProjektList.ProjektSelected += UCProjektList_ProjektSelected;
UCProjektList.ProjektAdded += UCProjektList_ProjektAdded;
UCProjektList.ProjektEdited += UCProjektList_ProjektEdited;
ContentController.Content = UCProjektList;
}
private void rbBaustellen_Checked(object sender, RoutedEventArgs e)
{
Projekt projekt = (DataContext as MainWindowViewModel).SelectedProjekt;
if (projekt == null) return;
UCBaustelleList = new UI.UCBaustelleList(projekt);
UCBaustelleList.BaustelleAdded += UCBaustelleList_BaustelleAdded;
UCBaustelleList.BaustelleEdited += UCBaustelleList_BaustelleEdited;
UCBaustelleList.BaustelleSelected += UCBaustelleList_BaustelleSelected;
ContentController.Content = UCBaustelleList;
}
private void rbObjekte_Checked(object sender, RoutedEventArgs e)
{
rbObjekte.IsChecked = true;
UI.UCObjekteList uCObjekteList = new UI.UCObjekteList((DataContext as MainWindowViewModel).SelectedBaustelle);
uCObjekteList.ObjektSelected += UCObjekteList_ObjektSelected;
ContentController.Content = uCObjekteList;
}
}
}