Schachtedit view hinzugefügt

This commit is contained in:
2023-03-26 14:29:14 +02:00
parent 9007099d56
commit 525972b7f3
14 changed files with 125 additions and 35 deletions

View File

@@ -10,7 +10,7 @@ namespace SewerStammGen.Enum
{ {
Home, Home,
Projects, Projects,
Manholes, EditSchacht,
Sewer Sewer
} }
} }

View File

@@ -23,6 +23,11 @@ namespace SewerStammGen.HostBuilders
return () => new HomeViewModel(); return () => new HomeViewModel();
}); });
services.AddSingleton<CreateViewModel<EditManHoleViewModel>>(services =>
{
return () => new EditManHoleViewModel();
});
services.AddSingleton<IViewModelAbstractFactory, MainWindowViewModelFactory>(); services.AddSingleton<IViewModelAbstractFactory, MainWindowViewModelFactory>();

View File

@@ -5,9 +5,21 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:my="clr-namespace:SewerStammGen.Views" xmlns:my="clr-namespace:SewerStammGen.Views"
xmlns:local="clr-namespace:SewerStammGen" xmlns:local="clr-namespace:SewerStammGen"
xmlns:view="clr-namespace:SewerStammGen.Views"
xmlns:viewmodel="clr-namespace:SewerStammGen.ViewModel"
xmlns:controls="clr-namespace:SewerStammGen.Views.Controls" xmlns:controls="clr-namespace:SewerStammGen.Views.Controls"
mc:Ignorable="d" mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800"> Title="{Binding ApplicationTitle}" Height="450" Width="800">
<Window.Resources>
<DataTemplate DataType="{x:Type viewmodel:HomeViewModel}">
<view:HomeView />
</DataTemplate>
<DataTemplate DataType="{x:Type viewmodel:EditManHoleViewModel}">
<view:UCEditSchacht />
</DataTemplate>
</Window.Resources>
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="200" /> <ColumnDefinition Width="200" />

View File

@@ -10,10 +10,10 @@
<Compile Update="Views\Controls\UCMainWindowNavigationBar.xaml.cs"> <Compile Update="Views\Controls\UCMainWindowNavigationBar.xaml.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Update="Views\EditSchacht.xaml.cs"> <Compile Update="Views\HomeView.xaml.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Update="Views\HomeView.xaml.cs"> <Compile Update="Views\UCEditSchacht.xaml.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Update="Views\UCNormXML.xaml.cs"> <Compile Update="Views\UCNormXML.xaml.cs">
@@ -30,15 +30,15 @@
<Page Update="Views\Controls\UCMainWindowNavigationBar.xaml"> <Page Update="Views\Controls\UCMainWindowNavigationBar.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Update="Views\EditSchacht.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Views\HomeView.xaml"> <Page Update="Views\HomeView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Update="Views\styles\my_controls.xaml"> <Page Update="Views\styles\my_controls.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Update="Views\UCEditSchacht.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Views\UCNormXML.xaml"> <Page Update="Views\UCNormXML.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SewerStammGen.ViewModel
{
public class EditManHoleViewModel : BaseViewModel
{
}
}

View File

@@ -11,12 +11,15 @@ namespace SewerStammGen.ViewModel.Factories
public class MainWindowViewModelFactory : IViewModelAbstractFactory public class MainWindowViewModelFactory : IViewModelAbstractFactory
{ {
private CreateViewModel<HomeViewModel> _createHomeViewModel; private CreateViewModel<HomeViewModel> _createHomeViewModel;
private CreateViewModel<EditManHoleViewModel> _createEditManholeViewModel;
public MainWindowViewModelFactory( public MainWindowViewModelFactory(
CreateViewModel<HomeViewModel> createHomeViewModel CreateViewModel<HomeViewModel> createHomeViewModel,
CreateViewModel<EditManHoleViewModel> createEditManholeViewModel
) )
{ {
_createHomeViewModel = createHomeViewModel; _createHomeViewModel = createHomeViewModel;
_createEditManholeViewModel = createEditManholeViewModel;
} }
public BaseViewModel CreateViewModel(EMainWindowViewType viewType) public BaseViewModel CreateViewModel(EMainWindowViewType viewType)
@@ -26,6 +29,9 @@ namespace SewerStammGen.ViewModel.Factories
case EMainWindowViewType.Home: case EMainWindowViewType.Home:
return _createHomeViewModel(); return _createHomeViewModel();
case EMainWindowViewType.EditSchacht:
return _createEditManholeViewModel();
default: default:
throw new NotImplementedException(); throw new NotImplementedException();
} }

View File

@@ -19,6 +19,11 @@ namespace SewerStammGen.ViewModel
public ICommand UpdateCurrentViewModelCommand { get; } public ICommand UpdateCurrentViewModelCommand { get; }
public static string ApplicationTitle
{
get => "Stammdatengenerator Version 0.1";
}
public MainWindowViewModel( public MainWindowViewModel(
IMainWindowNavigator navigator, IMainWindowNavigator navigator,
IViewModelAbstractFactory viewModelFactory IViewModelAbstractFactory viewModelFactory
@@ -29,6 +34,15 @@ namespace SewerStammGen.ViewModel
UpdateCurrentViewModelCommand = new UpdateCurrentViewModelCommand(navigator, viewModelFactory); UpdateCurrentViewModelCommand = new UpdateCurrentViewModelCommand(navigator, viewModelFactory);
UpdateCurrentViewModelCommand.Execute(EMainWindowViewType.Home); UpdateCurrentViewModelCommand.Execute(EMainWindowViewType.Home);
Navigator.StateChanged += Navigator_StateChanged;
}
private void Navigator_StateChanged()
{
OnPropertyChanged(nameof(CurrentViewModel));
} }
} }
} }

