material edit windows were added
This commit is contained in:
BIN
StructureHelper/Documentation/Manuals/UserManual.docx
Normal file
BIN
StructureHelper/Documentation/Manuals/UserManual.docx
Normal file
Binary file not shown.
15
StructureHelper/Infrastructure/Enums/MaterialType.cs
Normal file
15
StructureHelper/Infrastructure/Enums/MaterialType.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Infrastructure.Enums
|
||||||
|
{
|
||||||
|
internal enum MaterialType
|
||||||
|
{
|
||||||
|
Concrete,
|
||||||
|
Reinforcement,
|
||||||
|
Elastic
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelper.Infrastructure.UI.Converters.Units
|
namespace StructureHelper.Infrastructure.UI.Converters.Units
|
||||||
{
|
{
|
||||||
internal static class UnitConstatnts
|
internal static class UnitConstants
|
||||||
{
|
{
|
||||||
public static double Length = 1e3d;
|
public static double Length = 1e3d;
|
||||||
public static double Force = 1e-3d;
|
public static double Force = 1e-3d;
|
||||||
107
StructureHelper/Infrastructure/UI/Resources/Materials.xaml
Normal file
107
StructureHelper/Infrastructure/UI/Resources/Materials.xaml
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
|
||||||
|
<DataTemplate x:Key="LibraryMaterial">
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="Library material"/>
|
||||||
|
<ComboBox Height="25" VerticalAlignment="Top" ItemsSource="{Binding MaterialLibrary}" SelectedItem="{Binding MaterialEntity}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Name}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="SafetyFactors">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="30"/>
|
||||||
|
<RowDefinition Height="200"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Button Content="Show Safety Factors" Command="{Binding DataContext.ShowSafetyFactors, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Window}}"/>
|
||||||
|
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource MaterialSafetyFactors}" Content="{Binding DataContext, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Window}}"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="ConcreteLibMaterial">
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="Library material"/>
|
||||||
|
<ComboBox Height="25" VerticalAlignment="Top" ItemsSource="{Binding LibConcreteMaterials}" SelectedItem="{Binding SelectedLibMaterial}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Name}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
<ContentControl ContentTemplate="{StaticResource SafetyFactors}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="ConcreteMaterial">
|
||||||
|
<StackPanel>
|
||||||
|
<ContentControl ContentTemplate="{StaticResource LibraryMaterial}" Content="{Binding}"/>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="120"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Row="0" Text="Tension for ULS"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="Tension for SLS"/>
|
||||||
|
<TextBlock Grid.Row="2" Text="Relative humidity"/>
|
||||||
|
<CheckBox Grid.Column="1" IsChecked="{Binding TensionForULS}"/>
|
||||||
|
<CheckBox Grid.Column="1" Grid.Row="1" IsChecked="{Binding TensionForSLS}"/>
|
||||||
|
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding Humidity}"/>
|
||||||
|
</Grid>
|
||||||
|
<Button Content="Show Safety Factors" Command="{Binding ShowSafetyFactors}"/>
|
||||||
|
<ContentControl ContentTemplate="{StaticResource MaterialSafetyFactors}" Content="{Binding SafetyFactors}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="ReinforcementMaterial">
|
||||||
|
<StackPanel>
|
||||||
|
<ContentControl ContentTemplate="{StaticResource LibraryMaterial}" Content="{Binding}"/>
|
||||||
|
<Button Content="Show Safety Factors" Command="{Binding ShowSafetyFactors}"/>
|
||||||
|
<ContentControl ContentTemplate="{StaticResource MaterialSafetyFactors}" Content="{Binding SafetyFactors}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="ReinforcementLibMaterial">
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="Library material"/>
|
||||||
|
<ComboBox Height="25" VerticalAlignment="Top" ItemsSource="{Binding LibReinforcementMaterials}" SelectedItem="{Binding SelectedLibMaterial}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Name}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
<ContentControl ContentTemplate="{StaticResource SafetyFactors}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="ElasticMaterial">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="180"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="28"/>
|
||||||
|
<RowDefinition Height="28"/>
|
||||||
|
<RowDefinition Height="28"/>
|
||||||
|
<RowDefinition Height="28"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Text="Elastic material"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="Young's modulus"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Modulus, Converter={StaticResource StressConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBlock Grid.Row="2" Text="Compressive strength"/>
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding CompressiveStrength, Converter={StaticResource StressConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBlock Grid.Row="3" Text="Tensile strength"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding TensileStrength, Converter={StaticResource StressConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -18,12 +18,12 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
resultFuncs.Add(new ResultFunc() { Name = "Total Strain with prestrain", ResultFunction = stressLogic.GetTotalStrainWithPresrain });
|
resultFuncs.Add(new ResultFunc() { Name = "Total Strain with prestrain", ResultFunction = stressLogic.GetTotalStrainWithPresrain });
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Elastic Strain", ResultFunction = stressLogic.GetElasticStrain });
|
resultFuncs.Add(new ResultFunc() { Name = "Elastic Strain", ResultFunction = stressLogic.GetElasticStrain });
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Plastic Strain", ResultFunction = stressLogic.GetPlasticStrain });
|
resultFuncs.Add(new ResultFunc() { Name = "Plastic Strain", ResultFunction = stressLogic.GetPlasticStrain });
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Stress", ResultFunction = stressLogic.GetStress, UnitFactor = UnitConstatnts.Stress });
|
resultFuncs.Add(new ResultFunc() { Name = "Stress", ResultFunction = stressLogic.GetStress, UnitFactor = UnitConstants.Stress });
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Secant modulus", ResultFunction = stressLogic.GetSecantModulus, UnitFactor = UnitConstatnts.Stress });
|
resultFuncs.Add(new ResultFunc() { Name = "Secant modulus", ResultFunction = stressLogic.GetSecantModulus, UnitFactor = UnitConstants.Stress });
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Modulus degradation", ResultFunction = stressLogic.GetModulusDegradation });
|
resultFuncs.Add(new ResultFunc() { Name = "Modulus degradation", ResultFunction = stressLogic.GetModulusDegradation });
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Force", ResultFunction = stressLogic.GetForce, UnitFactor = UnitConstatnts.Force });
|
resultFuncs.Add(new ResultFunc() { Name = "Force", ResultFunction = stressLogic.GetForce, UnitFactor = UnitConstants.Force });
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Moment X", ResultFunction = stressLogic.GetMomentX, UnitFactor = UnitConstatnts.Force });
|
resultFuncs.Add(new ResultFunc() { Name = "Moment X", ResultFunction = stressLogic.GetMomentX, UnitFactor = UnitConstants.Force });
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Moment Y", ResultFunction = stressLogic.GetMomentY, UnitFactor = UnitConstatnts.Force });
|
resultFuncs.Add(new ResultFunc() { Name = "Moment Y", ResultFunction = stressLogic.GetMomentY, UnitFactor = UnitConstants.Force });
|
||||||
return resultFuncs;
|
return resultFuncs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
{
|
{
|
||||||
inputData.ReinforcementStress = inputData.ReinforcementStrength * Math.Sign(inputData.ReinforcementStress);
|
inputData.ReinforcementStress = inputData.ReinforcementStrength * Math.Sign(inputData.ReinforcementStress);
|
||||||
}
|
}
|
||||||
var val = inputData.ReinforcementStress * UnitConstatnts.Stress;
|
var val = inputData.ReinforcementStress * UnitConstants.Stress;
|
||||||
var valuePrimitive = GetValuePrimitive(primitive, val);
|
var valuePrimitive = GetValuePrimitive(primitive, val);
|
||||||
primitives.Add(valuePrimitive);
|
primitives.Add(valuePrimitive);
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
var primitive = item as ReinforcementPrimitive;
|
var primitive = item as ReinforcementPrimitive;
|
||||||
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
|
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
|
||||||
var calculator = new AnchorageCalculator(inputData);
|
var calculator = new AnchorageCalculator(inputData);
|
||||||
var val = calculator.GetBaseDevLength() * UnitConstatnts.Length;
|
var val = calculator.GetBaseDevLength() * UnitConstants.Length;
|
||||||
var valuePrimitive = GetValuePrimitive(primitive, val);
|
var valuePrimitive = GetValuePrimitive(primitive, val);
|
||||||
primitives.Add(valuePrimitive);
|
primitives.Add(valuePrimitive);
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
inputData.ReinforcementStress = inputData.ReinforcementStrength * Math.Sign(inputData.ReinforcementStress);
|
inputData.ReinforcementStress = inputData.ReinforcementStrength * Math.Sign(inputData.ReinforcementStress);
|
||||||
}
|
}
|
||||||
var calculator = new AnchorageCalculator(inputData);
|
var calculator = new AnchorageCalculator(inputData);
|
||||||
var val = calculator.GetDevLength() * UnitConstatnts.Length;
|
var val = calculator.GetDevLength() * UnitConstants.Length;
|
||||||
var valuePrimitive = GetValuePrimitive(primitive, val);
|
var valuePrimitive = GetValuePrimitive(primitive, val);
|
||||||
primitives.Add(valuePrimitive);
|
primitives.Add(valuePrimitive);
|
||||||
}
|
}
|
||||||
@@ -125,7 +125,7 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
inputData.ReinforcementStress = inputData.ReinforcementStrength * Math.Sign(inputData.ReinforcementStress);
|
inputData.ReinforcementStress = inputData.ReinforcementStrength * Math.Sign(inputData.ReinforcementStress);
|
||||||
}
|
}
|
||||||
var calculator = new AnchorageCalculator(inputData);
|
var calculator = new AnchorageCalculator(inputData);
|
||||||
var val = calculator.GetLapLength() * UnitConstatnts.Length;
|
var val = calculator.GetLapLength() * UnitConstants.Length;
|
||||||
var valuePrimitive = GetValuePrimitive(primitive, val);
|
var valuePrimitive = GetValuePrimitive(primitive, val);
|
||||||
primitives.Add(valuePrimitive);
|
primitives.Add(valuePrimitive);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,4 +48,8 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Documentation\Manuals\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -18,6 +18,9 @@
|
|||||||
<Compile Update="Windows\MainWindow\AboutView.xaml.cs">
|
<Compile Update="Windows\MainWindow\AboutView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="Windows\MainWindow\Materials\HeadMaterialView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Windows\MainWindow\Materials\MaterialDiagramView.xaml.cs">
|
<Compile Update="Windows\MainWindow\Materials\MaterialDiagramView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -29,6 +32,9 @@
|
|||||||
<Page Update="Infrastructure\UI\Resources\ForceTemplates.xaml">
|
<Page Update="Infrastructure\UI\Resources\ForceTemplates.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Update="Infrastructure\UI\Resources\Materials.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="Windows\Errors\ErrorMessage.xaml">
|
<Page Update="Windows\Errors\ErrorMessage.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
@@ -38,6 +44,9 @@
|
|||||||
<Page Update="Windows\MainWindow\AboutView.xaml">
|
<Page Update="Windows\MainWindow\AboutView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Update="Windows\MainWindow\Materials\HeadMaterialView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="Windows\MainWindow\Materials\MaterialDiagramView.xaml">
|
<Page Update="Windows\MainWindow\Materials\MaterialDiagramView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<Window x:Class="StructureHelper.Windows.MainWindow.Materials.HeadMaterialView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:StructureHelper.Windows.MainWindow.Materials"
|
||||||
|
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">
|
||||||
|
<Window.Resources>
|
||||||
|
<ResourceDictionary Source="/Infrastructure/UI/Resources/Materials.xaml"/>
|
||||||
|
</Window.Resources>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="46"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition Height="1"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<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">
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelper.Windows.ViewModels.Materials;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.MainWindow.Materials
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для HeadMaterialView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class HeadMaterialView : Window
|
||||||
|
{
|
||||||
|
IHeadMaterial headMaterial;
|
||||||
|
HeadMaterialViewModel vm;
|
||||||
|
|
||||||
|
public HeadMaterialView(IHeadMaterial headMaterial)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.headMaterial = headMaterial;
|
||||||
|
vm = new HeadMaterialViewModel(this.headMaterial);
|
||||||
|
DataContext = vm;
|
||||||
|
AddDataTemplates();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddDataTemplates()
|
||||||
|
{
|
||||||
|
StpMaterialProperties.Children.Clear();
|
||||||
|
var bindings = new Dictionary<string, Binding>();
|
||||||
|
var helperMaterial = headMaterial.HelperMaterial;
|
||||||
|
string templateName;
|
||||||
|
var binding = new Binding();
|
||||||
|
if (helperMaterial is IConcreteLibMaterial)
|
||||||
|
{
|
||||||
|
templateName = "ConcreteMaterial";
|
||||||
|
binding.Source = vm.HelperMaterialViewModel;
|
||||||
|
}
|
||||||
|
else if (helperMaterial is IReinforcementLibMaterial)
|
||||||
|
{
|
||||||
|
templateName = "ReinforcementMaterial";
|
||||||
|
binding.Source = vm.HelperMaterialViewModel;
|
||||||
|
}
|
||||||
|
else if (helperMaterial is IElasticMaterial)
|
||||||
|
{
|
||||||
|
templateName = "ElasticMaterial";
|
||||||
|
binding.Source = vm.HelperMaterialViewModel;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $". Expected: {typeof(IHelperMaterial)}, but was: {helperMaterial.GetType()}");
|
||||||
|
}
|
||||||
|
|
||||||
|
bindings.Add(templateName, binding);
|
||||||
|
foreach (var item in bindings)
|
||||||
|
{
|
||||||
|
ContentControl contentControl = new ContentControl();
|
||||||
|
contentControl.SetResourceReference(ContentTemplateProperty, item.Key);
|
||||||
|
contentControl.SetBinding(ContentProperty, item.Value);
|
||||||
|
StpMaterialProperties.Children.Add(contentControl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,63 +9,7 @@
|
|||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Materials" Height="350" Width="680" MinHeight="350" MinWidth="680" WindowStartupLocation="CenterScreen">
|
Title="Materials" Height="350" Width="680" MinHeight="350" MinWidth="680" WindowStartupLocation="CenterScreen">
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<DataTemplate x:Key="SafetyFactors">
|
<ResourceDictionary Source="/Infrastructure/UI/Resources/Materials.xaml"/>
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="30"/>
|
|
||||||
<RowDefinition Height="200"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Button Content="Show Safety Factors" Command="{Binding DataContext.ShowSafetyFactors, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Window}}"/>
|
|
||||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource MaterialSafetyFactors}" Content="{Binding DataContext, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Window}}"/>
|
|
||||||
</Grid>
|
|
||||||
</DataTemplate>
|
|
||||||
<DataTemplate x:Key="ConcreteLibMaterial">
|
|
||||||
<StackPanel>
|
|
||||||
<TextBlock Text="Library material"/>
|
|
||||||
<ComboBox Height="25" VerticalAlignment="Top" ItemsSource="{Binding LibConcreteMaterials}" SelectedItem="{Binding SelectedLibMaterial}">
|
|
||||||
<ComboBox.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<TextBlock Text="{Binding Name}"/>
|
|
||||||
</DataTemplate>
|
|
||||||
</ComboBox.ItemTemplate>
|
|
||||||
</ComboBox>
|
|
||||||
<ContentControl ContentTemplate="{StaticResource SafetyFactors}"/>
|
|
||||||
</StackPanel>
|
|
||||||
</DataTemplate>
|
|
||||||
<DataTemplate x:Key="ReinforcementLibMaterial">
|
|
||||||
<StackPanel>
|
|
||||||
<TextBlock Text="Library material"/>
|
|
||||||
<ComboBox Height="25" VerticalAlignment="Top" ItemsSource="{Binding LibReinforcementMaterials}" SelectedItem="{Binding SelectedLibMaterial}">
|
|
||||||
<ComboBox.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<TextBlock Text="{Binding Name}"/>
|
|
||||||
</DataTemplate>
|
|
||||||
</ComboBox.ItemTemplate>
|
|
||||||
</ComboBox>
|
|
||||||
<ContentControl ContentTemplate="{StaticResource SafetyFactors}"/>
|
|
||||||
</StackPanel>
|
|
||||||
</DataTemplate>
|
|
||||||
<DataTemplate x:Key="ElasticMaterial">
|
|
||||||
<Grid>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="180"/>
|
|
||||||
<ColumnDefinition/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="28"/>
|
|
||||||
<RowDefinition Height="28"/>
|
|
||||||
<RowDefinition Height="28"/>
|
|
||||||
<RowDefinition Height="28"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<TextBlock Text="Elastic material"/>
|
|
||||||
<TextBlock Grid.Row="1" Text="Young's modulus"/>
|
|
||||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Modulus, Converter={StaticResource StressConverter}, ValidatesOnExceptions=True}"/>
|
|
||||||
<TextBlock Grid.Row="2" Text="Compressive strength"/>
|
|
||||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding CompressiveStrength, Converter={StaticResource StressConverter}, ValidatesOnExceptions=True}"/>
|
|
||||||
<TextBlock Grid.Row="3" Text="Tensile strength"/>
|
|
||||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding TensileStrength, Converter={StaticResource StressConverter}, ValidatesOnExceptions=True}"/>
|
|
||||||
</Grid>
|
|
||||||
</DataTemplate>
|
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@@ -103,14 +47,14 @@
|
|||||||
<Button Content="New Elastic Material" Command="{Binding AddElasticMaterialCommand}"/>
|
<Button Content="New Elastic Material" Command="{Binding AddElasticMaterialCommand}"/>
|
||||||
<Button Content="Show diagram" Command="{Binding ShowMaterialDiagram}"/>
|
<Button Content="Show diagram" Command="{Binding ShowMaterialDiagram}"/>
|
||||||
<Button Content="Edit color" Command="{Binding EditColorCommand}"/>
|
<Button Content="Edit color" Command="{Binding EditColorCommand}"/>
|
||||||
|
<Button Content="Edit" Command="{Binding EditCommand}"/>
|
||||||
<Button Content="Copy" Command="{Binding CopyHeadMaterialCommand}"/>
|
<Button Content="Copy" Command="{Binding CopyHeadMaterialCommand}"/>
|
||||||
<Button Content="Delete" Command="{Binding DeleteMaterialCommand}"/>
|
<Button Content="Delete" Command="{Binding DeleteMaterialCommand}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Column="2">
|
<StackPanel x:Name="MatProps" Grid.Column="2">
|
||||||
<TextBlock Text="Name"/>
|
<TextBlock Text="Name"/>
|
||||||
<TextBox Text="{Binding SelectedMaterial.Name}"/>
|
<TextBox Text="{Binding SelectedMaterial.Name}"/>
|
||||||
<StackPanel x:Name="StpMaterialProperties"/>
|
<StackPanel x:Name="StpMaterialProperties"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
|||||||
{
|
{
|
||||||
if (parameter is not null)
|
if (parameter is not null)
|
||||||
{
|
{
|
||||||
ActionType paramType = (ActionType)parameter;
|
var paramType = (ActionType)parameter;
|
||||||
if (paramType == ActionType.ForceCombination)
|
if (paramType == ActionType.ForceCombination)
|
||||||
{
|
{
|
||||||
NewItem = new ForceCombinationList() { Name = "New Force Combination" };
|
NewItem = new ForceCombinationList() { Name = "New Force Combination" };
|
||||||
@@ -34,7 +34,6 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
|||||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $": Actual type: {nameof(paramType)}");
|
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $": Actual type: {nameof(paramType)}");
|
||||||
base.AddMethod(parameter);
|
base.AddMethod(parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DeleteMethod(object parameter)
|
public override void DeleteMethod(object parameter)
|
||||||
@@ -42,25 +41,13 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
|||||||
var dialogResult = MessageBox.Show("Delete action?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
var dialogResult = MessageBox.Show("Delete action?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||||
if (dialogResult == DialogResult.Yes)
|
if (dialogResult == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
var calcRepository = repository.CalculatorsList;
|
DeleteAction();
|
||||||
foreach (var item in calcRepository)
|
|
||||||
{
|
|
||||||
if (item is IForceCalculator)
|
|
||||||
{
|
|
||||||
var forceCalculator = item as IForceCalculator;
|
|
||||||
var containSelected = forceCalculator.ForceActions.Contains(SelectedItem);
|
|
||||||
if (containSelected)
|
|
||||||
{
|
|
||||||
var dialogResultCalc = MessageBox.Show($"Action is contained in calculator {item.Name}", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
|
||||||
if (dialogResultCalc == DialogResult.OK) { forceCalculator.ForceActions.Remove(SelectedItem); }
|
|
||||||
else return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
base.DeleteMethod(parameter);
|
base.DeleteMethod(parameter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public override void EditMethod(object parameter)
|
public override void EditMethod(object parameter)
|
||||||
{
|
{
|
||||||
System.Windows.Window wnd;
|
System.Windows.Window wnd;
|
||||||
@@ -83,5 +70,24 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
|||||||
{
|
{
|
||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DeleteAction()
|
||||||
|
{
|
||||||
|
var calcRepository = repository.CalculatorsList;
|
||||||
|
foreach (var item in calcRepository)
|
||||||
|
{
|
||||||
|
if (item is IForceCalculator)
|
||||||
|
{
|
||||||
|
var forceCalculator = item as IForceCalculator;
|
||||||
|
var containSelected = forceCalculator.ForceActions.Contains(SelectedItem);
|
||||||
|
if (containSelected)
|
||||||
|
{
|
||||||
|
var dialogResultCalc = MessageBox.Show($"Action is contained in calculator {item.Name}", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||||
|
if (dialogResultCalc == DialogResult.OK) { forceCalculator.ForceActions.Remove(SelectedItem); }
|
||||||
|
else return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
using LoaderCalculator.Data.Materials;
|
||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Settings;
|
||||||
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.ViewModels.Materials
|
||||||
|
{
|
||||||
|
internal class ConcreteViewModel : LibMaterialViewModel
|
||||||
|
{
|
||||||
|
readonly IConcreteLibMaterial concreteMaterial;
|
||||||
|
public bool TensionForULS
|
||||||
|
{
|
||||||
|
get => concreteMaterial.TensionForULS;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
concreteMaterial.TensionForULS = value;
|
||||||
|
OnPropertyChanged(nameof(TensionForULS));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool TensionForSLS
|
||||||
|
{
|
||||||
|
get => concreteMaterial.TensionForSLS;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
concreteMaterial.TensionForSLS = value;
|
||||||
|
OnPropertyChanged(nameof(TensionForSLS));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double Humidity
|
||||||
|
{
|
||||||
|
get => concreteMaterial.Humidity;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
concreteMaterial.Humidity = value;
|
||||||
|
OnPropertyChanged(nameof(Humidity));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IEnumerable<ILibMaterialEntity> MaterialLibrary => LibMaterialPepository.GetConcreteRepository(ProgramSetting.CodeType);
|
||||||
|
|
||||||
|
|
||||||
|
public ConcreteViewModel(ILibMaterial material) : base(material)
|
||||||
|
{
|
||||||
|
if (material is not IConcreteLibMaterial)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $". Expected: {typeof(IConcreteLibMaterial)}, but was: {material.GetType()}");
|
||||||
|
}
|
||||||
|
this.concreteMaterial = material as IConcreteLibMaterial;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
using LoaderCalculator.Data.Materials;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.ViewModels.Materials
|
||||||
|
{
|
||||||
|
internal class ElasticViewModel : HelperMaterialViewModel
|
||||||
|
{
|
||||||
|
IElasticMaterial material;
|
||||||
|
public double Modulus
|
||||||
|
{
|
||||||
|
get => material.Modulus;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
material.Modulus = value;
|
||||||
|
OnPropertyChanged(nameof(Modulus));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double CompressiveStrength
|
||||||
|
{
|
||||||
|
get => material.CompressiveStrength;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
material.CompressiveStrength = value;
|
||||||
|
OnPropertyChanged(nameof(CompressiveStrength));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double TensileStrength
|
||||||
|
{
|
||||||
|
get => material.TensileStrength;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
material.TensileStrength = value;
|
||||||
|
OnPropertyChanged(nameof(TensileStrength));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ElasticViewModel(IElasticMaterial material)
|
||||||
|
{
|
||||||
|
this.material = material;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelper.Windows.AddMaterialWindow;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
|
using StructureHelperCommon.Services.ColorServices;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.ViewModels.Materials
|
||||||
|
{
|
||||||
|
internal class HeadMaterialViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
IHeadMaterial headMaterial;
|
||||||
|
HelperMaterialViewModel helperMaterialViewModel;
|
||||||
|
private ICommand showSafetyFactors;
|
||||||
|
private ICommand editColorCommand;
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get => headMaterial.Name;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
headMaterial.Name = value;
|
||||||
|
OnPropertyChanged(nameof(Name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color Color
|
||||||
|
{
|
||||||
|
get => headMaterial.Color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HelperMaterialViewModel HelperMaterialViewModel => helperMaterialViewModel;
|
||||||
|
|
||||||
|
public ICommand ShowSafetyFactors
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return showSafetyFactors ??= new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
if (headMaterial is ILibMaterial)
|
||||||
|
{
|
||||||
|
var material = headMaterial as ILibMaterial;
|
||||||
|
var wnd = new SafetyFactorsView(material.SafetyFactors);
|
||||||
|
wnd.ShowDialog();
|
||||||
|
}
|
||||||
|
}, o => headMaterial is LibMaterial
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand EditColorCommand => editColorCommand ??= new RelayCommand(o => EditColor());
|
||||||
|
|
||||||
|
private void EditColor()
|
||||||
|
{
|
||||||
|
Color color = headMaterial.Color;
|
||||||
|
ColorProcessor.EditColor(ref color);
|
||||||
|
headMaterial.Color = color;
|
||||||
|
OnPropertyChanged(nameof(Color));
|
||||||
|
}
|
||||||
|
|
||||||
|
public HeadMaterialViewModel(IHeadMaterial headMaterial)
|
||||||
|
{
|
||||||
|
this.headMaterial = headMaterial;
|
||||||
|
var helperMaterial = headMaterial.HelperMaterial;
|
||||||
|
if (helperMaterial is IConcreteLibMaterial)
|
||||||
|
{
|
||||||
|
var material = helperMaterial as IConcreteLibMaterial;
|
||||||
|
helperMaterialViewModel = new ConcreteViewModel(material);
|
||||||
|
}
|
||||||
|
else if (helperMaterial is IReinforcementLibMaterial)
|
||||||
|
{
|
||||||
|
var material = helperMaterial as IReinforcementLibMaterial;
|
||||||
|
helperMaterialViewModel = new ReinforcementViewModel(material);
|
||||||
|
}
|
||||||
|
else if (helperMaterial is IElasticMaterial)
|
||||||
|
{
|
||||||
|
var material = helperMaterial as IElasticMaterial;
|
||||||
|
helperMaterialViewModel = new ElasticViewModel(material);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $". Expected: {typeof(IHelperMaterial)}, but was: {helperMaterial.GetType()}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -54,19 +54,24 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ICommand CopyHeadMaterialCommand { get; set; }
|
public ICommand CopyHeadMaterialCommand { get; set; }
|
||||||
public ICommand EditColorCommand { get; set; }
|
public ICommand EditColorCommand => editColorCommand ??= new RelayCommand(o => EditColor(), o => SelectedMaterial is not null);
|
||||||
public ICommand DeleteMaterialCommand { get; set; }
|
public ICommand EditCommand => editCommand ??= new RelayCommand(o => Edit(), o => SelectedMaterial is not null);
|
||||||
public ICommand EditHeadMaterial;
|
|
||||||
|
|
||||||
private ICommand showSafetyfactors;
|
private void Edit()
|
||||||
|
{
|
||||||
|
var wnd = new HeadMaterialView(SelectedMaterial);
|
||||||
|
wnd.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand DeleteMaterialCommand { get; set; }
|
||||||
|
|
||||||
|
private ICommand showSafetyFactors;
|
||||||
|
|
||||||
public ICommand ShowSafetyFactors
|
public ICommand ShowSafetyFactors
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return showSafetyfactors ??
|
return showSafetyFactors ??= new RelayCommand(o =>
|
||||||
(
|
|
||||||
showSafetyfactors = new RelayCommand(o =>
|
|
||||||
{
|
{
|
||||||
if (selectedMaterial.HelperMaterial is ILibMaterial)
|
if (selectedMaterial.HelperMaterial is ILibMaterial)
|
||||||
{
|
{
|
||||||
@@ -76,7 +81,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
|||||||
OnPropertyChanged(nameof(Items));
|
OnPropertyChanged(nameof(Items));
|
||||||
}
|
}
|
||||||
}, o=> SelectedLibMaterial != null
|
}, o=> SelectedLibMaterial != null
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,6 +103,8 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
|||||||
|
|
||||||
private ICommand? addElasticMaterialCommand;
|
private ICommand? addElasticMaterialCommand;
|
||||||
private ICommand? showMaterialDiagram;
|
private ICommand? showMaterialDiagram;
|
||||||
|
private ICommand? editColorCommand;
|
||||||
|
private ICommand editCommand;
|
||||||
|
|
||||||
public ObservableCollection<IHeadMaterial> HeadMaterials { get; private set; }
|
public ObservableCollection<IHeadMaterial> HeadMaterials { get; private set; }
|
||||||
public IHeadMaterial SelectedMaterial
|
public IHeadMaterial SelectedMaterial
|
||||||
@@ -183,7 +190,6 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
|||||||
AddNewConcreteMaterialCommand = new RelayCommand(o => AddConcreteMaterial());
|
AddNewConcreteMaterialCommand = new RelayCommand(o => AddConcreteMaterial());
|
||||||
AddNewReinforcementMaterialCommand = new RelayCommand(o => AddReinforcementMaterial());
|
AddNewReinforcementMaterialCommand = new RelayCommand(o => AddReinforcementMaterial());
|
||||||
CopyHeadMaterialCommand = new RelayCommand(o => CopyMaterial(), o => !(SelectedMaterial is null));
|
CopyHeadMaterialCommand = new RelayCommand(o => CopyMaterial(), o => !(SelectedMaterial is null));
|
||||||
EditColorCommand = new RelayCommand(o => EditColor(), o=> ! (SelectedMaterial is null));
|
|
||||||
DeleteMaterialCommand = new RelayCommand(o => DeleteMaterial(), o => !(SelectedMaterial is null));
|
DeleteMaterialCommand = new RelayCommand(o => DeleteMaterial(), o => !(SelectedMaterial is null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.ViewModels.Materials
|
||||||
|
{
|
||||||
|
internal abstract class HelperMaterialViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
using LoaderCalculator.Data.Materials;
|
||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelper.Windows.AddMaterialWindow;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.ViewModels.Materials
|
||||||
|
{
|
||||||
|
internal abstract class LibMaterialViewModel : HelperMaterialViewModel
|
||||||
|
{
|
||||||
|
ILibMaterial material;
|
||||||
|
ICommand showSafetyFactors;
|
||||||
|
SafetyFactorsViewModel safetyFactorsViewModel;
|
||||||
|
|
||||||
|
public ILibMaterialEntity MaterialEntity
|
||||||
|
{
|
||||||
|
get => material.MaterialEntity;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
material.MaterialEntity = value;
|
||||||
|
OnPropertyChanged(nameof(MaterialEntity));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public abstract IEnumerable<ILibMaterialEntity> MaterialLibrary { get; }
|
||||||
|
public SafetyFactorsViewModel SafetyFactors => safetyFactorsViewModel;
|
||||||
|
|
||||||
|
public ICommand ShowSafetyFactors =>
|
||||||
|
showSafetyFactors ??= new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
var wnd = new SafetyFactorsView(material.SafetyFactors);
|
||||||
|
wnd.ShowDialog();
|
||||||
|
safetyFactorsViewModel = new SafetyFactorsViewModel(material.SafetyFactors);
|
||||||
|
OnPropertyChanged(nameof(SafetyFactors));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
public LibMaterialViewModel(ILibMaterial material)
|
||||||
|
{
|
||||||
|
this.material = material;
|
||||||
|
safetyFactorsViewModel = new SafetyFactorsViewModel(material.SafetyFactors);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,18 @@
|
|||||||
using LiveCharts;
|
using LiveCharts;
|
||||||
using LiveCharts.Wpf;
|
using LiveCharts.Wpf;
|
||||||
|
using StructureHelper.Infrastructure.UI.Converters.Units;
|
||||||
using StructureHelper.Models.Materials;
|
using StructureHelper.Models.Materials;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperLogics.Models.Materials;
|
using StructureHelperLogics.Models.Materials;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using Brushes = System.Windows.Media.Brushes;
|
||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.Materials
|
namespace StructureHelper.Windows.ViewModels.Materials
|
||||||
{
|
{
|
||||||
@@ -56,7 +60,9 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
|||||||
var title = titles[n];
|
var title = titles[n];
|
||||||
for (double s = minValue; s < maxValue; s += step)
|
for (double s = minValue; s < maxValue; s += step)
|
||||||
{
|
{
|
||||||
double diagramValue = loaderMaterial.Diagram.Invoke(loaderMaterial.DiagramParameters,s);
|
double diagramValue = Math.Round(loaderMaterial.Diagram.Invoke(loaderMaterial.DiagramParameters,s)) * UnitConstants.Stress;
|
||||||
|
//var point = new PointF() { X = (float)s, Y = (float)diagramValue };
|
||||||
|
//chartValues.Add(point);
|
||||||
chartValues.Add(diagramValue);
|
chartValues.Add(diagramValue);
|
||||||
labels.Add(Convert.ToString(Math.Round(s,4)));
|
labels.Add(Convert.ToString(Math.Round(s,4)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
using StructureHelper.Infrastructure.Enums;
|
||||||
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelper.Windows.MainWindow.Materials;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Settings;
|
||||||
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.ViewModels.Materials
|
||||||
|
{
|
||||||
|
internal class MaterialsViewModel : CRUDViewModelBase<IHeadMaterial>
|
||||||
|
{
|
||||||
|
public override void AddMethod(object parameter)
|
||||||
|
{
|
||||||
|
CheckParameters(parameter);
|
||||||
|
var paramType = (MaterialType)parameter;
|
||||||
|
if (paramType == MaterialType.Concrete) { AddConcrete(); }
|
||||||
|
else if (paramType == MaterialType.Reinforcement) { AddReinforcement(); }
|
||||||
|
else if (paramType == MaterialType.Elastic) { AddElastic(); }
|
||||||
|
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $". Expected: {typeof(MaterialType)}, Actual type: {nameof(paramType)}");
|
||||||
|
base.AddMethod(parameter);
|
||||||
|
}
|
||||||
|
public override void DeleteMethod(object parameter)
|
||||||
|
{
|
||||||
|
#error
|
||||||
|
//to do delete method
|
||||||
|
base.DeleteMethod(parameter);
|
||||||
|
}
|
||||||
|
public override void EditMethod(object parameter)
|
||||||
|
{
|
||||||
|
var wnd = new HeadMaterialView(SelectedItem);
|
||||||
|
wnd.ShowDialog();
|
||||||
|
base.EditMethod(parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddElastic()
|
||||||
|
{
|
||||||
|
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Elastic200, ProgramSetting.CodeType);
|
||||||
|
material.Name = "New Elastic Material";
|
||||||
|
NewItem = material;
|
||||||
|
}
|
||||||
|
private void AddReinforcement()
|
||||||
|
{
|
||||||
|
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforecement400, ProgramSetting.CodeType);
|
||||||
|
material.Name = "New Reinforcement";
|
||||||
|
NewItem = material;
|
||||||
|
}
|
||||||
|
private void AddConcrete()
|
||||||
|
{
|
||||||
|
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, ProgramSetting.CodeType);
|
||||||
|
material.Name = "New Concrete";
|
||||||
|
NewItem = material;
|
||||||
|
}
|
||||||
|
private void CheckParameters(object parameter)
|
||||||
|
{
|
||||||
|
if (parameter is null) { throw new StructureHelperException(ErrorStrings.ParameterIsNull); }
|
||||||
|
if (parameter is not MaterialType) { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $". Expected: {typeof(MaterialType)} . Actual type: {nameof(parameter)}"); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Settings;
|
||||||
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.ViewModels.Materials
|
||||||
|
{
|
||||||
|
internal class ReinforcementViewModel : LibMaterialViewModel
|
||||||
|
{
|
||||||
|
public override IEnumerable<ILibMaterialEntity> MaterialLibrary => LibMaterialPepository.GetReinforcementRepository(ProgramSetting.CodeType);
|
||||||
|
public ReinforcementViewModel(ILibMaterial material) : base(material)
|
||||||
|
{
|
||||||
|
if (material is not IReinforcementLibMaterial)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $". Expected: {typeof(IConcreteLibMaterial)}, but was: {material.GetType()}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,5 +17,6 @@
|
|||||||
public static string LongitudinalForceMustBeLessThanZero => "#0012: Longitudinal force must be less than zero";
|
public static string LongitudinalForceMustBeLessThanZero => "#0012: Longitudinal force must be less than zero";
|
||||||
public static string LongitudinalForceMustBeLessThanCriticalForce => "#0013: Absolute value of longitudinal force must be greater than critical force";
|
public static string LongitudinalForceMustBeLessThanCriticalForce => "#0013: Absolute value of longitudinal force must be greater than critical force";
|
||||||
public static string SizeMustBeGreaterThanZero => "#0014: Size must be greater than zero";
|
public static string SizeMustBeGreaterThanZero => "#0014: Size must be greater than zero";
|
||||||
|
public static string ParameterIsNull => "#0015: Parameter is null";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
public List<IMaterialSafetyFactor> SafetyFactors { get; }
|
public List<IMaterialSafetyFactor> SafetyFactors { get; }
|
||||||
public bool TensionForULS { get ; set; }
|
public bool TensionForULS { get ; set; }
|
||||||
public bool TensionForSLS { get; set; }
|
public bool TensionForSLS { get; set; }
|
||||||
|
public double Humidity { get; set; }
|
||||||
|
|
||||||
private IMaterialOptionLogic optionLogic;
|
private IMaterialOptionLogic optionLogic;
|
||||||
private LoaderMaterialLogic.ITrueStrengthLogic strengthLogic;
|
private LoaderMaterialLogic.ITrueStrengthLogic strengthLogic;
|
||||||
@@ -31,6 +32,7 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
optionLogic = new MaterialOptionLogic(new LoaderMaterialBuilders.ConcreteOptions());
|
optionLogic = new MaterialOptionLogic(new LoaderMaterialBuilders.ConcreteOptions());
|
||||||
TensionForULS = false;
|
TensionForULS = false;
|
||||||
TensionForSLS = true;
|
TensionForSLS = true;
|
||||||
|
Humidity = 0.55d;
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
|
|||||||
@@ -11,5 +11,6 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
{
|
{
|
||||||
bool TensionForULS { get; set; }
|
bool TensionForULS { get; set; }
|
||||||
bool TensionForSLS { get; set; }
|
bool TensionForSLS { get; set; }
|
||||||
|
double Humidity { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user