Umbau angefangen auf ICommand
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using KanSan.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
@@ -17,6 +18,7 @@ namespace KanSan
|
||||
public App()
|
||||
{
|
||||
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MjM0MjUzQDMxMzgyZTMxMmUzMG8wTDNQcm5mN3UxaU9MbjdkVUlQbDgzWHcvUXZCOHdaVVY3c2I5S3BvN0U9");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -61,9 +61,15 @@
|
||||
<Compile Update="UI\Güteschutz\UCGüteschutzBerichtEdit.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="UI\SewerMainWindow.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="UI\UCHarzSanierung.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="UI\SanMaßnahmen\UCSanierungOverview.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="UI\UCSewerMainWindow.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
@@ -138,9 +144,15 @@
|
||||
<Page Update="UI\Güteschutz\UCGüteschutzBerichtEdit.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="UI\SewerMainWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="UI\UCHarzSanierung.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="UI\SanMaßnahmen\UCSanierungOverview.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="UI\UCSewerMainWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
xmlns:local="clr-namespace:KanSan"
|
||||
xmlns:syncfusion="clr-namespace:Syncfusion.Windows.Shared;assembly=Syncfusion.Shared.WPF" x:Class="KanSan.MainWindow"
|
||||
TitleTextAlignment="Center" TitleBarBackground="BlueViolet"
|
||||
@@ -17,6 +18,7 @@
|
||||
<ResourceDictionary Source="./my_controls.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -36,10 +38,10 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Grid.ColumnSpan="2">
|
||||
<RadioButton Name="rbKunden" Content="Kunden" Style="{StaticResource ToggelButtonList}" Checked="rbKunden_Checked" />
|
||||
<RadioButton Name="rbProjekte" Content="Projekte" Style="{StaticResource ToggelButtonList}" Checked="rbProjekte_Checked" />
|
||||
<RadioButton Name="rbBaustellen" Content="Baustellen" Style="{StaticResource ToggelButtonList}" Checked="rbBaustellen_Checked" />
|
||||
<RadioButton x:Name="rbObjekte" Content="Objekte" Style="{StaticResource ToggelButtonList}" Checked="rbObjekte_Checked" />
|
||||
<RadioButton Name="rbKunden" Content="Kunden" Style="{StaticResource ToggelButtonList}" Command="{Binding ListClientsCommand}" />
|
||||
<RadioButton Name="rbProjekte" Content="Projekte" Style="{StaticResource ToggelButtonList}" Command="{Binding ListProjectsCommand}" />
|
||||
<RadioButton Name="rbBaustellen" Content="Baustellen" Style="{StaticResource ToggelButtonList}" Command="{Binding ListBaustellenCommand}" />
|
||||
<RadioButton x:Name="rbObjekte" Content="Objekte" Style="{StaticResource ToggelButtonList}" Command="{Binding ListObjectsCommand}" />
|
||||
</StackPanel>
|
||||
<Line Grid.Row="1" Stroke="Black" Width="auto" Height="4" StrokeThickness="20" Fill="Black" Stretch="Fill" X1="9" X2="10" />
|
||||
<StackPanel Grid.Row="2">
|
||||
@@ -48,7 +50,7 @@
|
||||
<RadioButton Name="Test" Checked="Test_Checked" Content="Test" Style="{StaticResource ToggelButtonList}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<ContentControl Grid.Column="1" Name="ContentController" Content="KanSan"/>
|
||||
<ContentControl Grid.Column="1" Name="ContentController" Content="{Binding ActualViewModel}"/>
|
||||
<StatusBar Grid.ColumnSpan="2" Margin="0,1,0,0" Grid.Row="1">
|
||||
<StatusBarItem Content="{Binding SelectedKunde.Vorname}" />
|
||||
<StatusBarItem Content="{Binding SelectedProjekt.Projektnummer}" />
|
||||
|
||||
@@ -125,51 +125,6 @@ namespace KanSan
|
||||
|
||||
}
|
||||
|
||||
private void rbKunden_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
rbLeistungsverzeichnis.IsChecked = false;
|
||||
rbLeistungsverzeichnisBaustellen.IsChecked = false;
|
||||
UCKundeList = new UI.UCKundeList();
|
||||
UCKundeList.KundeAdded += UCKundeList_KundeAdded;
|
||||
UCKundeList.KundeSelect += UCKundeList_KundeSelect;
|
||||
ContentController.Content = UCKundeList;
|
||||
}
|
||||
|
||||
private void rbProjekte_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
rbLeistungsverzeichnis.IsChecked = false;
|
||||
rbLeistungsverzeichnisBaustellen.IsChecked = false;
|
||||
Kunde client = (DataContext as MainWindowViewModel).SelectedKunde;
|
||||
if (client == null) return;
|
||||
UCProjektList = new UI.UCProjektList(client);
|
||||
UCProjektList.ProjektSelected += UCProjektList_ProjektSelected;
|
||||
UCProjektList.ProjektAdded += UCProjektList_ProjektAdded;
|
||||
UCProjektList.ProjektEdited += UCProjektList_ProjektEdited;
|
||||
ContentController.Content = UCProjektList;
|
||||
}
|
||||
|
||||
private void rbBaustellen_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
rbLeistungsverzeichnis.IsChecked = false;
|
||||
rbLeistungsverzeichnisBaustellen.IsChecked = false;
|
||||
Projekt projekt = (DataContext as MainWindowViewModel).SelectedProjekt;
|
||||
if (projekt == null) return;
|
||||
UCBaustelleList = new UI.UCBaustelleList(projekt);
|
||||
UCBaustelleList.BaustelleAdded += UCBaustelleList_BaustelleAdded;
|
||||
UCBaustelleList.BaustelleEdited += UCBaustelleList_BaustelleEdited;
|
||||
UCBaustelleList.BaustelleSelected += UCBaustelleList_BaustelleSelected;
|
||||
ContentController.Content = UCBaustelleList;
|
||||
}
|
||||
|
||||
private void rbObjekte_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
rbLeistungsverzeichnis.IsChecked = false;
|
||||
rbLeistungsverzeichnisBaustellen.IsChecked = false;
|
||||
rbObjekte.IsChecked = true;
|
||||
UI.UCObjekteList uCObjekteList = new UI.UCObjekteList((DataContext as MainWindowViewModel).SelectedBaustelle);
|
||||
uCObjekteList.ObjektSelected += UCObjekteList_ObjektSelected;
|
||||
ContentController.Content = uCObjekteList;
|
||||
}
|
||||
|
||||
private void rbLeistungsverzeichnis_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
@@ -23,6 +23,11 @@ namespace KanSan.UI
|
||||
public event EventHandler<SelectBaustelleEventArgs> BaustelleSelected;
|
||||
public event EventHandler<SelectBaustelleEventArgs> BaustelleAdded;
|
||||
public event EventHandler<SelectBaustelleEventArgs> BaustelleEdited;
|
||||
|
||||
public UCBaustelleList()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public UCBaustelleList(Projekt projekt)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</DataGrid>
|
||||
<Button Grid.Row="1" Name="SelectKunde" Content="Kunde Auswählen" Click="SelectKunde_Click" />
|
||||
<Button Grid.Row="2" Name="EditKunde" Content="Kunde Editieren" Click="EditKunde_Click" />
|
||||
<Button Grid.Row="3" Name="NeueKunde" Content="Neue Kunde anlegen" Click="NeueKunde_Click" />
|
||||
<Button Grid.Row="3" Name="NeueKunde" Content="Neue Kunde anlegen" Command="{Binding AddNewClientCommand}" />
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -19,7 +19,14 @@
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
<TreeView Name="trvItems" ItemsSource="{Binding KanalObjekte}" MouseDoubleClick="trvItems_MouseDoubleClick">
|
||||
<TreeView Name="trvItems" ItemsSource="{Binding KanalObjekte}" >
|
||||
<TreeView.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type TreeViewItem}">
|
||||
<Setter Property="local:MouseLeftButtonUp.Command" Value="{Binding DataContext.ObjektSelected, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type TreeView}}}" />
|
||||
<Setter Property="local:MouseLeftButtonUp.CommandParamter"
|
||||
Value="{Binding ElementName=trvItems, Path=SelectedItem}"/>
|
||||
</Style>
|
||||
</TreeView.ItemContainerStyle>
|
||||
<TreeView.Resources>
|
||||
<HierarchicalDataTemplate DataType="{x:Type self:ObjekteTransfer}" ItemsSource="{Binding Objekte}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
|
||||
@@ -16,6 +16,52 @@ using System.Windows.Shapes;
|
||||
|
||||
namespace KanSan.UI
|
||||
{
|
||||
public class MouseLeftButtonUp
|
||||
{
|
||||
public static DependencyProperty CommandProperty = DependencyProperty.RegisterAttached("Command", typeof(ICommand), typeof(MouseLeftButtonUp), new UIPropertyMetadata(CommandChanged));
|
||||
public static DependencyProperty CommandParameterProperty =
|
||||
DependencyProperty.RegisterAttached("CommandParamter",
|
||||
typeof(object),
|
||||
typeof(MouseLeftButtonUp),
|
||||
new UIPropertyMetadata(null));
|
||||
|
||||
public static void SetCommand(DependencyObject target, ICommand value)
|
||||
{
|
||||
target.SetValue(CommandProperty, value);
|
||||
}
|
||||
public static object GetCommand(DependencyObject target, ICommand value)
|
||||
{
|
||||
return target.GetValue(CommandProperty);
|
||||
}
|
||||
public static void SetCommandParamter(DependencyObject target, object value)
|
||||
{
|
||||
target.SetValue(CommandProperty, value);
|
||||
}
|
||||
public static object GetCommandParamter(DependencyObject target)
|
||||
{
|
||||
return target.GetValue(CommandParameterProperty);
|
||||
}
|
||||
private static void CommandChanged(DependencyObject target, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
//throw new NotImplementedException();
|
||||
Control control = target as Control;
|
||||
if (control == null) return;
|
||||
if ((e.NewValue != null) && (e.OldValue == null))
|
||||
control.MouseLeftButtonUp += OnMouseLeftButtonUp;
|
||||
else if ((e.NewValue == null) && (e.OldValue != null))
|
||||
control.MouseLeftButtonUp -= OnMouseLeftButtonUp;
|
||||
|
||||
}
|
||||
private static void OnMouseLeftButtonUp(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//throw new NotImplementedException();
|
||||
Control control = sender as Control;
|
||||
ICommand command = (ICommand)control.GetValue(CommandProperty);
|
||||
object commandParameter = control.GetValue(CommandParameterProperty);
|
||||
command.Execute(commandParameter);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Interaktionslogik für UCObjekteList.xaml
|
||||
/// </summary>
|
||||
@@ -23,6 +69,10 @@ namespace KanSan.UI
|
||||
{
|
||||
public event EventHandler<ObjektSelectEventArgs> ObjektSelected;
|
||||
Baustelle baustelle;
|
||||
public UCObjekteList()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public UCObjekteList(Baustelle baustelle)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@@ -23,7 +23,11 @@ namespace KanSan.UI
|
||||
public event EventHandler<SelectProjektEventArgs> ProjektAdded;
|
||||
public event EventHandler<SelectProjektEventArgs> ProjektEdited;
|
||||
public event EventHandler<SelectProjektEventArgs> ProjektSelected;
|
||||
|
||||
public UCProjektList()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
public UCProjektList(Kunde selectedKunde)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
19
KanSan/UI/SanMaßnahmen/UCSanierungOverview.xaml
Normal file
19
KanSan/UI/SanMaßnahmen/UCSanierungOverview.xaml
Normal file
@@ -0,0 +1,19 @@
|
||||
<UserControl x:Class="KanSan.UI.UCSanierungOverview"
|
||||
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">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="./../../my_controls.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<ContentControl Name="Sanierungsmaßnahmen" Content="{Binding Path=Sanierungsmaßnahmen}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
26
KanSan/UI/SanMaßnahmen/UCSanierungOverview.xaml.cs
Normal file
26
KanSan/UI/SanMaßnahmen/UCSanierungOverview.xaml.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
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 UCSanierungOverview.xaml
|
||||
/// </summary>
|
||||
public partial class UCSanierungOverview : UserControl
|
||||
{
|
||||
public UCSanierungOverview()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
KanSan/UI/SewerMainWindow.xaml
Normal file
12
KanSan/UI/SewerMainWindow.xaml
Normal file
@@ -0,0 +1,12 @@
|
||||
<Window x:Class="KanSan.UI.SewerMainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:KanSan.UI"
|
||||
mc:Ignorable="d"
|
||||
Title="SewerMainWindow" Height="450" Width="800">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
32
KanSan/UI/SewerMainWindow.xaml.cs
Normal file
32
KanSan/UI/SewerMainWindow.xaml.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
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.Shapes;
|
||||
|
||||
namespace KanSan.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für SewerMainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class SewerMainWindow : Window
|
||||
{
|
||||
public SewerMainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public SewerMainWindow(Sewer model)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new SewerMainWindowViewModel(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ namespace KanSan.UI
|
||||
public UCSewerMainMenu(Sewer objekt)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new SewerMainMenuViewModel(objekt);
|
||||
this.DataContext = new SewerMainWindowViewModel(objekt);
|
||||
UI.UCObjektEdit uCObjektEdit = new UCObjektEdit(objekt);
|
||||
ObjektContentcontroller.Content = uCObjektEdit;
|
||||
rbStammdaten.IsChecked = true;
|
||||
@@ -47,11 +47,11 @@ namespace KanSan.UI
|
||||
switch(btn.Name)
|
||||
{
|
||||
case "rbStammdaten":
|
||||
UI.UCObjektEdit uCObjektEdit = new UCObjektEdit((DataContext as SewerMainMenuViewModel).Objekt);
|
||||
UI.UCObjektEdit uCObjektEdit = new UCObjektEdit((DataContext as SewerMainWindowViewModel).Objekt);
|
||||
ObjektContentcontroller.Content = uCObjektEdit;
|
||||
break;
|
||||
case "rbSchaeden":
|
||||
UI.UCSchaedenList uCSchaedenList = new UCSchaedenList((DataContext as SewerMainMenuViewModel).Objekt);
|
||||
UI.UCSchaedenList uCSchaedenList = new UCSchaedenList((DataContext as SewerMainWindowViewModel).Objekt);
|
||||
uCSchaedenList.SchaedenSelected += UCSchaedenList_SchaedenSelected;
|
||||
uCSchaedenList.SanierungsmaßnahmenSelected += UCSchaedenList_SanierungsmaßnahmenSelected;
|
||||
ObjektContentcontroller.Content = uCSchaedenList;
|
||||
@@ -65,7 +65,7 @@ namespace KanSan.UI
|
||||
{
|
||||
aktuellSchadenSelected = e.schaeden;
|
||||
UI.UCSanMaßnahmenList uCSanMaßnahmenList = new UCSanMaßnahmenList(e.schaeden);
|
||||
(DataContext as SewerMainMenuViewModel).Schaden = e.schaeden;
|
||||
(DataContext as SewerMainWindowViewModel).Schaden = e.schaeden;
|
||||
|
||||
uCSanMaßnahmenList.TaetigkeitenSelected += UCSanMaßnahmenList_TaetigkeitenSelected;
|
||||
rbSchaeden.IsChecked = false;
|
||||
@@ -103,7 +103,7 @@ namespace KanSan.UI
|
||||
|
||||
private void UCSchaedenEdit_SpeichernClicked(object sender, EventArgs e)
|
||||
{
|
||||
UI.UCSchaedenList uCSchaedenList = new UCSchaedenList((DataContext as SewerMainMenuViewModel).Objekt);
|
||||
UI.UCSchaedenList uCSchaedenList = new UCSchaedenList((DataContext as SewerMainWindowViewModel).Objekt);
|
||||
uCSchaedenList.SchaedenSelected += UCSchaedenList_SchaedenSelected;
|
||||
ObjektContentcontroller.Content = uCSchaedenList;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,24 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:KanSan"
|
||||
xmlns:vm="clr-namespace:KanSan.ViewModel;assembly=KanSan.ViewModel"
|
||||
xmlns:l="clr-namespace:KanSan.UI">
|
||||
<DataTemplate x:Key="SanierungViewModelDataTemplate" DataType="{x:Type l:UCHarzSanierung }">
|
||||
<l:UCHarzSanierung />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type vm:KundenListViewModel}">
|
||||
<l:UCKundeList/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type vm:ProjektListViewModel}">
|
||||
<l:UCProjektList/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type vm:BaustellenListViewModel}">
|
||||
<l:UCBaustelleList/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type vm:ObjekteListViewModel}">
|
||||
<l:UCObjekteList />
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="SelectNewTätigkeitenLVPosition">
|
||||
<Border BorderThickness="2" BorderBrush="Red">
|
||||
<ItemsControl ItemsSource="{Binding LVPositionen }">
|
||||
|
||||
Reference in New Issue
Block a user