Umbau angefangen auf ICommand

This commit is contained in:
Husky
2020-07-12 19:32:14 +02:00
parent 9f8e167ce3
commit 3e9a353fc0
33 changed files with 342 additions and 77 deletions

View File

@@ -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";
@@ -27,6 +33,32 @@ namespace KanSan.ViewModel
public static Baustelle Baustelle;
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
@@ -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()