Change table UI and VM, add parser dll, add modulus
This commit is contained in:
BIN
StructureHelper/Libraries/FunctionParser.dll
Normal file
BIN
StructureHelper/Libraries/FunctionParser.dll
Normal file
Binary file not shown.
18
StructureHelperCommon/Models/Materials/MaterialSettings.cs
Normal file
18
StructureHelperCommon/Models/Materials/MaterialSettings.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Materials
|
||||||
|
{
|
||||||
|
public class MaterialSettings
|
||||||
|
{
|
||||||
|
public bool IsActive { get; set; }
|
||||||
|
public LimitStates LimitState { get; set; }
|
||||||
|
public CalcTerms CalcTerm { get; set; }
|
||||||
|
public IOneVariableFunction Function { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="FunctionParser">
|
<Reference Include="FunctionParser">
|
||||||
<HintPath>..\..\FunctionParser\FunctionParser\bin\Debug\FunctionParser.dll</HintPath>
|
<HintPath>..\StructureHelper\Libraries\FunctionParser.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="LoaderCalculator">
|
<Reference Include="LoaderCalculator">
|
||||||
<HintPath>..\StructureHelper\Libraries\LoaderCalculator.dll</HintPath>
|
<HintPath>..\StructureHelper\Libraries\LoaderCalculator.dll</HintPath>
|
||||||
|
|||||||
@@ -2,11 +2,17 @@
|
|||||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Update="Windows\FunctionMaterialCreationView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Windows\FunctionSelectionView.xaml.cs">
|
<Compile Update="Windows\FunctionSelectionView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Page Update="Windows\FunctionMaterialCreationView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="Windows\FunctionSelectionView.xaml">
|
<Page Update="Windows\FunctionSelectionView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
76
StructureHelperCommon/Windows/FunctionMaterialCreationVM.cs
Normal file
76
StructureHelperCommon/Windows/FunctionMaterialCreationVM.cs
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
using FunctionParser;
|
||||||
|
using StructureHelperCommon.Infrastructures.Commands;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Infrastructures.Settings;
|
||||||
|
using StructureHelperCommon.Models.Functions;
|
||||||
|
using StructureHelperCommon.Models.Materials;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Windows
|
||||||
|
{
|
||||||
|
public class FunctionMaterialCreationVM
|
||||||
|
{
|
||||||
|
public string CREATE_MATERIAL { get; } = "Create Function Material";
|
||||||
|
public string MODULUS_OF_ELASTICITY { get; } = "Modulus of elasticity = ";
|
||||||
|
|
||||||
|
private const string ERROR_TEXT_1 = "Not all material states have functions ";
|
||||||
|
private RelayCommand createFunctionMaterialCommand;
|
||||||
|
public ICommand CreateFunctionMaterialCommand
|
||||||
|
{
|
||||||
|
get => createFunctionMaterialCommand ??= new RelayCommand(o => CreateFunctionMaterial(o));
|
||||||
|
}
|
||||||
|
public double Modulus { get; set; } = 2e11d;
|
||||||
|
public ObservableCollection<IOneVariableFunction> Functions { get; set; } = new ObservableCollection<IOneVariableFunction>();
|
||||||
|
public ObservableCollection<MaterialSettings> MaterialSettingsList { get; set; } = new() { new MaterialSettings() };
|
||||||
|
public FunctionMaterialCreationVM()
|
||||||
|
{
|
||||||
|
var stressStrainFunctions = new ObservableCollection<IOneVariableFunction>
|
||||||
|
(
|
||||||
|
ProgramSetting.Functions
|
||||||
|
.Where(x => x.FunctionPurpose == Infrastructures.Enums.FunctionPurpose.StressStrain)
|
||||||
|
);
|
||||||
|
GetFunctionsFromTree(stressStrainFunctions);
|
||||||
|
}
|
||||||
|
private void GetFunctionsFromTree(ObservableCollection<IOneVariableFunction> stressStrainFunctions)
|
||||||
|
{
|
||||||
|
foreach (IOneVariableFunction func in stressStrainFunctions)
|
||||||
|
{
|
||||||
|
Functions.Add(func);
|
||||||
|
if (func.Functions.Count > 0)
|
||||||
|
{
|
||||||
|
GetFunctionsFromTree(func.Functions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void CreateFunctionMaterial(object parameter)
|
||||||
|
{
|
||||||
|
// var window = parameter as Window;
|
||||||
|
// if (Func_ST_ULS == null ||
|
||||||
|
// Func_ST_SLS == null ||
|
||||||
|
// Func_ST_Special == null ||
|
||||||
|
// Func_LT_ULS == null ||
|
||||||
|
// Func_LT_SLS == null ||
|
||||||
|
// Func_LT_Special == null)
|
||||||
|
// {
|
||||||
|
// MessageBox.Show($"{ERROR_TEXT_1}");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// FunctionStorage.Func_ST_ULS = Func_ST_ULS;
|
||||||
|
// FunctionStorage.Func_ST_SLS = Func_ST_SLS;
|
||||||
|
// FunctionStorage.Func_ST_Special = Func_ST_Special;
|
||||||
|
// FunctionStorage.Func_LT_ULS = Func_LT_ULS;
|
||||||
|
// FunctionStorage.Func_LT_SLS = Func_LT_SLS;
|
||||||
|
// FunctionStorage.Func_LT_Special = Func_LT_Special;
|
||||||
|
// window.DialogResult = true;
|
||||||
|
// window.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
<Window x:Class="StructureHelperCommon.Windows.FunctionMaterialCreationView"
|
||||||
|
x:Name="FunctionMaterialCreationView_win"
|
||||||
|
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:StructureHelperCommon.Windows"
|
||||||
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="FunctionMaterial" Height="250" Width="860"
|
||||||
|
d:DataContext="{d:DesignInstance local:FunctionMaterialCreationVM}"
|
||||||
|
Background="LightYellow">
|
||||||
|
<Window.Resources>
|
||||||
|
</Window.Resources>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="200"/>
|
||||||
|
<ColumnDefinition Width="100"/>
|
||||||
|
<ColumnDefinition Width="200"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<DataGrid
|
||||||
|
Name="DataGrid"
|
||||||
|
Grid.ColumnSpan="4"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
CanUserDeleteRows="True"
|
||||||
|
CanUserAddRows="True"
|
||||||
|
Margin="10"
|
||||||
|
ItemsSource="{Binding MaterialSettingsList}">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTemplateColumn Width="50"
|
||||||
|
Header="Active">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<CheckBox
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
IsChecked="{Binding IsActive}">
|
||||||
|
</CheckBox>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="150"
|
||||||
|
Header="Limit state">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ComboBox SelectedItem ="{Binding LimitState}">
|
||||||
|
</ComboBox>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="150"
|
||||||
|
Header="Calculation term">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ComboBox SelectedItem ="{Binding CalcTerm}">
|
||||||
|
</ComboBox>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="*"
|
||||||
|
Header="Function">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ComboBox ItemsSource="{Binding Functions}"
|
||||||
|
SelectedItem="{Binding Function}">
|
||||||
|
</ComboBox>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<TextBlock Grid.Column="1"
|
||||||
|
Grid.Row="3"
|
||||||
|
Text="{Binding MODULUS_OF_ELASTICITY}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Right">
|
||||||
|
</TextBlock>
|
||||||
|
<TextBox Grid.Column="2"
|
||||||
|
Grid.Row="2"
|
||||||
|
Height="20"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Text="{Binding Modulus}"
|
||||||
|
>
|
||||||
|
</TextBox>
|
||||||
|
<Button Grid.Column="3"
|
||||||
|
Grid.Row="3"
|
||||||
|
Margin="10"
|
||||||
|
Content="{Binding CREATE_MATERIAL}"
|
||||||
|
Command="{Binding CreateFunctionMaterialCommand}"
|
||||||
|
CommandParameter="{Binding ElementName=FunctionSelectionView_win}" Click="Button_Click"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
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 StructureHelperCommon.Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for FunctionMaterialCreationView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class FunctionMaterialCreationView : Window
|
||||||
|
{
|
||||||
|
public FunctionMaterialCreationVM ViewModel { get; set; }
|
||||||
|
public FunctionMaterialCreationView(FunctionMaterialCreationVM viewModel)
|
||||||
|
{
|
||||||
|
this.ViewModel = viewModel;
|
||||||
|
DataContext = this.ViewModel;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
public FunctionMaterialCreationView() : this(new FunctionMaterialCreationVM())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
private void Button_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ using StructureHelperCommon.Infrastructures.Commands;
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Infrastructures.Settings;
|
using StructureHelperCommon.Infrastructures.Settings;
|
||||||
using StructureHelperCommon.Models.Functions;
|
using StructureHelperCommon.Models.Functions;
|
||||||
|
using StructureHelperCommon.Models.Materials;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
@@ -36,6 +37,7 @@ namespace StructureHelperCommon.Windows
|
|||||||
public IOneVariableFunction Func_LT_SLS { get; set; }
|
public IOneVariableFunction Func_LT_SLS { get; set; }
|
||||||
public IOneVariableFunction Func_LT_Special { get; set; }
|
public IOneVariableFunction Func_LT_Special { get; set; }
|
||||||
public FunctionStorage FunctionStorage { get; set; } = new();
|
public FunctionStorage FunctionStorage { get; set; } = new();
|
||||||
|
public ObservableCollection<MaterialSettings> MaterialSettings { get; set; } = new();
|
||||||
public FunctionSelectionVM()
|
public FunctionSelectionVM()
|
||||||
{
|
{
|
||||||
var stressStrainFunctions = new ObservableCollection<IOneVariableFunction>
|
var stressStrainFunctions = new ObservableCollection<IOneVariableFunction>
|
||||||
|
|||||||
@@ -108,17 +108,18 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
}
|
}
|
||||||
private static IHeadMaterial GetFunction()
|
private static IHeadMaterial GetFunction()
|
||||||
{
|
{
|
||||||
var functionSelectionView = new FunctionSelectionView();
|
var functionMaterialCreationView = new FunctionMaterialCreationView();
|
||||||
functionSelectionView.ShowDialog();
|
functionMaterialCreationView.ShowDialog();
|
||||||
var material = new HeadMaterial();
|
var material = new HeadMaterial();
|
||||||
material.HelperMaterial = new FunctionMaterial()
|
material.HelperMaterial = new FunctionMaterial()
|
||||||
{
|
{
|
||||||
Modulus = 2e11d,
|
Modulus = functionMaterialCreationView.ViewModel.Modulus,
|
||||||
CompressiveStrength = 4e8d,
|
CompressiveStrength = 4e8d,
|
||||||
TensileStrength = 4e8d,
|
TensileStrength = 4e8d,
|
||||||
FunctionStorage = functionSelectionView.ViewModel.FunctionStorage,
|
//FunctionStorage = functionMaterialCreationView.ViewModel.FunctionStorage,
|
||||||
|
MaterialSettings = functionMaterialCreationView.ViewModel.MaterialSettingsList.ToList(),
|
||||||
};
|
};
|
||||||
if (functionSelectionView.DialogResult == true)
|
if (functionMaterialCreationView.DialogResult == true)
|
||||||
{
|
{
|
||||||
material.SuccessfullyCreated = true;
|
material.SuccessfullyCreated = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using StructureHelperCommon.Infrastructures.Enums;
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Infrastructures.Settings;
|
using StructureHelperCommon.Infrastructures.Settings;
|
||||||
using StructureHelperCommon.Models.Functions;
|
using StructureHelperCommon.Models.Functions;
|
||||||
|
using StructureHelperCommon.Models.Materials;
|
||||||
using StructureHelperCommon.Models.Materials.Libraries;
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
using StructureHelperLogics.Models.Materials.Logics;
|
using StructureHelperLogics.Models.Materials.Logics;
|
||||||
using System;
|
using System;
|
||||||
@@ -22,6 +23,7 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
public List<IMaterialSafetyFactor> SafetyFactors { get; } = new();
|
public List<IMaterialSafetyFactor> SafetyFactors { get; } = new();
|
||||||
public IOneVariableFunction Function { get; set; }
|
public IOneVariableFunction Function { get; set; }
|
||||||
public FunctionStorage FunctionStorage { get; set; }
|
public FunctionStorage FunctionStorage { get; set; }
|
||||||
|
public List<MaterialSettings> MaterialSettings { get; set; }
|
||||||
|
|
||||||
public Guid Id { get; }
|
public Guid Id { get; }
|
||||||
|
|
||||||
|
|||||||
@@ -17,5 +17,7 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
List<IMaterialSafetyFactor> SafetyFactors { get; }
|
List<IMaterialSafetyFactor> SafetyFactors { get; }
|
||||||
public FunctionStorage FunctionStorage { get; set; }
|
public FunctionStorage FunctionStorage { get; set; }
|
||||||
public IOneVariableFunction Function { get; set; }
|
public IOneVariableFunction Function { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user