Baustellen können nun angelegt und ausgewählt werden
This commit is contained in:
@@ -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