Interpolation View for calculation result was added
This commit is contained in:
@@ -7,43 +7,58 @@
|
||||
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Forces"
|
||||
d:DataContext="{d:DesignInstance vm:ForceCombinationViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Title="Force Combination" Height="250" Width="450" MinHeight="300" MinWidth="450" MaxWidth="500" WindowStartupLocation="CenterScreen">
|
||||
Title="Force Combination" Height="250" Width="550" MinHeight="300" MinWidth="450" MaxWidth="500" WindowStartupLocation="CenterScreen">
|
||||
<Window.Resources>
|
||||
<DataTemplate x:Key="ForceTemplate">
|
||||
|
||||
</DataTemplate>
|
||||
</Window.Resources>
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="95"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Name"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding Name}"/>
|
||||
<TextBlock Grid.Row="1" Text="Set force into initial Gravity Center"/>
|
||||
<CheckBox Grid.Row="1" Grid.Column="1" Margin="3,5,3,5" IsChecked="{Binding SetInGravityCenter}"/>
|
||||
<TextBlock Grid.Row="2" Text="Center X"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding CenterX}" IsEnabled="{Binding CoordEnable}"/>
|
||||
<TextBlock Grid.Row="3" Text="Center Y"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding CenterY}" IsEnabled="{Binding CoordEnable}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="1" DataContext="{Binding DesignForces}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="80"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Name"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding Name}"/>
|
||||
<TextBlock Grid.Row="1" Text="Set force into initial Gravity Center"/>
|
||||
<CheckBox Grid.Row="1" Grid.Column="1" Margin="3,5,3,5" IsChecked="{Binding SetInGravityCenter}"/>
|
||||
<TextBlock Grid.Row="2" Text="Center X"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding CenterX}" IsEnabled="{Binding CoordEnable}"/>
|
||||
<TextBlock Grid.Row="3" Text="Center Y"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding CenterY}" IsEnabled="{Binding CoordEnable}"/>
|
||||
<DataGrid x:Name="ForceGrid" Style="{StaticResource ItemsDataGrid}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridComboBoxColumn Header="Limit state" Width="80" MinWidth="70" SelectedItemBinding="{Binding LimitState}" ItemsSource="{Binding Source={StaticResource LimitStateEnum}}"/>
|
||||
<DataGridComboBoxColumn Header="Duration" Width="80" MinWidth="70" SelectedItemBinding="{Binding CalcTerm}" ItemsSource="{Binding Source={StaticResource CalcTermEnum}}"/>
|
||||
<DataGridTextColumn Header="Moment Mx" Width="85" Binding="{Binding ForceTuple.Mx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||
<DataGridTextColumn Header="Moment My" Width="85" Binding="{Binding ForceTuple.My, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||
<DataGridTextColumn Header="Force Nz" Width="85" Binding="{Binding ForceTuple.Nz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<StackPanel Grid.Column="1">
|
||||
<Button Style="{StaticResource AddButton}"/>
|
||||
<Button Style="{StaticResource DeleteButton}"/>
|
||||
<Button Style="{StaticResource CopyButton}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<DataGrid x:Name="ForceGrid" AutoGenerateColumns="False"
|
||||
ItemsSource="{Binding ForceTuples}"
|
||||
SelectedItem="{Binding SelectedTuple}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Limit State" Width="90" Binding="{Binding LimitState}" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="Duration" Width="90" Binding="{Binding CalcTerm}" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="Moment Mx" Width="90" Binding="{Binding ForceTuple.Mx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||
<DataGridTextColumn Header="Moment My" Width="90" Binding="{Binding ForceTuple.My, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||
<DataGridTextColumn Header="Force Nz" Width="90" Binding="{Binding ForceTuple.Nz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
49
Windows/Forces/InterpolateTuplesView.xaml
Normal file
49
Windows/Forces/InterpolateTuplesView.xaml
Normal file
@@ -0,0 +1,49 @@
|
||||
<Window x:Class="StructureHelper.Windows.Forces.InterpolateTuplesView"
|
||||
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.Forces"
|
||||
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Forces"
|
||||
d:DataContext="{d:DesignInstance vm:InterpolateTuplesViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Title="Interpolate Combinations" Height="200" Width="350" MinHeight="180" MinWidth="250" WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="40"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="1" Text="Moment Mx" HorizontalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="2" Text="Moment My" HorizontalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="3" Text="Force Nz" HorizontalAlignment="Center"/>
|
||||
<TextBlock Grid.Row="1" Text="Start Combination"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding StartDesignForce.ForceTuple.Mx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="2" Text="{Binding StartDesignForce.ForceTuple.My, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding StartDesignForce.ForceTuple.Nz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBlock Grid.Row="2" Text="Finish Combination"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding FinishDesignForce.ForceTuple.Mx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="2" Text="{Binding FinishDesignForce.ForceTuple.My, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="3" Text="{Binding FinishDesignForce.ForceTuple.Nz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBlock Grid.Row="3" Text="Step count"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding StepCount, ValidatesOnExceptions=True}"/>
|
||||
</Grid>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Style="{StaticResource CancelButton}"/>
|
||||
<Button Style="{StaticResource OkButton}" Click="Button_Click"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
37
Windows/Forces/InterpolateTuplesView.xaml.cs
Normal file
37
Windows/Forces/InterpolateTuplesView.xaml.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using StructureHelper.Windows.ViewModels.Forces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
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.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace StructureHelper.Windows.Forces
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для InterpolateTuplesView.xaml
|
||||
/// </summary>
|
||||
public partial class InterpolateTuplesView : Window
|
||||
{
|
||||
public InterpolateTuplesView(InterpolateTuplesViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = viewModel;
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ using StructureHelper.Windows.MainWindow.Materials;
|
||||
using StructureHelper.Windows.PrimitiveTemplates.RCs.RectangleBeam;
|
||||
using StructureHelper.Windows.ViewModels.Calculations.CalculationProperies;
|
||||
using StructureHelper.Windows.ViewModels.Calculations.CalculationResult;
|
||||
using StructureHelper.Windows.ViewModels.Forces;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
@@ -45,7 +46,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
|
||||
private readonly ICalculatorsViewModelLogic calculatorsLogic;
|
||||
public ICalculatorsViewModelLogic CalculatorsLogic { get => calculatorsLogic;}
|
||||
public IForceCombinationViewModelLogic CombinationsLogic { get => combinationsLogic; }
|
||||
public ActionsViewModel CombinationsLogic { get => combinationsLogic; }
|
||||
public IPrimitiveViewModelLogic PrimitiveLogic => primitiveLogic;
|
||||
|
||||
private MainModel Model { get; }
|
||||
@@ -171,14 +172,14 @@ namespace StructureHelper.Windows.MainWindow
|
||||
private double delta = 0.0005;
|
||||
private double axisLineThickness;
|
||||
private double gridLineThickness;
|
||||
private IForceCombinationViewModelLogic combinationsLogic;
|
||||
private ActionsViewModel combinationsLogic;
|
||||
private IPrimitiveViewModelLogic primitiveLogic;
|
||||
|
||||
public MainViewModel(MainModel model)
|
||||
{
|
||||
Model = model;
|
||||
section = model.Section;
|
||||
combinationsLogic = new ForceCombinationViewModelLogic(repository);
|
||||
combinationsLogic = new ActionsViewModel(repository);
|
||||
calculatorsLogic = new CalculatorsViewModelLogic(repository);
|
||||
CanvasWidth = 2d * scale;
|
||||
CanvasHeight = 1.5d * scale;
|
||||
|
||||
@@ -9,28 +9,40 @@
|
||||
mc:Ignorable="d"
|
||||
Title="Materials" Height="350" Width="680" MinHeight="350" MinWidth="680" WindowStartupLocation="CenterScreen">
|
||||
<Window.Resources>
|
||||
<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 Grid.Row="2" Height="25" VerticalAlignment="Top" ItemsSource="{Binding LibConcreteMaterials}" SelectedItem="{Binding SelectedLibMaterial}">
|
||||
<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 Grid.Row="2" Height="25" VerticalAlignment="Top" ItemsSource="{Binding LibReinforcementMaterials}" SelectedItem="{Binding SelectedLibMaterial}">
|
||||
<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">
|
||||
|
||||
42
Windows/MainWindow/Materials/PartialFactorsView.xaml
Normal file
42
Windows/MainWindow/Materials/PartialFactorsView.xaml
Normal file
@@ -0,0 +1,42 @@
|
||||
<Window x:Class="StructureHelper.Windows.MainWindow.Materials.PartialFactorsView"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance vm:PartialFactorsViewModel}"
|
||||
Title="Material Partial Factors" Height="350" Width="500" WindowStartupLocation="CenterScreen">
|
||||
<Window.Resources>
|
||||
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="80"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<DataGrid ItemsSource="{Binding Items}" AutoGenerateColumns="False" SelectedItem="{Binding SelectedItem}">
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Take}" Value="false">
|
||||
<Setter Property="Background" Value="LightGray"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridComboBoxColumn Header="Stress state" Width="90" MinWidth="70" SelectedItemBinding="{Binding StressState}" ItemsSource="{Binding Source={StaticResource StressStateEnum}}"/>
|
||||
<DataGridComboBoxColumn Header="Limit state" Width="90" MinWidth="70" SelectedItemBinding="{Binding LimitState}" ItemsSource="{Binding Source={StaticResource LimitStateEnum}}"/>
|
||||
<DataGridComboBoxColumn Header="Duration" Width="90" MinWidth="70" SelectedItemBinding="{Binding CalcTerm}" ItemsSource="{Binding Source={StaticResource CalcTermEnum}}"/>
|
||||
<DataGridTextColumn Header="Value" Width="70" MinWidth="70" Binding="{Binding FactorValue, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<StackPanel Grid.Column="1">
|
||||
<Button Style="{StaticResource AddButton}"/>
|
||||
<Button Style="{StaticResource DeleteButton}"/>
|
||||
<Button Style="{StaticResource CopyButton}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
31
Windows/MainWindow/Materials/PartialFactorsView.xaml.cs
Normal file
31
Windows/MainWindow/Materials/PartialFactorsView.xaml.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using StructureHelper.Windows.ViewModels.Materials;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
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>
|
||||
/// Логика взаимодействия для PartialFactorsView.xaml
|
||||
/// </summary>
|
||||
public partial class PartialFactorsView : Window
|
||||
{
|
||||
public PartialFactorsView(List<IMaterialPartialFactor> factors)
|
||||
{
|
||||
InitializeComponent();
|
||||
var vm = new PartialFactorsViewModel(factors);
|
||||
this.DataContext = vm;
|
||||
}
|
||||
}
|
||||
}
|
||||
24
Windows/MainWindow/Materials/SafetyFactorsView.xaml
Normal file
24
Windows/MainWindow/Materials/SafetyFactorsView.xaml
Normal file
@@ -0,0 +1,24 @@
|
||||
<Window x:Class="StructureHelper.Windows.AddMaterialWindow.SafetyFactorsView"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance vm:SafetyFactorsViewModel}"
|
||||
Title="Material Safety Factors" Height="350" Width="500" WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="80"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentControl ContentTemplate="{StaticResource MaterialSafetyFactors}" Content="{Binding}"/>
|
||||
<StackPanel Grid.Column="1">
|
||||
<Button Style="{StaticResource AddButton}"/>
|
||||
<Button Style="{StaticResource DeleteButton}"/>
|
||||
<Button Style="{StaticResource CopyButton}"/>
|
||||
<Button Style="{StaticResource CommandButton}" Content="Partial frs" Command="{Binding ShowPartialFactors}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
31
Windows/MainWindow/Materials/SafetyFactorsView.xaml.cs
Normal file
31
Windows/MainWindow/Materials/SafetyFactorsView.xaml.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using StructureHelper.Windows.ViewModels.Materials;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
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.AddMaterialWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для SafetyFactorsView.xaml
|
||||
/// </summary>
|
||||
public partial class SafetyFactorsView : Window
|
||||
{
|
||||
public SafetyFactorsView(List<IMaterialSafetyFactor> safetyFactors)
|
||||
{
|
||||
InitializeComponent();
|
||||
var vm = new SafetyFactorsViewModel(safetyFactors);
|
||||
this.DataContext = vm;
|
||||
}
|
||||
}
|
||||
}
|
||||
35
Windows/PrimitivePropertiesWindow/SelectPrimitivesView.xaml
Normal file
35
Windows/PrimitivePropertiesWindow/SelectPrimitivesView.xaml
Normal file
@@ -0,0 +1,35 @@
|
||||
<Window x:Class="StructureHelper.Windows.PrimitivePropertiesWindow.SelectPrimitivesView"
|
||||
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.PrimitivePropertiesWindow"
|
||||
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.PrimitiveProperties"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance vm:SelectPrimitivesViewModel}"
|
||||
Title="Select Primitives" Height="250" Width="250" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="35"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ListBox ItemsSource="{Binding Items.CollectionItems}" SelectedItem="Items.SelectedItem">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="22"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox IsChecked="{Binding IsSelected}"/>
|
||||
<ContentControl Grid.Column="1" ContentTemplate="{StaticResource ColoredItemTemplate}" Content="{Binding Item}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Style="{StaticResource CancelButton}"/>
|
||||
<Button Style="{StaticResource OkButton}" Click="Button_Click"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,35 @@
|
||||
using StructureHelper.Windows.ViewModels.PrimitiveProperties;
|
||||
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.PrimitivePropertiesWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для SelectPrimitivesView.xaml
|
||||
/// </summary>
|
||||
public partial class SelectPrimitivesView : Window
|
||||
{
|
||||
public SelectPrimitivesView(SelectPrimitivesViewModel vm)
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = vm;
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DialogResult = true;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
126
Windows/ViewModels/CRUDViewModelBase.cs
Normal file
126
Windows/ViewModels/CRUDViewModelBase.cs
Normal file
@@ -0,0 +1,126 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Documents;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels
|
||||
{
|
||||
public abstract class CRUDViewModelBase<TItem> : ViewModelBase, ICRUDViewModel<TItem> where TItem : class
|
||||
{
|
||||
|
||||
private RelayCommand addCommand;
|
||||
private RelayCommand deleteCommand;
|
||||
private RelayCommand copyCommand;
|
||||
private RelayCommand editCommand;
|
||||
|
||||
public List<TItem> Collection { get; set; }
|
||||
|
||||
public TItem NewItem { get; set; }
|
||||
public TItem SelectedItem { get; set; }
|
||||
|
||||
public ObservableCollection<TItem> Items { get; private set; }
|
||||
|
||||
public RelayCommand Add
|
||||
{
|
||||
get
|
||||
{
|
||||
return addCommand ??
|
||||
(
|
||||
addCommand = new RelayCommand(o =>
|
||||
{
|
||||
AddMethod(o);
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
public virtual void AddMethod(object parameter)
|
||||
{
|
||||
Collection.Add(NewItem);
|
||||
Items.Add(NewItem);
|
||||
}
|
||||
public RelayCommand Delete
|
||||
{
|
||||
get
|
||||
{
|
||||
return deleteCommand ??
|
||||
(
|
||||
deleteCommand = new RelayCommand(o =>
|
||||
{
|
||||
DeleteMethod();
|
||||
}, o => SelectedItem != null
|
||||
));
|
||||
}
|
||||
}
|
||||
public virtual void DeleteMethod()
|
||||
{
|
||||
Collection.Remove(SelectedItem);
|
||||
Items.Remove(SelectedItem);
|
||||
}
|
||||
public RelayCommand Edit
|
||||
{
|
||||
get
|
||||
{
|
||||
return editCommand ??
|
||||
(editCommand = new RelayCommand(o=>
|
||||
{
|
||||
EditMethod(o);
|
||||
}, o => SelectedItem != null
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void EditMethod(object parameter)
|
||||
{
|
||||
Items.Clear();
|
||||
foreach (var item in Collection)
|
||||
{
|
||||
Items.Add(item);
|
||||
}
|
||||
OnPropertyChanged(nameof(Items));
|
||||
}
|
||||
|
||||
public RelayCommand Copy
|
||||
{
|
||||
get
|
||||
{
|
||||
return copyCommand ??
|
||||
(copyCommand = new RelayCommand (o=>
|
||||
{
|
||||
CopyMethod();
|
||||
}, o => SelectedItem != null
|
||||
));
|
||||
}
|
||||
}
|
||||
public virtual void CopyMethod()
|
||||
{
|
||||
if (SelectedItem is ICloneable)
|
||||
{
|
||||
NewItem = (SelectedItem as ICloneable).Clone() as TItem;
|
||||
}
|
||||
Collection.Add(NewItem);
|
||||
Items.Add(NewItem);
|
||||
}
|
||||
public void AddItems(IEnumerable<TItem> items)
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
Items.Add(item);
|
||||
}
|
||||
}
|
||||
public CRUDViewModelBase()
|
||||
{
|
||||
Items = new ObservableCollection<TItem>();
|
||||
}
|
||||
|
||||
public CRUDViewModelBase(List<TItem> collection)
|
||||
{
|
||||
Collection = collection;
|
||||
Items = new ObservableCollection<TItem>(collection);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,13 @@ using StructureHelper.Services.Reports;
|
||||
using StructureHelper.Services.Reports.CalculationReports;
|
||||
using StructureHelper.Services.ResultViewers;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
||||
using StructureHelper.Windows.Forces;
|
||||
using StructureHelper.Windows.PrimitivePropertiesWindow;
|
||||
using StructureHelper.Windows.ViewModels.Forces;
|
||||
using StructureHelper.Windows.ViewModels.PrimitiveProperties;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
@@ -30,6 +35,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
private IForceCalculator forceCalculator;
|
||||
private IForcesResults forcesResults;
|
||||
private IEnumerable<INdmPrimitive> ndmPrimitives;
|
||||
private IEnumerable<INdmPrimitive> selectedNdmPrimitives;
|
||||
private IEnumerable<INdm> ndms;
|
||||
private IReport isoFieldReport;
|
||||
|
||||
@@ -50,8 +56,15 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
return showIsoFieldCommand ??
|
||||
(showIsoFieldCommand = new RelayCommand(o =>
|
||||
{
|
||||
GetNdms();
|
||||
ShowIsoField();
|
||||
var vm = new SelectPrimitivesViewModel(ndmPrimitives);
|
||||
var wnd = new SelectPrimitivesView(vm);
|
||||
wnd.ShowDialog();
|
||||
if (wnd.DialogResult == true)
|
||||
{
|
||||
selectedNdmPrimitives = vm.Items.CollectionItems.Where(x => x.IsSelected == true).Select(x => x.Item.GetNdmPrimitive());
|
||||
GetNdms();
|
||||
ShowIsoField();
|
||||
}
|
||||
}, o => (SelectedResult != null) && SelectedResult.IsValid));
|
||||
}
|
||||
}
|
||||
@@ -73,7 +86,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
{
|
||||
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
saveFileDialog.Filter = "csv |*.csv";
|
||||
saveFileDialog.Title = "Save an Image File";
|
||||
saveFileDialog.Title = "Save an csv File";
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var filename = saveFileDialog.FileName;
|
||||
@@ -119,8 +132,16 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
|
||||
private void Interpolate()
|
||||
{
|
||||
int stepCount = 100;
|
||||
var calculator = InterpolateService.InterpolateForceCalculator(forceCalculator, SelectedResult.DesignForceTuple, stepCount);
|
||||
IDesignForceTuple startDesignTuple, finishDesignTuple;
|
||||
finishDesignTuple = SelectedResult.DesignForceTuple.Clone() as IDesignForceTuple;
|
||||
var viewModel = new InterpolateTuplesViewModel(finishDesignTuple, null, 100);
|
||||
var wndTuples = new InterpolateTuplesView(viewModel);
|
||||
wndTuples.ShowDialog();
|
||||
if (wndTuples.DialogResult != true) return;
|
||||
startDesignTuple = viewModel.StartDesignForce;
|
||||
finishDesignTuple = viewModel.FinishDesignForce;
|
||||
int stepCount = viewModel.StepCount;
|
||||
var calculator = InterpolateService.InterpolateForceCalculator(forceCalculator, finishDesignTuple, startDesignTuple, stepCount);
|
||||
calculator.Run();
|
||||
var result = calculator.Result;
|
||||
if (result is null || result.IsValid == false)
|
||||
@@ -154,7 +175,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
{
|
||||
var limitState = SelectedResult.DesignForceTuple.LimitState;
|
||||
var calcTerm = SelectedResult.DesignForceTuple.CalcTerm;
|
||||
ndms = NdmPrimitivesService.GetNdms(ndmPrimitives, limitState, calcTerm);
|
||||
ndms = NdmPrimitivesService.GetNdms(selectedNdmPrimitives, limitState, calcTerm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
60
Windows/ViewModels/Forces/ActionsViewModel.cs
Normal file
60
Windows/ViewModels/Forces/ActionsViewModel.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using StructureHelper.Windows.Forces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Forces
|
||||
{
|
||||
public class ActionsViewModel : CRUDViewModelBase<IForceCombinationList>
|
||||
{
|
||||
ICrossSectionRepository repository;
|
||||
|
||||
public override void AddMethod(object parameter)
|
||||
{
|
||||
NewItem = new ForceCombinationList() { Name = "New Force Combination" };
|
||||
base.AddMethod(parameter);
|
||||
}
|
||||
|
||||
public override void DeleteMethod()
|
||||
{
|
||||
var dialogResult = MessageBox.Show("Delete action?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
var calcRepository = repository.CalculatorsList;
|
||||
foreach (var item in calcRepository)
|
||||
{
|
||||
if (item is IForceCalculator)
|
||||
{
|
||||
var forceCalculator = item as IForceCalculator;
|
||||
var containSelected = forceCalculator.ForceCombinationLists.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.ForceCombinationLists.Remove(SelectedItem); }
|
||||
else return;
|
||||
}
|
||||
}
|
||||
}
|
||||
base.DeleteMethod();
|
||||
}
|
||||
}
|
||||
|
||||
public override void EditMethod(object parameter)
|
||||
{
|
||||
var wnd = new ForceCombinationView(SelectedItem);
|
||||
wnd.ShowDialog();
|
||||
base.EditMethod(parameter);
|
||||
}
|
||||
|
||||
public ActionsViewModel(ICrossSectionRepository repository) : base (repository.ForceCombinationLists)
|
||||
{
|
||||
this.repository = repository;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,9 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
||||
{
|
||||
IForceCombinationList combinationList;
|
||||
|
||||
public IDesignForceTuple SelectedTuple { get; set; }
|
||||
//public IDesignForceTuple SelectedTuple { get; set; }
|
||||
public ForceTuplesViewModel DesignForces { get;}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => combinationList.Name;
|
||||
@@ -55,11 +57,12 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<IDesignForceTuple> ForceTuples { get => combinationList.DesignForces; }
|
||||
//public IEnumerable<IDesignForceTuple> ForceTuples { get => combinationList.DesignForces; }
|
||||
|
||||
public ForceCombinationViewModel(IForceCombinationList combinationList)
|
||||
{
|
||||
this.combinationList = combinationList;
|
||||
DesignForces = new ForceTuplesViewModel(this.combinationList.DesignForces);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
25
Windows/ViewModels/Forces/ForceTuplesViewModel.cs
Normal file
25
Windows/ViewModels/Forces/ForceTuplesViewModel.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using StructureHelper.Properties;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Forces
|
||||
{
|
||||
public class ForceTuplesViewModel : CRUDViewModelBase<IDesignForceTuple>
|
||||
{
|
||||
public override void AddMethod(object parameter)
|
||||
{
|
||||
NewItem = new DesignForceTuple() { LimitState=LimitStates.ULS, CalcTerm=CalcTerms.ShortTerm};
|
||||
base.AddMethod(parameter);
|
||||
}
|
||||
|
||||
public ForceTuplesViewModel(List<IDesignForceTuple> collection) : base(collection)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
40
Windows/ViewModels/Forces/InterpolateTuplesViewModel.cs
Normal file
40
Windows/ViewModels/Forces/InterpolateTuplesViewModel.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Forces
|
||||
{
|
||||
public class InterpolateTuplesViewModel : OkCancelViewModelBase
|
||||
{
|
||||
public IDesignForceTuple StartDesignForce { get; }
|
||||
public IDesignForceTuple FinishDesignForce { get; }
|
||||
public int StepCount { get; set; }
|
||||
|
||||
public InterpolateTuplesViewModel(IDesignForceTuple finishDesignForce, IDesignForceTuple startDesignForce=null, int stepCount = 100)
|
||||
{
|
||||
if (startDesignForce !=null)
|
||||
{
|
||||
if (startDesignForce.LimitState != finishDesignForce.LimitState) throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid);
|
||||
if (startDesignForce.CalcTerm != finishDesignForce.CalcTerm) throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid);
|
||||
StartDesignForce = startDesignForce;
|
||||
}
|
||||
else
|
||||
{
|
||||
StartDesignForce = new DesignForceTuple()
|
||||
{
|
||||
CalcTerm = finishDesignForce.CalcTerm,
|
||||
LimitState = finishDesignForce.LimitState,
|
||||
ForceTuple = new ForceTuple() { Mx = 0, My = 0, Nz = 0 },
|
||||
};
|
||||
}
|
||||
FinishDesignForce = finishDesignForce;
|
||||
StepCount = stepCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Services.Primitives;
|
||||
using StructureHelper.Windows.AddMaterialWindow;
|
||||
using StructureHelper.Windows.MainWindow;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
@@ -56,6 +57,29 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
public ICommand DeleteMaterialCommand { get; set; }
|
||||
public ICommand EditHeadMaterial;
|
||||
|
||||
private RelayCommand showSafetyfactors;
|
||||
|
||||
public RelayCommand ShowSafetyFactors
|
||||
{
|
||||
get
|
||||
{
|
||||
return showSafetyfactors ??
|
||||
(
|
||||
showSafetyfactors = new RelayCommand(o =>
|
||||
{
|
||||
if (selectedMaterial.HelperMaterial is ILibMaterial)
|
||||
{
|
||||
var material = selectedMaterial.HelperMaterial as ILibMaterial;
|
||||
var wnd = new SafetyFactorsView(material.SafetyFactors);
|
||||
wnd.ShowDialog();
|
||||
OnPropertyChanged(nameof(Items));
|
||||
}
|
||||
}, o=> SelectedLibMaterial != null
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private ICommand addElasticMaterialCommand;
|
||||
|
||||
public ObservableCollection<IHeadMaterial> HeadMaterials { get; private set; }
|
||||
@@ -74,6 +98,19 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<IMaterialSafetyFactor> Items
|
||||
{
|
||||
get
|
||||
{
|
||||
if (selectedMaterial.HelperMaterial is ILibMaterial)
|
||||
{
|
||||
var material = selectedMaterial.HelperMaterial as ILibMaterial;
|
||||
return new ObservableCollection<IMaterialSafetyFactor>(material.SafetyFactors);
|
||||
}
|
||||
else return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string SelectedName
|
||||
{
|
||||
get => selectedMaterial.Name;
|
||||
|
||||
15
Windows/ViewModels/Materials/ISafetyFactorViewModel.cs
Normal file
15
Windows/ViewModels/Materials/ISafetyFactorViewModel.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
internal interface ISafetyFactorViewModel<TItem> : ICRUDViewModel<TItem>
|
||||
{
|
||||
RelayCommand ShowPartialFactors { get; }
|
||||
}
|
||||
}
|
||||
22
Windows/ViewModels/Materials/PartialFactorsViewModel.cs
Normal file
22
Windows/ViewModels/Materials/PartialFactorsViewModel.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
internal class PartialFactorsViewModel : CRUDViewModelBase<IMaterialPartialFactor>
|
||||
{
|
||||
public override void AddMethod(object parameter)
|
||||
{
|
||||
NewItem = new MaterialPartialFactor();
|
||||
base.AddMethod(parameter);
|
||||
}
|
||||
|
||||
public PartialFactorsViewModel(List<IMaterialPartialFactor> safetyFactors) : base(safetyFactors)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
41
Windows/ViewModels/Materials/SafetyFactorsViewModel.cs
Normal file
41
Windows/ViewModels/Materials/SafetyFactorsViewModel.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Windows.MainWindow.Materials;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
internal class SafetyFactorsViewModel : CRUDViewModelBase<IMaterialSafetyFactor>
|
||||
{
|
||||
private RelayCommand showPartialCommand;
|
||||
|
||||
public RelayCommand ShowPartialFactors
|
||||
{
|
||||
get
|
||||
{
|
||||
return showPartialCommand ??
|
||||
(showPartialCommand = new RelayCommand(o =>
|
||||
{
|
||||
var wnd = new PartialFactorsView(SelectedItem.PartialFactors);
|
||||
wnd.ShowDialog();
|
||||
}, o => SelectedItem != null
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddMethod(object parameter)
|
||||
{
|
||||
NewItem = new MaterialSafetyFactor();
|
||||
base.AddMethod(parameter);
|
||||
}
|
||||
|
||||
public SafetyFactorsViewModel(List<IMaterialSafetyFactor> safetyFactors) : base(safetyFactors)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
17
Windows/ViewModels/OkCancelViewModelBase.cs
Normal file
17
Windows/ViewModels/OkCancelViewModelBase.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels
|
||||
{
|
||||
public abstract class OkCancelViewModelBase : ViewModelBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
||||
{
|
||||
public class SelectPrimitivesViewModel
|
||||
{
|
||||
public SelectItemsViewModel<PrimitiveBase> Items { get; }
|
||||
|
||||
public SelectPrimitivesViewModel(IEnumerable<INdmPrimitive> primitives)
|
||||
{
|
||||
var primitiveViews = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(primitives);
|
||||
Items = new SelectItemsViewModel<PrimitiveBase>(primitiveViews);
|
||||
Items.ItemDataDemplate = Application.Current.Resources["ColoredItemTemplate"] as DataTemplate;
|
||||
}
|
||||
}
|
||||
}
|
||||
33
Windows/ViewModels/SelectItemsViewModel.cs
Normal file
33
Windows/ViewModels/SelectItemsViewModel.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels
|
||||
{
|
||||
public class SelectItemsViewModel<TItem>
|
||||
where TItem : class
|
||||
{
|
||||
public class CollectionItem
|
||||
{
|
||||
public bool IsSelected { get; set; }
|
||||
public TItem Item { get; set; }
|
||||
}
|
||||
|
||||
public DataTemplate ItemDataDemplate { get; set; }
|
||||
|
||||
public ObservableCollection<CollectionItem> CollectionItems { get; }
|
||||
|
||||
public SelectItemsViewModel(IEnumerable<TItem> items)
|
||||
{
|
||||
CollectionItems = new ObservableCollection<CollectionItem>();
|
||||
foreach (var item in items)
|
||||
{
|
||||
CollectionItems.Add(new CollectionItem() { IsSelected = true, Item = item });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user