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.Models;
|
||||
using KanSan.ViewModel.Commands;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Win32;
|
||||
using Syncfusion.XlsIO;
|
||||
using System;
|
||||
@@ -11,6 +12,7 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
|
||||
@@ -32,9 +34,10 @@ namespace KanSan.ViewModel
|
||||
private Sewer _selectedObjekt;
|
||||
|
||||
public static Baustelle Baustelle;
|
||||
//public static Sewer SelectedObjekt;
|
||||
public static List<LeistungsverzeichnisPosition> LVPositionen = null;
|
||||
|
||||
|
||||
public static IServiceProvider ServiceProvider { get; private set; }
|
||||
|
||||
public ICommand ListClientsCommand { get; set; }
|
||||
public ICommand ListProjectsCommand { get; set; }
|
||||
@@ -48,13 +51,13 @@ namespace KanSan.ViewModel
|
||||
{
|
||||
get
|
||||
{
|
||||
Trace.WriteLine(actualViewModel);
|
||||
return actualViewModel;
|
||||
//return actualViewModel;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (actualViewModel == value) return;
|
||||
Trace.WriteLine("Setze viewModel auf " + value);
|
||||
Trace.WriteLine("AktualView Geändert zu " + value);
|
||||
actualViewModel = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
@@ -145,6 +148,7 @@ namespace KanSan.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Sewer SelectedObjekt
|
||||
{
|
||||
get
|
||||
@@ -161,6 +165,7 @@ namespace KanSan.ViewModel
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveInRegistry(string key, string value)
|
||||
{
|
||||
Registry.SetValue(REGISTRYKEY, key, value);
|
||||
@@ -223,10 +228,11 @@ namespace KanSan.ViewModel
|
||||
}
|
||||
public MainWindowViewModel()
|
||||
{
|
||||
|
||||
ServiceProvider = ConfigureServiceProvider();
|
||||
LadeRegistry();
|
||||
LoadBaustellenLeistungsverzeichnis();
|
||||
|
||||
|
||||
ListClients();
|
||||
|
||||
|
||||
@@ -235,6 +241,22 @@ namespace KanSan.ViewModel
|
||||
ListBaustellenCommand = new RelayCommand(paramter => ListBaustellen());
|
||||
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()
|
||||
|
||||
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.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
@@ -170,6 +171,8 @@ namespace KanSan.ViewModel
|
||||
|
||||
public void Speichern()
|
||||
{
|
||||
objekt.PunktOben = getPoint(punktOben, true);
|
||||
objekt.PunktUnten = getPoint(punktUnten, true);
|
||||
objekt.StrasseName = strassename;
|
||||
objekt.DN = durchmesser;
|
||||
objekt.Haltungslaenge = haltungslaenge;
|
||||
@@ -183,5 +186,28 @@ namespace KanSan.ViewModel
|
||||
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.Models;
|
||||
using KanSan.ViewModel.Commands;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -19,7 +20,17 @@ namespace KanSan.ViewModel
|
||||
}
|
||||
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());
|
||||
|
||||
@@ -42,20 +53,24 @@ namespace KanSan.ViewModel
|
||||
}).ToList();
|
||||
kanalObjekte = x;
|
||||
|
||||
ObjektSelected = new RelayCommand(SelectObjekt);
|
||||
//ObjektSelected = new RelayCommand(SelectObjekt);
|
||||
|
||||
//kanalObjekte = unitOfWork.KanaeleRepository.Get(x => x.Baustelle.Equals(selectedBaustelle)).ToList();
|
||||
}
|
||||
|
||||
private void SelectObjekt(object obj)
|
||||
{
|
||||
|
||||
//Debugger.Break();
|
||||
if (!(obj is Sewer)) return;
|
||||
Sewer sewer = (Sewer)obj;
|
||||
if (sewer == null) return;
|
||||
|
||||
SewerMainWindowViewModel t = new SewerMainWindowViewModel(sewer);
|
||||
//MainWindowViewModel.SelectedObjekt = sewer;
|
||||
/*SewerMainWindowViewModel t = new SewerMainWindowViewModel(sewer);
|
||||
Debugger.Break();
|
||||
//throw new NotImplementedException();
|
||||
*/
|
||||
}
|
||||
|
||||
public Sewer NeueObjektHinzufügen()
|
||||
|
||||
@@ -12,7 +12,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class SchaedenListViewModel : ISchaedenListViewModel
|
||||
public class SchaedenListViewModel : BaseViewModel, ISchaedenListViewModel
|
||||
{
|
||||
private Sewer actualSelectedSewer;
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
using KanSan.Base.Models;
|
||||
using KanSan.ViewModel.Commands;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
@@ -12,7 +16,21 @@ namespace KanSan.ViewModel
|
||||
private Sewer model;
|
||||
private SchaedenViewModel schadenViewModel;
|
||||
private Schaeden schaden;
|
||||
private BaseViewModel aktualView;
|
||||
|
||||
public BaseViewModel AktualView
|
||||
{
|
||||
get
|
||||
{
|
||||
return aktualView;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (aktualView == value) return;
|
||||
aktualView = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (model == null) throw new ArgumentNullException();
|
||||
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:syncfusion="http://schemas.syncfusion.com/wpf"
|
||||
xmlns:local="clr-namespace:KanSan"
|
||||
StartupUri="MainWindow.xaml">
|
||||
>
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using KanSan.ViewModel;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
@@ -22,6 +23,8 @@ namespace KanSan
|
||||
|
||||
}
|
||||
|
||||
public static IServiceProvider ServiceProvider { get; private set; }
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
FrameworkElement.StyleProperty.OverrideMetadata(typeof(Window), new FrameworkPropertyMetadata
|
||||
@@ -33,6 +36,23 @@ namespace KanSan
|
||||
{
|
||||
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.UCLeistungsverzeichnisPosList UCLeistungsverzeichnisPosList;
|
||||
|
||||
public MainWindow()
|
||||
public MainWindow(object dataContext)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
this.DataContext = new MainWindowViewModel();
|
||||
(this.DataContext as MainWindowViewModel).GenerateExcelFile();
|
||||
DataContext = dataContext;
|
||||
//(this.DataContext as MainWindowViewModel).GenerateExcelFile();
|
||||
#if DEBUG
|
||||
System.Diagnostics.PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Critical;
|
||||
#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)
|
||||
{
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</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">
|
||||
<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}" />
|
||||
|
||||
@@ -20,15 +20,10 @@ namespace KanSan.UI
|
||||
/// </summary>
|
||||
public partial class UCObjektEdit : UserControl
|
||||
{
|
||||
public UCObjektEdit(Sewer objekt)
|
||||
public UCObjektEdit()
|
||||
{
|
||||
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" />
|
||||
</Grid.RowDefinitions>
|
||||
<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 Name="trvItems" ItemsSource="{Binding KanalObjekte}" MouseDoubleClick="trvItems_MouseDoubleClick" >
|
||||
|
||||
<TreeView.Resources>
|
||||
<HierarchicalDataTemplate DataType="{x:Type self:ObjekteTransfer}" ItemsSource="{Binding Objekte}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
@@ -51,7 +45,7 @@
|
||||
</DataTemplate>
|
||||
</TreeView.Resources>
|
||||
</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="3" Name="ObjektNew" Content="Neue Objekt Hinzufügen" Click="ObjektNew_Click" />
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace KanSan.UI
|
||||
/// </summary>
|
||||
public partial class UCObjekteList : UserControl
|
||||
{
|
||||
public event EventHandler<ObjektSelectEventArgs> ObjektSelected;
|
||||
|
||||
Baustelle baustelle;
|
||||
public UCObjekteList()
|
||||
{
|
||||
@@ -88,24 +88,17 @@ namespace KanSan.UI
|
||||
|
||||
private void trvItems_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
|
||||
TreeView treeView = (TreeView)sender;
|
||||
if (treeView == null) return;
|
||||
if (!(treeView.SelectedItem is Sewer)) return;
|
||||
Sewer sewer = (Sewer)treeView.SelectedItem;
|
||||
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>
|
||||
<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" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -29,6 +29,11 @@ namespace KanSan.UI
|
||||
this.DataContext = new SchaedenListViewModel(actualSelectedSewer);
|
||||
}
|
||||
|
||||
public UCSchaedenList()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected virtual void OnClickSchaedenSelect(SelectSchaedenEventArgs e)
|
||||
{
|
||||
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: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:syncfusion="clr-namespace:Syncfusion.Windows.Shared;assembly=Syncfusion.Shared.WPF"
|
||||
xmlns:local="clr-namespace:KanSan.UI"
|
||||
mc:Ignorable="d"
|
||||
Title="SewerMainWindow" Height="450" Width="800">
|
||||
mc:Ignorable="d" TitleBarBackground="BlueViolet"
|
||||
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.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>
|
||||
</Window>
|
||||
</syncfusion:ChromelessWindow>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using KanSan.Base.Models;
|
||||
using KanSan.ViewModel;
|
||||
using Syncfusion.Windows.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
@@ -17,7 +18,7 @@ namespace KanSan.UI
|
||||
/// <summary>
|
||||
/// Interaktionslogik für SewerMainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class SewerMainWindow : Window
|
||||
public partial class SewerMainWindow : ChromelessWindow
|
||||
{
|
||||
public SewerMainWindow()
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace KanSan.UI
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new SewerMainWindowViewModel(objekt);
|
||||
UI.UCObjektEdit uCObjektEdit = new UCObjektEdit(objekt);
|
||||
ObjektContentcontroller.Content = uCObjektEdit;
|
||||
//UI.UCObjektEdit uCObjektEdit = new UCObjektEdit(objekt);
|
||||
//ObjektContentcontroller.Content = uCObjektEdit;
|
||||
rbStammdaten.IsChecked = true;
|
||||
|
||||
Style style = this.FindResource("ToggelButtonList") as Style;
|
||||
@@ -42,6 +42,7 @@ namespace KanSan.UI
|
||||
|
||||
private void rbSewerMenuItem_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
/*
|
||||
RadioButton btn = (RadioButton)sender;
|
||||
if (btn == null) return;
|
||||
switch(btn.Name)
|
||||
@@ -58,7 +59,7 @@ namespace KanSan.UI
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
}
|
||||
Schaeden aktuellSchadenSelected = null;
|
||||
private void UCSchaedenList_SanierungsmaßnahmenSelected(object sender, SelectSchaedenEventArgs e)
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
<DataTemplate DataType="{x:Type vm:ObjekteListViewModel}">
|
||||
<l:UCObjekteList />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type vm:ObjekteEditViewModel}">
|
||||
<l:UCObjektEdit />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type vm:SchaedenListViewModel}">
|
||||
<l:UCSchaedenList />
|
||||
</DataTemplate>
|
||||
|
||||
|
||||
<DataTemplate x:Key="SelectNewTätigkeitenLVPosition">
|
||||
<Border BorderThickness="2" BorderBrush="Red">
|
||||
|
||||
Reference in New Issue
Block a user