View File

@@ -16,8 +16,8 @@
<Grid> <Grid>
<StackPanel> <StackPanel>
<RadioButton Content="Home" 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}" /> <RadioButton Content="Home" 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}" />
<RadioButton Content="Projekte" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.Projects}" Style="{StaticResource ToggleButtonList}" /> <RadioButton IsEnabled="False" Content="Projekte" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.Projects}" Style="{StaticResource ToggleButtonList}" />
<RadioButton Content="Schächte" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.Manholes}" Style="{StaticResource ToggleButtonList}" /> <RadioButton Content="Schächte" IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:EditManHoleViewModel}}" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.EditSchacht}" Style="{StaticResource ToggleButtonList}" />
<RadioButton Content="Kanäle" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.Sewer}" Style="{StaticResource ToggleButtonList}" /> <RadioButton Content="Kanäle" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.Sewer}" Style="{StaticResource ToggleButtonList}" />
</StackPanel> </StackPanel>

View File

@@ -1,14 +0,0 @@
<Page x:Class="SewerStammGen.Views.EditSchacht"
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:SewerStammGen.Views"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
Title="EditSchacht">
<Grid>
</Grid>
</Page>

View File

@@ -7,6 +7,6 @@
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<Grid> <Grid>
<TextBlock Text="Willkommen" /> <TextBlock Text="Willkommen dieses Programm generiert Stammdaten für die TV Inspektion" />
</Grid> </Grid>
</UserControl> </UserControl>

View File

@@ -0,0 +1,40 @@
<UserControl x:Class="SewerStammGen.Views.UCEditSchacht"
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:SewerStammGen.Views"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="400" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Label FontSize="20" Grid.Column="0" Grid.Row="0" Content="Bezeichnung" />
<Label FontSize="20" Grid.Column="0" Grid.Row="1" Content="Rechtswert" />
<Label FontSize="20" Grid.Column="0" Grid.Row="2" Content="Hochwert" />
<Label FontSize="20" Grid.Column="0" Grid.Row="3" Content="Sohlhöhe" />
<Label FontSize="20" Grid.Column="0" Grid.Row="4" Content="Deckelhöhe" />
<TextBox Margin="2" FontSize="20" Grid.Column="1" Grid.Row="0" Text="{Binding X}" />
<TextBox Margin="2" FontSize="20" Grid.Column="1" Grid.Row="1" Text="{Binding X}" />
<TextBox Margin="2" FontSize="20" Grid.Column="1" Grid.Row="2" Text="{Binding X}" />
<TextBox Margin="2" FontSize="20" Grid.Column="1" Grid.Row="3" Text="{Binding X}" />
<TextBox Margin="2" FontSize="20" Grid.Column="1" Grid.Row="4" Text="{Binding X}" />
<StackPanel Grid.ColumnSpan="2" Grid.Row="5">
<Button FontSize="20" Content="Speichern" />
</StackPanel>
</Grid>
</UserControl>

View File

@@ -16,11 +16,11 @@ using System.Windows.Shapes;
namespace SewerStammGen.Views namespace SewerStammGen.Views
{ {
/// <summary> /// <summary>
/// Interaktionslogik für EditSchacht.xaml /// Interaktionslogik für UCEditSchacht.xaml
/// </summary> /// </summary>
public partial class EditSchacht : Page public partial class UCEditSchacht : UserControl
{ {
public EditSchacht() public UCEditSchacht()
{ {
InitializeComponent(); InitializeComponent();
} }

View File

@@ -6,10 +6,14 @@ using System.Threading.Tasks;
namespace Shared.Domain namespace Shared.Domain
{ {
internal class Kanal public class Kanal
{ {
public int Id { get; set; }
public string Objektbezeichnung { get; set; }
Schacht? startSchacht = null; Schacht? startSchacht = null;
Schacht? endSchacht = null; Schacht? endSchacht = null;
string objektbezeichnung = ""; public int DN { get; set; }
public string Material { get; set; }
} }
} }

View File

@@ -1,16 +1,27 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Shared.Domain namespace Shared.Domain
{ {
internal class Schacht public class Schacht
{ {
string objektbezeichnung = ""; public int Id { get; set; }
decimal rechtsWert; public string Objektbezeichnung { get; set; }
decimal hochwert;
decimal hoehe; [Column(TypeName = "decimal(18,4)")]
public decimal RechtsWert { get; set; }
[Column(TypeName = "decimal(18,4)")]
public decimal HochWert { get; set; }
[Column(TypeName = "decimal(18,4)")]
public decimal SohlHoehe { get; set; }
[Column(TypeName = "decimal(18,4)")]
public decimal DeckelHoehe { get; set; }
} }
} }