Haltung exporter angefangen

This commit is contained in:
2023-04-13 18:58:53 +02:00
parent 33d0b1da93
commit 19bba6dfc1
15 changed files with 62 additions and 25 deletions

View File

@@ -27,7 +27,6 @@ namespace SewerStammGen.WPF.Commands
public override async Task ExecuteAsync(object? parameter)
{
Debugger.Break();
_haltungEditViewModel.Model = await _haltungDataService.Update(_haltungEditViewModel.Model);
_renavigator.Renavigate();

View File

@@ -0,0 +1,29 @@
using SewerStammGen.Shared.Domain;
using SewerStammGen.WPF.ViewModel.State;
using Shared.Contracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SewerStammGen.WPF.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>());
}
}
}

View File

@@ -11,7 +11,6 @@
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
<PackageReference Include="Syncfusion.SfGrid.WPF" Version="20.4.0.54" />
</ItemGroup>
<ItemGroup>

View File

@@ -137,6 +137,7 @@ namespace SewerStammGen.WPF.ViewModel
}
public ICommand Speichern { get; set; }
public ICommand Abbrechen { get; set; }
public HaltungEditViewModel(
IHaltungDataService haltungDataService,
@@ -153,6 +154,7 @@ namespace SewerStammGen.WPF.ViewModel
_model = _actualState.SelectedHaltung;
Speichern = new HaltungEditSaveCommand(_haltungDataService, renavigator, this);
Abbrechen = new RelayCommand((x) => Abbruch(renavigator));
ladeVerfuegbareSchaechte();
@@ -160,6 +162,11 @@ namespace SewerStammGen.WPF.ViewModel
}
private void Abbruch(IRenavigator renavigator)
{
renavigator.Renavigate();
}
private async void ladeVerfuegbareSchaechte()
{
var s = await _schachtDataService.GetAllByProjekt(_actualState.ProjektID);

View File

@@ -24,6 +24,7 @@ namespace SewerStammGen.WPF.ViewModel
public ICommand EditCommand { get; set; }
public ICommand AddCommand { get; set; }
public ICommand ExportCommand { get; set; }
public HaltungListViewModel(IHaltungDataService haltungDataService, IActualState actualState, IRenavigator renavigator )
{
@@ -35,6 +36,7 @@ namespace SewerStammGen.WPF.ViewModel
EditCommand = new HaltungEditCommand(actualState, renavigator, this);
AddCommand = new HaltungAddCommand();
ExportCommand = new ProjectExportCommand(actualState);
LoadHaltungen();
}

View File

@@ -1,5 +1,5 @@
using Microsoft.Xaml.Behaviors;
using Syncfusion.UI.Xaml.Grid;
//using Syncfusion.UI.Xaml.Grid;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -8,6 +8,7 @@ using System.Threading.Tasks;
namespace SewerStammGen.WPF.Views
{
/*
public class TextBoxFilterAction : TargetedTriggerAction<SfMultiColumnDropDownControl>
{
protected override void Invoke(object parameter)
@@ -15,4 +16,5 @@ namespace SewerStammGen.WPF.Views
throw new NotImplementedException();
}
}
*/
}

View File

@@ -9,7 +9,7 @@ namespace SewerStammGen.WPF.ViewModel.State.Navigation
{
internal class MainWindowNavigator : ObservableObject, IMainWindowNavigator
{
private BaseViewModel _currentViewModel;
private BaseViewModel _currentViewModel = new BaseViewModel();
public BaseViewModel CurrentViewModel
{
get => _currentViewModel;

View File

@@ -12,7 +12,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="600" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.RowDefinitions>
@@ -29,11 +29,9 @@
<Label Grid.Row="1" Grid.Column="0" Content="Untere Schacht" />
<Label Grid.Row="2" Grid.Column="0" Content="Haltungsbezeichnung" />
<!--<TextBox Grid.Row="0" Grid.Column="1" Margin="5" Text="{Binding ObereSchacht}" />-->
<ComboBox Grid.Row="0" Grid.Column="1" DisplayMemberPath="Objektbezeichnung" SelectedIndex="{Binding SelectedObenIndex}" ItemsSource="{Binding AvSchaechte}"></ComboBox>
<ComboBox Grid.Row="1" Grid.Column="1" DisplayMemberPath="Objektbezeichnung" SelectedIndex="{Binding SelectedUntenIndex}" ItemsSource="{Binding AvSchaechte}"></ComboBox>
<!--<TextBox Grid.Row="1" Grid.Column="1" Margin="5" Text="{Binding UntereSchacht}" />-->
<TextBox Grid.Row="2" Grid.Column="1" Margin="5" Text="{Binding 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">
@@ -53,19 +51,20 @@
<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" Margin="5,5,5,5" Text="{Binding Material}" Grid.ColumnSpan="2" />
<TextBox Grid.Row="1" Grid.Column="1" Margin="5,5,5,5" Text="{Binding Durchmesser}" Grid.ColumnSpan="2" />
<TextBox Grid.Row="2" Grid.Column="1" Margin="5,5,5,5" Text="{Binding Haltungslaenge}" Grid.ColumnSpan="2" />
<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" />
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Schmutzwasser" />
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Mischwasser" />
</DockPanel>
</Grid>
<StackPanel Grid.Row="4">
<Button Content="Speichern" Command="{Binding Speichern}" />
<!--<ListBox ItemsSource="{Binding VerfuegbareSchaechte }" />-->
</StackPanel>
<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>

View File

@@ -20,6 +20,7 @@
</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>