ProjektList angefangen
This commit is contained in:
@@ -16,6 +16,9 @@
|
||||
<Compile Update="UI\Kunde\UCKundeEdit.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="UI\Projekt\UCProjektList.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="MainWindow.xaml">
|
||||
@@ -30,5 +33,8 @@
|
||||
<Page Update="UI\Kunde\UCKundeEdit.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="UI\Projekt\UCProjektList.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
21
KanSan/UI/Projekt/UCProjektList.xaml
Normal file
21
KanSan/UI/Projekt/UCProjektList.xaml
Normal file
@@ -0,0 +1,21 @@
|
||||
<UserControl x:Class="KanSan.UI.UCProjektList"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:KanSan.UI"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
<DataGrid ItemsSource="{Binding Projekte}" Name="dgProjekte" />
|
||||
<Button Grid.Row="1" x:Name="ProjektSelect" Content="Projekt Auswählen" Click="ProjektSelect_Click" />
|
||||
<Button Grid.Row="2" Name="ProjektEdit" Content="Projekt Editieren" Click="ProjektEdit_Click" />
|
||||
<Button Grid.Row="3" Name="ProjektNew" Content="Neue Projekt Hinzufügen" Click="ProjektNew_Click" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
79
KanSan/UI/Projekt/UCProjektList.xaml.cs
Normal file
79
KanSan/UI/Projekt/UCProjektList.xaml.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using KanSan.Base.Models;
|
||||
using KanSan.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace KanSan.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für UCProjektList.xaml
|
||||
/// </summary>
|
||||
public partial class UCProjektList : UserControl
|
||||
{
|
||||
public event EventHandler<SelectProjektEventArgs> ProjektAdded;
|
||||
public event EventHandler<SelectProjektEventArgs> ProjektEdited;
|
||||
public event EventHandler<SelectProjektEventArgs> ProjektSelected;
|
||||
public UCProjektList()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new ProjektListViewModel();
|
||||
}
|
||||
|
||||
private void ProjektSelect_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Projekt selectedProjekt = (dgProjekte.SelectedItem as Projekt);
|
||||
if (selectedProjekt == null) return;
|
||||
OnClickProjektSelect(new SelectProjektEventArgs() { projekt = selectedProjekt });
|
||||
}
|
||||
|
||||
private void ProjektEdit_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Projekt selectedProjekt = (dgProjekte.SelectedItem as Projekt);
|
||||
if (selectedProjekt == null) return;
|
||||
OnClickProjektEdit(new SelectProjektEventArgs() { projekt = selectedProjekt });
|
||||
}
|
||||
|
||||
private void ProjektNew_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OnClickProjektAdd(
|
||||
new SelectProjektEventArgs()
|
||||
{
|
||||
projekt = (DataContext as ProjektListViewModel).NeueProjekt()
|
||||
});
|
||||
}
|
||||
|
||||
protected virtual void OnClickProjektSelect(SelectProjektEventArgs e)
|
||||
{
|
||||
EventHandler<SelectProjektEventArgs> handler = ProjektSelected;
|
||||
if (handler != null)
|
||||
handler(this, e);
|
||||
}
|
||||
protected virtual void OnClickProjektEdit(SelectProjektEventArgs e)
|
||||
{
|
||||
EventHandler<SelectProjektEventArgs> handler = ProjektEdited;
|
||||
if (handler != null)
|
||||
handler(this, e);
|
||||
}
|
||||
protected virtual void OnClickProjektAdd(SelectProjektEventArgs e)
|
||||
{
|
||||
EventHandler<SelectProjektEventArgs> handler = ProjektAdded;
|
||||
if (handler != null)
|
||||
handler(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
public class SelectProjektEventArgs : EventArgs
|
||||
{
|
||||
public Projekt projekt { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user