Schriftgröse geändert

Projekte können nun ausgewählt werden
This commit is contained in:
Husky
2020-02-26 14:54:27 +01:00
parent 9457784293
commit 5ba62ac16f
16 changed files with 302 additions and 16 deletions

View File

@@ -4,6 +4,14 @@
xmlns:local="clr-namespace:KanSan"
StartupUri="MainWindow.xaml">
<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>

View File

@@ -5,6 +5,7 @@ using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
namespace KanSan
{
@@ -16,7 +17,21 @@ namespace KanSan
public App()
{
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))
});
}
}
}

View File

@@ -10,6 +10,9 @@
<Compile Update="UI\Kunde\UCKundeList.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="UI\Projekt\UCProjektEdit.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="UI\Projekt\WindowProjektEdit.xaml.cs">
<SubType>Code</SubType>
</Compile>
@@ -27,6 +30,9 @@
<Page Update="UI\Kunde\UCKundeList.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="UI\Projekt\UCProjektEdit.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="UI\Projekt\WindowProjektEdit.xaml">
<SubType>Designer</SubType>
</Page>

View File

@@ -25,7 +25,7 @@
<ContentControl Grid.Column="1" Name="ContentController" Content="KanSan"/>
<StatusBar Grid.ColumnSpan="2" Margin="0,1,0,0" Grid.Row="1">
<StatusBarItem Content="{Binding SelectedKunde.Vorname}" />
<StatusBarItem Content="Projekt" />
<StatusBarItem Content="{Binding SelectedProjekt.Projektnummer}" />
<StatusBarItem Content="Baustelle" />
</StatusBar>
</Grid>

View File

@@ -37,21 +37,18 @@ namespace KanSan
UCKundeList = new UI.UCKundeList();
UCKundeList.KundeAdded += UCKundeList_KundeAdded;
UCKundeList.KundeSelect += UCKundeList_KundeSelect;
}
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)
{
throw new NotImplementedException();
(DataContext as MainWindowViewModel).SelectedProjekt = e.projekt;
}
private void UCKundeList_KundeSelect(object sender, UI.KundeAddedKlickEventArgs e)
@@ -62,6 +59,7 @@ namespace KanSan
private void UCKundeList_KundeAdded(object sender, UI.KundeAddedKlickEventArgs e)
{
UCKundeEdit = new UI.UCKundeEdit(e.kunde);
UCKundeEdit.SpeichernClicked += Edit_SpeichernClicked;
ContentController.Content = UCKundeEdit;
}
@@ -77,8 +75,23 @@ namespace KanSan
UCProjektList = new UI.UCProjektList(client);
UCProjektList.ProjektSelected += UCProjektList_ProjektSelected;
UCProjektList.ProjektAdded += UCProjektList_ProjektAdded;
UCProjektList.ProjektEdited += UCProjektList_ProjektEdited;
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";
}
}
}

View 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";
}
}
}

View 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()
}) ;
}
}
}
}

View File

@@ -22,6 +22,15 @@ namespace KanSan.UI
/// </summary>
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 UnitOfWork unitOfWork = null;
public UCKundeEdit(Kunde kunde = null)
@@ -35,6 +44,7 @@ namespace KanSan.UI
private void Speichern_Click(object sender, RoutedEventArgs e)
{
((KundenEditViewModel)DataContext).Speichern();
OnSpeichernKlicked(EventArgs.Empty);
}
}

View 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>

View 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);
}
}
}

View File

@@ -4,8 +4,12 @@
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:ProjektListViewModelSampleData />
</d:UserControl.DataContext>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
@@ -13,7 +17,12 @@
<RowDefinition Height="50" />
<RowDefinition Height="50" />
</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="2" Name="ProjektEdit" Content="Projekt Editieren" Click="ProjektEdit_Click" />
<Button Grid.Row="3" Name="ProjektNew" Content="Neue Projekt Hinzufügen" Click="ProjektNew_Click" />