Umbau
This commit is contained in:
11
KanSan.Base/Interfaces/IDialogWindowService.cs
Normal file
11
KanSan.Base/Interfaces/IDialogWindowService.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace KanSan.Base.Interfaces
|
||||||
|
{
|
||||||
|
public interface IDialogWindowService
|
||||||
|
{
|
||||||
|
void showWindow(object viewModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
10
KanSan.Base/WindowService.cs
Normal file
10
KanSan.Base/WindowService.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace KanSan.Base
|
||||||
|
{
|
||||||
|
class WindowService
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
using KanSan.Base.Interfaces;
|
using KanSan.Base.Interfaces;
|
||||||
using KanSan.Base.Models;
|
using KanSan.Base.Models;
|
||||||
using KanSan.ViewModel.Commands;
|
using KanSan.ViewModel.Commands;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using Syncfusion.XlsIO;
|
using Syncfusion.XlsIO;
|
||||||
using System;
|
using System;
|
||||||
@@ -11,6 +12,7 @@ using System.Diagnostics;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
@@ -32,10 +34,11 @@ namespace KanSan.ViewModel
|
|||||||
private Sewer _selectedObjekt;
|
private Sewer _selectedObjekt;
|
||||||
|
|
||||||
public static Baustelle Baustelle;
|
public static Baustelle Baustelle;
|
||||||
|
//public static Sewer SelectedObjekt;
|
||||||
public static List<LeistungsverzeichnisPosition> LVPositionen = null;
|
public static List<LeistungsverzeichnisPosition> LVPositionen = null;
|
||||||
|
|
||||||
|
public static IServiceProvider ServiceProvider { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
public ICommand ListClientsCommand { get; set; }
|
public ICommand ListClientsCommand { get; set; }
|
||||||
public ICommand ListProjectsCommand { get; set; }
|
public ICommand ListProjectsCommand { get; set; }
|
||||||
public ICommand ListBaustellenCommand { get; set; }
|
public ICommand ListBaustellenCommand { get; set; }
|
||||||
@@ -48,13 +51,13 @@ namespace KanSan.ViewModel
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
Trace.WriteLine(actualViewModel);
|
|
||||||
return actualViewModel;
|
return actualViewModel;
|
||||||
|
//return actualViewModel;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (actualViewModel == value) return;
|
if (actualViewModel == value) return;
|
||||||
Trace.WriteLine("Setze viewModel auf " + value);
|
Trace.WriteLine("AktualView Geändert zu " + value);
|
||||||
actualViewModel = value;
|
actualViewModel = value;
|
||||||
OnPropertyChanged();
|
OnPropertyChanged();
|
||||||
}
|
}
|
||||||
@@ -145,6 +148,7 @@ namespace KanSan.ViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Sewer SelectedObjekt
|
public Sewer SelectedObjekt
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -161,6 +165,7 @@ namespace KanSan.ViewModel
|
|||||||
OnPropertyChanged();
|
OnPropertyChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveInRegistry(string key, string value)
|
private void SaveInRegistry(string key, string value)
|
||||||
{
|
{
|
||||||
Registry.SetValue(REGISTRYKEY, key, value);
|
Registry.SetValue(REGISTRYKEY, key, value);
|
||||||
@@ -223,10 +228,11 @@ namespace KanSan.ViewModel
|
|||||||
}
|
}
|
||||||
public MainWindowViewModel()
|
public MainWindowViewModel()
|
||||||
{
|
{
|
||||||
|
ServiceProvider = ConfigureServiceProvider();
|
||||||
LadeRegistry();
|
LadeRegistry();
|
||||||
LoadBaustellenLeistungsverzeichnis();
|
LoadBaustellenLeistungsverzeichnis();
|
||||||
|
|
||||||
|
|
||||||
ListClients();
|
ListClients();
|
||||||
|
|
||||||
|
|
||||||
@@ -235,6 +241,22 @@ namespace KanSan.ViewModel
|
|||||||
ListBaustellenCommand = new RelayCommand(paramter => ListBaustellen());
|
ListBaustellenCommand = new RelayCommand(paramter => ListBaustellen());
|
||||||
ListObjectsCommand = new RelayCommand(parameter => ListObjekte());
|
ListObjectsCommand = new RelayCommand(parameter => ListObjekte());
|
||||||
|
|
||||||
|
Mediator.Subscribe("GoTo1Screen", OnGo1Screen);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGo1Screen(object obj)
|
||||||
|
{
|
||||||
|
ListClients();
|
||||||
|
}
|
||||||
|
|
||||||
|
private IServiceProvider ConfigureServiceProvider()
|
||||||
|
{
|
||||||
|
IServiceCollection service = new ServiceCollection();
|
||||||
|
|
||||||
|
service.AddSingleton<MainWindowViewModel>();
|
||||||
|
|
||||||
|
return service.BuildServiceProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ListClients()
|
private void ListClients()
|
||||||
|
|||||||
45
KanSan.ViewModel/Mediator.cs
Normal file
45
KanSan.ViewModel/Mediator.cs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace KanSan.ViewModel
|
||||||
|
{
|
||||||
|
class Mediator
|
||||||
|
{
|
||||||
|
private static IDictionary<string, List<Action<object>>> pl_dict = new Dictionary<string, List<Action<object>>>();
|
||||||
|
public static void Subscribe(string token, Action<object> callback)
|
||||||
|
{
|
||||||
|
if(!pl_dict.ContainsKey(token))
|
||||||
|
{
|
||||||
|
var list = new List<Action<object>>();
|
||||||
|
list.Add(callback);
|
||||||
|
pl_dict.Add(token, list);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
foreach(var item in pl_dict[token])
|
||||||
|
{
|
||||||
|
if (item.Method.ToString() == callback.Method.ToString())
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
|
pl_dict[token].Add(callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Unsubscribe(string token, Action<object> callback)
|
||||||
|
{
|
||||||
|
if (pl_dict.ContainsKey(token))
|
||||||
|
pl_dict[token].Remove(callback);
|
||||||
|
}
|
||||||
|
public static void Notify(string token, object args = null)
|
||||||
|
{
|
||||||
|
if(pl_dict.ContainsKey(token))
|
||||||
|
{
|
||||||
|
foreach (var callback in pl_dict[token])
|
||||||
|
callback(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ using KanSan.Base.Models;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
@@ -170,6 +171,8 @@ namespace KanSan.ViewModel
|
|||||||
|
|
||||||
public void Speichern()
|
public void Speichern()
|
||||||
{
|
{
|
||||||
|
objekt.PunktOben = getPoint(punktOben, true);
|
||||||
|
objekt.PunktUnten = getPoint(punktUnten, true);
|
||||||
objekt.StrasseName = strassename;
|
objekt.StrasseName = strassename;
|
||||||
objekt.DN = durchmesser;
|
objekt.DN = durchmesser;
|
||||||
objekt.Haltungslaenge = haltungslaenge;
|
objekt.Haltungslaenge = haltungslaenge;
|
||||||
@@ -182,6 +185,29 @@ namespace KanSan.ViewModel
|
|||||||
unitOfWork.KanaeleRepository.Update(objekt);
|
unitOfWork.KanaeleRepository.Update(objekt);
|
||||||
unitOfWork.Commit();
|
unitOfWork.Commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SewerPoint getPoint(string objektnummer, bool createIfNotFound = false)
|
||||||
|
{
|
||||||
|
List<SewerPoint> sewerPoints = unitOfWork.ObjekteRepository.Get(x => x.Objektnummer.Equals(objektnummer)).ToList();
|
||||||
|
if (sewerPoints.Count < 1)
|
||||||
|
{
|
||||||
|
if (createIfNotFound == false)
|
||||||
|
return null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Guid guidNr = Guid.NewGuid();
|
||||||
|
unitOfWork.ObjekteRepository.Update(new SewerPoint()
|
||||||
|
{
|
||||||
|
Objektnummer = objektnummer,
|
||||||
|
GuidNr = guidNr
|
||||||
|
});
|
||||||
|
unitOfWork.Commit();
|
||||||
|
|
||||||
|
return unitOfWork.ObjekteRepository.Get(x => x.GuidNr.Equals(guidNr)).ToList().First();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sewerPoints.First();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using KanSan.Base.Interfaces;
|
|||||||
using KanSan.Base.Interfaces.UI;
|
using KanSan.Base.Interfaces.UI;
|
||||||
using KanSan.Base.Models;
|
using KanSan.Base.Models;
|
||||||
using KanSan.ViewModel.Commands;
|
using KanSan.ViewModel.Commands;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@@ -19,7 +20,17 @@ namespace KanSan.ViewModel
|
|||||||
}
|
}
|
||||||
public class ObjekteListViewModel : BaseViewModel
|
public class ObjekteListViewModel : BaseViewModel
|
||||||
{
|
{
|
||||||
public ICommand ObjektSelected { get; set; }
|
private ICommand _objektSelected;
|
||||||
|
public ICommand ObjektSelected {
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _objektSelected ?? (_objektSelected = new RelayCommand(x =>
|
||||||
|
{
|
||||||
|
Mediator.Notify("GoTo1Screen", "");
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
|
|
||||||
@@ -42,20 +53,24 @@ namespace KanSan.ViewModel
|
|||||||
}).ToList();
|
}).ToList();
|
||||||
kanalObjekte = x;
|
kanalObjekte = x;
|
||||||
|
|
||||||
ObjektSelected = new RelayCommand(SelectObjekt);
|
//ObjektSelected = new RelayCommand(SelectObjekt);
|
||||||
|
|
||||||
//kanalObjekte = unitOfWork.KanaeleRepository.Get(x => x.Baustelle.Equals(selectedBaustelle)).ToList();
|
//kanalObjekte = unitOfWork.KanaeleRepository.Get(x => x.Baustelle.Equals(selectedBaustelle)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SelectObjekt(object obj)
|
private void SelectObjekt(object obj)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//Debugger.Break();
|
||||||
if (!(obj is Sewer)) return;
|
if (!(obj is Sewer)) return;
|
||||||
Sewer sewer = (Sewer)obj;
|
Sewer sewer = (Sewer)obj;
|
||||||
if (sewer == null) return;
|
if (sewer == null) return;
|
||||||
|
|
||||||
SewerMainWindowViewModel t = new SewerMainWindowViewModel(sewer);
|
//MainWindowViewModel.SelectedObjekt = sewer;
|
||||||
|
/*SewerMainWindowViewModel t = new SewerMainWindowViewModel(sewer);
|
||||||
Debugger.Break();
|
Debugger.Break();
|
||||||
//throw new NotImplementedException();
|
//throw new NotImplementedException();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public Sewer NeueObjektHinzufügen()
|
public Sewer NeueObjektHinzufügen()
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
public class SchaedenListViewModel : ISchaedenListViewModel
|
public class SchaedenListViewModel : BaseViewModel, ISchaedenListViewModel
|
||||||
{
|
{
|
||||||
private Sewer actualSelectedSewer;
|
private Sewer actualSelectedSewer;
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
using KanSan.Base.Models;
|
using KanSan.Base.Models;
|
||||||
|
using KanSan.ViewModel.Commands;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
@@ -12,7 +16,21 @@ namespace KanSan.ViewModel
|
|||||||
private Sewer model;
|
private Sewer model;
|
||||||
private SchaedenViewModel schadenViewModel;
|
private SchaedenViewModel schadenViewModel;
|
||||||
private Schaeden schaden;
|
private Schaeden schaden;
|
||||||
|
private BaseViewModel aktualView;
|
||||||
|
|
||||||
|
public BaseViewModel AktualView
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return aktualView;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (aktualView == value) return;
|
||||||
|
aktualView = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Sewer Objekt
|
public Sewer Objekt
|
||||||
{
|
{
|
||||||
@@ -56,12 +74,30 @@ namespace KanSan.ViewModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ICommand StammdatenSelect { get; private set; }
|
||||||
|
public ICommand SchädenübersichtSelect { get; private set; }
|
||||||
|
|
||||||
public SewerMainWindowViewModel(Sewer model)
|
public SewerMainWindowViewModel(Sewer model)
|
||||||
{
|
{
|
||||||
if (model == null) throw new ArgumentNullException();
|
if (model == null) throw new ArgumentNullException();
|
||||||
this.model = model;
|
this.model = model;
|
||||||
|
|
||||||
|
StammdatenSelect = new RelayCommand(parameter => SelectStammdaten());
|
||||||
|
SchädenübersichtSelect = new RelayCommand(parameter => SelectSchädenübersicht());
|
||||||
|
|
||||||
|
var x = MainWindowViewModel.ServiceProvider.GetService<MainWindowViewModel>();
|
||||||
|
x.ActualViewModel = new ObjekteEditViewModel(model);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SelectSchädenübersicht()
|
||||||
|
{
|
||||||
|
AktualView = new SchaedenListViewModel(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SelectStammdaten()
|
||||||
|
{
|
||||||
|
AktualView = new ObjekteEditViewModel(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
|
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
|
||||||
xmlns:local="clr-namespace:KanSan"
|
xmlns:local="clr-namespace:KanSan"
|
||||||
StartupUri="MainWindow.xaml">
|
>
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using KanSan.ViewModel;
|
using KanSan.ViewModel;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
@@ -22,6 +23,8 @@ namespace KanSan
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IServiceProvider ServiceProvider { get; private set; }
|
||||||
|
|
||||||
protected override void OnStartup(StartupEventArgs e)
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
{
|
{
|
||||||
FrameworkElement.StyleProperty.OverrideMetadata(typeof(Window), new FrameworkPropertyMetadata
|
FrameworkElement.StyleProperty.OverrideMetadata(typeof(Window), new FrameworkPropertyMetadata
|
||||||
@@ -33,6 +36,23 @@ namespace KanSan
|
|||||||
{
|
{
|
||||||
DefaultValue = FindResource(typeof(UserControl))
|
DefaultValue = FindResource(typeof(UserControl))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ServiceProvider = CreateServiceProvider();
|
||||||
|
|
||||||
|
Window window = ServiceProvider.GetRequiredService<MainWindow>();
|
||||||
|
window.Show();
|
||||||
|
base.OnStartup(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private IServiceProvider CreateServiceProvider()
|
||||||
|
{
|
||||||
|
IServiceCollection services = new ServiceCollection();
|
||||||
|
services.AddSingleton<SewerMainWindowViewModel>();
|
||||||
|
|
||||||
|
services.AddScoped<MainWindowViewModel>();
|
||||||
|
services.AddScoped<MainWindow>(s => new MainWindow(s.GetRequiredService<MainWindowViewModel>()));
|
||||||
|
|
||||||
|
return services.BuildServiceProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
20
KanSan/DialogWindowService.cs
Normal file
20
KanSan/DialogWindowService.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using KanSan.Base.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace KanSan
|
||||||
|
{
|
||||||
|
class DialogWindowService: IDialogWindowService
|
||||||
|
{
|
||||||
|
public void showWindow(object viewModel)
|
||||||
|
{
|
||||||
|
Window win = new Window();
|
||||||
|
win.Content = viewModel;
|
||||||
|
win.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -36,52 +36,19 @@ namespace KanSan
|
|||||||
UI.UCLeistungsverzeichnisPositionenBaustelle UCLeistungsverzeichnisPositionenBaustelle;
|
UI.UCLeistungsverzeichnisPositionenBaustelle UCLeistungsverzeichnisPositionenBaustelle;
|
||||||
UI.UCLeistungsverzeichnisPosList UCLeistungsverzeichnisPosList;
|
UI.UCLeistungsverzeichnisPosList UCLeistungsverzeichnisPosList;
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow(object dataContext)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
|
||||||
this.DataContext = new MainWindowViewModel();
|
DataContext = dataContext;
|
||||||
(this.DataContext as MainWindowViewModel).GenerateExcelFile();
|
//(this.DataContext as MainWindowViewModel).GenerateExcelFile();
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
System.Diagnostics.PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Critical;
|
System.Diagnostics.PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Critical;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UCProjektList_ProjektAdded(object sender, UI.SelectProjektEventArgs e)
|
|
||||||
{
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
(DataContext as MainWindowViewModel).SelectedProjekt = e.projekt;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UCKundeList_KundeSelect(object sender, UI.KundeAddedKlickEventArgs e)
|
|
||||||
{
|
|
||||||
(DataContext as MainWindowViewModel).SelectedKunde = e.kunde;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UCKundeList_KundeAdded(object sender, UI.KundeAddedKlickEventArgs e)
|
|
||||||
{
|
|
||||||
UCKundeEdit = new UI.UCKundeEdit(e.kunde);
|
|
||||||
UCKundeEdit.SpeichernClicked += Edit_SpeichernClicked;
|
|
||||||
ContentController.Content = UCKundeEdit;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
private void Edit_SpeichernClicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@@ -89,42 +56,6 @@ namespace KanSan
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void UCBaustelleList_BaustelleSelected(object sender, UI.SelectBaustelleEventArgs e)
|
|
||||||
{
|
|
||||||
(DataContext as MainWindowViewModel).SelectedBaustelle = e.baustelle;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UCBaustelleList_BaustelleEdited(object sender, UI.SelectBaustelleEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.baustelle == null) return;
|
|
||||||
UI.UCBaustelleEdit uCBaustelleEdit = new UI.UCBaustelleEdit(e.baustelle);
|
|
||||||
|
|
||||||
uCBaustelleEdit.SpeichernClicked += Edit_SpeichernClicked;
|
|
||||||
ContentController.Content = uCBaustelleEdit;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UCBaustelleList_BaustelleAdded(object sender, UI.SelectBaustelleEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.baustelle == null) return;
|
|
||||||
UI.UCBaustelleEdit uBaustelleEdit = new UI.UCBaustelleEdit(e.baustelle);
|
|
||||||
uBaustelleEdit.SpeichernClicked += Edit_SpeichernClicked;
|
|
||||||
ContentController.Content = uBaustelleEdit;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void UCObjekteList_ObjektSelected(object sender, UI.ObjektSelectEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Objekt == null) return;
|
|
||||||
(DataContext as MainWindowViewModel).SelectedObjekt = e.Objekt;
|
|
||||||
rbObjekte.IsChecked = false;
|
|
||||||
|
|
||||||
uCSewerMainMenu = new UI.UCSewerMainMenu(e.Objekt);
|
|
||||||
|
|
||||||
ContentController.Content = uCSewerMainMenu;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void rbLeistungsverzeichnis_Checked(object sender, RoutedEventArgs e)
|
private void rbLeistungsverzeichnis_Checked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Button Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Content="Speichern" Name="Speichern" Click="Speichern_Click"/>
|
<Button Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Content="Speichern" Name="Speichern" />
|
||||||
<StackPanel Grid.Column="1">
|
<StackPanel Grid.Column="1">
|
||||||
<CheckBox Content="Rohrleitung in Betrieb" IsChecked="{Binding Path=(iself:IObjekteEditViewModel.RohrleitungInBetrieb)}" Style="{StaticResource checkBoxCircle}"/>
|
<CheckBox Content="Rohrleitung in Betrieb" IsChecked="{Binding Path=(iself:IObjekteEditViewModel.RohrleitungInBetrieb)}" Style="{StaticResource checkBoxCircle}"/>
|
||||||
<CheckBox Content="Wasserhaltung durchgeführt" IsChecked="{Binding Path=(iself:IObjekteEditViewModel.WasserHaltungDurchgefuehrt)}" Style="{StaticResource checkBoxCircle}" />
|
<CheckBox Content="Wasserhaltung durchgeführt" IsChecked="{Binding Path=(iself:IObjekteEditViewModel.WasserHaltungDurchgefuehrt)}" Style="{StaticResource checkBoxCircle}" />
|
||||||
|
|||||||
@@ -20,15 +20,10 @@ namespace KanSan.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class UCObjektEdit : UserControl
|
public partial class UCObjektEdit : UserControl
|
||||||
{
|
{
|
||||||
public UCObjektEdit(Sewer objekt)
|
public UCObjektEdit()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.DataContext = new ObjekteEditViewModel(objekt);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Speichern_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
(DataContext as ObjekteEditViewModel).Speichern();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,14 +19,8 @@
|
|||||||
<RowDefinition Height="50" />
|
<RowDefinition Height="50" />
|
||||||
<RowDefinition Height="50" />
|
<RowDefinition Height="50" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TreeView Name="trvItems" ItemsSource="{Binding KanalObjekte}" >
|
<TreeView Name="trvItems" ItemsSource="{Binding KanalObjekte}" MouseDoubleClick="trvItems_MouseDoubleClick" >
|
||||||
<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>
|
<TreeView.Resources>
|
||||||
<HierarchicalDataTemplate DataType="{x:Type self:ObjekteTransfer}" ItemsSource="{Binding Objekte}">
|
<HierarchicalDataTemplate DataType="{x:Type self:ObjekteTransfer}" ItemsSource="{Binding Objekte}">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
@@ -51,7 +45,7 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</TreeView.Resources>
|
</TreeView.Resources>
|
||||||
</TreeView>
|
</TreeView>
|
||||||
<Button Grid.Row="1" x:Name="ProjektSelect" Content="Objekt Auswählen" />
|
<Button Grid.Row="1" x:Name="ProjektSelect" Content="Objekt Auswählen" Command="{Binding ObjektSelected}" />
|
||||||
<Button Grid.Row="2" Name="ProjektEdit" Content="Objekt Editieren" />
|
<Button Grid.Row="2" Name="ProjektEdit" Content="Objekt Editieren" />
|
||||||
<Button Grid.Row="3" Name="ObjektNew" Content="Neue Objekt Hinzufügen" Click="ObjektNew_Click" />
|
<Button Grid.Row="3" Name="ObjektNew" Content="Neue Objekt Hinzufügen" Click="ObjektNew_Click" />
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace KanSan.UI
|
|||||||
control.MouseLeftButtonUp += OnMouseLeftButtonUp;
|
control.MouseLeftButtonUp += OnMouseLeftButtonUp;
|
||||||
else if ((e.NewValue == null) && (e.OldValue != null))
|
else if ((e.NewValue == null) && (e.OldValue != null))
|
||||||
control.MouseLeftButtonUp -= OnMouseLeftButtonUp;
|
control.MouseLeftButtonUp -= OnMouseLeftButtonUp;
|
||||||
|
|
||||||
}
|
}
|
||||||
private static void OnMouseLeftButtonUp(object sender, RoutedEventArgs e)
|
private static void OnMouseLeftButtonUp(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -67,7 +67,7 @@ namespace KanSan.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class UCObjekteList : UserControl
|
public partial class UCObjekteList : UserControl
|
||||||
{
|
{
|
||||||
public event EventHandler<ObjektSelectEventArgs> ObjektSelected;
|
|
||||||
Baustelle baustelle;
|
Baustelle baustelle;
|
||||||
public UCObjekteList()
|
public UCObjekteList()
|
||||||
{
|
{
|
||||||
@@ -88,24 +88,17 @@ namespace KanSan.UI
|
|||||||
|
|
||||||
private void trvItems_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
private void trvItems_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
TreeView treeView = (TreeView)sender;
|
TreeView treeView = (TreeView)sender;
|
||||||
if (treeView == null) return;
|
if (treeView == null) return;
|
||||||
if (!(treeView.SelectedItem is Sewer)) return;
|
if (!(treeView.SelectedItem is Sewer)) return;
|
||||||
Sewer sewer = (Sewer)treeView.SelectedItem;
|
Sewer sewer = (Sewer)treeView.SelectedItem;
|
||||||
if (sewer == null) return;
|
if (sewer == null) return;
|
||||||
OnObjektSelectKlick(new ObjektSelectEventArgs() { Objekt = sewer });
|
SewerMainWindow sewerMainWindow = new SewerMainWindow();
|
||||||
|
sewerMainWindow.DataContext = new SewerMainWindowViewModel(sewer);
|
||||||
|
sewerMainWindow.ShowDialog();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnObjektSelectKlick(ObjektSelectEventArgs e)
|
|
||||||
{
|
|
||||||
EventHandler<ObjektSelectEventArgs> handler = ObjektSelected;
|
|
||||||
if (handler != null)
|
|
||||||
handler(this, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ObjektSelectEventArgs : EventArgs
|
|
||||||
{
|
|
||||||
public Sewer Objekt { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<Button Grid.Row="1" Name="NewSchaden" Click="NewSchaden_Click" Content="Neue Schäden Hinzufügen" />
|
<Button Grid.Row="1" Name="NewSchaden" Command="{Binding neueSchadenHinzufügen}" Content="Neue Schäden Hinzufügen" />
|
||||||
<Button Grid.Row="2" Name="GenerateExcel" Content="Schadensbericht erstellen" Click="GenerateExcel_Click" />
|
<Button Grid.Row="2" Name="GenerateExcel" Content="Schadensbericht erstellen" Click="GenerateExcel_Click" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ namespace KanSan.UI
|
|||||||
this.DataContext = new SchaedenListViewModel(actualSelectedSewer);
|
this.DataContext = new SchaedenListViewModel(actualSelectedSewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UCSchaedenList()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void OnClickSchaedenSelect(SelectSchaedenEventArgs e)
|
protected virtual void OnClickSchaedenSelect(SelectSchaedenEventArgs e)
|
||||||
{
|
{
|
||||||
EventHandler<SelectSchaedenEventArgs> handler = SchaedenSelected;
|
EventHandler<SelectSchaedenEventArgs> handler = SchaedenSelected;
|
||||||
|
|||||||
@@ -1,12 +1,42 @@
|
|||||||
<Window x:Class="KanSan.UI.SewerMainWindow"
|
<syncfusion:ChromelessWindow x:Class="KanSan.UI.SewerMainWindow"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:syncfusion="clr-namespace:Syncfusion.Windows.Shared;assembly=Syncfusion.Shared.WPF"
|
||||||
xmlns:local="clr-namespace:KanSan.UI"
|
xmlns:local="clr-namespace:KanSan.UI"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d" TitleBarBackground="BlueViolet"
|
||||||
Title="SewerMainWindow" Height="450" Width="800">
|
Title="SewerMainWindow" Height="450" Width="800" WindowStartupLocation="CenterScreen" WindowState="Maximized">
|
||||||
|
<Window.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="./../my_controls.xaml" />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</Window.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="150" />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="11*" />
|
||||||
|
<RowDefinition Height="64*" />
|
||||||
|
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
|
||||||
|
<TextBlock Text="{Binding ObjektBezeichnung}" />
|
||||||
|
<!--<TextBlock Text="{Binding Path=(self:SewerMainMenuViewModel.ObjektBezeichnung)}" />
|
||||||
|
<TextBlock Text="{Binding Path=(self:SewerMainMenuViewModel.SchadenEntfernung)}" />-->
|
||||||
|
<TextBlock Text="" />
|
||||||
|
</StackPanel>
|
||||||
|
<!--<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Text="{Binding Path=(self:SewerMainMenuViewModel.ObjektBezeichnung)}" />-->
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="0" Grid.Row="1" Name="MenuItems">
|
||||||
|
|
||||||
|
<RadioButton Command="{Binding StammdatenSelect}" Style="{StaticResource ToggelButtonList}" Content="Stammdaten" />
|
||||||
|
<RadioButton Command="{Binding SchädenübersichtSelect}" Name="rbSchaeden" Style="{StaticResource ToggelButtonList}" Content="Schäden" />
|
||||||
|
</StackPanel>
|
||||||
|
<ContentControl Grid.Column="1" Grid.Row="1" Content="{Binding AktualView}" Name="ObjektContentcontroller" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</syncfusion:ChromelessWindow>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using KanSan.Base.Models;
|
using KanSan.Base.Models;
|
||||||
using KanSan.ViewModel;
|
using KanSan.ViewModel;
|
||||||
|
using Syncfusion.Windows.Shared;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -17,7 +18,7 @@ namespace KanSan.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaktionslogik für SewerMainWindow.xaml
|
/// Interaktionslogik für SewerMainWindow.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class SewerMainWindow : Window
|
public partial class SewerMainWindow : ChromelessWindow
|
||||||
{
|
{
|
||||||
public SewerMainWindow()
|
public SewerMainWindow()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:self="clr-namespace:KanSan.ViewModel;assembly=KanSan.ViewModel"
|
xmlns:self="clr-namespace:KanSan.ViewModel;assembly=KanSan.ViewModel"
|
||||||
|
xmlns:syncfusion="clr-namespace:Syncfusion.Windows.Shared;assembly=Syncfusion.Shared.WPF"
|
||||||
xmlns:local="clr-namespace:KanSan.UI"
|
xmlns:local="clr-namespace:KanSan.UI"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ namespace KanSan.UI
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.DataContext = new SewerMainWindowViewModel(objekt);
|
this.DataContext = new SewerMainWindowViewModel(objekt);
|
||||||
UI.UCObjektEdit uCObjektEdit = new UCObjektEdit(objekt);
|
//UI.UCObjektEdit uCObjektEdit = new UCObjektEdit(objekt);
|
||||||
ObjektContentcontroller.Content = uCObjektEdit;
|
//ObjektContentcontroller.Content = uCObjektEdit;
|
||||||
rbStammdaten.IsChecked = true;
|
rbStammdaten.IsChecked = true;
|
||||||
|
|
||||||
Style style = this.FindResource("ToggelButtonList") as Style;
|
Style style = this.FindResource("ToggelButtonList") as Style;
|
||||||
@@ -42,6 +42,7 @@ namespace KanSan.UI
|
|||||||
|
|
||||||
private void rbSewerMenuItem_Checked(object sender, RoutedEventArgs e)
|
private void rbSewerMenuItem_Checked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
RadioButton btn = (RadioButton)sender;
|
RadioButton btn = (RadioButton)sender;
|
||||||
if (btn == null) return;
|
if (btn == null) return;
|
||||||
switch(btn.Name)
|
switch(btn.Name)
|
||||||
@@ -58,7 +59,7 @@ namespace KanSan.UI
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
Schaeden aktuellSchadenSelected = null;
|
Schaeden aktuellSchadenSelected = null;
|
||||||
private void UCSchaedenList_SanierungsmaßnahmenSelected(object sender, SelectSchaedenEventArgs e)
|
private void UCSchaedenList_SanierungsmaßnahmenSelected(object sender, SelectSchaedenEventArgs e)
|
||||||
|
|||||||
@@ -18,6 +18,13 @@
|
|||||||
<DataTemplate DataType="{x:Type vm:ObjekteListViewModel}">
|
<DataTemplate DataType="{x:Type vm:ObjekteListViewModel}">
|
||||||
<l:UCObjekteList />
|
<l:UCObjekteList />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type vm:ObjekteEditViewModel}">
|
||||||
|
<l:UCObjektEdit />
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type vm:SchaedenListViewModel}">
|
||||||
|
<l:UCSchaedenList />
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
|
||||||
<DataTemplate x:Key="SelectNewTätigkeitenLVPosition">
|
<DataTemplate x:Key="SelectNewTätigkeitenLVPosition">
|
||||||
<Border BorderThickness="2" BorderBrush="Red">
|
<Border BorderThickness="2" BorderBrush="Red">
|
||||||
|
|||||||
Reference in New Issue
Block a user