Umbau angefangen auf ICommand
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class PropertyChangedClass
|
||||
public class BaseViewModel
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected internal void OnPropertyChanged([CallerMemberName] string propertyname = null)
|
||||
{
|
||||
Trace.WriteLine("OnPropertyChanged ()" + propertyname);
|
||||
if (PropertyChanged != null)
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(propertyname));
|
||||
}
|
||||
@@ -9,7 +9,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class BaustelleEditViewModel : PropertyChangedClass, INotifyPropertyChanged, IBaustelleEditViewModel
|
||||
public class BaustelleEditViewModel : BaseViewModel, INotifyPropertyChanged, IBaustelleEditViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
private Baustelle baustelle;
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class BaustellenListViewModel : IBaustelleListViewModel
|
||||
public class BaustellenListViewModel :BaseViewModel, IBaustelleListViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
private List<Baustelle> baustellen;
|
||||
|
||||
32
KanSan.ViewModel/Commands/RelayCommand.cs
Normal file
32
KanSan.ViewModel/Commands/RelayCommand.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.Mapping;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace KanSan.ViewModel.Commands
|
||||
{
|
||||
public class RelayCommand : ICommand
|
||||
{
|
||||
private Action<object> execute;
|
||||
private Func<object, bool> canExecute;
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public RelayCommand(Action<object> execute, Func<object, bool> canExecute = null)
|
||||
{
|
||||
this.execute = execute;
|
||||
this.canExecute = canExecute;
|
||||
}
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
return this.canExecute == null || this.canExecute(parameter);
|
||||
}
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
this.execute(parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class KundenEditViewModel : PropertyChangedClass, INotifyPropertyChanged
|
||||
public class KundenEditViewModel : BaseViewModel, INotifyPropertyChanged
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
|
||||
|
||||
@@ -2,19 +2,23 @@
|
||||
using KanSan.Base.Interfaces;
|
||||
using KanSan.Base.Interfaces.UI;
|
||||
using KanSan.Base.Models;
|
||||
using KanSan.ViewModel.Commands;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class KundenListViewModel : IKundenListViewModel
|
||||
public class KundenListViewModel : BaseViewModel, IKundenListViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
private List<Kunde> kunden;
|
||||
|
||||
public ICommand AddNewClientCommand { get; set; }
|
||||
|
||||
public List<Kunde> Kunden
|
||||
{
|
||||
get
|
||||
@@ -26,6 +30,8 @@ namespace KanSan.ViewModel
|
||||
public KundenListViewModel()
|
||||
{
|
||||
kunden = unitOfWork.KundenRepository.Get().ToList();
|
||||
|
||||
AddNewClientCommand = new RelayCommand(parameter => NeueKunde());
|
||||
}
|
||||
|
||||
public Kunde NeueKunde()
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace KanSan.ViewModel
|
||||
public string Tag { get => tag; set => tag = value; }
|
||||
public bool IsActiveInBaustelle { get => isActiveInBaustelle; set => isActiveInBaustelle = value; }
|
||||
}
|
||||
public class LeistungsverzeichnisBaustelleViewModel : PropertyChangedClass, INotifyPropertyChanged, ILeistungsverzeichnisBaustelleViewModel
|
||||
public class LeistungsverzeichnisBaustelleViewModel : BaseViewModel, INotifyPropertyChanged, ILeistungsverzeichnisBaustelleViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class LeistungsverzeichnisPositionenListViewModel :PropertyChangedClass, INotifyPropertyChanged, ILeistungsverzeichnisPositionListViewModel
|
||||
public class LeistungsverzeichnisPositionenListViewModel :BaseViewModel, INotifyPropertyChanged, ILeistungsverzeichnisPositionListViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
List<LeistungsverzeichnisPosition> lvPositionen;
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class LeistungsverzeichnisPositionViewModel : PropertyChangedClass, INotifyPropertyChanged, ILeistungsverzeichnisPositionViewModel
|
||||
public class LeistungsverzeichnisPositionViewModel : BaseViewModel, INotifyPropertyChanged, ILeistungsverzeichnisPositionViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using KanSan.Base;
|
||||
using KanSan.Base.Interfaces;
|
||||
using KanSan.Base.Models;
|
||||
using KanSan.ViewModel.Commands;
|
||||
using Microsoft.Win32;
|
||||
using Syncfusion.XlsIO;
|
||||
using System;
|
||||
@@ -11,12 +12,17 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class MainWindowViewModel : PropertyChangedClass, INotifyPropertyChanged
|
||||
public class MainWindowViewModel : BaseViewModel, INotifyPropertyChanged
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
|
||||
BaseViewModel actualViewModel;
|
||||
|
||||
|
||||
RegistryKey registry;
|
||||
const string REGISTRYKEY = "HKEY_CURRENT_USER\\Software\\Cosysda\\KanSan";
|
||||
|
||||
@@ -29,6 +35,32 @@ namespace KanSan.ViewModel
|
||||
public static List<LeistungsverzeichnisPosition> LVPositionen = null;
|
||||
|
||||
|
||||
|
||||
public ICommand ListClientsCommand { get; set; }
|
||||
public ICommand ListProjectsCommand { get; set; }
|
||||
public ICommand ListBaustellenCommand { get; set; }
|
||||
public ICommand ListObjectsCommand { get; set; }
|
||||
public ICommand ShowLeistungsverzeichnisCommand { get; set; }
|
||||
public ICommand SelectLeistungsverzeichnisBaustelleCommand { get; set; }
|
||||
|
||||
|
||||
public BaseViewModel ActualViewModel
|
||||
{
|
||||
get
|
||||
{
|
||||
Trace.WriteLine(actualViewModel);
|
||||
return actualViewModel;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (actualViewModel == value) return;
|
||||
Trace.WriteLine("Setze viewModel auf " + value);
|
||||
actualViewModel = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string ApplicationTitle
|
||||
{
|
||||
get
|
||||
@@ -184,10 +216,45 @@ namespace KanSan.ViewModel
|
||||
Registry.CurrentUser.CreateSubKey("Software\\Cosysda\\KanSan");
|
||||
LadeRegistry();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
|
||||
}
|
||||
public MainWindowViewModel()
|
||||
{
|
||||
|
||||
LadeRegistry();
|
||||
LoadBaustellenLeistungsverzeichnis();
|
||||
|
||||
ListClients();
|
||||
|
||||
|
||||
ListClientsCommand = new RelayCommand(parmater => ListClients());
|
||||
ListProjectsCommand = new RelayCommand(parameter => ListProjekte());
|
||||
ListBaustellenCommand = new RelayCommand(paramter => ListBaustellen());
|
||||
ListObjectsCommand = new RelayCommand(parameter => ListObjekte());
|
||||
|
||||
}
|
||||
|
||||
private void ListClients()
|
||||
{
|
||||
ActualViewModel = new KundenListViewModel();
|
||||
}
|
||||
|
||||
private void ListProjekte()
|
||||
{
|
||||
ActualViewModel = new ProjektListViewModel(SelectedKunde);
|
||||
}
|
||||
|
||||
private void ListBaustellen()
|
||||
{
|
||||
ActualViewModel = new BaustellenListViewModel(SelectedProjekt);
|
||||
}
|
||||
|
||||
private void ListObjekte()
|
||||
{
|
||||
ActualViewModel = new ObjekteListViewModel(SelectedBaustelle);
|
||||
}
|
||||
|
||||
public void GenerateExcelFile()
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class ObjekteEditViewModel : PropertyChangedClass,IObjekteEditViewModel, INotifyPropertyChanged
|
||||
public class ObjekteEditViewModel : BaseViewModel,IObjekteEditViewModel, INotifyPropertyChanged
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
string strassename;
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
using KanSan.Base.Interfaces;
|
||||
using KanSan.Base.Interfaces.UI;
|
||||
using KanSan.Base.Models;
|
||||
using KanSan.ViewModel.Commands;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
@@ -14,8 +17,10 @@ namespace KanSan.ViewModel
|
||||
public string Strassename { get; set; }
|
||||
public IEnumerable<Sewer> Objekte { get; set; }
|
||||
}
|
||||
public class ObjekteListViewModel
|
||||
public class ObjekteListViewModel : BaseViewModel
|
||||
{
|
||||
public ICommand ObjektSelected { get; set; }
|
||||
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
|
||||
List<ObjekteTransfer> kanalObjekte = new List<ObjekteTransfer>();
|
||||
@@ -37,9 +42,22 @@ namespace KanSan.ViewModel
|
||||
}).ToList();
|
||||
kanalObjekte = x;
|
||||
|
||||
ObjektSelected = new RelayCommand(SelectObjekt);
|
||||
|
||||
//kanalObjekte = unitOfWork.KanaeleRepository.Get(x => x.Baustelle.Equals(selectedBaustelle)).ToList();
|
||||
}
|
||||
|
||||
private void SelectObjekt(object obj)
|
||||
{
|
||||
if (!(obj is Sewer)) return;
|
||||
Sewer sewer = (Sewer)obj;
|
||||
if (sewer == null) return;
|
||||
|
||||
SewerMainWindowViewModel t = new SewerMainWindowViewModel(sewer);
|
||||
Debugger.Break();
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Sewer NeueObjektHinzufügen()
|
||||
{
|
||||
Guid guid = Guid.NewGuid();
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class ProjektEditViewModel : PropertyChangedClass,INotifyPropertyChanged, IProjektEditViewModel
|
||||
public class ProjektEditViewModel : BaseViewModel,INotifyPropertyChanged, IProjektEditViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
private Projekt projekt;
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class ProjektListViewModel : IProjektListViewModel
|
||||
public class ProjektListViewModel : BaseViewModel, IProjektListViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
private List<Projekt> projektevonKunde;
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class ProjektViewModel : PropertyChangedClass,INotifyPropertyChanged
|
||||
public class ProjektViewModel : BaseViewModel,INotifyPropertyChanged
|
||||
{
|
||||
private Projekt _baustelle;
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
|
||||
@@ -11,7 +11,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class SchaedenEditViewModel : PropertyChangedClass, INotifyPropertyChanged, ISchaedenEditViewModel
|
||||
public class SchaedenEditViewModel : BaseViewModel, INotifyPropertyChanged, ISchaedenEditViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
decimal entfernung;
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class SewerMainMenuViewModel : PropertyChangedClass,INotifyPropertyChanged
|
||||
public class SewerMainWindowViewModel : BaseViewModel,INotifyPropertyChanged
|
||||
{
|
||||
private Sewer model;
|
||||
private SchaedenViewModel schadenViewModel;
|
||||
@@ -58,7 +58,7 @@ namespace KanSan.ViewModel
|
||||
|
||||
|
||||
|
||||
public SewerMainMenuViewModel(Sewer model)
|
||||
public SewerMainWindowViewModel(Sewer model)
|
||||
{
|
||||
if (model == null) throw new ArgumentNullException();
|
||||
this.model = model;
|
||||
@@ -10,7 +10,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class TaetigkeitEditViewModel : PropertyChangedClass, INotifyPropertyChanged, ITaetigkeitEditViewModel
|
||||
public class TaetigkeitEditViewModel : BaseViewModel, INotifyPropertyChanged, ITaetigkeitEditViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
Fahrzeug fahrzeug;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using KanSan.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
@@ -18,6 +19,7 @@ namespace KanSan
|
||||
{
|
||||
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MjM0MjUzQDMxMzgyZTMxMmUzMG8wTDNQcm5mN3UxaU9MbjdkVUlQbDgzWHcvUXZCOHdaVVY3c2I5S3BvN0U9");
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
|
||||
@@ -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