Start localization
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<system:String x:Key="Actions">Actions</system:String>
|
||||
<system:String x:Key="Geometry">Geometry</system:String>
|
||||
<system:String x:Key="Materials">Materials</system:String>
|
||||
<system:String x:Key="Show Materials">Show Materials</system:String>
|
||||
<system:String x:Key="Analisis">Analisis</system:String>
|
||||
<system:String x:Key="Analises">Analises</system:String>
|
||||
<system:String x:Key="Add Full Combination">Add Full Combination</system:String>
|
||||
<system:String x:Key="Add Factored Combination">Add Factored Combination</system:String>
|
||||
<system:String x:Key="Concrete">Concrete</system:String>
|
||||
<system:String x:Key="Reinforcement">Reinforcement</system:String>
|
||||
<system:String x:Key="Elastic">Elastic</system:String>
|
||||
<system:String x:Key="CarbonFiber">CarbonFiber</system:String>
|
||||
<system:String x:Key="GlassFiber">GlassFiber</system:String>
|
||||
<system:String x:Key="Rectangle">Rectangle</system:String>
|
||||
<system:String x:Key="Circle">Circle</system:String>
|
||||
<system:String x:Key="Rebar">Rebar</system:String>
|
||||
<system:String x:Key="Point">Point</system:String>
|
||||
<system:String x:Key="Run">Run</system:String>
|
||||
<system:String x:Key="Add">Add</system:String>
|
||||
<system:String x:Key="Edit">Edit</system:String>
|
||||
<system:String x:Key="Copy">Copy</system:String>
|
||||
<system:String x:Key="Copy To">Copy To</system:String>
|
||||
<system:String x:Key="Delete">Delete</system:String>
|
||||
<system:String x:Key="To Foreground">To Foreground</system:String>
|
||||
<system:String x:Key="To Background">To Background</system:String>
|
||||
<system:String x:Key="Add Force Calculator">Add Force Calculator</system:String>
|
||||
<system:String x:Key="Add Interaction Diagram Calculator">Add Interaction Diagram Calculator</system:String>
|
||||
<system:String x:Key="Add Rectangle Primitive">Add Rectangle Primitive</system:String>
|
||||
<system:String x:Key="Add Circle Primitive">Add Circle Primitive</system:String>
|
||||
<system:String x:Key="Add Rebar Primitive">Add Rebar Primitive</system:String>
|
||||
<system:String x:Key="Add Point Primitive">Add Point Primitive</system:String>
|
||||
<system:String x:Key="Add Rectangle RC Column">Add Rectangle RC Column</system:String>
|
||||
<system:String x:Key="Add Circle RC Column">Add Circle RC Column</system:String>
|
||||
<system:String x:Key="Add RC Beam">Add RC Beam</system:String>
|
||||
<system:String x:Key="Add RC Slab">Add RC Slab</system:String>
|
||||
<system:String x:Key="Add Reinforcement Material">Add Reinforcement Material</system:String>
|
||||
<system:String x:Key="Add Elastic Material">Add Elastic Material</system:String>
|
||||
<system:String x:Key="Add Carbon Fiber Material">Add Carbon Fiber Material</system:String>
|
||||
<system:String x:Key="Change Language">Change Language</system:String>
|
||||
<system:String x:Key="Visual Settings">Visual Settings</system:String>
|
||||
<system:String x:Key="RU_EN">EN</system:String>
|
||||
<system:String x:Key="RC Templates">RC Templates</system:String>
|
||||
<system:String x:Key="Base Primitives">Base Primitives</system:String>
|
||||
<system:String x:Key="Tools">Tools</system:String>
|
||||
<system:String x:Key="Grid size">Grid size: </system:String>
|
||||
<system:String x:Key="Number of primitives">Number of primitives: </system:String>
|
||||
<!-- All StringResources Goes Here -->
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,53 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<system:String x:Key="Actions">Усилия</system:String>
|
||||
<system:String x:Key="Geometry">Геометрия</system:String>
|
||||
<system:String x:Key="Materials">Материалы</system:String>
|
||||
<system:String x:Key="Show Materials">Показать материалы</system:String>
|
||||
<system:String x:Key="Analisis">Расчет</system:String>
|
||||
<system:String x:Key="Analises">Расчеты</system:String>
|
||||
<system:String x:Key="Add Full Combination">Создать комбинацию явно</system:String>
|
||||
<system:String x:Key="Add Factored Combination">Создать комбинацию коэффициентами</system:String>
|
||||
<system:String x:Key="Concrete">Бетон</system:String>
|
||||
<system:String x:Key="Reinforcement">Арматура</system:String>
|
||||
<system:String x:Key="Elastic">Упругий</system:String>
|
||||
<system:String x:Key="CarbonFiber">Углеволокно</system:String>
|
||||
<system:String x:Key="GlassFiber">Стекловолокно</system:String>
|
||||
<system:String x:Key="Rectangle">Прямоугольник</system:String>
|
||||
<system:String x:Key="Circle">Окружность</system:String>
|
||||
<system:String x:Key="Rebar">Стержень</system:String>
|
||||
<system:String x:Key="Point">Точка</system:String>
|
||||
<system:String x:Key="Run">Выполнить</system:String>
|
||||
<system:String x:Key="Add">Создать</system:String>
|
||||
<system:String x:Key="Edit">Изменить</system:String>
|
||||
<system:String x:Key="Copy">Копировать</system:String>
|
||||
<system:String x:Key="Copy To">Копировать в</system:String>
|
||||
<system:String x:Key="Delete">Удалить</system:String>
|
||||
<system:String x:Key="To Foreground">На передний план</system:String>
|
||||
<system:String x:Key="To Background">На задний план</system:String>
|
||||
<system:String x:Key="Add Force Calculator">Создать расчет по усилиям</system:String>
|
||||
<system:String x:Key="Add Interaction Diagram Calculator">Создать расчет области прочности</system:String>
|
||||
<system:String x:Key="Add Rectangle Primitive">Создать прямоугольник</system:String>
|
||||
<system:String x:Key="Add Circle Primitive">Создать окружность</system:String>
|
||||
<system:String x:Key="Add Rebar Primitive">Создать арматурный стержень</system:String>
|
||||
<system:String x:Key="Add Point Primitive">Создать точку</system:String>
|
||||
<system:String x:Key="Add Rectangle RC Column">Создать прямоугольную ЖБ колонну</system:String>
|
||||
<system:String x:Key="Add Circle RC Column">Создать круглую ЖБ колонну</system:String>
|
||||
<system:String x:Key="Add RC Beam">Создать ЖБ балку</system:String>
|
||||
<system:String x:Key="Add RC Slab">Создать ЖБ плиту</system:String>
|
||||
<system:String x:Key="Add Reinforcement Material">Создать материал армирования</system:String>
|
||||
<system:String x:Key="Add Elastic Material">Создать упругий материал</system:String>
|
||||
<system:String x:Key="Add Carbon Fiber Material">Создать углеволокно</system:String>
|
||||
<system:String x:Key="Change Language">Смена языка</system:String>
|
||||
<system:String x:Key="Visual Settings">Настройки изображения</system:String>
|
||||
<system:String x:Key="RU_EN">RU</system:String>
|
||||
<system:String x:Key="RC Templates">ЖБ шаблоны</system:String>
|
||||
<system:String x:Key="Base Primitives">Базовые примитивы</system:String>
|
||||
<system:String x:Key="Tools">Инструменты</system:String>
|
||||
<system:String x:Key="Grid size">Шаг сетки: </system:String>
|
||||
<system:String x:Key="Number of primitives">Кол-во примитивов: </system:String>
|
||||
<!-- All StringResources Goes Here -->
|
||||
</ResourceDictionary>
|
||||
@@ -74,6 +74,12 @@
|
||||
<Page Update="Infrastructure\UI\Resources\Materials.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Infrastructure\UI\Resources\Strings.en-US.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Infrastructure\UI\Resources\Strings.ru-RU.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Windows\Arrays\ArrayView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
|
||||
@@ -205,6 +205,8 @@
|
||||
<Button Command="{Binding ShowVisualProperty}" ToolTip="Visual Settings">
|
||||
<Image Width="32" Height="32" Source="/Windows/MainWindow/Tools_Settings.png"/>
|
||||
</Button>
|
||||
<Button Command="{Binding ChangeLanguage}" ToolTip="{DynamicResource Change Language}" Content="{DynamicResource RU_EN}">
|
||||
</Button>
|
||||
</ToolBar>
|
||||
</ToolBarTray>
|
||||
<Grid>
|
||||
@@ -250,33 +252,33 @@
|
||||
</Expander.Header>
|
||||
<Expander.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="Materials" Command="{Binding EditMaterialsCommand}">
|
||||
<MenuItem Header="{DynamicResource Materials}" Command="{Binding EditMaterialsCommand}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Materials32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Add">
|
||||
<MenuItem Header="Concrete" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Concrete}">
|
||||
<MenuItem Header="{DynamicResource Concrete}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Concrete}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/ConMaterial32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Reinforcement" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Reinforcement}">
|
||||
<MenuItem Header="{DynamicResource Reinforcement}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Reinforcement}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/RFMaterial32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Elastic" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Elastic}">
|
||||
<MenuItem Header="{DynamicResource Elastic}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Elastic}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/ElasticMaterial32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="CarbonFiber" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.CarbonFiber}">
|
||||
<MenuItem Header="{DynamicResource CarbonFiber}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.CarbonFiber}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/СarbonMaterial32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="GlassFiber" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.GlassFiber}">
|
||||
<MenuItem Header="{DynamicResource GlassFiber}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.GlassFiber}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/GlassMaterial32.png" />
|
||||
</MenuItem.Icon>
|
||||
@@ -289,26 +291,26 @@
|
||||
ItemTemplate="{StaticResource ColoredItemTemplate}"
|
||||
ContextMenu="{StaticResource EditCopyDelete}"/>
|
||||
</Expander>
|
||||
<Expander Header="Geometry" MinWidth="20">
|
||||
<Expander Header="{DynamicResource Geometry}" MinWidth="20">
|
||||
<Expander.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="Add" DataContext="{Binding PrimitiveLogic}">
|
||||
<MenuItem Header="Rectangle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}">
|
||||
<MenuItem Header="{DynamicResource Add}" DataContext="{Binding PrimitiveLogic}">
|
||||
<MenuItem Header="{DynamicResource Rectangle}" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Rectangle32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Circle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}">
|
||||
<MenuItem Header="{DynamicResource Circle}" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Circle32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Rebar" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Reinforcement}">
|
||||
<MenuItem Header="{DynamicResource Rebar}" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Reinforcement}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Rebar32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Point" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}">
|
||||
<MenuItem Header="{DynamicResource Point}" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Point32.png" />
|
||||
</MenuItem.Icon>
|
||||
@@ -330,7 +332,7 @@
|
||||
</Expander.Header>
|
||||
<Expander.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="Add" Command="{Binding Add}" CommandParameter="{x:Static enums:CalculatorTypes.ForceCalculator}">
|
||||
<MenuItem Header="{DynamicResource Add}" Command="{Binding Add}" CommandParameter="{x:Static enums:CalculatorTypes.ForceCalculator}">
|
||||
<MenuItem Header="Add Force Calculator" Command="{Binding Add}" CommandParameter="{x:Static enums:CalculatorTypes.ForceCalculator}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16" Source="/Windows/MainWindow/Calculator32.png" />
|
||||
@@ -367,39 +369,39 @@
|
||||
<Canvas.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="Add" DataContext="{Binding PrimitiveLogic}">
|
||||
<MenuItem Header="Rectangle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}">
|
||||
<MenuItem Header="{DynamicResource Rectangle}" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Rectangle32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Circle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}">
|
||||
<MenuItem Header="{DynamicResource Circle}" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Circle32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Rebar" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Reinforcement}">
|
||||
<MenuItem Header="{DynamicResource Rebar}" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Reinforcement}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Rebar32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Point" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}">
|
||||
<MenuItem Header="{DynamicResource Point}" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Point.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Templates" DataContext="{Binding}">
|
||||
<MenuItem Header="Add Rectangle RC Column" Command="{Binding AddColumnCase}">
|
||||
<MenuItem Header="{DynamicResource Add Rectangle RC Column}" Command="{Binding AddColumnCase}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/RectangleColumn32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Add Circle RC Column" Command="{Binding AddRCCircleCase}">
|
||||
<MenuItem Header="{DynamicResource Add Circle RC Column}" Command="{Binding AddRCCircleCase}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/CircleColumn32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Add RC Beam" Command="{Binding AddBeamCase}">
|
||||
<MenuItem Header="{DynamicResource Add RC Beam}" Command="{Binding AddBeamCase}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Beam32.png" />
|
||||
</MenuItem.Icon>
|
||||
@@ -471,14 +473,14 @@
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Number of primitives: "/>
|
||||
<TextBlock Text="{Binding PrimitiveLogic.PrimitivesCount}"/>
|
||||
<TextBlock Text="{DynamicResource Number of primitives}"/>
|
||||
<TextBlock Margin="5,0,0,0" Text="{Binding PrimitiveLogic.PrimitivesCount}"/>
|
||||
</StackPanel>
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Grid size: "/>
|
||||
<TextBlock Text="{Binding GridSize, Converter={StaticResource LengthConverter}}"/>
|
||||
<TextBlock Text="{DynamicResource Grid size}"/>
|
||||
<TextBlock Margin="5,0,0,0" Text="{Binding GridSize, Converter={StaticResource LengthConverter}}"/>
|
||||
</StackPanel>
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
|
||||
@@ -1,29 +1,36 @@
|
||||
using System.Windows;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Services;
|
||||
using StructureHelper.Services.Primitives;
|
||||
|
||||
namespace StructureHelper.Windows.MainWindow
|
||||
{
|
||||
public partial class CrossSectionView : Window
|
||||
{
|
||||
private CrossSectionViewModel viewModel;
|
||||
public IPrimitiveRepository PrimitiveRepository { get; }
|
||||
public partial class CrossSectionView : Window
|
||||
{
|
||||
private CrossSectionViewModel viewModel;
|
||||
public IPrimitiveRepository PrimitiveRepository { get; }
|
||||
|
||||
public CrossSectionView(IPrimitiveRepository primitiveRepository, CrossSectionViewModel viewModel)
|
||||
{
|
||||
PrimitiveRepository = primitiveRepository;
|
||||
this.viewModel = viewModel;
|
||||
DataContext = this.viewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
public CrossSectionView(IPrimitiveRepository primitiveRepository, CrossSectionViewModel viewModel)
|
||||
{
|
||||
PrimitiveRepository = primitiveRepository;
|
||||
this.viewModel = viewModel;
|
||||
DataContext = this.viewModel;
|
||||
viewModel.MV = this;
|
||||
ResourceDictionary dict = new ResourceDictionary();
|
||||
dict.Source = new Uri("..\\Infrastructure\\UI\\Resources\\Strings.en-US.xaml",
|
||||
UriKind.Relative);
|
||||
this.Resources.MergedDictionaries.Add(dict);
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void ContentPresenter_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
var contentPresenter = sender as ContentPresenter;
|
||||
var item = contentPresenter?.Content as PrimitiveBase;
|
||||
viewModel.PrimitiveLogic.SelectedItem = item;
|
||||
}
|
||||
}
|
||||
private void ContentPresenter_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
var contentPresenter = sender as ContentPresenter;
|
||||
var item = contentPresenter?.Content as PrimitiveBase;
|
||||
viewModel.PrimitiveLogic.SelectedItem = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using LoaderCalculator.Logics.Geometry;
|
||||
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Models.Materials;
|
||||
@@ -9,12 +10,15 @@ using StructureHelper.Windows.ViewModels;
|
||||
using StructureHelper.Windows.ViewModels.Forces;
|
||||
using StructureHelper.Windows.ViewModels.Materials;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.Models.Templates.CrossSections.RCs;
|
||||
using StructureHelperLogics.Models.Templates.RCs;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -25,375 +29,420 @@ using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.MainWindow
|
||||
{
|
||||
public class CrossSectionViewModel : ViewModelBase
|
||||
{
|
||||
private ICrossSection section;
|
||||
private ICrossSectionRepository repository => section.SectionRepository;
|
||||
private readonly double scaleRate = 1.1d;
|
||||
public class CrossSectionViewModel : ViewModelBase
|
||||
{
|
||||
private ICrossSection section;
|
||||
private ICrossSectionRepository repository => section.SectionRepository;
|
||||
private readonly double scaleRate = 1.1d;
|
||||
|
||||
public CrossSectionVisualPropertyVM VisualProperty { get; private set; }
|
||||
public CrossSectionVisualPropertyVM VisualProperty { get; private set; }
|
||||
|
||||
|
||||
public PrimitiveBase SelectedPrimitive { get; set; }
|
||||
public PrimitiveBase SelectedPrimitive { get; set; }
|
||||
|
||||
public AnalysisVewModelLogic CalculatorsLogic { get; private set; }
|
||||
public ActionsViewModel CombinationsLogic { get; }
|
||||
public MaterialsViewModel MaterialsLogic { get; }
|
||||
public PrimitiveViewModelLogic PrimitiveLogic { get; }
|
||||
public HelpLogic HelpLogic => new HelpLogic();
|
||||
public AnalysisVewModelLogic CalculatorsLogic { get; private set; }
|
||||
public ActionsViewModel CombinationsLogic { get; }
|
||||
public MaterialsViewModel MaterialsLogic { get; }
|
||||
public PrimitiveViewModelLogic PrimitiveLogic { get; }
|
||||
public HelpLogic HelpLogic => new HelpLogic();
|
||||
|
||||
private CrossSectionModel Model { get; }
|
||||
private CrossSectionModel Model { get; }
|
||||
|
||||
private double panelX, panelY, scrollPanelX, scrollPanelY;
|
||||
private double panelX, panelY, scrollPanelX, scrollPanelY;
|
||||
|
||||
public double PanelX
|
||||
{
|
||||
get => panelX;
|
||||
set => OnPropertyChanged(value, ref panelX);
|
||||
}
|
||||
public double PanelY
|
||||
{
|
||||
get => panelY;
|
||||
set => OnPropertyChanged(value, ref panelY);
|
||||
}
|
||||
public double ScrollPanelX
|
||||
{
|
||||
get => scrollPanelX;
|
||||
set => OnPropertyChanged(value, ref scrollPanelX);
|
||||
}
|
||||
public double ScrollPanelY
|
||||
{
|
||||
get => scrollPanelY;
|
||||
set => OnPropertyChanged(value, ref scrollPanelY);
|
||||
}
|
||||
public double PanelX
|
||||
{
|
||||
get => panelX;
|
||||
set => OnPropertyChanged(value, ref panelX);
|
||||
}
|
||||
public double PanelY
|
||||
{
|
||||
get => panelY;
|
||||
set => OnPropertyChanged(value, ref panelY);
|
||||
}
|
||||
public double ScrollPanelX
|
||||
{
|
||||
get => scrollPanelX;
|
||||
set => OnPropertyChanged(value, ref scrollPanelX);
|
||||
}
|
||||
public double ScrollPanelY
|
||||
{
|
||||
get => scrollPanelY;
|
||||
set => OnPropertyChanged(value, ref scrollPanelY);
|
||||
}
|
||||
|
||||
private double scaleValue;
|
||||
private double scaleValue;
|
||||
|
||||
public double ScaleValue
|
||||
{
|
||||
get => Math.Round(scaleValue);
|
||||
set
|
||||
public double ScaleValue
|
||||
{
|
||||
get => Math.Round(scaleValue);
|
||||
set
|
||||
{
|
||||
OnPropertyChanged(value, ref scaleValue);
|
||||
OnPropertyChanged(nameof(AxisLineThickness));
|
||||
OnPropertyChanged(nameof(GridLineThickness));
|
||||
}
|
||||
}
|
||||
|
||||
public double AxisLineThickness
|
||||
{
|
||||
get => VisualProperty.AxisLineThickness / scaleValue;
|
||||
}
|
||||
|
||||
public double GridLineThickness
|
||||
{
|
||||
get => VisualProperty.GridLineThickness / scaleValue;
|
||||
}
|
||||
|
||||
public string CanvasViewportSize
|
||||
{
|
||||
get
|
||||
{
|
||||
string s = VisualProperty.GridSize.ToString();
|
||||
s = s.Replace(',', '.');
|
||||
return $"0,0,{s},{s}";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public double GridSize => VisualProperty.GridSize;
|
||||
|
||||
public ObservableCollection<IHeadMaterial> HeadMaterials
|
||||
{
|
||||
get
|
||||
{
|
||||
var collection = new ObservableCollection<IHeadMaterial>();
|
||||
foreach (var obj in Model.Section.SectionRepository.HeadMaterials)
|
||||
{
|
||||
OnPropertyChanged(value, ref scaleValue);
|
||||
OnPropertyChanged(nameof(AxisLineThickness));
|
||||
OnPropertyChanged(nameof(GridLineThickness));
|
||||
collection.Add(obj);
|
||||
}
|
||||
}
|
||||
return collection;
|
||||
}
|
||||
}
|
||||
|
||||
public double AxisLineThickness
|
||||
{
|
||||
get => VisualProperty.AxisLineThickness / scaleValue;
|
||||
}
|
||||
/// <summary>
|
||||
/// Right edge of work plane, coordinate X
|
||||
/// </summary>
|
||||
public double RightLimitX => VisualProperty.WorkPlainWidth;
|
||||
/// <summary>
|
||||
/// Bottom edge of work plane Y
|
||||
/// </summary>
|
||||
public double BottomLimitY => VisualProperty.WorkPlainHeight;
|
||||
/// <summary>
|
||||
/// Middle of coordinate X
|
||||
/// </summary>
|
||||
public double MiddleLimitX => VisualProperty.WorkPlainWidth / 2d;
|
||||
/// <summary>
|
||||
/// Middle of coordinate Y
|
||||
/// </summary>
|
||||
public double MiddleLimitY => VisualProperty.WorkPlainHeight / 2d;
|
||||
|
||||
public double GridLineThickness
|
||||
{
|
||||
get => VisualProperty.GridLineThickness / scaleValue;
|
||||
}
|
||||
private int langID = 0;
|
||||
public int LangID { get => langID; set { langID = value; OnPropertyChanged(); } }
|
||||
public RelayCommand ChangeLanguage
|
||||
{
|
||||
get
|
||||
{
|
||||
return changeLanguage ?? (changeLanguage = new RelayCommand(obj => { ChangeLang(); }));
|
||||
}
|
||||
}
|
||||
|
||||
public string CanvasViewportSize
|
||||
{
|
||||
get
|
||||
public void ChangeLang()
|
||||
{
|
||||
if (LangID == 0)
|
||||
{
|
||||
LangID = 1;
|
||||
SetLanguageDictionary(LangID);
|
||||
}
|
||||
else
|
||||
{
|
||||
LangID = 0;
|
||||
SetLanguageDictionary(LangID);
|
||||
}
|
||||
}
|
||||
|
||||
// Загрузка файлов ресурсов для выбранного языка
|
||||
private void SetLanguageDictionary(int local)
|
||||
{
|
||||
ResourceDictionary dict = new ResourceDictionary();
|
||||
switch (local)
|
||||
{
|
||||
case 0:
|
||||
dict.Source = new Uri("..\\Infrastructure\\UI\\Resources\\Strings.en-US.xaml",
|
||||
UriKind.Relative);
|
||||
break;
|
||||
case 1:
|
||||
dict.Source = new Uri("..\\Infrastructure\\UI\\Resources\\Strings.ru-RU.xaml",
|
||||
UriKind.Relative);
|
||||
break;
|
||||
}
|
||||
MV.Resources.MergedDictionaries.Add(dict);
|
||||
}
|
||||
|
||||
internal CrossSectionView MV;
|
||||
|
||||
public ICommand Calculate { get; }
|
||||
public ICommand EditCalculationPropertyCommand { get; }
|
||||
public ICommand EditHeadMaterialsCommand { get; }
|
||||
public ICommand AddRCCircleCase
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand(o =>
|
||||
{
|
||||
string s = VisualProperty.GridSize.ToString();
|
||||
s = s.Replace(',', '.');
|
||||
return $"0,0,{s},{s}";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public double GridSize => VisualProperty.GridSize;
|
||||
|
||||
public ObservableCollection<IHeadMaterial> HeadMaterials
|
||||
{
|
||||
get
|
||||
{
|
||||
var collection = new ObservableCollection<IHeadMaterial>();
|
||||
foreach (var obj in Model.Section.SectionRepository.HeadMaterials)
|
||||
PrimitiveLogic.AddItems(GetRCCirclePrimitives());
|
||||
MaterialsLogic.Refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
public ICommand AddBeamCase { get; }
|
||||
public ICommand AddColumnCase { get; }
|
||||
public ICommand AddSlabCase { get; }
|
||||
public ICommand LeftButtonDown { get; }
|
||||
public ICommand LeftButtonUp { get; }
|
||||
public ICommand MovePrimitiveToGravityCenterCommand { get; }
|
||||
public ICommand PreviewMouseMove { get; }
|
||||
public ICommand ClearSelection { get; }
|
||||
public ICommand OpenMaterialCatalog { get; }
|
||||
public ICommand OpenMaterialCatalogWithSelection { get; }
|
||||
public ICommand OpenUnitsSystemSettings { get; }
|
||||
public ICommand SetColor { get; }
|
||||
public ICommand SetInFrontOfAll { get; }
|
||||
public ICommand SetInBackOfAll { get; }
|
||||
public ICommand ScaleCanvasDown { get; }
|
||||
public ICommand ScaleCanvasUp { get; }
|
||||
public ICommand SetPopupCanBeClosedTrue { get; }
|
||||
public ICommand SetPopupCanBeClosedFalse { get; }
|
||||
public RelayCommand ShowVisualProperty
|
||||
{
|
||||
get
|
||||
{
|
||||
return showVisualProperty ??
|
||||
(showVisualProperty = new RelayCommand(o =>
|
||||
{
|
||||
collection.Add(obj);
|
||||
}
|
||||
return collection;
|
||||
}
|
||||
}
|
||||
var wnd = new VisualPropertyView(VisualProperty);
|
||||
wnd.ShowDialog();
|
||||
OnPropertyChanged(nameof(AxisLineThickness));
|
||||
OnPropertyChanged(nameof(CanvasViewportSize));
|
||||
OnPropertyChanged(nameof(GridSize));
|
||||
OnPropertyChanged(nameof(RightLimitX));
|
||||
OnPropertyChanged(nameof(BottomLimitY));
|
||||
OnPropertyChanged(nameof(MiddleLimitX));
|
||||
OnPropertyChanged(nameof(MiddleLimitY));
|
||||
PrimitiveLogic.WorkPlaneWidth = VisualProperty.WorkPlainWidth;
|
||||
PrimitiveLogic.WorkPlaneHeight = VisualProperty.WorkPlainHeight;
|
||||
PrimitiveLogic.Refresh();
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Right edge of work plane, coordinate X
|
||||
/// </summary>
|
||||
public double RightLimitX => VisualProperty.WorkPlainWidth;
|
||||
/// <summary>
|
||||
/// Bottom edge of work plane Y
|
||||
/// </summary>
|
||||
public double BottomLimitY => VisualProperty.WorkPlainHeight;
|
||||
/// <summary>
|
||||
/// Middle of coordinate X
|
||||
/// </summary>
|
||||
public double MiddleLimitX => VisualProperty.WorkPlainWidth / 2d;
|
||||
/// <summary>
|
||||
/// Middle of coordinate Y
|
||||
/// </summary>
|
||||
public double MiddleLimitY => VisualProperty.WorkPlainHeight / 2d;
|
||||
|
||||
public ICommand Calculate { get; }
|
||||
public ICommand EditCalculationPropertyCommand { get; }
|
||||
public ICommand EditHeadMaterialsCommand { get; }
|
||||
public ICommand AddRCCircleCase
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand(o =>
|
||||
public RelayCommand SelectPrimitiveCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return selectPrimitive ??
|
||||
(selectPrimitive = new RelayCommand(obj =>
|
||||
{
|
||||
PrimitiveLogic.AddItems(GetRCCirclePrimitives());
|
||||
MaterialsLogic.Refresh();
|
||||
});
|
||||
if (obj is PrimitiveBase)
|
||||
{
|
||||
SelectedPrimitive = obj as PrimitiveBase;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
private double delta = 0.0005;
|
||||
private RelayCommand showVisualProperty;
|
||||
private RelayCommand selectPrimitive;
|
||||
private RelayCommand changeLanguage;
|
||||
|
||||
public CrossSectionViewModel(CrossSectionModel model)
|
||||
{
|
||||
VisualProperty = new CrossSectionVisualPropertyVM();
|
||||
Model = model;
|
||||
section = model.Section;
|
||||
CombinationsLogic = new ActionsViewModel(repository);
|
||||
MaterialsLogic = new MaterialsViewModel(repository);
|
||||
MaterialsLogic.AfterItemsEdit += afterMaterialEdit;
|
||||
CalculatorsLogic = new AnalysisVewModelLogic(repository);
|
||||
PrimitiveLogic = new PrimitiveViewModelLogic(section)
|
||||
{
|
||||
WorkPlaneWidth = VisualProperty.WorkPlainWidth,
|
||||
WorkPlaneHeight = VisualProperty.WorkPlainHeight
|
||||
};
|
||||
scaleValue = 500d;
|
||||
|
||||
LeftButtonUp = new RelayCommand(o =>
|
||||
{
|
||||
if (o is RectangleViewPrimitive rect) rect.BorderCaptured = false;
|
||||
});
|
||||
LeftButtonDown = new RelayCommand(o =>
|
||||
{
|
||||
if (o is RectangleViewPrimitive rect) rect.BorderCaptured = true;
|
||||
});
|
||||
PreviewMouseMove = new RelayCommand(o =>
|
||||
{
|
||||
if (o is RectangleViewPrimitive rect && rect.BorderCaptured && !rect.ElementLock)
|
||||
{
|
||||
if (rect.PrimitiveWidth % 10d < delta || rect.PrimitiveWidth % 10d >= delta)
|
||||
rect.PrimitiveWidth = Math.Round(PanelX / 10d) * 10d - rect.PrimitiveLeft + 10d;
|
||||
else
|
||||
rect.PrimitiveWidth = PanelX - rect.PrimitiveLeft + 10d;
|
||||
|
||||
if (rect.PrimitiveHeight % 10d < delta || rect.PrimitiveHeight % 10d >= delta)
|
||||
rect.PrimitiveHeight = Math.Round(PanelY / 10d) * 10d - rect.PrimitiveTop + 10d;
|
||||
else
|
||||
rect.PrimitiveHeight = PanelY - rect.PrimitiveTop + 10d;
|
||||
}
|
||||
}
|
||||
public ICommand AddBeamCase { get; }
|
||||
public ICommand AddColumnCase { get; }
|
||||
public ICommand AddSlabCase { get; }
|
||||
public ICommand LeftButtonDown { get; }
|
||||
public ICommand LeftButtonUp { get; }
|
||||
public ICommand MovePrimitiveToGravityCenterCommand { get; }
|
||||
public ICommand PreviewMouseMove { get; }
|
||||
public ICommand ClearSelection { get; }
|
||||
public ICommand OpenMaterialCatalog { get; }
|
||||
public ICommand OpenMaterialCatalogWithSelection { get; }
|
||||
public ICommand OpenUnitsSystemSettings { get; }
|
||||
public ICommand SetColor { get; }
|
||||
public ICommand SetInFrontOfAll { get; }
|
||||
public ICommand SetInBackOfAll { get; }
|
||||
public ICommand ScaleCanvasDown { get; }
|
||||
public ICommand ScaleCanvasUp { get; }
|
||||
public ICommand SetPopupCanBeClosedTrue { get; }
|
||||
public ICommand SetPopupCanBeClosedFalse { get; }
|
||||
public RelayCommand ShowVisualProperty
|
||||
{
|
||||
get
|
||||
{
|
||||
return showVisualProperty ??
|
||||
(showVisualProperty = new RelayCommand(o=>
|
||||
{
|
||||
var wnd = new VisualPropertyView(VisualProperty);
|
||||
wnd.ShowDialog();
|
||||
OnPropertyChanged(nameof(AxisLineThickness));
|
||||
OnPropertyChanged(nameof(CanvasViewportSize));
|
||||
OnPropertyChanged(nameof(GridSize));
|
||||
OnPropertyChanged(nameof(RightLimitX));
|
||||
OnPropertyChanged(nameof(BottomLimitY));
|
||||
OnPropertyChanged(nameof(MiddleLimitX));
|
||||
OnPropertyChanged(nameof(MiddleLimitY));
|
||||
PrimitiveLogic.WorkPlaneWidth = VisualProperty.WorkPlainWidth;
|
||||
PrimitiveLogic.WorkPlaneHeight = VisualProperty.WorkPlainHeight;
|
||||
PrimitiveLogic.Refresh();
|
||||
}));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
public RelayCommand SelectPrimitiveCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return selectPrimitive ??
|
||||
(selectPrimitive = new RelayCommand(obj=>
|
||||
{
|
||||
if (obj is PrimitiveBase)
|
||||
{
|
||||
SelectedPrimitive = obj as PrimitiveBase;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
ScaleCanvasDown = new RelayCommand(o =>
|
||||
{
|
||||
ScrollPanelX = PanelX;
|
||||
ScrollPanelY = PanelY;
|
||||
ScaleValue *= scaleRate;
|
||||
});
|
||||
|
||||
private double delta = 0.0005;
|
||||
private RelayCommand showVisualProperty;
|
||||
private RelayCommand selectPrimitive;
|
||||
ScaleCanvasUp = new RelayCommand(o =>
|
||||
{
|
||||
ScrollPanelX = PanelX;
|
||||
ScrollPanelY = PanelY;
|
||||
ScaleValue /= scaleRate;
|
||||
});
|
||||
|
||||
public CrossSectionViewModel(CrossSectionModel model)
|
||||
{
|
||||
VisualProperty = new CrossSectionVisualPropertyVM();
|
||||
Model = model;
|
||||
section = model.Section;
|
||||
CombinationsLogic = new ActionsViewModel(repository);
|
||||
MaterialsLogic = new MaterialsViewModel(repository);
|
||||
MaterialsLogic.AfterItemsEdit += afterMaterialEdit;
|
||||
CalculatorsLogic = new AnalysisVewModelLogic(repository);
|
||||
PrimitiveLogic = new PrimitiveViewModelLogic(section)
|
||||
{
|
||||
WorkPlaneWidth = VisualProperty.WorkPlainWidth,
|
||||
WorkPlaneHeight = VisualProperty.WorkPlainHeight
|
||||
};
|
||||
scaleValue = 500d;
|
||||
AddBeamCase = new RelayCommand(o =>
|
||||
{
|
||||
PrimitiveLogic.AddItems(GetBeamCasePrimitives());
|
||||
MaterialsLogic.Refresh();
|
||||
});
|
||||
|
||||
LeftButtonUp = new RelayCommand(o =>
|
||||
{
|
||||
if (o is RectangleViewPrimitive rect) rect.BorderCaptured = false;
|
||||
});
|
||||
LeftButtonDown = new RelayCommand(o =>
|
||||
{
|
||||
if (o is RectangleViewPrimitive rect) rect.BorderCaptured = true;
|
||||
});
|
||||
PreviewMouseMove = new RelayCommand(o =>
|
||||
{
|
||||
if (o is RectangleViewPrimitive rect && rect.BorderCaptured && !rect.ElementLock)
|
||||
{
|
||||
if (rect.PrimitiveWidth % 10d < delta || rect.PrimitiveWidth % 10d >= delta)
|
||||
rect.PrimitiveWidth = Math.Round(PanelX / 10d) * 10d - rect.PrimitiveLeft + 10d;
|
||||
else
|
||||
rect.PrimitiveWidth = PanelX - rect.PrimitiveLeft + 10d;
|
||||
AddColumnCase = new RelayCommand(o =>
|
||||
{
|
||||
PrimitiveLogic.AddItems(GetColumnCasePrimitives());
|
||||
MaterialsLogic.Refresh();
|
||||
});
|
||||
|
||||
if (rect.PrimitiveHeight % 10d < delta || rect.PrimitiveHeight % 10d >= delta)
|
||||
rect.PrimitiveHeight = Math.Round(PanelY / 10d) * 10d - rect.PrimitiveTop + 10d;
|
||||
else
|
||||
rect.PrimitiveHeight = PanelY - rect.PrimitiveTop + 10d;
|
||||
}
|
||||
});
|
||||
AddSlabCase = new RelayCommand(o =>
|
||||
{
|
||||
PrimitiveLogic.AddItems(GetSlabCasePrimitives());
|
||||
MaterialsLogic.Refresh();
|
||||
});
|
||||
|
||||
ScaleCanvasDown = new RelayCommand(o =>
|
||||
{
|
||||
ScrollPanelX = PanelX;
|
||||
ScrollPanelY = PanelY;
|
||||
ScaleValue *= scaleRate;
|
||||
});
|
||||
|
||||
ScaleCanvasUp = new RelayCommand(o =>
|
||||
{
|
||||
ScrollPanelX = PanelX;
|
||||
ScrollPanelY = PanelY;
|
||||
ScaleValue /= scaleRate;
|
||||
});
|
||||
|
||||
AddBeamCase = new RelayCommand(o =>
|
||||
{
|
||||
PrimitiveLogic.AddItems(GetBeamCasePrimitives());
|
||||
MaterialsLogic.Refresh();
|
||||
});
|
||||
|
||||
AddColumnCase = new RelayCommand(o =>
|
||||
{
|
||||
PrimitiveLogic.AddItems(GetColumnCasePrimitives());
|
||||
MaterialsLogic.Refresh();
|
||||
});
|
||||
|
||||
AddSlabCase = new RelayCommand(o =>
|
||||
{
|
||||
PrimitiveLogic.AddItems(GetSlabCasePrimitives());
|
||||
MaterialsLogic.Refresh();
|
||||
});
|
||||
|
||||
MovePrimitiveToGravityCenterCommand = new RelayCommand(o =>
|
||||
{
|
||||
if (CheckMaterials() == false) { return;}
|
||||
var ndms = NdmPrimitivesService.GetNdms(repository.Primitives, LimitStates.SLS, CalcTerms.ShortTerm);
|
||||
var center = GeometryOperations.GetGravityCenter(ndms);
|
||||
foreach (var item in PrimitiveLogic.Items)
|
||||
{
|
||||
item.CenterX -= center.Cx;
|
||||
item.CenterY -= center.Cy;
|
||||
}
|
||||
},
|
||||
o => repository.Primitives.Count() > 0
|
||||
);
|
||||
|
||||
SetPopupCanBeClosedTrue = new RelayCommand(o =>
|
||||
{
|
||||
if (!(o is PrimitiveBase primitive)) return;
|
||||
primitive.PopupCanBeClosed = true;
|
||||
});
|
||||
|
||||
SetPopupCanBeClosedFalse = new RelayCommand(o =>
|
||||
{
|
||||
if (!(o is PrimitiveBase primitive)) return;
|
||||
primitive.PopupCanBeClosed = false;
|
||||
});
|
||||
}
|
||||
|
||||
private void afterMaterialEdit(SelectItemVM<IHeadMaterial> sender, CRUDVMEventArgs e)
|
||||
{
|
||||
foreach (var primitive in PrimitiveLogic.Items)
|
||||
{
|
||||
primitive.RefreshColor();
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckMaterials()
|
||||
{
|
||||
MovePrimitiveToGravityCenterCommand = new RelayCommand(o =>
|
||||
{
|
||||
if (CheckMaterials() == false) { return; }
|
||||
var ndms = NdmPrimitivesService.GetNdms(repository.Primitives, LimitStates.SLS, CalcTerms.ShortTerm);
|
||||
var center = GeometryOperations.GetGravityCenter(ndms);
|
||||
foreach (var item in PrimitiveLogic.Items)
|
||||
{
|
||||
if (item.HeadMaterial == null)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show($"Primitive {item.Name} does not has material", "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
item.CenterX -= center.Cx;
|
||||
item.CenterY -= center.Cy;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private IEnumerable<PrimitiveBase> GetRCCirclePrimitives()
|
||||
{
|
||||
var template = new CircleTemplate();
|
||||
return GetCasePrimitives(template);
|
||||
}
|
||||
private IEnumerable<PrimitiveBase> GetBeamCasePrimitives()
|
||||
{
|
||||
var template = new RectangleBeamTemplate();
|
||||
return GetCasePrimitives(template);
|
||||
}
|
||||
private IEnumerable<PrimitiveBase> GetColumnCasePrimitives()
|
||||
{
|
||||
var template = new RectangleBeamTemplate(0.5d, 0.5d) { CoverGap = 0.05, WidthCount = 3, HeightCount = 3, TopDiameter = 0.025d, BottomDiameter = 0.025d };
|
||||
return GetCasePrimitives(template);
|
||||
}
|
||||
private IEnumerable<PrimitiveBase> GetSlabCasePrimitives()
|
||||
{
|
||||
var template = new RectangleBeamTemplate(1d, 0.2d) { CoverGap = 0.04, WidthCount = 5, HeightCount = 2, TopDiameter = 0.012d, BottomDiameter = 0.012d };
|
||||
return GetCasePrimitives(template);
|
||||
}
|
||||
},
|
||||
o => repository.Primitives.Count() > 0
|
||||
);
|
||||
|
||||
private IEnumerable<PrimitiveBase> GetCasePrimitives(IRCSectionTemplate template)
|
||||
{
|
||||
Window wnd;
|
||||
IRCGeometryLogic geometryLogic;
|
||||
if (template is IRectangleBeamTemplate)
|
||||
{
|
||||
var rectTemplate = template as IRectangleBeamTemplate;
|
||||
geometryLogic = new RectGeometryLogic(rectTemplate);
|
||||
wnd = new RectangleBeamView(rectTemplate);
|
||||
}
|
||||
else if (template is ICircleTemplate)
|
||||
{
|
||||
var circleTemplate = template as ICircleTemplate;
|
||||
geometryLogic = new CircleGeometryLogic(circleTemplate);
|
||||
wnd = new CircleView(circleTemplate);
|
||||
}
|
||||
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $"Was: {nameof(template)}"); }
|
||||
wnd.ShowDialog();
|
||||
if (wnd.DialogResult == true)
|
||||
{
|
||||
SetPopupCanBeClosedTrue = new RelayCommand(o =>
|
||||
{
|
||||
if (!(o is PrimitiveBase primitive)) return;
|
||||
primitive.PopupCanBeClosed = true;
|
||||
});
|
||||
|
||||
var newSection = new SectionTemplate(geometryLogic).GetCrossSection();
|
||||
var newRepository = newSection.SectionRepository;
|
||||
repository.HeadMaterials.AddRange(newRepository.HeadMaterials);
|
||||
repository.Primitives.AddRange(newRepository.Primitives);
|
||||
repository.ForceActions.AddRange(newRepository.ForceActions);
|
||||
repository.CalculatorsList.AddRange(newRepository.CalculatorsList);
|
||||
OnPropertyChanged(nameof(HeadMaterials));
|
||||
CombinationsLogic.AddItems(newRepository.ForceActions);
|
||||
CalculatorsLogic.AddItems(newRepository.CalculatorsList);
|
||||
var primitives = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(newRepository.Primitives);
|
||||
foreach (var item in primitives)
|
||||
{
|
||||
item.RegisterDeltas(VisualProperty.WorkPlainWidth / 2, VisualProperty.WorkPlainHeight / 2);
|
||||
}
|
||||
PrimitiveLogic.Refresh();
|
||||
foreach (var item in newRepository.HeadMaterials)
|
||||
{
|
||||
GlobalRepository.Materials.Create(item);
|
||||
}
|
||||
foreach (var item in newRepository.ForceActions)
|
||||
{
|
||||
GlobalRepository.Actions.Create(item);
|
||||
}
|
||||
return primitives;
|
||||
SetPopupCanBeClosedFalse = new RelayCommand(o =>
|
||||
{
|
||||
if (!(o is PrimitiveBase primitive)) return;
|
||||
primitive.PopupCanBeClosed = false;
|
||||
});
|
||||
}
|
||||
|
||||
private void afterMaterialEdit(SelectItemVM<IHeadMaterial> sender, CRUDVMEventArgs e)
|
||||
{
|
||||
foreach (var primitive in PrimitiveLogic.Items)
|
||||
{
|
||||
primitive.RefreshColor();
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckMaterials()
|
||||
{
|
||||
foreach (var item in PrimitiveLogic.Items)
|
||||
{
|
||||
if (item.HeadMaterial == null)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show($"Primitive {item.Name} does not has material", "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
return new List<PrimitiveBase>();
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private IEnumerable<PrimitiveBase> GetRCCirclePrimitives()
|
||||
{
|
||||
var template = new CircleTemplate();
|
||||
return GetCasePrimitives(template);
|
||||
}
|
||||
private IEnumerable<PrimitiveBase> GetBeamCasePrimitives()
|
||||
{
|
||||
var template = new RectangleBeamTemplate();
|
||||
return GetCasePrimitives(template);
|
||||
}
|
||||
private IEnumerable<PrimitiveBase> GetColumnCasePrimitives()
|
||||
{
|
||||
var template = new RectangleBeamTemplate(0.5d, 0.5d) { CoverGap = 0.05, WidthCount = 3, HeightCount = 3, TopDiameter = 0.025d, BottomDiameter = 0.025d };
|
||||
return GetCasePrimitives(template);
|
||||
}
|
||||
private IEnumerable<PrimitiveBase> GetSlabCasePrimitives()
|
||||
{
|
||||
var template = new RectangleBeamTemplate(1d, 0.2d) { CoverGap = 0.04, WidthCount = 5, HeightCount = 2, TopDiameter = 0.012d, BottomDiameter = 0.012d };
|
||||
return GetCasePrimitives(template);
|
||||
}
|
||||
|
||||
private IEnumerable<PrimitiveBase> GetCasePrimitives(IRCSectionTemplate template)
|
||||
{
|
||||
Window wnd;
|
||||
IRCGeometryLogic geometryLogic;
|
||||
if (template is IRectangleBeamTemplate)
|
||||
{
|
||||
var rectTemplate = template as IRectangleBeamTemplate;
|
||||
geometryLogic = new RectGeometryLogic(rectTemplate);
|
||||
wnd = new RectangleBeamView(rectTemplate);
|
||||
}
|
||||
else if (template is ICircleTemplate)
|
||||
{
|
||||
var circleTemplate = template as ICircleTemplate;
|
||||
geometryLogic = new CircleGeometryLogic(circleTemplate);
|
||||
wnd = new CircleView(circleTemplate);
|
||||
}
|
||||
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $"Was: {nameof(template)}"); }
|
||||
wnd.ShowDialog();
|
||||
if (wnd.DialogResult == true)
|
||||
{
|
||||
|
||||
var newSection = new SectionTemplate(geometryLogic).GetCrossSection();
|
||||
var newRepository = newSection.SectionRepository;
|
||||
repository.HeadMaterials.AddRange(newRepository.HeadMaterials);
|
||||
repository.Primitives.AddRange(newRepository.Primitives);
|
||||
repository.ForceActions.AddRange(newRepository.ForceActions);
|
||||
repository.CalculatorsList.AddRange(newRepository.CalculatorsList);
|
||||
OnPropertyChanged(nameof(HeadMaterials));
|
||||
CombinationsLogic.AddItems(newRepository.ForceActions);
|
||||
CalculatorsLogic.AddItems(newRepository.CalculatorsList);
|
||||
var primitives = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(newRepository.Primitives);
|
||||
foreach (var item in primitives)
|
||||
{
|
||||
item.RegisterDeltas(VisualProperty.WorkPlainWidth / 2, VisualProperty.WorkPlainHeight / 2);
|
||||
}
|
||||
PrimitiveLogic.Refresh();
|
||||
foreach (var item in newRepository.HeadMaterials)
|
||||
{
|
||||
GlobalRepository.Materials.Create(item);
|
||||
}
|
||||
foreach (var item in newRepository.ForceActions)
|
||||
{
|
||||
GlobalRepository.Actions.Create(item);
|
||||
}
|
||||
return primitives;
|
||||
}
|
||||
return new List<PrimitiveBase>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user