Baustellen können nun angelegt und ausgewählt werden
This commit is contained in:
@@ -5,8 +5,27 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:KanSan.UI"
|
||||
mc:Ignorable="d"
|
||||
xmlns:sd ="clr-namespace:KanSan.SampleData"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<d:UserControl.DataContext>
|
||||
<sd:BaustelleEditViewModelSampleData/>
|
||||
</d:UserControl.DataContext>
|
||||
<Grid>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" Background="Beige" Content="OrtTeil" />
|
||||
<Label Grid.Row="1" Grid.Column="0" Background="Beige" Content="Projektnummer" />
|
||||
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding OrtTeil}" />
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding BaustelleNummer}"/>
|
||||
|
||||
<Button Grid.ColumnSpan="2" Grid.Row="2" Content="Speichern" Name="Speichern" Click="Speichern_Click" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using KanSan.Base.Models;
|
||||
using KanSan.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
@@ -18,9 +20,23 @@ namespace KanSan.UI
|
||||
/// </summary>
|
||||
public partial class UCBaustelleEdit : UserControl
|
||||
{
|
||||
public UCBaustelleEdit()
|
||||
public event EventHandler SpeichernClicked;
|
||||
public UCBaustelleEdit(Baustelle baustelle)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new BaustelleEditViewModel(baustelle);
|
||||
}
|
||||
protected virtual void OnSpeichernKlicked(EventArgs e)
|
||||
{
|
||||
EventHandler handler = SpeichernClicked;
|
||||
if (handler != null)
|
||||
handler(this, e);
|
||||
}
|
||||
|
||||
private void Speichern_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
(DataContext as BaustelleEditViewModel).Speichern();
|
||||
OnSpeichernKlicked(EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,27 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:KanSan.UI"
|
||||
xmlns:sd ="clr-namespace:KanSan.SampleData"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
d:DesignHeight="450" d:DesignWidth="1024">
|
||||
<d:UserControl.DataContext>
|
||||
<sd:BaustelleListViewModelSampleData />
|
||||
</d:UserControl.DataContext>
|
||||
<Grid>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
<DataGrid Name="dgBaustelle" ItemsSource="{Binding Baustellen}" AutoGenerateColumns="False">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="OrtTeil" Binding="{Binding OrtTeil}" />
|
||||
<DataGridTextColumn Header="BaustelleNummer" Binding="{Binding BaustelleNummer}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Button Grid.Row="1" Name="BaustelleSelect" Content="Baustelle Auswählen" Click="BaustelleSelect_Click" />
|
||||
<Button Grid.Row="2" Name="BaustelleEdit" Content="Baustelle Editieren" Click="BaustelleEdit_Click" />
|
||||
<Button Grid.Row="3" Name="BaustelleNew" Content="Neue Baustelle Hinzufügen" Click="BaustelleNew_Click" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using KanSan.Base.Models;
|
||||
using KanSan.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
@@ -18,9 +20,59 @@ namespace KanSan.UI
|
||||
/// </summary>
|
||||
public partial class UCBaustelleList : UserControl
|
||||
{
|
||||
public UCBaustelleList()
|
||||
public event EventHandler<SelectBaustelleEventArgs> BaustelleSelected;
|
||||
public event EventHandler<SelectBaustelleEventArgs> BaustelleAdded;
|
||||
public event EventHandler<SelectBaustelleEventArgs> BaustelleEdited;
|
||||
public UCBaustelleList(Projekt projekt)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new BaustellenListViewModel(projekt);
|
||||
}
|
||||
|
||||
private void BaustelleSelect_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Baustelle selectedBaustelle = (dgBaustelle.SelectedItem as Baustelle);
|
||||
if (selectedBaustelle == null) return;
|
||||
OnClickBaustelleSelect(new SelectBaustelleEventArgs() { baustelle = selectedBaustelle });
|
||||
}
|
||||
|
||||
private void BaustelleEdit_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Baustelle selectedBaustelle = (dgBaustelle.SelectedItem as Baustelle);
|
||||
if (selectedBaustelle == null) return;
|
||||
OnClickBaustelleEdit(new SelectBaustelleEventArgs() { baustelle = selectedBaustelle });
|
||||
}
|
||||
|
||||
private void BaustelleNew_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OnClickBaustelleAdd(
|
||||
new SelectBaustelleEventArgs()
|
||||
{
|
||||
baustelle = (DataContext as BaustellenListViewModel).NeueBaustelle()
|
||||
});
|
||||
}
|
||||
|
||||
protected virtual void OnClickBaustelleSelect(SelectBaustelleEventArgs e)
|
||||
{
|
||||
EventHandler<SelectBaustelleEventArgs> handler = BaustelleSelected;
|
||||
if (handler != null)
|
||||
handler(this, e);
|
||||
}
|
||||
protected virtual void OnClickBaustelleAdd(SelectBaustelleEventArgs e)
|
||||
{
|
||||
EventHandler<SelectBaustelleEventArgs> handler = BaustelleAdded;
|
||||
if (handler != null)
|
||||
handler(this, e);
|
||||
}
|
||||
protected virtual void OnClickBaustelleEdit(SelectBaustelleEventArgs e)
|
||||
{
|
||||
EventHandler<SelectBaustelleEventArgs> handler = BaustelleEdited;
|
||||
if (handler != null)
|
||||
handler(this, e);
|
||||
}
|
||||
}
|
||||
public class SelectBaustelleEventArgs : EventArgs
|
||||
{
|
||||
public Baustelle baustelle { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user