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

@@ -24,15 +24,11 @@
<RowDefinition Height="11*" /> <RowDefinition Height="11*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<StackPanel Grid.Column="0"> <StackPanel Grid.Column="0">
<RadioButton Name="rbKunden" Content="Kunden" Style="{StaticResource ToggelButtonList}" /> <RadioButton Name="rbKunden" Content="Kunden" Style="{StaticResource ToggelButtonList}" Checked="rbKunden_Checked" />
<RadioButton Name="rbProjekte" Content="Projekte" Style="{StaticResource ToggelButtonList}" /> <RadioButton Name="rbProjekte" Content="Projekte" Style="{StaticResource ToggelButtonList}" Checked="rbProjekte_Checked" />
<RadioButton Name="rbBaustellen" Content="Baustellen" Style="{StaticResource ToggelButtonList}" /> <RadioButton Name="rbBaustellen" Content="Baustellen" Style="{StaticResource ToggelButtonList}" Checked="rbBaustellen_Checked" />
<RadioButton x:Name="rbObjekte" Content="Objekte" Style="{StaticResource ToggelButtonList}" /> <RadioButton x:Name="rbObjekte" Content="Objekte" Style="{StaticResource ToggelButtonList}" Checked="rbObjekte_Checked" />
<!-- <Button Content="Kunden" Name="btnKunden" Click="btnKunden_Click" />
<Button Content="Projekte" Name="btnProjekte" Click="btnProjekte_Click" />
<Button Content="Baustellen" Name="btnBaustellen" Click="btnBaustellen_Click" />
<Button Content="Objekte" Name="btnObjekte" Click="btnObjekte_Click" />
-->
</StackPanel> </StackPanel>
<ContentControl Grid.Column="1" Name="ContentController" Content="KanSan"/> <ContentControl Grid.Column="1" Name="ContentController" Content="KanSan"/>
<StatusBar Grid.ColumnSpan="2" Margin="0,1,0,0" Grid.Row="1"> <StatusBar Grid.ColumnSpan="2" Margin="0,1,0,0" Grid.Row="1">

View File

@@ -30,6 +30,7 @@ namespace KanSan
UI.UCProjektList UCProjektList; UI.UCProjektList UCProjektList;
UI.UCBaustelleList UCBaustelleList; UI.UCBaustelleList UCBaustelleList;
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
@@ -64,21 +65,7 @@ namespace KanSan
ContentController.Content = UCKundeEdit; 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) private void UCProjektList_ProjektEdited(object sender, UI.SelectProjektEventArgs e)
{ {
@@ -94,16 +81,6 @@ namespace KanSan
ContentController.Content = "MainView"; 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) private void UCBaustelleList_BaustelleSelected(object sender, UI.SelectBaustelleEventArgs e)
{ {
@@ -128,12 +105,6 @@ namespace KanSan
ContentController.Content = uBaustelleEdit; 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) private void UCObjekteList_ObjektSelected(object sender, UI.ObjektSelectEventArgs e)
{ {
@@ -143,6 +114,41 @@ namespace KanSan
ContentController.Content = uCObjektEdit; ContentController.Content = uCObjektEdit;
//Debugger.Break(); //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;
}
} }
} }