Gui neu angelegt
This commit is contained in:
15
StammGenerator/App.xaml
Normal file
15
StammGenerator/App.xaml
Normal file
@@ -0,0 +1,15 @@
|
||||
<Application x:Class="StammGenerator.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:StammGenerator"
|
||||
>
|
||||
<Application.Resources>
|
||||
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="./Views/styles/my_controls.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
47
StammGenerator/App.xaml.cs
Normal file
47
StammGenerator/App.xaml.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using StammGenerator.HostBuilders;
|
||||
using StammGenerator.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace StammGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
private readonly IHost _host;
|
||||
public App()
|
||||
{
|
||||
_host = CreateHostBuilder().Build();
|
||||
}
|
||||
|
||||
static IHostBuilder CreateHostBuilder(string[]? args = null)
|
||||
{
|
||||
return Host.CreateDefaultBuilder(args)
|
||||
.AddConfiguration()
|
||||
.AddServices()
|
||||
.AddViewModels()
|
||||
.AddStores();
|
||||
}
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
_host.Start();
|
||||
|
||||
|
||||
|
||||
MainWindow? window = new MainWindow() { DataContext = _host.Services.GetRequiredService<MainWindowViewModel>() };
|
||||
window.Show();
|
||||
|
||||
base.OnStartup(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
10
StammGenerator/AssemblyInfo.cs
Normal file
10
StammGenerator/AssemblyInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Windows;
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
45
StammGenerator/Commands/AsyncCommandBase.cs
Normal file
45
StammGenerator/Commands/AsyncCommandBase.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StammGenerator.Commands
|
||||
{
|
||||
internal abstract class AsyncCommandBase : ICommand
|
||||
{
|
||||
bool _isExecuting = false;
|
||||
public event EventHandler? CanExecuteChanged;
|
||||
|
||||
public bool IsExecuting
|
||||
{
|
||||
get => _isExecuting;
|
||||
set
|
||||
{
|
||||
_isExecuting = value;
|
||||
CanExecuteChanged?.Invoke(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnCanExecuteChanged()
|
||||
{
|
||||
CanExecuteChanged?.Invoke(this, new EventArgs());
|
||||
}
|
||||
|
||||
|
||||
public virtual bool CanExecute(object? parameter)
|
||||
{
|
||||
return !IsExecuting;
|
||||
}
|
||||
|
||||
public async void Execute(object? parameter)
|
||||
{
|
||||
IsExecuting = true;
|
||||
await ExecuteAsync(parameter);
|
||||
IsExecuting = false;
|
||||
}
|
||||
|
||||
public abstract Task ExecuteAsync(object? parameter);
|
||||
}
|
||||
}
|
||||
30
StammGenerator/Commands/HaltungAddCommand.cs
Normal file
30
StammGenerator/Commands/HaltungAddCommand.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using StammGenerator.Interface;
|
||||
using StammGenerator.ViewModel;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.Commands
|
||||
{
|
||||
internal class HaltungAddCommand : AsyncCommandBase
|
||||
{
|
||||
private readonly IActualState actualState;
|
||||
private readonly IRenavigator renavigator;
|
||||
|
||||
public HaltungAddCommand(IActualState actualState, IRenavigator renavigator)
|
||||
{
|
||||
this.actualState = actualState;
|
||||
this.renavigator = renavigator;
|
||||
}
|
||||
|
||||
public override async Task ExecuteAsync(object? parameter)
|
||||
{
|
||||
Kanal haltung = new Kanal()
|
||||
{
|
||||
Id = -1,
|
||||
Projekt = new Projekt() { Id = actualState.ProjektID },
|
||||
};
|
||||
actualState.SetHaltung(haltung);
|
||||
renavigator.Renavigate();
|
||||
}
|
||||
}
|
||||
}
|
||||
30
StammGenerator/Commands/HaltungEditCommand.cs
Normal file
30
StammGenerator/Commands/HaltungEditCommand.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using StammGenerator.Commands;
|
||||
using StammGenerator.Interface;
|
||||
using StammGenerator.ViewModel;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.Commands
|
||||
{
|
||||
internal class HaltungEditCommand : AsyncCommandBase
|
||||
{
|
||||
|
||||
private IActualState actualState;
|
||||
private IRenavigator renavigator;
|
||||
private HaltungListViewModel haltungListViewModel;
|
||||
|
||||
|
||||
public HaltungEditCommand(IActualState actualState, IRenavigator renavigator, HaltungListViewModel haltungListViewModel)
|
||||
{
|
||||
|
||||
this.actualState = actualState;
|
||||
this.renavigator = renavigator;
|
||||
this.haltungListViewModel = haltungListViewModel;
|
||||
}
|
||||
|
||||
public override async Task ExecuteAsync(object? parameter)
|
||||
{
|
||||
actualState.SetHaltung(haltungListViewModel.SelectedHaltung);
|
||||
renavigator.Renavigate();
|
||||
}
|
||||
}
|
||||
}
|
||||
38
StammGenerator/Commands/HaltungEditSaveCommand.cs
Normal file
38
StammGenerator/Commands/HaltungEditSaveCommand.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using SewerStammGen.Shared.Contracts;
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using StammGenerator.Commands;
|
||||
using StammGenerator.Interface;
|
||||
using StammGenerator.ViewModel;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.Commands
|
||||
{
|
||||
internal class HaltungEditSaveCommand : AsyncCommandBase
|
||||
{
|
||||
private readonly IHaltungDataService _haltungDataService;
|
||||
private readonly IRenavigator _renavigator;
|
||||
private readonly Kanal _model;
|
||||
|
||||
public HaltungEditSaveCommand(IHaltungDataService haltungDataService,IRenavigator renavigator,HaltungEditViewModel haltungEditViewModel)
|
||||
{
|
||||
|
||||
this._haltungDataService = haltungDataService;
|
||||
this._renavigator = renavigator;
|
||||
this._model = haltungEditViewModel.Model;
|
||||
}
|
||||
|
||||
public override async Task ExecuteAsync(object? parameter)
|
||||
{
|
||||
if(_model.Id == -1) // Neu anlegen
|
||||
{
|
||||
await _haltungDataService.Create(_model);
|
||||
}
|
||||
else
|
||||
{
|
||||
await _haltungDataService.Update(_model);
|
||||
}
|
||||
|
||||
_renavigator.Renavigate();
|
||||
}
|
||||
}
|
||||
}
|
||||
27
StammGenerator/Commands/ProjectExportCommand.cs
Normal file
27
StammGenerator/Commands/ProjectExportCommand.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using Shared.Contracts;
|
||||
using StammGenerator.Commands;
|
||||
using StammGenerator.ViewModel;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.Commands
|
||||
{
|
||||
internal class ProjectExportCommand : AsyncCommandBase
|
||||
{
|
||||
private readonly IActualState _actualState;
|
||||
private readonly IExport _export;
|
||||
|
||||
public ProjectExportCommand(IActualState actualState)
|
||||
{
|
||||
_actualState = actualState;
|
||||
|
||||
}
|
||||
|
||||
public override async Task ExecuteAsync(object? parameter)
|
||||
{
|
||||
await _export.Export(new List<Kanal>(), new List<Schacht>());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
42
StammGenerator/Commands/ProjektAddCommand.cs
Normal file
42
StammGenerator/Commands/ProjektAddCommand.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using SewerStammGen.Shared.Contracts;
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using StammGenerator.Commands;
|
||||
using StammGenerator.Interface;
|
||||
using StammGenerator.ViewModel;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.Commands
|
||||
{
|
||||
internal class ProjektAddCommand : AsyncCommandBase
|
||||
{
|
||||
private readonly IActualState _actualState;
|
||||
private readonly IProjektDataService _generic;
|
||||
private readonly IRenavigator _renavigator;
|
||||
|
||||
public ProjektAddCommand(IProjektDataService generic, IActualState actualState, IRenavigator renavigator)
|
||||
{
|
||||
_renavigator = renavigator;
|
||||
_generic = generic;
|
||||
_actualState = actualState;
|
||||
}
|
||||
|
||||
public override async Task ExecuteAsync(object? parameter)
|
||||
{
|
||||
Projekt newProjekt = new Projekt()
|
||||
{
|
||||
Erstelldatum = "",
|
||||
Strasse = "",
|
||||
Ort = "",
|
||||
Projektname = "",
|
||||
Auftraggeber = new Auftraggeber(),
|
||||
Schaechte = new List<Schacht>(),
|
||||
Kanaele = new List<Kanal>()
|
||||
};
|
||||
newProjekt = await _generic.Create(newProjekt);
|
||||
_actualState.SetProjekt(newProjekt);
|
||||
_renavigator.Renavigate();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
34
StammGenerator/Commands/ProjektEditCommand.cs
Normal file
34
StammGenerator/Commands/ProjektEditCommand.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using Shared.Contracts;
|
||||
using StammGenerator.Commands;
|
||||
using StammGenerator.Interface;
|
||||
using StammGenerator.ViewModel;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.Commands
|
||||
{
|
||||
internal class ProjektEditCommand : AsyncCommandBase
|
||||
{
|
||||
private IDataService<Projekt> _dataService;
|
||||
private IActualState _actualState;
|
||||
private IRenavigator _renavigator;
|
||||
private ProjektListViewModel _projektListViewModel;
|
||||
|
||||
|
||||
public ProjektEditCommand(IDataService<Projekt> dataService, IActualState actualState, IRenavigator renavigator, ProjektListViewModel projektListViewModel)
|
||||
{
|
||||
_dataService = dataService;
|
||||
_actualState = actualState;
|
||||
_renavigator = renavigator;
|
||||
_projektListViewModel = projektListViewModel;
|
||||
}
|
||||
|
||||
public override async Task ExecuteAsync(object? parameter)
|
||||
{
|
||||
|
||||
_actualState.SetProjekt(_projektListViewModel.SelectedProjekt);
|
||||
_renavigator.Renavigate();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
24
StammGenerator/Commands/ProjektSelectCommand.cs
Normal file
24
StammGenerator/Commands/ProjektSelectCommand.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using StammGenerator.Commands;
|
||||
using StammGenerator.ViewModel;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.Commands
|
||||
{
|
||||
internal class ProjektSelectCommand : AsyncCommandBase
|
||||
{
|
||||
private readonly IActualState _actualState;
|
||||
private readonly ProjektListViewModel _projektListViewModel;
|
||||
|
||||
public ProjektSelectCommand(IActualState actualState, ProjektListViewModel projektListViewModel)
|
||||
{
|
||||
_actualState = actualState;
|
||||
_projektListViewModel = projektListViewModel;
|
||||
}
|
||||
|
||||
public override async Task ExecuteAsync(object? parameter)
|
||||
{
|
||||
if (_projektListViewModel.SelectedProjekt == null) return;
|
||||
_actualState.SetProjekt(_projektListViewModel.SelectedProjekt);
|
||||
}
|
||||
}
|
||||
}
|
||||
31
StammGenerator/Commands/SchachtAddCommand.cs
Normal file
31
StammGenerator/Commands/SchachtAddCommand.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using StammGenerator.Commands;
|
||||
using StammGenerator.Interface;
|
||||
using StammGenerator.ViewModel;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.Commands
|
||||
{
|
||||
class SchachtAddCommand : AsyncCommandBase
|
||||
{
|
||||
private readonly IActualState actualState;
|
||||
private readonly IRenavigator renavigator;
|
||||
|
||||
|
||||
public SchachtAddCommand(IActualState actualState, IRenavigator renavigator)
|
||||
{
|
||||
this.actualState = actualState;
|
||||
this.renavigator = renavigator;
|
||||
}
|
||||
|
||||
public override async Task ExecuteAsync(object? parameter)
|
||||
{
|
||||
Schacht newSchacht = new Schacht()
|
||||
{
|
||||
Projekt = new Projekt() { Id = actualState.ProjektID },
|
||||
};
|
||||
actualState.SetSchacht(newSchacht);
|
||||
renavigator.Renavigate();
|
||||
}
|
||||
}
|
||||
}
|
||||
30
StammGenerator/Commands/SchachtDeleteCommand.cs
Normal file
30
StammGenerator/Commands/SchachtDeleteCommand.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using SewerStammGen.Shared.Contracts;
|
||||
using StammGenerator.Commands;
|
||||
using StammGenerator.Interface;
|
||||
using StammGenerator.ViewModel;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.Commands
|
||||
{
|
||||
class SchachtDeleteCommand : AsyncCommandBase
|
||||
{
|
||||
private ISchachtDataService schachtService;
|
||||
private IActualState actualState;
|
||||
private IRenavigator renavigator;
|
||||
private ManholeListViewModel manholeListViewModel;
|
||||
|
||||
public SchachtDeleteCommand(ISchachtDataService schachtService, IActualState actualState, IRenavigator renavigator, ManholeListViewModel manholeListViewModel)
|
||||
{
|
||||
this.schachtService = schachtService;
|
||||
this.actualState = actualState;
|
||||
this.renavigator = renavigator;
|
||||
this.manholeListViewModel = manholeListViewModel;
|
||||
}
|
||||
|
||||
public override Task ExecuteAsync(object? parameter)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
28
StammGenerator/Commands/SchachtEditCommand.cs
Normal file
28
StammGenerator/Commands/SchachtEditCommand.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using StammGenerator.Commands;
|
||||
using StammGenerator.Interface;
|
||||
using StammGenerator.ViewModel;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.Commands
|
||||
{
|
||||
class SchachtEditCommand : AsyncCommandBase
|
||||
{
|
||||
|
||||
private IActualState actualState;
|
||||
private IRenavigator renavigator;
|
||||
private ManholeListViewModel manholeListViewModel;
|
||||
|
||||
public SchachtEditCommand(IActualState actualState, IRenavigator renavigator, ManholeListViewModel manholeListViewModel)
|
||||
{
|
||||
this.actualState = actualState;
|
||||
this.renavigator = renavigator;
|
||||
this.manholeListViewModel = manholeListViewModel;
|
||||
}
|
||||
|
||||
public override async Task ExecuteAsync(object? parameter)
|
||||
{
|
||||
actualState.SetSchacht(manholeListViewModel.SelectedSchacht);
|
||||
renavigator.Renavigate();
|
||||
}
|
||||
}
|
||||
}
|
||||
28
StammGenerator/Commands/UpdateCurrentViewModelCommand.cs
Normal file
28
StammGenerator/Commands/UpdateCurrentViewModelCommand.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using StammGenerator.Commands;
|
||||
using StammGenerator.Enum;
|
||||
using StammGenerator.Interface;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.Commands
|
||||
{
|
||||
internal class UpdateCurrentViewModelCommand : AsyncCommandBase
|
||||
{
|
||||
private INavigator _navigator;
|
||||
private readonly IViewModelAbstractFactory _viewModelFactory;
|
||||
|
||||
public UpdateCurrentViewModelCommand(INavigator navigator, IViewModelAbstractFactory viewModelFactory)
|
||||
{
|
||||
_navigator = navigator;
|
||||
_viewModelFactory = viewModelFactory;
|
||||
}
|
||||
|
||||
public override async Task ExecuteAsync(object? parameter)
|
||||
{
|
||||
if(parameter is EMainWindowViewType)
|
||||
{
|
||||
EMainWindowViewType viewType = (EMainWindowViewType)parameter;
|
||||
_navigator.CurrentViewModel = _viewModelFactory.CreateViewModel(viewType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
24
StammGenerator/Converters/EqualValueToParameterConverter.cs
Normal file
24
StammGenerator/Converters/EqualValueToParameterConverter.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace StammGenerator.Converters
|
||||
{
|
||||
public class EqualValueToParameterConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return value.ToString() == parameter.ToString();
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
26
StammGenerator/Converters/ValueToEntConverter.cs
Normal file
26
StammGenerator/Converters/ValueToEntConverter.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using SewerStammGen.Shared.Enum;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace StammGenerator.Converters
|
||||
{
|
||||
public class ValueToEntConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return value.ToString() == parameter.ToString();
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
|
||||
return (EEntwaeserung)parameter;
|
||||
}
|
||||
}
|
||||
}
|
||||
18
StammGenerator/Enum/EMainWindowViewType.cs
Normal file
18
StammGenerator/Enum/EMainWindowViewType.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.Enum
|
||||
{
|
||||
public enum EMainWindowViewType
|
||||
{
|
||||
Home,
|
||||
ProjectList,
|
||||
SchachtList,
|
||||
SchachtEdit,
|
||||
HaltungList,
|
||||
SewerConnectionEdit
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.HostBuilders
|
||||
{
|
||||
static class AddConfigurationHostBuilderExtensions
|
||||
{
|
||||
public static IHostBuilder AddConfiguration(this IHostBuilder hostBuilder)
|
||||
{
|
||||
hostBuilder.ConfigureAppConfiguration(c =>
|
||||
{
|
||||
c.AddJsonFile("appsettings.json");
|
||||
c.AddEnvironmentVariables();
|
||||
}
|
||||
);
|
||||
return hostBuilder;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.HostBuilders
|
||||
{
|
||||
static class AddDBContextHostBuilderExtensions
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using SewerStammGen.Shared.Contracts;
|
||||
using StammGenerator.Interface;
|
||||
using StammGenerator.ViewModel;
|
||||
using System;
|
||||
|
||||
namespace StammGenerator.HostBuilders
|
||||
{
|
||||
internal static class AddServicesHostBuilderExtensions
|
||||
{
|
||||
public static IHostBuilder AddServices(this IHostBuilder host)
|
||||
{
|
||||
host.ConfigureServices((context,services) =>
|
||||
{
|
||||
services.AddSingleton<IMainWindowNavigator, MainWindowNavigator>();
|
||||
services.AddSingleton<ViewModelDelegateRenavigator<ProjektEditViewModel>>();
|
||||
|
||||
string? databaseToUse = context.Configuration.GetConnectionString("databaseToUse");
|
||||
if(databaseToUse != null)
|
||||
{
|
||||
if(databaseToUse.Equals("postgresql"))
|
||||
{
|
||||
string? connectionstring = context.Configuration.GetConnectionString("postgresql");
|
||||
if(connectionstring == null) throw new ArgumentNullException(nameof(connectionstring));
|
||||
services.AddSingleton<IProjektDataService>(_=> new SewerStammGen.DAL.Services.PostgresqlData.ProjektDataService(connectionstring));
|
||||
services.AddSingleton<IAuftraggeberDataService>(_ => new SewerStammGen.DAL.Services.PostgresqlData.AuftraggeberDataService(connectionstring));
|
||||
services.AddSingleton<ISchachtDataService>(_ => new SewerStammGen.DAL.Services.PostgresqlData.SchachtDataService(connectionstring));
|
||||
services.AddSingleton<IHaltungDataService>(_ => new SewerStammGen.DAL.Services.PostgresqlData.HaltungDataService(connectionstring));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
return host;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using StammGenerator.ViewModel;
|
||||
|
||||
namespace StammGenerator.HostBuilders
|
||||
{
|
||||
static class AddStoresHostBuilderExtensions
|
||||
{
|
||||
public static IHostBuilder AddStores(this IHostBuilder hostBuilder)
|
||||
{
|
||||
hostBuilder.ConfigureServices(services =>
|
||||
{
|
||||
services.AddSingleton<IActualState, ActualState>();
|
||||
});
|
||||
return hostBuilder;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using SewerStammGen.Shared.Contracts;
|
||||
using StammGenerator.Interface;
|
||||
using StammGenerator.ViewModel;
|
||||
using StammGenerator.ViewModel.Factories;
|
||||
|
||||
namespace StammGenerator.HostBuilders
|
||||
{
|
||||
static class AddViewModelsHostBuilderExtensions
|
||||
{
|
||||
public static IHostBuilder AddViewModels(this IHostBuilder hostBuilder)
|
||||
{
|
||||
hostBuilder.ConfigureServices(services =>
|
||||
{
|
||||
|
||||
services.AddTransient<MainWindowViewModel>();
|
||||
|
||||
services.AddSingleton<ViewModelDelegateRenavigator<ProjektListViewModel>>();
|
||||
services.AddSingleton<ViewModelDelegateRenavigator<ProjektEditViewModel>>();
|
||||
|
||||
services.AddSingleton<ViewModelDelegateRenavigator<ManholeListViewModel>>();
|
||||
services.AddSingleton<ViewModelDelegateRenavigator<ManholeEditViewModel>>();
|
||||
services.AddSingleton<ViewModelDelegateRenavigator<ManholeImportViewModel>>();
|
||||
|
||||
services.AddSingleton<ViewModelDelegateRenavigator<HaltungListViewModel>>();
|
||||
services.AddSingleton<ViewModelDelegateRenavigator<HaltungEditViewModel>>();
|
||||
|
||||
services.AddSingleton<CreateViewModel<HomeViewModel>>(services =>
|
||||
{
|
||||
return () => new HomeViewModel();
|
||||
});
|
||||
|
||||
#region Schächte
|
||||
services.AddSingleton<CreateViewModel<ManholeListViewModel>>(services =>
|
||||
{
|
||||
return () => new ManholeListViewModel(
|
||||
services.GetRequiredService<ISchachtDataService>(),
|
||||
services.GetRequiredService<ViewModelDelegateRenavigator<ManholeEditViewModel>>(),
|
||||
services.GetRequiredService<IActualState>(),
|
||||
services.GetRequiredService<ViewModelDelegateRenavigator<ManholeImportViewModel>>()
|
||||
);
|
||||
});
|
||||
|
||||
services.AddSingleton<CreateViewModel<ManholeEditViewModel>>(services =>
|
||||
{
|
||||
return () => new ManholeEditViewModel(
|
||||
services.GetRequiredService<ISchachtDataService>(),
|
||||
services.GetRequiredService<IActualState>(),
|
||||
services.GetRequiredService<ViewModelDelegateRenavigator<ManholeListViewModel>>()
|
||||
);
|
||||
});
|
||||
|
||||
services.AddSingleton<CreateViewModel<ManholeImportViewModel>>(services =>
|
||||
{
|
||||
return () => new ManholeImportViewModel(
|
||||
services.GetRequiredService<ISchachtDataService>(),
|
||||
services.GetRequiredService<ViewModelDelegateRenavigator<ManholeListViewModel>>(),
|
||||
services.GetRequiredService<IActualState>()
|
||||
);
|
||||
});
|
||||
#endregion
|
||||
|
||||
#region Haltungen
|
||||
services.AddSingleton<CreateViewModel<HaltungListViewModel>>(services =>
|
||||
{
|
||||
return () => new HaltungListViewModel(
|
||||
services.GetRequiredService<IHaltungDataService>(),
|
||||
services.GetRequiredService<IActualState>(),
|
||||
services.GetRequiredService<ViewModelDelegateRenavigator<HaltungEditViewModel>>()
|
||||
);
|
||||
});
|
||||
|
||||
services.AddTransient<CreateViewModel<HaltungEditViewModel>>(services =>
|
||||
{
|
||||
return () => new HaltungEditViewModel(
|
||||
services.GetRequiredService<IHaltungDataService>(),
|
||||
services.GetRequiredService<IActualState>(),
|
||||
services.GetRequiredService<ViewModelDelegateRenavigator<HaltungListViewModel>>(),
|
||||
services.GetRequiredService<ISchachtDataService>()
|
||||
);
|
||||
});
|
||||
#endregion
|
||||
|
||||
#region Projekte
|
||||
services.AddSingleton<CreateViewModel<ProjektEditViewModel>>(services =>
|
||||
{
|
||||
return () => new ProjektEditViewModel(
|
||||
services.GetRequiredService<IProjektDataService>(),
|
||||
services.GetRequiredService<ViewModelDelegateRenavigator<ProjektListViewModel>>(),
|
||||
services.GetRequiredService<IActualState>()
|
||||
);
|
||||
});
|
||||
|
||||
services.AddSingleton<CreateViewModel<ProjektListViewModel>>(services =>
|
||||
{
|
||||
return () => new ProjektListViewModel(
|
||||
services.GetRequiredService<IProjektDataService>(),
|
||||
services.GetRequiredService<ViewModelDelegateRenavigator<ProjektEditViewModel>>(),
|
||||
services.GetRequiredService<IActualState>()
|
||||
);
|
||||
});
|
||||
#endregion
|
||||
|
||||
services.AddSingleton<IViewModelAbstractFactory, MainWindowViewModelFactory>();
|
||||
});
|
||||
|
||||
return hostBuilder;
|
||||
}
|
||||
}
|
||||
}
|
||||
15
StammGenerator/Interface/IViewModelAbstractFactory.cs
Normal file
15
StammGenerator/Interface/IViewModelAbstractFactory.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using StammGenerator.Enum;
|
||||
using StammGenerator.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.Interface
|
||||
{
|
||||
public interface IViewModelAbstractFactory
|
||||
{
|
||||
BaseViewModel CreateViewModel(EMainWindowViewType viewType);
|
||||
}
|
||||
}
|
||||
12
StammGenerator/Interface/Navigator/IMainWindowNavigator.cs
Normal file
12
StammGenerator/Interface/Navigator/IMainWindowNavigator.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.Interface
|
||||
{
|
||||
public interface IMainWindowNavigator : INavigator
|
||||
{
|
||||
}
|
||||
}
|
||||
19
StammGenerator/Interface/Navigator/INavigator.cs
Normal file
19
StammGenerator/Interface/Navigator/INavigator.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using StammGenerator.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.Interface
|
||||
{
|
||||
public interface INavigator
|
||||
{
|
||||
BaseViewModel CurrentViewModel
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
event Action StateChanged;
|
||||
}
|
||||
}
|
||||
13
StammGenerator/Interface/Navigator/IRenavigator.cs
Normal file
13
StammGenerator/Interface/Navigator/IRenavigator.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.Interface
|
||||
{
|
||||
public interface IRenavigator
|
||||
{
|
||||
void Renavigate();
|
||||
}
|
||||
}
|
||||
57
StammGenerator/MainWindow.xaml
Normal file
57
StammGenerator/MainWindow.xaml
Normal file
@@ -0,0 +1,57 @@
|
||||
<Window x:Class="StammGenerator.MainWindow"
|
||||
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:StammGenerator"
|
||||
mc:Ignorable="d"
|
||||
|
||||
xmlns:view="clr-namespace:StammGenerator.Views"
|
||||
xmlns:viewmodel="clr-namespace:StammGenerator.ViewModel"
|
||||
|
||||
|
||||
Title="MainWindow" Height="450" Width="800">
|
||||
<Window.Resources>
|
||||
<DataTemplate DataType="{x:Type viewmodel:HomeViewModel}">
|
||||
<view:HomeView />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewmodel:ManholeListViewModel}">
|
||||
<view:SchachtListView />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewmodel:ManholeEditViewModel}">
|
||||
<view:SchachtEditView />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewmodel:ManholeImportViewModel}">
|
||||
<view:SchachtImportView />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewmodel:HaltungListViewModel}">
|
||||
<view:HaltungListView />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewmodel:HaltungEditViewModel}">
|
||||
<view:HaltungEditView />
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="{x:Type viewmodel:ProjektListViewModel}">
|
||||
<view:ProjektListView />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewmodel:ProjektEditViewModel}">
|
||||
<view:ProjektEditView />
|
||||
</DataTemplate>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<view:MainWindowNavigationBar Grid.Column="0" />
|
||||
|
||||
<ContentControl Grid.Column="1" Content="{Binding CurrentViewModel}" />
|
||||
<StatusBar Grid.Row="1" Grid.ColumnSpan="2">
|
||||
<StatusBarItem Content="{Binding Projektnummer}" />
|
||||
</StatusBar>
|
||||
</Grid>
|
||||
</Window>
|
||||
28
StammGenerator/MainWindow.xaml.cs
Normal file
28
StammGenerator/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
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 StammGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
26
StammGenerator/Services/OpenFileDialogService.cs
Normal file
26
StammGenerator/Services/OpenFileDialogService.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.Services
|
||||
{
|
||||
internal class OpenFileDialogService
|
||||
{
|
||||
public string OpenFileDialog()
|
||||
{
|
||||
OpenFileDialog dialog = new OpenFileDialog();
|
||||
dialog.Filter = "CSV Files(.csv)|*.csv";
|
||||
dialog.FilterIndex = 1;
|
||||
dialog.Multiselect = false;
|
||||
if(dialog.ShowDialog() == true)
|
||||
{
|
||||
return dialog.FileName;
|
||||
}
|
||||
return string.Empty;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
31
StammGenerator/StammGenerator.csproj
Normal file
31
StammGenerator/StammGenerator.csproj
Normal file
@@ -0,0 +1,31 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net7.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="ViewModel\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SewerStammGen.DAL\SewerStammGen.DAL.csproj" />
|
||||
<ProjectReference Include="..\SewerStammGen.Shared\SewerStammGen.Shared.csproj" />
|
||||
<ProjectReference Include="..\WWTech_KanalSchnittstelle\WWTech_KanalSchnittstelle.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="appsettings.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
70
StammGenerator/StammGenerator.csproj.user
Normal file
70
StammGenerator/StammGenerator.csproj.user
Normal file
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Update="App.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Views\Haltung\HaltungEditView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\Haltung\HaltungListView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\HomeView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\MainWindowNavigationBar.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\Projekt\ProjektEditView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\Projekt\ProjektListView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\Schacht\SchachtEditView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\Schacht\SchachtImportView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\Schacht\SchachtListView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="MainWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\Haltung\HaltungEditView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\Haltung\HaltungListView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\HomeView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\MainWindowNavigationBar.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\Projekt\ProjektEditView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\Projekt\ProjektListView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\Schacht\SchachtEditView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\Schacht\SchachtImportView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\Schacht\SchachtListView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
14
StammGenerator/ViewModel/BaseViewModel.cs
Normal file
14
StammGenerator/ViewModel/BaseViewModel.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.ViewModel
|
||||
{
|
||||
public delegate TViewModel CreateViewModel<TViewModel>() where TViewModel : BaseViewModel;
|
||||
public class BaseViewModel : ObservableObject
|
||||
{
|
||||
public virtual void Dispose() { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using StammGenerator;
|
||||
using StammGenerator.Enum;
|
||||
using StammGenerator.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.ViewModel.Factories
|
||||
{
|
||||
public class MainWindowViewModelFactory : IViewModelAbstractFactory
|
||||
{
|
||||
private CreateViewModel<HomeViewModel> _createHomeViewModel;
|
||||
private CreateViewModel<ManholeEditViewModel> _createManholeEditViewModel;
|
||||
private CreateViewModel<ManholeListViewModel> _createManholeListViewModel;
|
||||
private CreateViewModel<HaltungListViewModel> _createHaltungListViewModel;
|
||||
//private CreateViewModel<SewerConnectorViewModel> _createSewerConnectorViewModel;
|
||||
private CreateViewModel<ProjektListViewModel> _createProjektListViewModel;
|
||||
|
||||
public MainWindowViewModelFactory(
|
||||
CreateViewModel<HomeViewModel> createHomeViewModel,
|
||||
CreateViewModel<ManholeEditViewModel> createManholeEditViewModel,
|
||||
CreateViewModel<ManholeListViewModel> createManholeListViewModel,
|
||||
CreateViewModel<HaltungListViewModel> createHaltungListViewModel,
|
||||
|
||||
CreateViewModel<ProjektListViewModel> createProjektListViewModel
|
||||
)
|
||||
{
|
||||
_createHomeViewModel = createHomeViewModel;
|
||||
_createManholeEditViewModel = createManholeEditViewModel;
|
||||
//_createSewerConnectorViewModel = createSewerConnectorViewModel;
|
||||
_createProjektListViewModel = createProjektListViewModel;
|
||||
_createManholeListViewModel = createManholeListViewModel;
|
||||
_createHaltungListViewModel = createHaltungListViewModel;
|
||||
}
|
||||
|
||||
public BaseViewModel CreateViewModel(EMainWindowViewType viewType)
|
||||
{
|
||||
switch(viewType)
|
||||
{
|
||||
case EMainWindowViewType.Home: return _createHomeViewModel();
|
||||
|
||||
case EMainWindowViewType.SchachtList: return _createManholeListViewModel();
|
||||
case EMainWindowViewType.SchachtEdit: return _createManholeEditViewModel();
|
||||
|
||||
case EMainWindowViewType.HaltungList: return _createHaltungListViewModel();
|
||||
//case EMainWindowViewType.SewerConnectionEdit: return _createSewerConnectorViewModel();
|
||||
|
||||
case EMainWindowViewType.ProjectList: return _createProjektListViewModel();
|
||||
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
209
StammGenerator/ViewModel/Haltung/HaltungEditViewModel.cs
Normal file
209
StammGenerator/ViewModel/Haltung/HaltungEditViewModel.cs
Normal file
@@ -0,0 +1,209 @@
|
||||
using SewerStammGen.Shared.Contracts;
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using SewerStammGen.Shared.Enum;
|
||||
using StammGenerator.Commands;
|
||||
using StammGenerator.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StammGenerator.ViewModel
|
||||
{
|
||||
internal class HaltungEditViewModel : BaseViewModel
|
||||
{
|
||||
private readonly IActualState _actualState;
|
||||
private readonly IHaltungDataService _haltungDataService;
|
||||
private readonly ISchachtDataService _schachtDataService;
|
||||
private List<Schacht> avaibleSchaechte;
|
||||
private int _selectedObenIndex;
|
||||
private int _selectedUntenIndex;
|
||||
private Kanal _model;
|
||||
|
||||
public List<Schacht> AvSchaechte
|
||||
{
|
||||
get
|
||||
{
|
||||
return avaibleSchaechte;
|
||||
}
|
||||
}
|
||||
|
||||
public EEntwaeserung Entwaeserung
|
||||
{
|
||||
get => _model.Entwaesserung;
|
||||
set
|
||||
{
|
||||
if(_model.Entwaesserung != value)
|
||||
{
|
||||
_model.Entwaesserung = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int SelectedObenIndex
|
||||
{
|
||||
get => _selectedObenIndex;
|
||||
set
|
||||
{
|
||||
if (_selectedObenIndex != value)
|
||||
{
|
||||
_selectedObenIndex = value;
|
||||
_model.StartSchacht = avaibleSchaechte[value];
|
||||
RecalculateLength();
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
public int SelectedUntenIndex
|
||||
{
|
||||
get => _selectedUntenIndex;
|
||||
set
|
||||
{
|
||||
if (_selectedUntenIndex != value)
|
||||
{
|
||||
_selectedUntenIndex = value;
|
||||
_model.EndSchacht = avaibleSchaechte[value];
|
||||
RecalculateLength();
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Kanal Model
|
||||
{
|
||||
get => _model;
|
||||
set
|
||||
{
|
||||
_model = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string Haltungsbezeichnung
|
||||
{
|
||||
get => _model.Objektbezeichnung;
|
||||
set
|
||||
{
|
||||
if (_model.Objektbezeichnung != value)
|
||||
{
|
||||
_model.Objektbezeichnung = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
public string Material
|
||||
{
|
||||
get => _model.Material;
|
||||
set
|
||||
{
|
||||
if (_model.Material != value)
|
||||
{
|
||||
_model.Material = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
public string Durchmesser
|
||||
{
|
||||
get => _model.DN.ToString();
|
||||
set
|
||||
{
|
||||
if (_model.DN.ToString() != value)
|
||||
{
|
||||
_model.DN = int.Parse(value);
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
public string Haltungslaenge
|
||||
{
|
||||
get => _model.Haltungslaenge.ToString();
|
||||
set
|
||||
{
|
||||
if (_model.Haltungslaenge.ToString() != value)
|
||||
{
|
||||
_model.Haltungslaenge = decimal.Parse(value);
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand Speichern { get; set; }
|
||||
public ICommand Abbrechen { get; set; }
|
||||
|
||||
public HaltungEditViewModel(
|
||||
IHaltungDataService haltungDataService,
|
||||
IActualState actualState,
|
||||
IRenavigator renavigator,
|
||||
ISchachtDataService schachtDataService)
|
||||
{
|
||||
_actualState = actualState;
|
||||
_haltungDataService = haltungDataService;
|
||||
_schachtDataService = schachtDataService;
|
||||
|
||||
|
||||
|
||||
_model = _actualState.SelectedHaltung;
|
||||
|
||||
Speichern = new HaltungEditSaveCommand(_haltungDataService, renavigator, this);
|
||||
Abbrechen = new RelayCommand((x) => Abbruch(renavigator));
|
||||
|
||||
ladeVerfuegbareSchaechte();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void RecalculateLength()
|
||||
{
|
||||
|
||||
double x1 = (double)Model.StartSchacht.DeckelRechtsWert;
|
||||
double x2 = (double)Model.EndSchacht.DeckelRechtsWert;
|
||||
double y1 = (double)Model.StartSchacht.DeckelHochWert;
|
||||
double y2 = (double)Model.EndSchacht.DeckelHochWert;
|
||||
|
||||
|
||||
double length = Math.Sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
|
||||
Haltungslaenge = length.ToString();
|
||||
OnPropertyChanged(nameof(Haltungslaenge));
|
||||
}
|
||||
|
||||
private void Abbruch(IRenavigator renavigator)
|
||||
{
|
||||
renavigator.Renavigate();
|
||||
}
|
||||
|
||||
private async void ladeVerfuegbareSchaechte()
|
||||
{
|
||||
var s = await _schachtDataService.GetAllByProjekt(_actualState.ProjektID);
|
||||
avaibleSchaechte = s.ToList();
|
||||
int counter = 0;
|
||||
foreach (var d in avaibleSchaechte)
|
||||
{
|
||||
if (d.Id == Model.StartSchacht.Id)
|
||||
{
|
||||
SelectedObenIndex = counter;
|
||||
break;
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
counter = 0;
|
||||
foreach (var d in avaibleSchaechte)
|
||||
{
|
||||
if (d.Id == Model.EndSchacht.Id)
|
||||
{
|
||||
SelectedUntenIndex = counter;
|
||||
break;
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
OnPropertyChanged(nameof(AvSchaechte));
|
||||
OnPropertyChanged(nameof(SelectedObenIndex));
|
||||
OnPropertyChanged(nameof(SelectedUntenIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
55
StammGenerator/ViewModel/Haltung/HaltungListViewModel.cs
Normal file
55
StammGenerator/ViewModel/Haltung/HaltungListViewModel.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using SewerStammGen.Shared.Contracts;
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using StammGenerator.Commands;
|
||||
using StammGenerator.Interface;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StammGenerator.ViewModel
|
||||
{
|
||||
public class HaltungListViewModel : BaseViewModel
|
||||
{
|
||||
private readonly ObservableCollection<Kanal> _haltungen;
|
||||
private readonly IActualState _actualState;
|
||||
private readonly IHaltungDataService _haltungDataService;
|
||||
|
||||
public Kanal? SelectedHaltung { get; set; }
|
||||
public ObservableCollection<Kanal> Haltungen { get => _haltungen; }
|
||||
|
||||
public ICommand EditCommand { get; set; }
|
||||
public ICommand AddCommand { get; set; }
|
||||
public ICommand ExportCommand { get; set; }
|
||||
|
||||
public HaltungListViewModel(IHaltungDataService haltungDataService, IActualState actualState, IRenavigator renavigator )
|
||||
{
|
||||
_haltungen = new ObservableCollection<Kanal>();
|
||||
_haltungDataService = haltungDataService;
|
||||
|
||||
_actualState = actualState;
|
||||
|
||||
|
||||
EditCommand = new HaltungEditCommand(actualState, renavigator, this);
|
||||
AddCommand = new HaltungAddCommand(actualState, renavigator);
|
||||
ExportCommand = new ProjectExportCommand(actualState);
|
||||
|
||||
LoadHaltungen();
|
||||
}
|
||||
|
||||
private async void LoadHaltungen()
|
||||
{
|
||||
var haltungen = await _haltungDataService.GetAllByProjekt(_actualState.ProjektID);
|
||||
InitCollection(_haltungen, haltungen);
|
||||
|
||||
}
|
||||
|
||||
private void InitCollection(ObservableCollection<Kanal> dest, IEnumerable<Kanal> source)
|
||||
{
|
||||
dest.Clear();
|
||||
foreach (var sourceItem in source)
|
||||
{
|
||||
dest.Add(sourceItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
20
StammGenerator/ViewModel/Haltung/TextBoxFilterAction.cs
Normal file
20
StammGenerator/ViewModel/Haltung/TextBoxFilterAction.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
//using Microsoft.Xaml.Behaviors;
|
||||
//using Syncfusion.UI.Xaml.Grid;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.Views
|
||||
{
|
||||
/*
|
||||
public class TextBoxFilterAction : TargetedTriggerAction<SfMultiColumnDropDownControl>
|
||||
{
|
||||
protected override void Invoke(object parameter)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
12
StammGenerator/ViewModel/HomeViewModel.cs
Normal file
12
StammGenerator/ViewModel/HomeViewModel.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.ViewModel
|
||||
{
|
||||
public class HomeViewModel : BaseViewModel
|
||||
{
|
||||
}
|
||||
}
|
||||
70
StammGenerator/ViewModel/MainWindowViewModel.cs
Normal file
70
StammGenerator/ViewModel/MainWindowViewModel.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
|
||||
using StammGenerator.Enum;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using StammGenerator.Interface;
|
||||
using StammGenerator.Commands;
|
||||
|
||||
namespace StammGenerator.ViewModel
|
||||
{
|
||||
public class MainWindowViewModel : BaseViewModel
|
||||
{
|
||||
public IMainWindowNavigator Navigator { get; set; }
|
||||
public string? Projektnummer { get; set; }
|
||||
private readonly IActualState _actualState;
|
||||
public BaseViewModel CurrentViewModel => Navigator.CurrentViewModel;
|
||||
|
||||
public ICommand UpdateCurrentViewModelCommand { get; }
|
||||
|
||||
public static string ApplicationTitle
|
||||
{
|
||||
get => "Stammdatengenerator Version 0.1";
|
||||
}
|
||||
|
||||
public MainWindowViewModel(
|
||||
IMainWindowNavigator navigator,
|
||||
IViewModelAbstractFactory viewModelFactory,
|
||||
IActualState actualState
|
||||
|
||||
)
|
||||
{
|
||||
Navigator = navigator;
|
||||
|
||||
UpdateCurrentViewModelCommand = new UpdateCurrentViewModelCommand(navigator, viewModelFactory);
|
||||
UpdateCurrentViewModelCommand.Execute(EMainWindowViewType.Home);
|
||||
|
||||
_actualState = actualState;
|
||||
|
||||
_actualState.ProjektChanged += ActualState_ProjektChanged;
|
||||
|
||||
|
||||
Navigator.StateChanged += Navigator_StateChanged;
|
||||
|
||||
|
||||
|
||||
#if DEBUG
|
||||
|
||||
_actualState.SetProjekt(new Projekt() { Id = 5 });
|
||||
#endif
|
||||
}
|
||||
|
||||
private void ActualState_ProjektChanged(object? sender, EventArgs e)
|
||||
{
|
||||
Projektnummer = _actualState.ProjektID.ToString();
|
||||
OnPropertyChanged(nameof(Projektnummer));
|
||||
}
|
||||
|
||||
private void Navigator_StateChanged()
|
||||
{
|
||||
OnPropertyChanged(nameof(CurrentViewModel));
|
||||
}
|
||||
}
|
||||
}
|
||||
14
StammGenerator/ViewModel/ObservableObject.cs
Normal file
14
StammGenerator/ViewModel/ObservableObject.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace StammGenerator.ViewModel
|
||||
{
|
||||
public class ObservableObject : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
102
StammGenerator/ViewModel/Projekt/ProjektEditViewModel.cs
Normal file
102
StammGenerator/ViewModel/Projekt/ProjektEditViewModel.cs
Normal file
@@ -0,0 +1,102 @@
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using Shared.Contracts;
|
||||
using StammGenerator.Interface;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StammGenerator.ViewModel
|
||||
{
|
||||
internal class ProjektEditViewModel : BaseViewModel
|
||||
{
|
||||
private Projekt _model;
|
||||
private int ProjektID;
|
||||
private readonly IDataService<Projekt> _dataService;
|
||||
private readonly IRenavigator _renavigator;
|
||||
|
||||
public ICommand Speichern { get; set; }
|
||||
public string ProjektName
|
||||
{
|
||||
get => _model.Projektname;
|
||||
set
|
||||
{
|
||||
if(_model.Projektname != value)
|
||||
{
|
||||
_model.Projektname = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
public string Erstelldatum
|
||||
{
|
||||
get => _model.Erstelldatum;
|
||||
set
|
||||
{
|
||||
if (_model.Erstelldatum != value)
|
||||
{
|
||||
_model.Erstelldatum = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
public string Strasse
|
||||
{
|
||||
get => _model.Strasse;
|
||||
set
|
||||
{
|
||||
if (_model.Strasse != value)
|
||||
{
|
||||
_model.Strasse = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
public string Ort
|
||||
{
|
||||
get => _model.Ort;
|
||||
set
|
||||
{
|
||||
if (_model.Ort != value)
|
||||
{
|
||||
_model.Ort = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ProjektEditViewModel(IDataService<Projekt> dataService, IRenavigator renavigator, IActualState actualState)
|
||||
{
|
||||
_dataService = dataService;
|
||||
_renavigator = renavigator;
|
||||
|
||||
ProjektID = actualState.ProjektID;
|
||||
|
||||
_model = new Projekt();
|
||||
Speichern = new RelayCommand((x) => this.SaveProject());
|
||||
|
||||
LoadProjekt();
|
||||
}
|
||||
|
||||
private async void LoadProjekt()
|
||||
{
|
||||
|
||||
_model = await _dataService.Get(ProjektID);
|
||||
if(_model == null)
|
||||
{
|
||||
_model = new Projekt()
|
||||
{
|
||||
Auftraggeber = new Auftraggeber(),
|
||||
};
|
||||
}
|
||||
OnPropertyChanged(nameof(ProjektName));
|
||||
OnPropertyChanged(nameof(Erstelldatum));
|
||||
OnPropertyChanged(nameof(Strasse));
|
||||
OnPropertyChanged(nameof(Ort));
|
||||
}
|
||||
|
||||
private void SaveProject()
|
||||
{
|
||||
_dataService.Update(_model);
|
||||
|
||||
_renavigator.Renavigate();
|
||||
}
|
||||
}
|
||||
}
|
||||
72
StammGenerator/ViewModel/Projekt/ProjektListViewModel.cs
Normal file
72
StammGenerator/ViewModel/Projekt/ProjektListViewModel.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using SewerStammGen.Shared.Contracts;
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using StammGenerator.Commands;
|
||||
using StammGenerator.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StammGenerator.ViewModel
|
||||
{
|
||||
public class ProjektListViewModel : BaseViewModel
|
||||
{
|
||||
private IProjektDataService genericDataService;
|
||||
private readonly ObservableCollection<Projekt> _projekte;
|
||||
private readonly IActualState _actualState;
|
||||
public ObservableCollection<Projekt> Projekte { get => _projekte; }
|
||||
public bool CanSelectProjekt => _selectedProjekt != null;
|
||||
|
||||
public ICommand SelectCommand { get; set; }
|
||||
public ICommand AddCommand { get; set; }
|
||||
public ICommand EditCommand { get; set; }
|
||||
|
||||
private Projekt? _selectedProjekt;
|
||||
|
||||
|
||||
|
||||
public Projekt? SelectedProjekt
|
||||
{
|
||||
get => _selectedProjekt;
|
||||
set
|
||||
{
|
||||
if(_selectedProjekt != value)
|
||||
{
|
||||
_selectedProjekt = value;
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged(nameof(CanSelectProjekt));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ProjektListViewModel(IProjektDataService generic, IRenavigator renavigator,IActualState actualState)
|
||||
{
|
||||
_projekte = new ObservableCollection<Projekt>();
|
||||
if (generic == null) throw new ArgumentNullException(nameof(generic));
|
||||
this.genericDataService = generic;
|
||||
_actualState = actualState;
|
||||
AddCommand = new ProjektAddCommand(generic,actualState, renavigator);
|
||||
SelectCommand = new ProjektSelectCommand(actualState,this);
|
||||
EditCommand = new ProjektEditCommand(generic, actualState, renavigator, this);
|
||||
|
||||
LoadProjekte();
|
||||
}
|
||||
|
||||
private async void LoadProjekte()
|
||||
{
|
||||
var projects = await genericDataService.GetAll();
|
||||
|
||||
InitCollection(_projekte, projects);
|
||||
|
||||
}
|
||||
|
||||
private void InitCollection(ObservableCollection<Projekt> projekte, IEnumerable<Projekt> projects)
|
||||
{
|
||||
projekte.Clear();
|
||||
foreach(var i in projects)
|
||||
{
|
||||
projekte.Add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
50
StammGenerator/ViewModel/RelayCommand.cs
Normal file
50
StammGenerator/ViewModel/RelayCommand.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StammGenerator.ViewModel
|
||||
{
|
||||
[Serializable]
|
||||
class RelayCommand : ICommand
|
||||
{
|
||||
#region Fields
|
||||
private readonly Action<object> execute;
|
||||
private readonly Predicate<object> canExecute;
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public RelayCommand(Action<object> execute) : this(execute, null) { }
|
||||
|
||||
public RelayCommand(Action<object> execute, Predicate<object> canExecute)
|
||||
{
|
||||
if (execute == null) throw new ArgumentNullException("execute");
|
||||
this.execute = execute;
|
||||
this.canExecute = canExecute;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICommand Members
|
||||
[DebuggerStepThrough]
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
if (canExecute == null) return true;
|
||||
return canExecute(parameter);
|
||||
}
|
||||
|
||||
public event EventHandler CanExecuteChanged
|
||||
{
|
||||
add { CommandManager.RequerySuggested += value; }
|
||||
remove { CommandManager.RequerySuggested -= value; }
|
||||
}
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
execute(parameter);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
146
StammGenerator/ViewModel/Schacht/ManholeEditViewModel.cs
Normal file
146
StammGenerator/ViewModel/Schacht/ManholeEditViewModel.cs
Normal file
@@ -0,0 +1,146 @@
|
||||
using SewerStammGen.Shared.Contracts;
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using SewerStammGen.Shared.Enum;
|
||||
using StammGenerator.Interface;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StammGenerator.ViewModel
|
||||
{
|
||||
public class ManholeEditViewModel : BaseViewModel
|
||||
{
|
||||
private readonly ISchachtDataService _schachtDataService;
|
||||
private readonly IRenavigator _renavigator;
|
||||
|
||||
private Schacht _model;
|
||||
|
||||
public ICommand Speichern { get; set; }
|
||||
|
||||
public string Objektbezeichnung
|
||||
{
|
||||
get
|
||||
{
|
||||
return _model.Objektbezeichnung;
|
||||
}
|
||||
set
|
||||
{
|
||||
if(_model.Objektbezeichnung != value)
|
||||
{
|
||||
_model.Objektbezeichnung = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
public decimal DeckelRechtsWert
|
||||
{
|
||||
get => _model.DeckelRechtsWert;
|
||||
set
|
||||
{
|
||||
if(_model.DeckelRechtsWert != value)
|
||||
{
|
||||
_model.DeckelRechtsWert = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
public decimal DeckelHochWert
|
||||
{
|
||||
get => _model.DeckelHochWert; set
|
||||
{
|
||||
if (_model.DeckelHochWert != value)
|
||||
{
|
||||
_model.DeckelHochWert = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
public decimal DeckelHoehe
|
||||
{
|
||||
get => _model.DeckelHoehe;
|
||||
set
|
||||
{
|
||||
if (_model.DeckelHoehe != value)
|
||||
{
|
||||
_model.DeckelHoehe = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
public decimal SohlHochWert
|
||||
{
|
||||
get => _model.SohlHochWert;
|
||||
set
|
||||
{
|
||||
if(_model.SohlHochWert != value)
|
||||
{
|
||||
_model.SohlHochWert = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
public decimal SohlRechtsWert
|
||||
{
|
||||
get => _model.SohlRechtsWert;
|
||||
set
|
||||
{
|
||||
if(_model.SohlRechtsWert != value)
|
||||
{
|
||||
_model.SohlRechtsWert = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public decimal SohlHoehe
|
||||
{
|
||||
get => _model.SohlHoehe;
|
||||
set
|
||||
{
|
||||
if (_model.SohlHoehe != value)
|
||||
{
|
||||
_model.SohlHoehe = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
public EEntwaeserung Entwaeserung
|
||||
{
|
||||
get => _model.Entwaesserung;
|
||||
set
|
||||
{
|
||||
if (_model.Entwaesserung != value)
|
||||
{
|
||||
_model.Entwaesserung = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ManholeEditViewModel(ISchachtDataService schachtDataService,IActualState actualState, IRenavigator renavigator)
|
||||
{
|
||||
_schachtDataService = schachtDataService;
|
||||
_model = actualState.SelectedSchacht;
|
||||
_renavigator = renavigator;
|
||||
|
||||
Speichern = new RelayCommand((x) => SaveSchacht());
|
||||
|
||||
}
|
||||
|
||||
public ManholeEditViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private async void SaveSchacht()
|
||||
{
|
||||
if (_model.Id == 0)
|
||||
{
|
||||
await _schachtDataService.Create(_model);
|
||||
}
|
||||
else
|
||||
{
|
||||
await _schachtDataService.Update(_model);
|
||||
}
|
||||
_renavigator.Renavigate();
|
||||
}
|
||||
}
|
||||
}
|
||||
62
StammGenerator/ViewModel/Schacht/ManholeImportViewModel.cs
Normal file
62
StammGenerator/ViewModel/Schacht/ManholeImportViewModel.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using SewerStammGen.Shared.Contracts;
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using SewerStammGen.Shared.Enum;
|
||||
using Shared.Contracts;
|
||||
using StammGenerator.Interface;
|
||||
using StammGenerator.Services;
|
||||
using System.Windows.Input;
|
||||
using WWTech_KanalSchnittstelle.Importer;
|
||||
|
||||
namespace StammGenerator.ViewModel
|
||||
{
|
||||
public class ManholeImportViewModel : BaseViewModel
|
||||
{
|
||||
private readonly ISchachtDataService schachtDataService;
|
||||
private readonly IRenavigator renavigator;
|
||||
private OpenFileDialogService fileDialogService;
|
||||
|
||||
private string filename = string.Empty;
|
||||
public string FileName
|
||||
{
|
||||
get => filename;
|
||||
set
|
||||
{
|
||||
if (filename == value) return;
|
||||
filename = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand LoadFile { get; set; }
|
||||
public ICommand OpenFileDialogCommand { get; set; }
|
||||
|
||||
private readonly IImport importer;
|
||||
|
||||
public ManholeImportViewModel(ISchachtDataService schachtDataService, IRenavigator renavigator, IActualState actualState)
|
||||
{
|
||||
#if DEBUG
|
||||
FileName = @"C:\Users\damia\source\repos\Stammdatengenerator\Beispieldaten\Koordinatendatei.csv";
|
||||
#endif
|
||||
LoadFile = new RelayCommand((x) => importFile());
|
||||
this.schachtDataService = schachtDataService;
|
||||
|
||||
importer = new CSVImporter(actualState.ProjektID);
|
||||
this.renavigator = renavigator;
|
||||
this.fileDialogService = new OpenFileDialogService();
|
||||
this.OpenFileDialogCommand = new RelayCommand((x) =>
|
||||
{
|
||||
FileName = fileDialogService.OpenFileDialog();
|
||||
});
|
||||
}
|
||||
|
||||
private async void importFile()
|
||||
{
|
||||
var schaechte = importer.LoadSchaechte(FileName, EEntwaeserung.Mischwasser);
|
||||
if (schaechte != null)
|
||||
{
|
||||
await schachtDataService.InsertSchachtBulk(schaechte);
|
||||
}
|
||||
renavigator.Renavigate();
|
||||
}
|
||||
}
|
||||
}
|
||||
64
StammGenerator/ViewModel/Schacht/ManholeListViewModel.cs
Normal file
64
StammGenerator/ViewModel/Schacht/ManholeListViewModel.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using SewerStammGen.Shared.Contracts;
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using StammGenerator.Commands;
|
||||
using StammGenerator.Interface;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StammGenerator.ViewModel
|
||||
{
|
||||
public class ManholeListViewModel : BaseViewModel
|
||||
{
|
||||
private readonly ISchachtDataService _schachtDataService;
|
||||
private readonly ObservableCollection<Schacht> _schaechte;
|
||||
private readonly IActualState _actualState;
|
||||
private readonly IRenavigator renavigateToImport;
|
||||
|
||||
public ObservableCollection<Schacht> Schaechte { get => _schaechte; }
|
||||
|
||||
public Schacht? SelectedSchacht { get; set; }
|
||||
|
||||
public ICommand AddSchachtCommand { get; set; }
|
||||
public ICommand EditSchachtCommand { get; set; }
|
||||
public ICommand DeleteSchachtCommand { get; set; }
|
||||
public ICommand ImportSchachtCommand { get; set; }
|
||||
|
||||
|
||||
|
||||
public ManholeListViewModel(ISchachtDataService schachtDataService, IRenavigator renavigator ,IActualState actualState, IRenavigator navigatetoImport)
|
||||
{
|
||||
_schachtDataService = schachtDataService;
|
||||
_actualState = actualState;
|
||||
|
||||
_schaechte = new ObservableCollection<Schacht>();
|
||||
renavigateToImport = navigatetoImport;
|
||||
|
||||
AddSchachtCommand = new SchachtAddCommand(actualState,renavigator);
|
||||
EditSchachtCommand = new SchachtEditCommand(actualState, renavigator,this);
|
||||
DeleteSchachtCommand = new SchachtDeleteCommand(schachtDataService, actualState, renavigator, this);
|
||||
ImportSchachtCommand = new RelayCommand((x) =>
|
||||
{
|
||||
navigatetoImport.Renavigate();
|
||||
});
|
||||
|
||||
|
||||
LoadSchaechte();
|
||||
}
|
||||
|
||||
private async void LoadSchaechte()
|
||||
{
|
||||
var schaechte = await _schachtDataService.GetAllByProjekt(_actualState.ProjektID);
|
||||
InitCollection(_schaechte, schaechte);
|
||||
}
|
||||
|
||||
private void InitCollection(ObservableCollection<Schacht> dest, IEnumerable<Schacht> source)
|
||||
{
|
||||
dest.Clear();
|
||||
foreach(var i in source)
|
||||
{
|
||||
dest.Add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
12
StammGenerator/ViewModel/Schacht/TestHole.cs
Normal file
12
StammGenerator/ViewModel/Schacht/TestHole.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.ViewModel
|
||||
{
|
||||
public class TestHole : BaseViewModel
|
||||
{
|
||||
}
|
||||
}
|
||||
66
StammGenerator/ViewModel/State/ActualState.cs
Normal file
66
StammGenerator/ViewModel/State/ActualState.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.ViewModel
|
||||
{
|
||||
internal class ActualState : IActualState
|
||||
{
|
||||
// TODO: set auf private set setzen
|
||||
public int ProjektID { get; set; }
|
||||
|
||||
public int SchachtID { get; private set; }
|
||||
public int HaltungID { get; private set; }
|
||||
public Schacht SelectedSchacht { get; private set; }
|
||||
|
||||
public Kanal SelectedHaltung {get; private set; }
|
||||
|
||||
public void SetProjekt(Projekt projekt, bool notification = true)
|
||||
{
|
||||
ProjektID = projekt.Id;
|
||||
if(notification)
|
||||
{
|
||||
OnProjektChanged();
|
||||
}
|
||||
}
|
||||
public void SetSchacht(Schacht schacht, bool notification = true)
|
||||
{
|
||||
SelectedSchacht = schacht;
|
||||
SchachtID = schacht.Id;
|
||||
if(notification)
|
||||
{
|
||||
OnSchachtChanged();
|
||||
}
|
||||
}
|
||||
public void SetHaltung(Kanal haltung, bool notification = true)
|
||||
{
|
||||
SelectedHaltung = haltung;
|
||||
HaltungID = haltung.Id;
|
||||
if(notification)
|
||||
{
|
||||
OnHaltungChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public event EventHandler? ProjektChanged;
|
||||
public event EventHandler? SchachtChanged;
|
||||
public event EventHandler? HaltungChanged;
|
||||
private void OnProjektChanged()
|
||||
{
|
||||
ProjektChanged?.Invoke(this, new EventArgs());
|
||||
}
|
||||
private void OnSchachtChanged()
|
||||
{
|
||||
SchachtChanged?.Invoke(this, new EventArgs());
|
||||
}
|
||||
private void OnHaltungChanged()
|
||||
{
|
||||
HaltungChanged?.Invoke(this, new EventArgs());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
24
StammGenerator/ViewModel/State/IActualState.cs
Normal file
24
StammGenerator/ViewModel/State/IActualState.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StammGenerator.ViewModel
|
||||
{
|
||||
public interface IActualState
|
||||
{
|
||||
event EventHandler? ProjektChanged;
|
||||
// TODO: ProjektID set entfernen!
|
||||
int ProjektID { get; set; }
|
||||
int SchachtID { get; }
|
||||
int HaltungID { get; }
|
||||
Schacht SelectedSchacht { get; }
|
||||
Kanal SelectedHaltung { get; }
|
||||
|
||||
void SetProjekt(Projekt projekt, bool notification = true);
|
||||
void SetSchacht(Schacht schacht, bool notification = true);
|
||||
void SetHaltung(Kanal haltung, bool notification = true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using StammGenerator.Interface;
|
||||
using System;
|
||||
|
||||
namespace StammGenerator.ViewModel
|
||||
{
|
||||
internal class MainWindowNavigator : ObservableObject, IMainWindowNavigator
|
||||
{
|
||||
private BaseViewModel _currentViewModel = new BaseViewModel();
|
||||
public BaseViewModel CurrentViewModel
|
||||
{
|
||||
get => _currentViewModel;
|
||||
set
|
||||
{
|
||||
_currentViewModel?.Dispose();
|
||||
_currentViewModel = value;
|
||||
StateChanged?.Invoke();
|
||||
}
|
||||
}
|
||||
public event Action StateChanged;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using StammGenerator.Interface;
|
||||
|
||||
namespace StammGenerator.ViewModel
|
||||
{
|
||||
internal class ViewModelDelegateRenavigator<TViewModel> : IRenavigator where TViewModel : BaseViewModel
|
||||
{
|
||||
private readonly IMainWindowNavigator _navigator;
|
||||
private readonly CreateViewModel<TViewModel> _createViewModel;
|
||||
|
||||
public ViewModelDelegateRenavigator(IMainWindowNavigator navigator, CreateViewModel<TViewModel> createViewModel)
|
||||
{
|
||||
_navigator = navigator;
|
||||
_createViewModel = createViewModel;
|
||||
}
|
||||
public void Renavigate()
|
||||
{
|
||||
_navigator.CurrentViewModel = _createViewModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
75
StammGenerator/Views/Haltung/HaltungEditView.xaml
Normal file
75
StammGenerator/Views/Haltung/HaltungEditView.xaml
Normal file
@@ -0,0 +1,75 @@
|
||||
<UserControl x:Class="StammGenerator.Views.HaltungEditView"
|
||||
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:StammGenerator.Views"
|
||||
xmlns:converter="clr-namespace:StammGenerator.Converters"
|
||||
xmlns:stat="clr-namespace:SewerStammGen.Shared.Enum;assembly=SewerStammGen.Shared"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<converter:ValueToEntConverter x:Key="EqualValueToEntwaesserungConverter" />
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="600" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="Obere Schacht" />
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="Untere Schacht" />
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="Haltungsbezeichnung" />
|
||||
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" Width="200" HorizontalAlignment="Left" Margin="5,5,5,5" DisplayMemberPath="Objektbezeichnung" SelectedIndex="{Binding SelectedObenIndex}" ItemsSource="{Binding AvSchaechte}"></ComboBox>
|
||||
<ComboBox Grid.Row="1" Grid.Column="1" Width="200" HorizontalAlignment="Left" Margin="5,5,5,5" DisplayMemberPath="Objektbezeichnung" SelectedIndex="{Binding SelectedUntenIndex}" ItemsSource="{Binding AvSchaechte}"></ComboBox>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Width="200" HorizontalAlignment="Left" Margin="5" Text="{Binding Haltungsbezeichnung}" />
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition Width="59*" />
|
||||
<ColumnDefinition Width="241*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label VerticalAlignment="Center" Grid.Column="0" Content="Material" />
|
||||
<Label VerticalAlignment="Center" Grid.Row="1" Grid.Column="0" Content="Durchmesser" />
|
||||
<Label VerticalAlignment="Center" Grid.Row="2" Grid.Column="0" Content="Haltungslänge" />
|
||||
<Label VerticalAlignment="Center" Grid.Row="3" Grid.Column="0" Content="Entwässerungsart" />
|
||||
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Width="200" HorizontalAlignment="Left" Margin="5,5,5,5" Text="{Binding Material}" Grid.ColumnSpan="2" />
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Width="200" HorizontalAlignment="Left" Margin="5,5,5,5" Text="{Binding Durchmesser}" Grid.ColumnSpan="2" />
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Width="100" HorizontalAlignment="Left" Margin="5,5,5,5" Text="{Binding Haltungslaenge}" Grid.ColumnSpan="2" />
|
||||
<DockPanel Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2">
|
||||
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Regenwasser" IsChecked="{Binding Entwaeserung, Converter={StaticResource EqualValueToEntwaesserungConverter},ConverterParameter={x:Static stat:EEntwaeserung.Regenwasser}}" />
|
||||
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Schmutzwasser" IsChecked="{Binding Entwaeserung, Converter={StaticResource EqualValueToEntwaesserungConverter},ConverterParameter={x:Static stat:EEntwaeserung.Schmutzwasser}}" />
|
||||
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Mischwasser" IsChecked="{Binding Entwaeserung, Converter={StaticResource EqualValueToEntwaesserungConverter},ConverterParameter={x:Static stat:EEntwaeserung.Mischwasser}}" />
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
|
||||
<TabPanel Grid.Row="2">
|
||||
<Button Margin="10,10,5,10" Content="Speichern" Command="{Binding Speichern}" Width="160" Height="160" HorizontalAlignment="Left" BorderThickness="2" BorderBrush="Green" />
|
||||
<Button Margin="5,10,10,10" Content="Abbrechen" Command="{Binding Abbrechen}" Width="160" Height="160" HorizontalAlignment="Left" BorderThickness="2" BorderBrush="Red" />
|
||||
</TabPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
28
StammGenerator/Views/Haltung/HaltungEditView.xaml.cs
Normal file
28
StammGenerator/Views/Haltung/HaltungEditView.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
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 StammGenerator.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für HaltungEditView.xaml
|
||||
/// </summary>
|
||||
public partial class HaltungEditView : UserControl
|
||||
{
|
||||
public HaltungEditView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
26
StammGenerator/Views/Haltung/HaltungListView.xaml
Normal file
26
StammGenerator/Views/Haltung/HaltungListView.xaml
Normal file
@@ -0,0 +1,26 @@
|
||||
<UserControl x:Class="StammGenerator.Views.HaltungListView"
|
||||
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:StammGenerator.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<StackPanel>
|
||||
<DataGrid ItemsSource="{Binding Haltungen}" AutoGenerateColumns="False" SelectedItem="{Binding SelectedHaltung}" IsReadOnly="False">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Objektbezeichnung" Binding="{Binding Objektbezeichnung}" />
|
||||
<DataGridTextColumn Header="Obere Schacht" Binding="{Binding StartSchacht.Objektbezeichnung}" />
|
||||
<DataGridTextColumn Header="Untere Schacht" Binding="{Binding EndSchacht.Objektbezeichnung}" />
|
||||
<DataGridTextColumn Header="DN" Binding="{Binding DN}" />
|
||||
<DataGridTextColumn Header="Material" Binding="{Binding Material}" />
|
||||
<DataGridTextColumn Header="Haltungslänge" Binding="{Binding Haltungslaenge}" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Button Content="Hinzufügen" Command="{Binding AddCommand}" />
|
||||
<Button Content="Editieren" Command="{Binding EditCommand}" />
|
||||
<Button Content="Daten Exportieren" Command="{Binding ExportCommand}" Width="220" Height="220" BorderBrush="AliceBlue" BorderThickness="5" HorizontalAlignment="Left" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
StammGenerator/Views/Haltung/HaltungListView.xaml.cs
Normal file
28
StammGenerator/Views/Haltung/HaltungListView.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
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 StammGenerator.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für HaltungListView.xaml
|
||||
/// </summary>
|
||||
public partial class HaltungListView : UserControl
|
||||
{
|
||||
public HaltungListView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
StammGenerator/Views/HomeView.xaml
Normal file
12
StammGenerator/Views/HomeView.xaml
Normal file
@@ -0,0 +1,12 @@
|
||||
<UserControl x:Class="StammGenerator.Views.HomeView"
|
||||
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:StammGenerator.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<TextBlock Text="Willkommen dieses Programm generiert Stammdaten für die TV Inspektion" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
StammGenerator/Views/HomeView.xaml.cs
Normal file
28
StammGenerator/Views/HomeView.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
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 StammGenerator.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für HomeView.xaml
|
||||
/// </summary>
|
||||
public partial class HomeView : UserControl
|
||||
{
|
||||
public HomeView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
24
StammGenerator/Views/MainWindowNavigationBar.xaml
Normal file
24
StammGenerator/Views/MainWindowNavigationBar.xaml
Normal file
@@ -0,0 +1,24 @@
|
||||
<UserControl x:Class="StammGenerator.Views.MainWindowNavigationBar"
|
||||
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:StammGenerator.Views"
|
||||
xmlns:nav="clr-namespace:StammGenerator.Enum"
|
||||
xmlns:viewmodel="clr-namespace:StammGenerator.ViewModel"
|
||||
mc:Ignorable="d"
|
||||
xmlns:converter="clr-namespace:StammGenerator.Converters"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<converter:EqualValueToParameterConverter x:Key="EqualValueToParameterConverter" />
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<StackPanel>
|
||||
<RadioButton IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:HomeViewModel}}" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.Home}" Style="{StaticResource ToggleButtonList}" Content="Home" />
|
||||
<RadioButton IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:ProjektListViewModel}}" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.ProjectList}" Style="{StaticResource ToggleButtonList}" Content="Projekte" />
|
||||
<RadioButton IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:ManholeListViewModel}}" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.SchachtList}" Style="{StaticResource ToggleButtonList}" Content="Schächte" />
|
||||
<RadioButton IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:HaltungListViewModel}}" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.HaltungList}" Style="{StaticResource ToggleButtonList}" Content="Haltungen" />
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
StammGenerator/Views/MainWindowNavigationBar.xaml.cs
Normal file
28
StammGenerator/Views/MainWindowNavigationBar.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
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 StammGenerator.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für MainWindowNavigationBar.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindowNavigationBar : UserControl
|
||||
{
|
||||
public MainWindowNavigationBar()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
35
StammGenerator/Views/Projekt/ProjektEditView.xaml
Normal file
35
StammGenerator/Views/Projekt/ProjektEditView.xaml
Normal file
@@ -0,0 +1,35 @@
|
||||
<UserControl x:Class="StammGenerator.Views.ProjektEditView"
|
||||
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:StammGenerator.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Column="0" Grid.Row="0" Content="Projektname" />
|
||||
<Label Grid.Column="0" Grid.Row="1" Content="Erstelldatum" />
|
||||
<Label Grid.Column="0" Grid.Row="2" Content="Strasse" />
|
||||
<Label Grid.Column="0" Grid.Row="3" Content="Ort" />
|
||||
|
||||
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding ProjektName}" />
|
||||
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding Erstelldatum}" />
|
||||
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding Strasse}" />
|
||||
<TextBox Grid.Column="1" Grid.Row="3" Text="{Binding Ort}" />
|
||||
|
||||
<Button Grid.ColumnSpan="2" Grid.Row="4" Content="Speichern" Command="{Binding Speichern}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
StammGenerator/Views/Projekt/ProjektEditView.xaml.cs
Normal file
28
StammGenerator/Views/Projekt/ProjektEditView.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
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 StammGenerator.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für ProjektEditView.xaml
|
||||
/// </summary>
|
||||
public partial class ProjektEditView : UserControl
|
||||
{
|
||||
public ProjektEditView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
24
StammGenerator/Views/Projekt/ProjektListView.xaml
Normal file
24
StammGenerator/Views/Projekt/ProjektListView.xaml
Normal file
@@ -0,0 +1,24 @@
|
||||
<UserControl x:Class="StammGenerator.Views.ProjektListView"
|
||||
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:StammGenerator.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<StackPanel>
|
||||
<DataGrid Margin="10" SelectedItem="{Binding SelectedProjekt}" ItemsSource="{Binding Projekte}" IsReadOnly="True" SelectionMode="Single" AutoGenerateColumns="False">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Projektname" Binding="{Binding Projektname}" />
|
||||
<DataGridTextColumn Header="Erstelldatum" Binding="{Binding Erstelldatum}" />
|
||||
<DataGridTextColumn Header="Strasse" Binding="{Binding Strasse}" />
|
||||
<DataGridTextColumn Header="Ort" Binding="{Binding Ort}" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Button Margin="2" FontSize="20" Content="Projekt Auswählen" IsEnabled="{Binding CanSelectProjekt}" Command="{Binding SelectCommand}" />
|
||||
<Button Margin="2" FontSize="20" Content="Projekt Editieren" IsEnabled="{Binding CanSelectProjekt}" Command="{Binding EditCommand}" />
|
||||
<Button Margin="2" FontSize="20" Content="Projekt Anlegen" Command="{Binding AddCommand}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
StammGenerator/Views/Projekt/ProjektListView.xaml.cs
Normal file
28
StammGenerator/Views/Projekt/ProjektListView.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
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 StammGenerator.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für ProjektListView.xaml
|
||||
/// </summary>
|
||||
public partial class ProjektListView : UserControl
|
||||
{
|
||||
public ProjektListView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
63
StammGenerator/Views/Schacht/SchachtEditView.xaml
Normal file
63
StammGenerator/Views/Schacht/SchachtEditView.xaml
Normal file
@@ -0,0 +1,63 @@
|
||||
<UserControl x:Class="StammGenerator.Views.SchachtEditView"
|
||||
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:viewmodel="clr-namespace:StammGenerator.ViewModel"
|
||||
|
||||
xmlns:local="clr-namespace:StammGenerator.Views"
|
||||
mc:Ignorable="d"
|
||||
xmlns:converter="clr-namespace:StammGenerator.Converters"
|
||||
xmlns:stat="clr-namespace:SewerStammGen.Shared.Enum;assembly=SewerStammGen.Shared"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<converter:ValueToEntConverter x:Key="EqualValueToEntwaesserungConverter" />
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="520" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Column="0" Grid.Row="0" Content="Bezeichnung" />
|
||||
<Label Grid.Column="0" Grid.Row="1" Content="Deckel Rechtswert" />
|
||||
<Label Grid.Column="0" Grid.Row="2" Content="Deckel Hochwert" />
|
||||
<Label Grid.Column="0" Grid.Row="3" Content="Deckel Höhe" />
|
||||
<Label Grid.Column="0" Grid.Row="4" Content="Sohl Rechtswert" />
|
||||
<Label Grid.Column="0" Grid.Row="5" Content="Sohl Hochwert" />
|
||||
<Label Grid.Column="0" Grid.Row="6" Content="Sohl Höhe" />
|
||||
<!--<Label Grid.Column="0" Grid.Row="7" Content="Deckelhöhe" />-->
|
||||
<Label Grid.Column="0" Grid.Row="7" Content="Entwässerungsart" />
|
||||
|
||||
<TextBox Margin="2" Grid.Column="1" Grid.Row="0" Text="{Binding Objektbezeichnung}" />
|
||||
<TextBox Margin="2" Grid.Column="1" Grid.Row="1" Text="{Binding DeckelRechtsWert}" />
|
||||
<TextBox Margin="2" Grid.Column="1" Grid.Row="2" Text="{Binding DeckelHochWert}" />
|
||||
<TextBox Margin="2" Grid.Column="1" Grid.Row="3" Text="{Binding DeckelHoehe}" />
|
||||
<TextBox Margin="2" Grid.Column="1" Grid.Row="4" Text="{Binding SohlRechtsWert}" />
|
||||
<TextBox Margin="2" Grid.Column="1" Grid.Row="5" Text="{Binding SohlHochWert}" />
|
||||
<TextBox Margin="2" Grid.Column="1" Grid.Row="6" Text="{Binding SohlHoehe}" />
|
||||
|
||||
<DockPanel Grid.Column="1" Grid.Row="7">
|
||||
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Regenwasser" IsChecked="{Binding Entwaeserung, Converter={StaticResource EqualValueToEntwaesserungConverter},ConverterParameter={x:Static stat:EEntwaeserung.Regenwasser}}" />
|
||||
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Schmutzwasser" IsChecked="{Binding Entwaeserung, Converter={StaticResource EqualValueToEntwaesserungConverter},ConverterParameter={x:Static stat:EEntwaeserung.Schmutzwasser}}" />
|
||||
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Mischwasser" IsChecked="{Binding Entwaeserung, Converter={StaticResource EqualValueToEntwaesserungConverter},ConverterParameter={x:Static stat:EEntwaeserung.Mischwasser}}" />
|
||||
</DockPanel>
|
||||
|
||||
|
||||
<StackPanel Grid.ColumnSpan="2" Grid.Row="8">
|
||||
<Button Content="Speichern" Command="{Binding Speichern}" />
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
StammGenerator/Views/Schacht/SchachtEditView.xaml.cs
Normal file
28
StammGenerator/Views/Schacht/SchachtEditView.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
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 StammGenerator.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für SchachtEditView.xaml
|
||||
/// </summary>
|
||||
public partial class SchachtEditView : UserControl
|
||||
{
|
||||
public SchachtEditView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
24
StammGenerator/Views/Schacht/SchachtImportView.xaml
Normal file
24
StammGenerator/Views/Schacht/SchachtImportView.xaml
Normal file
@@ -0,0 +1,24 @@
|
||||
<UserControl x:Class="StammGenerator.Views.SchachtImportView"
|
||||
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:StammGenerator.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="Dateiname" />
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding FileName}" Margin="20,20,20,132" />
|
||||
<Button Grid.Row="0" Grid.Column="1" Content="Datei wählen" Margin="120,170,200,4" Command="{Binding OpenFileDialogCommand}" />
|
||||
|
||||
<Button Grid.Row="1" Grid.ColumnSpan="2" Content="Laden" Command="{Binding LoadFile}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
StammGenerator/Views/Schacht/SchachtImportView.xaml.cs
Normal file
28
StammGenerator/Views/Schacht/SchachtImportView.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
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 StammGenerator.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für SchachtImportView.xaml
|
||||
/// </summary>
|
||||
public partial class SchachtImportView : UserControl
|
||||
{
|
||||
public SchachtImportView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
32
StammGenerator/Views/Schacht/SchachtListView.xaml
Normal file
32
StammGenerator/Views/Schacht/SchachtListView.xaml
Normal file
@@ -0,0 +1,32 @@
|
||||
<UserControl x:Class="StammGenerator.Views.SchachtListView"
|
||||
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:StammGenerator.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<DataGrid Grid.Row="0" ItemsSource="{Binding Schaechte}" AutoGenerateColumns="False" IsReadOnly="True" SelectionMode="Single" SelectedItem="{Binding SelectedSchacht}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Schachtnummer" Binding="{Binding Objektbezeichnung}" />
|
||||
<!--<DataGridTextColumn Header="Rechtswert" Binding="{Binding RechtsWert}" />-->
|
||||
<!--<DataGridTextColumn Header="Hochwert" Binding="{Binding HochWert}" />-->
|
||||
<!--<DataGridTextColumn Header="Sohlhöhe" Binding="{Binding SohlHoehe}" />-->
|
||||
<!--<DataGridTextColumn Header="Deckelhöhe" Binding="{Binding DeckelHoehe}" />-->
|
||||
<DataGridTextColumn Header="Entwässerung" Binding="{Binding Entwaesserung}" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<StackPanel Grid.Row="1">
|
||||
<Button Content="Schacht hinzufügen" Command="{Binding AddSchachtCommand}" />
|
||||
<Button Content="Schacht Editieren" Command="{Binding EditSchachtCommand}" />
|
||||
<Button Content="Schacht Löschen" Command="{Binding DeleteSchachtCommand}" />
|
||||
<Button Content="Schächte aus CSV Laden" Command="{Binding ImportSchachtCommand}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
StammGenerator/Views/Schacht/SchachtListView.xaml.cs
Normal file
28
StammGenerator/Views/Schacht/SchachtListView.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
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 StammGenerator.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für SchachtListView.xaml
|
||||
/// </summary>
|
||||
public partial class SchachtListView : UserControl
|
||||
{
|
||||
public SchachtListView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
30
StammGenerator/Views/styles/my_controls.xaml
Normal file
30
StammGenerator/Views/styles/my_controls.xaml
Normal file
@@ -0,0 +1,30 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style x:Key="ToggleButtonList" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="FrameworkElement.OverridesDefaultStyle" Value="True"/>
|
||||
<Setter Property="FrameworkElement.FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="Width" Value="170" />
|
||||
<Setter Property="Height" Value="70" />
|
||||
<Setter Property="Margin" Value="2" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
<Grid>
|
||||
<Rectangle Name="rect" Fill="#FF808080" Stretch="Fill"/>
|
||||
<ContentPresenter VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5" RecognizesAccessKey="True" TextBlock.FontFamily="Seggeo" TextBlock.FontSize="16" TextBlock.Foreground="#FFFFFFFF" TextBlock.FontWeight="Light" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="UIElement.IsMouseOver" Value="True">
|
||||
<Setter TargetName="rect" Property="Shape.Fill" Value="BlueViolet"/>
|
||||
<Setter Property="Foreground" Value="#FFFFFFFF"/>
|
||||
</Trigger>
|
||||
<Trigger Property="ToggleButton.IsChecked" Value="True">
|
||||
<Setter TargetName="rect" Property="Shape.Fill" Value="BlueViolet" />
|
||||
<Setter Property="Foreground" Value="#FFFFFFFF" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
7
StammGenerator/appsettings.json
Normal file
7
StammGenerator/appsettings.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"databaseToUse": "postgresql",
|
||||
"postgresql": "Host = localhost; Database = SewerGen; Username = SewerGen; Password = SewerGen",
|
||||
"sqlite": "Data Source=database.db"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user