Carbon material was changed

This commit is contained in:
Evgeny Redikultsev
2023-06-11 13:27:42 +05:00
parent 90843ea409
commit 5a9ced0870
12 changed files with 150 additions and 57 deletions

View File

@@ -25,6 +25,29 @@
</Grid>
</DataTemplate>
<DataTemplate x:Key="CarbonProperties">
<Expander Header="Fiber Cohesion Properties" IsExpanded="False">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="180"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="ULS Concrete Strength"/>
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding ULSConcreteStrength, Converter={StaticResource StressConverter}, ValidatesOnExceptions=True}"/>
<TextBlock Grid.Row="1" Text="Total Layers Thickness"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SumThickness, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
<TextBlock Grid.Row="2" Text="GammaF2 Factor"/>
<TextBox Grid.Row="2" Grid.Column="1" IsEnabled="False" Text="{Binding GammaF2, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
</Grid>
</Expander>
</DataTemplate>
<DataTemplate x:Key="DirectSafetyFactors">
<Grid>
<Grid.RowDefinitions>

View File

@@ -7,40 +7,43 @@
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Materials"
d:DataContext="{d:DesignInstance vm:HeadMaterialViewModel}"
mc:Ignorable="d"
Title="Material properties" Height="350" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
Title="Material properties"
Height="350" Width="300"
MinWidth="300" MaxWidth="400" MinHeight="350" MaxHeight="500"
WindowStartupLocation="CenterScreen">
<Window.Resources>
<ResourceDictionary Source="/Infrastructure/UI/Resources/Materials.xaml"/>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="46"/>
<RowDefinition/>
<RowDefinition Height="1"/>
</Grid.RowDefinitions>
<ScrollViewer>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="22"/>
<RowDefinition Height="22"/>
<RowDefinition Height="46"/>
<RowDefinition/>
<RowDefinition Height="1"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Text="Name"/>
<TextBlock Grid.Row="1" Text="Color"/>
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding Name}"/>
<StackPanel Grid.Column="1" Grid.Row="1" Orientation="Horizontal">
<Rectangle Width="100" Margin="1" Stroke="Black">
<Rectangle.Fill>
<SolidColorBrush Color="{Binding Color}"/>
</Rectangle.Fill>
</Rectangle>
<Button Width="50" Margin="1" Content="..." Command="{Binding EditColorCommand}"/>
</StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="22"/>
<RowDefinition Height="22"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Text="Name"/>
<TextBlock Grid.Row="1" Text="Color"/>
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding Name}"/>
<StackPanel Grid.Column="1" Grid.Row="1" Orientation="Horizontal">
<Rectangle Width="100" Margin="1" Stroke="Black">
<Rectangle.Fill>
<SolidColorBrush Color="{Binding Color}"/>
</Rectangle.Fill>
</Rectangle>
<Button Width="50" Margin="1" Content="..." Command="{Binding EditColorCommand}"/>
</StackPanel>
</Grid>
<StackPanel Grid.Row="1" x:Name="StpMaterialProperties"/>
</Grid>
<StackPanel Grid.Row="1" x:Name="StpMaterialProperties">
</StackPanel>
</Grid>
</ScrollViewer>
</Window>

View File

@@ -62,6 +62,13 @@ namespace StructureHelper.Windows.MainWindow.Materials
var binding = new Binding();
binding.Source = vm.HelperMaterialViewModel;
bindings.Add(templateName, binding);
if (helperMaterial is IFRMaterial)
{
templateName = "CarbonProperties";
var carbonBinding = new Binding();
carbonBinding.Source = vm.HelperMaterialViewModel as FRViewModel;
bindings.Add(templateName, carbonBinding);
}
templateName = "DirectSafetyFactors";
var frBinding = new Binding();
frBinding.Source = (vm.HelperMaterialViewModel as ElasticViewModel).SafetyFactors;

View File

@@ -10,9 +10,41 @@ namespace StructureHelper.Windows.ViewModels.Materials
{
internal class FRViewModel : ElasticViewModel
{
IFRMaterial material;
public double ULSConcreteStrength
{
get
{
return material.ULSConcreteStrength;
}
set
{
material.ULSConcreteStrength = value;
OnPropertyChanged(nameof(ULSConcreteStrength));
}
}
public double SumThickness
{
get
{
return material.SumThickness;
}
set
{
material.SumThickness = value;
OnPropertyChanged(nameof(SumThickness));
}
}
public double GammaF2
{
get => material.GammaF2;
set {}
}
public FRViewModel(IFRMaterial material) : base(material)
{
this.material = material;
}
}
}

View File

@@ -82,7 +82,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
}
private void AddCarbonFiber()
{
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Carbon4000, ProgramSetting.CodeType);
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Carbon1400, ProgramSetting.CodeType);
material.Name = "New CFR Material";
NewItem = material;
}