Schriftgröse geändert
Projekte können nun ausgewählt werden
This commit is contained in:
13
KanSan.Base/Interfaces/UI/IProjektEditViewModel.cs
Normal file
13
KanSan.Base/Interfaces/UI/IProjektEditViewModel.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace KanSan.Base.Interfaces.UI
|
||||||
|
{
|
||||||
|
public interface IProjektEditViewModel
|
||||||
|
{
|
||||||
|
string Projektnummer { get; set; }
|
||||||
|
string Ort { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
12
KanSan.Base/Interfaces/UI/IProjekteListViewModel.cs
Normal file
12
KanSan.Base/Interfaces/UI/IProjekteListViewModel.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using KanSan.Base.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace KanSan.Base.Interfaces.UI
|
||||||
|
{
|
||||||
|
public interface IProjekteListViewModel
|
||||||
|
{
|
||||||
|
List<Projekt> ProjekteVomKunde { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -53,6 +53,8 @@ namespace KanSan.ViewModel
|
|||||||
if (_selectedKunde.GuidNr.Equals(value.GuidNr)) return;
|
if (_selectedKunde.GuidNr.Equals(value.GuidNr)) return;
|
||||||
}
|
}
|
||||||
_selectedKunde = value;
|
_selectedKunde = value;
|
||||||
|
_selectedProjekt = null;
|
||||||
|
_selectedBaustelle = null;
|
||||||
SaveInRegistry("LastKunde", value.GuidNr.ToString());
|
SaveInRegistry("LastKunde", value.GuidNr.ToString());
|
||||||
OnPropertyChanged();
|
OnPropertyChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
54
KanSan.ViewModel/ProjektEditViewModel.cs
Normal file
54
KanSan.ViewModel/ProjektEditViewModel.cs
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
using KanSan.Base;
|
||||||
|
using KanSan.Base.Interfaces;
|
||||||
|
using KanSan.Base.Interfaces.UI;
|
||||||
|
using KanSan.Base.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace KanSan.ViewModel
|
||||||
|
{
|
||||||
|
public class ProjektEditViewModel : PropertyChangedClass,INotifyPropertyChanged, IProjektEditViewModel
|
||||||
|
{
|
||||||
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
|
private Projekt projekt;
|
||||||
|
string projektnummer;
|
||||||
|
string ort;
|
||||||
|
public string Projektnummer
|
||||||
|
{
|
||||||
|
get => projektnummer;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (projektnummer != null && projektnummer == value) return;
|
||||||
|
projektnummer = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string Ort
|
||||||
|
{
|
||||||
|
get => ort;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (ort != null && ort == value) return;
|
||||||
|
ort = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjektEditViewModel(Projekt projekt)
|
||||||
|
{
|
||||||
|
this.projekt = projekt;
|
||||||
|
projektnummer = projekt.Projektnummer;
|
||||||
|
ort = projekt.Ort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Speichern()
|
||||||
|
{
|
||||||
|
projekt.Ort = Ort;
|
||||||
|
projekt.Projektnummer = Projektnummer;
|
||||||
|
unitOfWork.ProjekteRepository.Update(projekt);
|
||||||
|
unitOfWork.Commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using KanSan.Base;
|
using KanSan.Base;
|
||||||
using KanSan.Base.Interfaces;
|
using KanSan.Base.Interfaces;
|
||||||
|
using KanSan.Base.Interfaces.UI;
|
||||||
using KanSan.Base.Models;
|
using KanSan.Base.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -8,20 +9,26 @@ using System.Text;
|
|||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
public class ProjektListViewModel
|
public class ProjektListViewModel : IProjekteListViewModel
|
||||||
{
|
{
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
|
private List<Projekt> projektevonKunde;
|
||||||
|
public List<Projekt> ProjekteVomKunde
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return projektevonKunde;
|
||||||
|
}
|
||||||
|
}
|
||||||
private Kunde selectedKunde;
|
private Kunde selectedKunde;
|
||||||
|
|
||||||
public ProjektListViewModel(Kunde client)
|
public ProjektListViewModel(Kunde client)
|
||||||
{
|
{
|
||||||
//List<Kunde> clients = unitOfWork.KundenRepository.Get(x => x.GuidNr.Equals(client.GuidNr)).ToList();
|
|
||||||
//this.selectedKunde = clients.First();
|
|
||||||
this.selectedKunde = client;
|
this.selectedKunde = client;
|
||||||
|
|
||||||
|
|
||||||
|
projektevonKunde = unitOfWork.ProjekteRepository.Get(x => x.Kunde.Equals(client)).ToList();
|
||||||
List<Projekt> projektevonKunde = unitOfWork.ProjekteRepository.Get(x => x.Kunde.Equals(client)).ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SelectProjekt()
|
public void SelectProjekt()
|
||||||
|
|||||||
@@ -4,6 +4,14 @@
|
|||||||
xmlns:local="clr-namespace:KanSan"
|
xmlns:local="clr-namespace:KanSan"
|
||||||
StartupUri="MainWindow.xaml">
|
StartupUri="MainWindow.xaml">
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
|
<Style TargetType="{x:Type UserControl}">
|
||||||
|
<Setter Property="FontFamily" Value="Comic Sans MS"/>
|
||||||
|
<Setter Property="FontSize" Value="20" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="{x:Type Window}">
|
||||||
|
<Setter Property="FontFamily" Value="Comic Sans MS"/>
|
||||||
|
<Setter Property="FontSize" Value="20" />
|
||||||
|
</Style>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
</Application>
|
</Application>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Data;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace KanSan
|
namespace KanSan
|
||||||
{
|
{
|
||||||
@@ -16,6 +17,20 @@ namespace KanSan
|
|||||||
public App()
|
public App()
|
||||||
{
|
{
|
||||||
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MjEwMDc1QDMxMzcyZTM0MmUzME9iTUUzZVRJSGpnYmNLdXg0cmpSMGF1SnZjcHhKN09MYUV6UlRRUWloTWs9");
|
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MjEwMDc1QDMxMzcyZTM0MmUzME9iTUUzZVRJSGpnYmNLdXg0cmpSMGF1SnZjcHhKN09MYUV6UlRRUWloTWs9");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
|
{
|
||||||
|
FrameworkElement.StyleProperty.OverrideMetadata(typeof(Window), new FrameworkPropertyMetadata
|
||||||
|
{
|
||||||
|
DefaultValue = FindResource(typeof(Window))
|
||||||
|
});
|
||||||
|
|
||||||
|
FrameworkElement.StyleProperty.OverrideMetadata(typeof(UserControl), new FrameworkPropertyMetadata
|
||||||
|
{
|
||||||
|
DefaultValue = FindResource(typeof(UserControl))
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,9 @@
|
|||||||
<Compile Update="UI\Kunde\UCKundeList.xaml.cs">
|
<Compile Update="UI\Kunde\UCKundeList.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="UI\Projekt\UCProjektEdit.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="UI\Projekt\WindowProjektEdit.xaml.cs">
|
<Compile Update="UI\Projekt\WindowProjektEdit.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -27,6 +30,9 @@
|
|||||||
<Page Update="UI\Kunde\UCKundeList.xaml">
|
<Page Update="UI\Kunde\UCKundeList.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Update="UI\Projekt\UCProjektEdit.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="UI\Projekt\WindowProjektEdit.xaml">
|
<Page Update="UI\Projekt\WindowProjektEdit.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
<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">
|
||||||
<StatusBarItem Content="{Binding SelectedKunde.Vorname}" />
|
<StatusBarItem Content="{Binding SelectedKunde.Vorname}" />
|
||||||
<StatusBarItem Content="Projekt" />
|
<StatusBarItem Content="{Binding SelectedProjekt.Projektnummer}" />
|
||||||
<StatusBarItem Content="Baustelle" />
|
<StatusBarItem Content="Baustelle" />
|
||||||
</StatusBar>
|
</StatusBar>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -37,21 +37,18 @@ namespace KanSan
|
|||||||
UCKundeList = new UI.UCKundeList();
|
UCKundeList = new UI.UCKundeList();
|
||||||
UCKundeList.KundeAdded += UCKundeList_KundeAdded;
|
UCKundeList.KundeAdded += UCKundeList_KundeAdded;
|
||||||
UCKundeList.KundeSelect += UCKundeList_KundeSelect;
|
UCKundeList.KundeSelect += UCKundeList_KundeSelect;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UCProjektList_ProjektAdded(object sender, UI.SelectProjektEventArgs e)
|
private void UCProjektList_ProjektAdded(object sender, UI.SelectProjektEventArgs e)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (e.projekt == null) return;
|
||||||
|
UI.UCProjektEdit uCProjektEdit = new UI.UCProjektEdit(e.projekt);
|
||||||
|
ContentController.Content = uCProjektEdit;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UCProjektList_ProjektSelected(object sender, UI.SelectProjektEventArgs e)
|
private void UCProjektList_ProjektSelected(object sender, UI.SelectProjektEventArgs e)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
(DataContext as MainWindowViewModel).SelectedProjekt = e.projekt;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UCKundeList_KundeSelect(object sender, UI.KundeAddedKlickEventArgs e)
|
private void UCKundeList_KundeSelect(object sender, UI.KundeAddedKlickEventArgs e)
|
||||||
@@ -62,6 +59,7 @@ namespace KanSan
|
|||||||
private void UCKundeList_KundeAdded(object sender, UI.KundeAddedKlickEventArgs e)
|
private void UCKundeList_KundeAdded(object sender, UI.KundeAddedKlickEventArgs e)
|
||||||
{
|
{
|
||||||
UCKundeEdit = new UI.UCKundeEdit(e.kunde);
|
UCKundeEdit = new UI.UCKundeEdit(e.kunde);
|
||||||
|
UCKundeEdit.SpeichernClicked += Edit_SpeichernClicked;
|
||||||
ContentController.Content = UCKundeEdit;
|
ContentController.Content = UCKundeEdit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,8 +75,23 @@ namespace KanSan
|
|||||||
UCProjektList = new UI.UCProjektList(client);
|
UCProjektList = new UI.UCProjektList(client);
|
||||||
UCProjektList.ProjektSelected += UCProjektList_ProjektSelected;
|
UCProjektList.ProjektSelected += UCProjektList_ProjektSelected;
|
||||||
UCProjektList.ProjektAdded += UCProjektList_ProjektAdded;
|
UCProjektList.ProjektAdded += UCProjektList_ProjektAdded;
|
||||||
|
UCProjektList.ProjektEdited += UCProjektList_ProjektEdited;
|
||||||
ContentController.Content = UCProjektList;
|
ContentController.Content = UCProjektList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UCProjektList_ProjektEdited(object sender, UI.SelectProjektEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.projekt == null) return;
|
||||||
|
UI.UCProjektEdit uCProjektEdit = new UI.UCProjektEdit(e.projekt);
|
||||||
|
|
||||||
|
uCProjektEdit.SpeichernClicked += Edit_SpeichernClicked;
|
||||||
|
ContentController.Content = uCProjektEdit;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Edit_SpeichernClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ContentController.Content = "MainView";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
21
KanSan/SampleData/ProjektEditViewModelSampleData.cs
Normal file
21
KanSan/SampleData/ProjektEditViewModelSampleData.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using KanSan.Base.Interfaces.UI;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace KanSan.SampleData
|
||||||
|
{
|
||||||
|
class ProjektEditViewModelSampleData : IProjektEditViewModel
|
||||||
|
{
|
||||||
|
string projektnummer;
|
||||||
|
string ort;
|
||||||
|
public string Projektnummer { get => projektnummer; set => projektnummer = value; }
|
||||||
|
public string Ort { get => ort; set => ort = value; }
|
||||||
|
|
||||||
|
public ProjektEditViewModelSampleData()
|
||||||
|
{
|
||||||
|
ort = "Oldenburg";
|
||||||
|
projektnummer = "20-850-024";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
41
KanSan/SampleData/ProjektListViewModelSampleData.cs
Normal file
41
KanSan/SampleData/ProjektListViewModelSampleData.cs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
using KanSan.Base.Interfaces.UI;
|
||||||
|
using KanSan.Base.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace KanSan.SampleData
|
||||||
|
{
|
||||||
|
class ProjektListViewModelSampleData : IProjekteListViewModel
|
||||||
|
{
|
||||||
|
private List<Projekt> _projekteVomKunde = new List<Projekt>();
|
||||||
|
public List<Projekt> ProjekteVomKunde => _projekteVomKunde;
|
||||||
|
|
||||||
|
public ProjektListViewModelSampleData()
|
||||||
|
{
|
||||||
|
Kunde client = new Kunde()
|
||||||
|
{
|
||||||
|
Vorname = "Damian",
|
||||||
|
Nachname = "Bodde",
|
||||||
|
Ort = "Papenburg",
|
||||||
|
PLZ = "26871",
|
||||||
|
Strasse = "Barenbergstraße",
|
||||||
|
ID = 1,
|
||||||
|
GuidNr = Guid.NewGuid()
|
||||||
|
};
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
_projekteVomKunde.Add(new Projekt()
|
||||||
|
{
|
||||||
|
ID = i + 1,
|
||||||
|
Ort = "Oldenburg",
|
||||||
|
Projektnummer = "20-850-0" + i,
|
||||||
|
Kunde = client,
|
||||||
|
GuidNr = Guid.NewGuid()
|
||||||
|
}) ;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,6 +22,15 @@ namespace KanSan.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class UCKundeEdit : UserControl
|
public partial class UCKundeEdit : UserControl
|
||||||
{
|
{
|
||||||
|
public event EventHandler SpeichernClicked;
|
||||||
|
|
||||||
|
protected virtual void OnSpeichernKlicked(EventArgs e)
|
||||||
|
{
|
||||||
|
EventHandler handler = SpeichernClicked;
|
||||||
|
if (handler != null)
|
||||||
|
handler(this, e);
|
||||||
|
}
|
||||||
|
|
||||||
//private Kunde kunde = null;
|
//private Kunde kunde = null;
|
||||||
//private UnitOfWork unitOfWork = null;
|
//private UnitOfWork unitOfWork = null;
|
||||||
public UCKundeEdit(Kunde kunde = null)
|
public UCKundeEdit(Kunde kunde = null)
|
||||||
@@ -35,6 +44,7 @@ namespace KanSan.UI
|
|||||||
private void Speichern_Click(object sender, RoutedEventArgs e)
|
private void Speichern_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
((KundenEditViewModel)DataContext).Speichern();
|
((KundenEditViewModel)DataContext).Speichern();
|
||||||
|
OnSpeichernKlicked(EventArgs.Empty);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
31
KanSan/UI/Projekt/UCProjektEdit.xaml
Normal file
31
KanSan/UI/Projekt/UCProjektEdit.xaml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<UserControl x:Class="KanSan.UI.UCProjektEdit"
|
||||||
|
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"
|
||||||
|
xmlns:sd ="clr-namespace:KanSan.SampleData"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<d:UserControl.DataContext>
|
||||||
|
<sd:ProjektEditViewModelSampleData />
|
||||||
|
</d:UserControl.DataContext>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Label Background="Beige" Grid.Column="0" Grid.Row="0" Content="Projektnummer" />
|
||||||
|
<Label Background="Beige" Grid.Column="0" Grid.Row="1" Content="Ort" />
|
||||||
|
<Button Grid.Row="2" Grid.ColumnSpan="2" Name="Speichern" Content="Speichern" Click="Speichern_Click" />
|
||||||
|
|
||||||
|
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Projektnummer}" />
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Ort}" />
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
44
KanSan/UI/Projekt/UCProjektEdit.xaml.cs
Normal file
44
KanSan/UI/Projekt/UCProjektEdit.xaml.cs
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
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 UCProjektEdit.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class UCProjektEdit : UserControl
|
||||||
|
{
|
||||||
|
public event EventHandler SpeichernClicked;
|
||||||
|
|
||||||
|
protected virtual void OnSpeichernKlicked(EventArgs e)
|
||||||
|
{
|
||||||
|
EventHandler handler = SpeichernClicked;
|
||||||
|
if (handler != null)
|
||||||
|
handler(this, e);
|
||||||
|
}
|
||||||
|
public UCProjektEdit(Projekt projekt)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
this.DataContext = new ProjektEditViewModel(projekt);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Speichern_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
(DataContext as ProjektEditViewModel).Speichern();
|
||||||
|
OnSpeichernKlicked(EventArgs.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,8 +4,12 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:KanSan.UI"
|
xmlns:local="clr-namespace:KanSan.UI"
|
||||||
|
xmlns:sd ="clr-namespace:KanSan.SampleData"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<d:UserControl.DataContext>
|
||||||
|
<sd:ProjektListViewModelSampleData />
|
||||||
|
</d:UserControl.DataContext>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
@@ -13,7 +17,12 @@
|
|||||||
<RowDefinition Height="50" />
|
<RowDefinition Height="50" />
|
||||||
<RowDefinition Height="50" />
|
<RowDefinition Height="50" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<DataGrid ItemsSource="{Binding Projekte}" Name="dgProjekte" />
|
<DataGrid ItemsSource="{Binding ProjekteVomKunde}" Name="dgProjekte" AutoGenerateColumns="False">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="Projektnummer" Binding="{Binding Projektnummer}" />
|
||||||
|
<DataGridTextColumn Header="Ort" Binding="{Binding Ort}" />
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
<Button Grid.Row="1" x:Name="ProjektSelect" Content="Projekt Auswählen" Click="ProjektSelect_Click" />
|
<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="2" Name="ProjektEdit" Content="Projekt Editieren" Click="ProjektEdit_Click" />
|
||||||
<Button Grid.Row="3" Name="ProjektNew" Content="Neue Projekt Hinzufügen" Click="ProjektNew_Click" />
|
<Button Grid.Row="3" Name="ProjektNew" Content="Neue Projekt Hinzufügen" Click="ProjektNew_Click" />
|
||||||
|
|||||||
Reference in New Issue
Block a user