All Test Was Repaired
This commit is contained in:
@@ -9,10 +9,22 @@
|
||||
mc:Ignorable="d"
|
||||
Title="Materials" Height="350" Width="680" MinHeight="350" MinWidth="680" WindowStartupLocation="CenterScreen">
|
||||
<Window.Resources>
|
||||
<DataTemplate x:Key="LibMaterial">
|
||||
<DataTemplate x:Key="ConcreteLibMaterial">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Library material"/>
|
||||
<ComboBox Grid.Row="2" Height="25" VerticalAlignment="Top" ItemsSource="{Binding LibMaterials}" SelectedItem="{Binding SelectedLibMaterial}">
|
||||
<ComboBox Grid.Row="2" Height="25" VerticalAlignment="Top" ItemsSource="{Binding LibConcreteMaterials}" SelectedItem="{Binding SelectedLibMaterial}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Name}"/>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="ReinforcementLibMaterial">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Library material"/>
|
||||
<ComboBox Grid.Row="2" Height="25" VerticalAlignment="Top" ItemsSource="{Binding LibReinforcementMaterials}" SelectedItem="{Binding SelectedLibMaterial}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Name}"/>
|
||||
@@ -74,7 +86,8 @@
|
||||
</ListBox>
|
||||
</Grid>
|
||||
<StackPanel Grid.Column="1">
|
||||
<Button Content="New Lib Material" Command="{Binding AddNewMaterialCommand}"/>
|
||||
<Button Content="New Concrete" Command="{Binding AddNewConcreteMaterialCommand}"/>
|
||||
<Button Content="New Reinforcement" Command="{Binding AddNewReinforcementMaterialCommand}"/>
|
||||
<Button Content="New Elastic Material" Command="{Binding AddElasticMaterialCommand}"/>
|
||||
<Button Content="Edit color" Command="{Binding EditColorCommand}"/>
|
||||
<Button Content="Copy" Command="{Binding CopyHeadMaterialCommand}"/>
|
||||
|
||||
@@ -25,13 +25,8 @@ namespace StructureHelper.Windows.MainWindow.Materials
|
||||
{
|
||||
private HeadMaterialsViewModel viewModel;
|
||||
|
||||
public HeadMaterialsView(IHeadMaterialRepository headMaterialRepository)
|
||||
{
|
||||
viewModel = new HeadMaterialsViewModel(headMaterialRepository);
|
||||
this.DataContext = viewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
//public HeadMaterialsView(List<IHeadMaterial> headMaterials) : this(new HeadMaterialsViewModel(headMaterials)) {}
|
||||
public HeadMaterialsView(IHasHeadMaterials hasHeadMaterials) : this(new HeadMaterialsViewModel(hasHeadMaterials)) { }
|
||||
public HeadMaterialsView(HeadMaterialsViewModel vm)
|
||||
{
|
||||
viewModel = vm;
|
||||
@@ -47,12 +42,17 @@ namespace StructureHelper.Windows.MainWindow.Materials
|
||||
var helperMaterial = selectedMaterial.HelperMaterial;
|
||||
string dataTemplateName = string.Empty;
|
||||
Binding binding = new Binding();
|
||||
if (helperMaterial is ILibMaterial)
|
||||
if (helperMaterial is IConcreteLibMaterial)
|
||||
{
|
||||
dataTemplateName = "LibMaterial";
|
||||
dataTemplateName = "ConcreteLibMaterial";
|
||||
binding.Source = viewModel;
|
||||
}
|
||||
if (helperMaterial is IElasticMaterial)
|
||||
else if (helperMaterial is IReinforcementLibMaterial)
|
||||
{
|
||||
dataTemplateName = "ReinforcementLibMaterial";
|
||||
binding.Source = viewModel;
|
||||
}
|
||||
else if (helperMaterial is IElasticMaterial)
|
||||
{
|
||||
dataTemplateName = "ElasticMaterial";
|
||||
binding.Source = viewModel.SelectedMaterial.HelperMaterial;
|
||||
|
||||
Reference in New Issue
Block a user