ProjektList angefangen

This commit is contained in:
Husky
2020-02-23 20:22:06 +01:00
parent 24ae7b517c
commit 14e3860613
5 changed files with 121 additions and 6 deletions

View File

@@ -91,14 +91,11 @@ namespace KanSan.ViewModel
OnPropertyChanged();
}
}
private void SaveInRegistry(string key, string value)
{
Registry.SetValue(REGISTRYKEY, key, value);
}
private void LadeRegistry()
{
registry = Registry.CurrentUser.OpenSubKey("Software\\Cosysda\\KanSan");
@@ -140,13 +137,11 @@ namespace KanSan.ViewModel
}
}
}
private void InitRegistry()
{
Registry.CurrentUser.CreateSubKey("Software\\Cosysda\\KanSan");
LadeRegistry();
}
public MainWindowViewModel()
{
LadeRegistry();

View File

@@ -1,4 +1,7 @@
using System;
using KanSan.Base;
using KanSan.Base.Interfaces;
using KanSan.Base.Models;
using System;
using System.Collections.Generic;
using System.Text;
@@ -6,5 +9,16 @@ namespace KanSan.ViewModel
{
public class ProjektListViewModel
{
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
public void SelectProjekt()
{
}
public Projekt NeueProjekt()
{
throw new NotImplementedException();
}
}
}

View File

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

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

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