MainWindow Viewmodel erstellt
This commit is contained in:
@@ -36,8 +36,4 @@
|
||||
<ProjectReference Include="..\KanSan.ViewModel\KanSan.ViewModel.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||
<Exec Command="git rev-parse HEAD >"$(ProjectDir)\version.txt" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -6,13 +6,27 @@
|
||||
xmlns:local="clr-namespace:KanSan"
|
||||
xmlns:syncfusion="http://schemas.syncfusion.com/wpf" x:Class="KanSan.MainWindow"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="450" Width="800" WindowStartupLocation="CenterScreen" WindowState="Maximized">
|
||||
Title="{Binding ApplicationTitle}" Height="450" Width="800" WindowStartupLocation="CenterScreen" WindowState="Maximized">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="29*" />
|
||||
<ColumnDefinition Width="171*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<ContentControl Grid.Column="1" Name="ContentController" Content="ContentControl" HorizontalAlignment="Left" Height="402" Margin="226,22,0,0" VerticalAlignment="Top" Width="564"/>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="206*" />
|
||||
<RowDefinition Height="11*" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<Button Content="Kunden" Name="btnKunden" Click="btnKunden_Click" />
|
||||
<Button Content="Projekte" Name="btnProjekte" />
|
||||
<Button Content="Baustellen" Name="btnBaustellen" />
|
||||
<Button Content="Objekte" Name="btnObjekte" />
|
||||
</StackPanel>
|
||||
<ContentControl Grid.Column="1" Name="ContentController" Content="KanSan"/>
|
||||
<StatusBar Grid.ColumnSpan="2" Margin="0,1,0,0" Grid.Row="1">
|
||||
<StatusBarItem Content="Kunde" />
|
||||
<StatusBarItem Content="Projekt" />
|
||||
<StatusBarItem Content="Baustelle" />
|
||||
</StatusBar>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using KanSan.Base;
|
||||
using KanSan.Base.Models;
|
||||
using KanSan.ViewModel;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace KanSan
|
||||
@@ -27,15 +28,8 @@ namespace KanSan
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Title = ProgrammHashVersion.GIT_HASH;
|
||||
|
||||
|
||||
/*UI.UCKundeEdit uCKundeEdit = new UI.UCKundeEdit();
|
||||
ContentController.Content = uCKundeEdit;*/
|
||||
|
||||
UI.UCKundeList uCKundeList = new UI.UCKundeList();
|
||||
uCKundeList.KundeAdded += UCKundeList_KundeAdded;
|
||||
ContentController.Content = uCKundeList;
|
||||
this.DataContext = new MainWindowViewModel();
|
||||
//this.Title = ProgrammHashVersion.GIT_HASH;
|
||||
}
|
||||
|
||||
private void UCKundeList_KundeAdded(object sender, UI.KundeAddedKlickEventArgs e)
|
||||
@@ -43,6 +37,13 @@ namespace KanSan
|
||||
UI.UCKundeEdit uCKundeEdit = new UI.UCKundeEdit(e.kunde);
|
||||
ContentController.Content = uCKundeEdit;
|
||||
}
|
||||
|
||||
private void btnKunden_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
UI.UCKundeList uCKundeList = new UI.UCKundeList();
|
||||
uCKundeList.KundeAdded += UCKundeList_KundeAdded;
|
||||
ContentController.Content = uCKundeList;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,8 +10,17 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="50"/>
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
<DataGrid ItemsSource="{Binding Kunden}" />
|
||||
<Button Grid.Row="1" Name="NeueKunde" Content="Neue Kunde anlegen" Click="NeueKunde_Click" />
|
||||
<DataGrid AutoGenerateColumns="False" SelectionMode="Single" ItemsSource="{Binding Kunden}" Name="dgKundenList">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Vorname" Binding="{Binding Vorname}" />
|
||||
<DataGridTextColumn Header="Nachname" Binding="{Binding Nachname}" />
|
||||
<DataGridTextColumn Header="Ort" Binding="{Binding Ort}" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Button Grid.Row="1" Name="EditKunde" Content="Kunde Editieren" Click="EditKunde_Click" />
|
||||
<Button Grid.Row="2" Name="NeueKunde" Content="Neue Kunde anlegen" Click="NeueKunde_Click" />
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using KanSan.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
@@ -41,6 +42,14 @@ namespace KanSan.UI
|
||||
handler(this, e);
|
||||
}
|
||||
public event EventHandler<KundeAddedKlickEventArgs> KundeAdded;
|
||||
|
||||
private void EditKunde_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Kunde selectedKunde = (dgKundenList.SelectedItem as Kunde);
|
||||
if (selectedKunde == null) return;
|
||||
|
||||
OnKlickedKunde(new KundeAddedKlickEventArgs() { kunde = selectedKunde });
|
||||
}
|
||||
}
|
||||
|
||||
public class KundeAddedKlickEventArgs : EventArgs
|
||||
|
||||
Reference in New Issue
Block a user