Library material was added

This commit is contained in:
Evgeny Redikultsev
2022-11-06 18:55:01 +05:00
parent 1cf54603bc
commit 5d19958fd7
52 changed files with 1018 additions and 171 deletions

View File

@@ -13,29 +13,46 @@
<ColumnDefinition/>
<ColumnDefinition Width="120"/>
</Grid.ColumnDefinitions>
<ListBox ItemsSource="{Binding HeadMaterials}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0" Margin="3">
<Rectangle.Fill>
<SolidColorBrush Color="{Binding Color}"/>
</Rectangle.Fill>
</Rectangle>
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<ListBox ItemsSource="{Binding HeadMaterials}" SelectedItem="{Binding SelectedMaterial}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20"/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0" Margin="3">
<Rectangle.Fill>
<SolidColorBrush Color="{Binding Color}"/>
</Rectangle.Fill>
</Rectangle>
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<TextBox Grid.Row="1" Text="{Binding SelectedMaterial.Name}"/>
<ComboBox Grid.Row="2" ItemsSource="{Binding LibMaterials}" SelectedItem="{Binding SelectedLibMaterial}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Grid>
<StackPanel Grid.Column="1">
<Button Content="New Concrete" Command="{Binding AddHeadMaterial}"/>
<Button Content="New Reinforcement" Command="{Binding AddHeadMaterial}"/>
<Button Content="Edit" Command="{Binding EditHeadMaterial}"/>
<Button Content="Edit" Command="{Binding DeleteHeadMaterial}"/>
<Button Content="New Material" Command="{Binding AddNewMaterialCommand}"/>
<Button Content="Edit color" Command="{Binding EditColorCommand}"/>
<Button Content="Copy" Command="{Binding CopyHeadMaterialCommand}"/>
<Button Content="Delete" Command="{Binding DeleteMaterialCommand}"/>
</StackPanel>
</Grid>
</Window>

View File

@@ -1,5 +1,6 @@
using StructureHelper.Models.Materials;
using StructureHelper.Windows.ViewModels.Materials;
using StructureHelperLogics.Models.Materials;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -23,9 +24,9 @@ namespace StructureHelper.Windows.MainWindow.Materials
{
private HeadMaterialsViewModel viewmodel;
public HeadMaterialsView(IEnumerable<IHeadMaterial> materials)
public HeadMaterialsView(IHeadMaterialRepository headMaterialRepository)
{
viewmodel = new HeadMaterialsViewModel(materials);
viewmodel = new HeadMaterialsViewModel(headMaterialRepository);
this.DataContext = viewmodel;
InitializeComponent();
}