PrimitiveProps editing via context menu was added
This commit is contained in:
@@ -14,11 +14,12 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
{
|
{
|
||||||
ICirclePrimitive primitive;
|
ICirclePrimitive primitive;
|
||||||
public double Diameter
|
public double Diameter
|
||||||
{ get
|
{
|
||||||
|
get
|
||||||
{
|
{
|
||||||
return primitive.Diameter;
|
return primitive.Diameter;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
primitive.Diameter = value;
|
primitive.Diameter = value;
|
||||||
RefreshPlacement();
|
RefreshPlacement();
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||||
xmlns:mouseEventTriggers="clr-namespace:StructureHelper.Infrastructure.UI.Triggers.MouseEventTriggers"
|
xmlns:mouseEventTriggers="clr-namespace:StructureHelper.Infrastructure.UI.Triggers.MouseEventTriggers"
|
||||||
xmlns:dataContexts="clr-namespace:StructureHelper.Infrastructure.UI.DataContexts"
|
xmlns:dataContexts="clr-namespace:StructureHelper.Infrastructure.UI.DataContexts"
|
||||||
xmlns:userControls="clr-namespace:StructureHelper.Infrastructure.UI.UserControls"
|
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Ellipse Style="{StaticResource EllipseStyle}" d:DataContext="{d:DesignInstance dataContexts:PointViewPrimitive}" Tag ="{Binding}">
|
<Ellipse Style="{StaticResource EllipseStyle}" d:DataContext="{d:DesignInstance dataContexts:PointViewPrimitive}" Tag ="{Binding}">
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||||
xmlns:infrastructure="clr-namespace:StructureHelper.Infrastructure"
|
xmlns:infrastructure="clr-namespace:StructureHelper.Infrastructure"
|
||||||
xmlns:mouseEventTriggers="clr-namespace:StructureHelper.Infrastructure.UI.Triggers.MouseEventTriggers"
|
xmlns:mouseEventTriggers="clr-namespace:StructureHelper.Infrastructure.UI.Triggers.MouseEventTriggers"
|
||||||
xmlns:userControls="clr-namespace:StructureHelper.Infrastructure.UI.UserControls"
|
|
||||||
xmlns:dataContexts="clr-namespace:StructureHelper.Infrastructure.UI.DataContexts"
|
xmlns:dataContexts="clr-namespace:StructureHelper.Infrastructure.UI.DataContexts"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DataContext="{d:DesignInstance dataContexts:RectangleViewPrimitive}">
|
d:DataContext="{d:DesignInstance dataContexts:RectangleViewPrimitive}">
|
||||||
|
|||||||
@@ -18,4 +18,19 @@
|
|||||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Text="{Binding Height, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
|
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Text="{Binding Height, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="CircleShapeEdit">
|
||||||
|
<DataTemplate.Resources>
|
||||||
|
</DataTemplate.Resources>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="100"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Row="0" Text="Diameter"/>
|
||||||
|
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Style="{StaticResource ValidatedError}" Text="{Binding Diameter, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||||
|
-->
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Any CPU</Platform>
|
||||||
|
<PublishDir>bin\Release\net6.0-windows7.0\win-x64\publish\win-x64\</PublishDir>
|
||||||
|
<PublishProtocol>FileSystem</PublishProtocol>
|
||||||
|
<_TargetId>Folder</_TargetId>
|
||||||
|
<TargetFramework>net6.0-windows7.0</TargetFramework>
|
||||||
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
|
<SelfContained>true</SelfContained>
|
||||||
|
<PublishReadyToRun>false</PublishReadyToRun>
|
||||||
|
<PublishTrimmed>false</PublishTrimmed>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||||
|
-->
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<History>True|2023-02-25T08:37:39.2738786Z;False|2023-02-25T13:37:24.0284261+05:00;True|2023-02-25T13:34:01.6858860+05:00;True|2023-02-25T13:31:18.8295711+05:00;False|2023-02-25T13:25:21.5807199+05:00;False|2023-02-25T13:24:41.7164398+05:00;</History>
|
||||||
|
<LastFailureDetails />
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net6.0-windows7.0</TargetFramework>
|
<TargetFramework>net6.0-windows7.0</TargetFramework>
|
||||||
|
<PublishSingleFile>true</PublishSingleFile>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
<ImplicitUsings>disable</ImplicitUsings>
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
|
|||||||
49
StructureHelper/StructureHelper.csproj.bak
Normal file
49
StructureHelper/StructureHelper.csproj.bak
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net6.0-windows7.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
|
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
|
||||||
|
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="StructureHelperCommon\**" />
|
||||||
|
<Compile Remove="StructureHelperLogics\**" />
|
||||||
|
<EmbeddedResource Remove="StructureHelperCommon\**" />
|
||||||
|
<EmbeddedResource Remove="StructureHelperLogics\**" />
|
||||||
|
<None Remove="StructureHelperCommon\**" />
|
||||||
|
<None Remove="StructureHelperLogics\**" />
|
||||||
|
<Page Remove="StructureHelperCommon\**" />
|
||||||
|
<Page Remove="StructureHelperLogics\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Autofac" Version="6.5.0" />
|
||||||
|
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
||||||
|
<PackageReference Include="System.Windows.Interactivity.WPF" Version="2.0.20525" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\FieldVisualizer\FieldVisualizer.csproj" />
|
||||||
|
<ProjectReference Include="..\StructureHelperCommon\StructureHelperCommon.csproj" />
|
||||||
|
<ProjectReference Include="..\StructureHelperLogics\StructureHelperLogics.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="LoaderCalculator">
|
||||||
|
<HintPath>Libraries\LoaderCalculator.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="Libraries\NLog.dll">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -1,10 +1,27 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup />
|
<PropertyGroup>
|
||||||
|
<_LastSelectedProfileId>C:\Source\Repos\StructureHelper\StructureHelper\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ApplicationDefinition Update="App.xaml">
|
<ApplicationDefinition Update="App.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup>
|
||||||
|
<Compile Update="Windows\MainWindow\AboutView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Windows\PrimitiveTemplates\RCs\Beams\CircleView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Page Update="Windows\MainWindow\AboutView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Update="Windows\PrimitiveTemplates\RCs\Beams\CircleView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
28
StructureHelper/Windows/MainWindow/AboutView.xaml
Normal file
28
StructureHelper/Windows/MainWindow/AboutView.xaml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<Window x:Class="StructureHelper.Windows.MainWindow.AboutView"
|
||||||
|
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"
|
||||||
|
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Help"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DataContext="{d:DesignInstance vm:AboutViewModel}"
|
||||||
|
Title="Structure Helper" Height="200" Width="400" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition Height="40"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Text="Authors"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="{Binding Authors}"/>
|
||||||
|
<TextBlock Grid.Row="2" Text="Version"/>
|
||||||
|
<TextBlock Grid.Row="3" Text="{Binding Version}"/>
|
||||||
|
<TextBlock Grid.Row="4" Text="Copy Right (c) Redikultsev Evgeny"/>
|
||||||
|
<Button Grid.Row="6" Style="{StaticResource OkButton}" Click="Button_Click"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
36
StructureHelper/Windows/MainWindow/AboutView.xaml.cs
Normal file
36
StructureHelper/Windows/MainWindow/AboutView.xaml.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using StructureHelper.Windows.ViewModels.Help;
|
||||||
|
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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для AboutView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class AboutView : Window
|
||||||
|
{
|
||||||
|
public AboutView()
|
||||||
|
{
|
||||||
|
var vm = new AboutViewModel();
|
||||||
|
vm.ParentWindow = this;
|
||||||
|
this.DataContext = vm;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,11 +41,12 @@
|
|||||||
<MenuItem Header="Edit">
|
<MenuItem Header="Edit">
|
||||||
<MenuItem Header="Primitives">
|
<MenuItem Header="Primitives">
|
||||||
<MenuItem Header="Add">
|
<MenuItem Header="Add">
|
||||||
<Button Content="Add Rectangle" Command="{Binding AddPrimitive}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
<Button Content="Rectangle" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
||||||
<Button Content="Add Point" Command="{Binding AddPrimitive}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
<Button Content="Circle" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}"/>
|
||||||
|
<Button Content="Point" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<Button Content="Edit primitive" Command="{Binding EditPrimitive}"/>
|
<Button Content="Edit primitive" Command="{Binding PrimitiveLogic.Edit}"/>
|
||||||
<Button Content="Delete primitive" Command="{Binding DeletePrimitive}"/>
|
<Button Content="Delete primitive" Command="{Binding PrimitiveLogic.Delete}"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<Button Content="Materials" Command="{Binding EditHeadMaterialsCommand}"/>
|
<Button Content="Materials" Command="{Binding EditHeadMaterialsCommand}"/>
|
||||||
<Button Content="Move primitives to center" Command="{Binding Path=MovePrimitiveToGravityCenterCommand}"/>
|
<Button Content="Move primitives to center" Command="{Binding Path=MovePrimitiveToGravityCenterCommand}"/>
|
||||||
@@ -53,13 +54,15 @@
|
|||||||
<Button Content="Concrete beam" Command="{Binding AddBeamCase}"/>
|
<Button Content="Concrete beam" Command="{Binding AddBeamCase}"/>
|
||||||
<Button Content="Concrete column" Command="{Binding AddColumnCase}"/>
|
<Button Content="Concrete column" Command="{Binding AddColumnCase}"/>
|
||||||
<Button Content="Concrete slab" Command="{Binding AddSlabCase}"/>
|
<Button Content="Concrete slab" Command="{Binding AddSlabCase}"/>
|
||||||
|
<Button Content="Concrete circle" Command="{Binding AddRCCircleCase}"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="Tools">
|
<MenuItem Header="Tools">
|
||||||
<Button Content="Settings" Command="{Binding ShowVisualProperty}"/>
|
<Button Content="Settings" Command="{Binding ShowVisualProperty}"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<!--<MenuItem Header="Help">
|
<MenuItem Header="Help">
|
||||||
</MenuItem>-->
|
<Button Content="About..." Command="{Binding HelpLogic.ShowAbout}"/>
|
||||||
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
<Grid Grid.Row="1">
|
<Grid Grid.Row="1">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@@ -100,24 +103,24 @@
|
|||||||
<ListBox ItemsSource="{Binding HeadMaterials}" ItemTemplate="{StaticResource ColoredItemTemplate}">
|
<ListBox ItemsSource="{Binding HeadMaterials}" ItemTemplate="{StaticResource ColoredItemTemplate}">
|
||||||
</ListBox>
|
</ListBox>
|
||||||
</Expander>
|
</Expander>
|
||||||
<Expander Header="Geometry" MinWidth="20">
|
<Expander Header="Geometry" MinWidth="20" DataContext="{Binding PrimitiveLogic}">
|
||||||
<Expander.ContextMenu>
|
<Expander.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<MenuItem Header="Add">
|
<MenuItem Header="Add">
|
||||||
<Button Content="Add Rectangle" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
<Button Content="Add Rectangle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
||||||
<Button Content="Add Circle" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}"/>
|
<Button Content="Add Circle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}"/>
|
||||||
<Button Content="Add Point" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
<Button Content="Add Point" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</Expander.ContextMenu>
|
</Expander.ContextMenu>
|
||||||
<ListBox ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}" ItemTemplate="{StaticResource ColoredItemTemplate}">
|
<ListBox ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}" ItemTemplate="{StaticResource ColoredItemTemplate}">
|
||||||
<ListBox.ContextMenu>
|
<ListBox.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<Button Content="Edit" Command="{Binding PrimitiveLogic.Edit}"/>
|
<Button Content="Edit" Command="{Binding Edit}"/>
|
||||||
<Button Content="Copy" Command="{Binding PrimitiveLogic.Copy}"/>
|
<Button Content="Copy" Command="{Binding Copy}"/>
|
||||||
<Button Content="Delete" Command="{Binding PrimitiveLogic.Delete}"/>
|
<Button Content="Delete" Command="{Binding Delete}"/>
|
||||||
<Button Content="To Foreground" Command="{Binding PrimitiveLogic.SetToFront}"/>
|
<Button Content="To Foreground" Command="{Binding SetToFront}"/>
|
||||||
<Button Content="To Background" Command="{Binding PrimitiveLogic.SetToBack}"/>
|
<Button Content="To Background" Command="{Binding SetToBack}"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</ListBox.ContextMenu>
|
</ListBox.ContextMenu>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
@@ -163,6 +166,12 @@
|
|||||||
<Button Content="Add Circle" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}"/>
|
<Button Content="Add Circle" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}"/>
|
||||||
<Button Content="Add Point" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
<Button Content="Add Point" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem Header="Templates">
|
||||||
|
<Button Content="Concrete beam" Command="{Binding AddBeamCase}"/>
|
||||||
|
<Button Content="Concrete column" Command="{Binding AddColumnCase}"/>
|
||||||
|
<Button Content="Concrete slab" Command="{Binding AddSlabCase}"/>
|
||||||
|
<Button Content="Concrete circle" Command="{Binding AddRCCircleCase}"/>
|
||||||
|
</MenuItem>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</Canvas.ContextMenu>
|
</Canvas.ContextMenu>
|
||||||
<i:Interaction.Behaviors>
|
<i:Interaction.Behaviors>
|
||||||
|
|||||||
@@ -1,31 +1,27 @@
|
|||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Logics.Geometry;
|
||||||
using LoaderCalculator.Logics.Geometry;
|
|
||||||
using StructureHelper.Infrastructure;
|
using StructureHelper.Infrastructure;
|
||||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
using StructureHelper.MaterialCatalogWindow;
|
using StructureHelper.MaterialCatalogWindow;
|
||||||
using StructureHelper.Models.Materials;
|
using StructureHelper.Models.Materials;
|
||||||
using StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow;
|
|
||||||
using StructureHelper.Windows.CalculationWindows.CalculationResultWindow;
|
|
||||||
using StructureHelper.Windows.ColorPickerWindow;
|
using StructureHelper.Windows.ColorPickerWindow;
|
||||||
using StructureHelper.Windows.MainWindow.Materials;
|
using StructureHelper.Windows.MainWindow.Materials;
|
||||||
|
using StructureHelper.Windows.PrimitiveTemplates.RCs.Beams;
|
||||||
using StructureHelper.Windows.PrimitiveTemplates.RCs.RectangleBeam;
|
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.Forces;
|
||||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Infrastructures.Strings;
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.Models.Templates.CrossSections.RCs;
|
using StructureHelperLogics.Models.Templates.CrossSections.RCs;
|
||||||
using StructureHelperLogics.Models.Templates.RCs;
|
using StructureHelperLogics.Models.Templates.RCs;
|
||||||
using StructureHelperLogics.Services.NdmCalculations;
|
|
||||||
using StructureHelperLogics.Services.NdmPrimitives;
|
using StructureHelperLogics.Services.NdmPrimitives;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
@@ -47,6 +43,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
public AnalysisVewModelLogic CalculatorsLogic { get => calculatorsLogic;}
|
public AnalysisVewModelLogic CalculatorsLogic { get => calculatorsLogic;}
|
||||||
public ActionsViewModel CombinationsLogic { get => combinationsLogic; }
|
public ActionsViewModel CombinationsLogic { get => combinationsLogic; }
|
||||||
public IPrimitiveViewModelLogic PrimitiveLogic => primitiveLogic;
|
public IPrimitiveViewModelLogic PrimitiveLogic => primitiveLogic;
|
||||||
|
public HelpLogic HelpLogic => new HelpLogic();
|
||||||
|
|
||||||
private MainModel Model { get; }
|
private MainModel Model { get; }
|
||||||
|
|
||||||
@@ -157,6 +154,15 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
public ICommand Calculate { get; }
|
public ICommand Calculate { get; }
|
||||||
public ICommand EditCalculationPropertyCommand { get; }
|
public ICommand EditCalculationPropertyCommand { get; }
|
||||||
public ICommand EditHeadMaterialsCommand { get; }
|
public ICommand EditHeadMaterialsCommand { get; }
|
||||||
|
public ICommand AddRCCircleCase
|
||||||
|
{ get
|
||||||
|
{
|
||||||
|
return new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
PrimitiveLogic.AddItems(GetRCCirclePrimitives());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
public ICommand AddBeamCase { get; }
|
public ICommand AddBeamCase { get; }
|
||||||
public ICommand AddColumnCase { get; }
|
public ICommand AddColumnCase { get; }
|
||||||
public ICommand AddSlabCase { get; }
|
public ICommand AddSlabCase { get; }
|
||||||
@@ -286,7 +292,6 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
AddBeamCase = new RelayCommand(o =>
|
AddBeamCase = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
PrimitiveLogic.AddItems(GetBeamCasePrimitives());
|
PrimitiveLogic.AddItems(GetBeamCasePrimitives());
|
||||||
//OnPropertyChanged(nameof(PrimitivesCount));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AddColumnCase = new RelayCommand(o =>
|
AddColumnCase = new RelayCommand(o =>
|
||||||
@@ -348,12 +353,17 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
{
|
{
|
||||||
if (item.HeadMaterial == null)
|
if (item.HeadMaterial == null)
|
||||||
{
|
{
|
||||||
MessageBox.Show($"Primitive {item.Name} does not has material", "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
System.Windows.Forms.MessageBox.Show($"Primitive {item.Name} does not has material", "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
private IEnumerable<PrimitiveBase> GetRCCirclePrimitives()
|
||||||
|
{
|
||||||
|
var template = new CircleTemplate();
|
||||||
|
return GetCasePrimitives(template);
|
||||||
|
}
|
||||||
private IEnumerable<PrimitiveBase> GetBeamCasePrimitives()
|
private IEnumerable<PrimitiveBase> GetBeamCasePrimitives()
|
||||||
{
|
{
|
||||||
var template = new RectangleBeamTemplate();
|
var template = new RectangleBeamTemplate();
|
||||||
@@ -370,13 +380,28 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
return GetCasePrimitives(template);
|
return GetCasePrimitives(template);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<PrimitiveBase> GetCasePrimitives(RectangleBeamTemplate template)
|
private IEnumerable<PrimitiveBase> GetCasePrimitives(IRCSectionTemplate template)
|
||||||
{
|
{
|
||||||
var wnd = new RectangleBeamView(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();
|
wnd.ShowDialog();
|
||||||
if (wnd.DialogResult == true)
|
if (wnd.DialogResult == true)
|
||||||
{
|
{
|
||||||
var newSection = new SectionTemplate(new RectGeometryLogic(template)).GetCrossSection();
|
|
||||||
|
var newSection = new SectionTemplate(geometryLogic).GetCrossSection();
|
||||||
var newRepository = newSection.SectionRepository;
|
var newRepository = newSection.SectionRepository;
|
||||||
repository.HeadMaterials.AddRange(newRepository.HeadMaterials);
|
repository.HeadMaterials.AddRange(newRepository.HeadMaterials);
|
||||||
repository.Primitives.AddRange(newRepository.Primitives);
|
repository.Primitives.AddRange(newRepository.Primitives);
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
<Window x:Class="StructureHelper.Windows.PrimitiveTemplates.RCs.Beams.CircleView"
|
||||||
|
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.PrimitiveTemplates.RCs.Beams"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Reinforced circle template" Height="220" Width="300" SizeToContent="Height" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition Height="40"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackPanel>
|
||||||
|
<ContentControl ContentTemplate="{StaticResource CircleShapeEdit}" Content="{Binding}"/>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="100"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Row="0" Text="Cover gap"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="Rebar Diameter"/>
|
||||||
|
<TextBlock Grid.Row="2" Text="Rebar Count"/>
|
||||||
|
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Style="{StaticResource ValidatedError}" Text="{Binding CoverGap, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Style="{StaticResource ValidatedError}" Text="{Binding BarDiameter, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Style="{StaticResource ValidatedError}" Text="{Binding BarCount, ValidatesOnExceptions=True}"/>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
|
<Button Width="60" Height="20" Margin="5" Content="Cancel" Command="{Binding CancelCommand}"/>
|
||||||
|
<Button Width="60" Height="20" Margin="5" Content="OK" Command="{Binding OkCommand}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using StructureHelper.Windows.ViewModels.PrimitiveTemplates.RCs;
|
||||||
|
using StructureHelperLogics.Models.Templates.CrossSections.RCs;
|
||||||
|
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.PrimitiveTemplates.RCs.Beams
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для CircleView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class CircleView : Window
|
||||||
|
{
|
||||||
|
private CircleViewModel viewModel;
|
||||||
|
|
||||||
|
public CircleView(ICircleTemplate template)
|
||||||
|
{
|
||||||
|
viewModel = new CircleViewModel(template);
|
||||||
|
viewModel.ParentWindow = this;
|
||||||
|
DataContext = viewModel;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
xmlns:vm ="clr-namespace:StructureHelper.Windows.ViewModels.PrimitiveTemplates.RCs"
|
xmlns:vm ="clr-namespace:StructureHelper.Windows.ViewModels.PrimitiveTemplates.RCs"
|
||||||
d:DataContext="{d:DesignInstance vm:RectangleBeamViewModel}"
|
d:DataContext="{d:DesignInstance vm:RectangleBeamViewModel}"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Reinforced beam template" Height="220" Width="300" SizeToContent="Height" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
Title="Reinforced rectangle template" Height="220" Width="300" SizeToContent="Height" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
@@ -46,6 +46,5 @@
|
|||||||
<Button Width="60" Height="20" Margin="5" Content="Cancel" Command="{Binding CancelCommand}"/>
|
<Button Width="60" Height="20" Margin="5" Content="Cancel" Command="{Binding CancelCommand}"/>
|
||||||
<Button Width="60" Height="20" Margin="5" Content="OK" Command="{Binding OkCommand}"/>
|
<Button Width="60" Height="20" Margin="5" Content="OK" Command="{Binding OkCommand}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
@@ -31,9 +31,9 @@ namespace StructureHelper.Windows.ViewModels
|
|||||||
{
|
{
|
||||||
return addCommand ??
|
return addCommand ??
|
||||||
(
|
(
|
||||||
addCommand = new RelayCommand(o =>
|
addCommand = new RelayCommand(param =>
|
||||||
{
|
{
|
||||||
AddMethod(o);
|
AddMethod(param);
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -49,14 +49,14 @@ namespace StructureHelper.Windows.ViewModels
|
|||||||
{
|
{
|
||||||
return deleteCommand ??
|
return deleteCommand ??
|
||||||
(
|
(
|
||||||
deleteCommand = new RelayCommand(o =>
|
deleteCommand = new RelayCommand(param =>
|
||||||
{
|
{
|
||||||
DeleteMethod();
|
DeleteMethod(param);
|
||||||
}, o => SelectedItem != null
|
}, o => SelectedItem != null
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public virtual void DeleteMethod()
|
public virtual void DeleteMethod(object parameter)
|
||||||
{
|
{
|
||||||
Collection.Remove(SelectedItem);
|
Collection.Remove(SelectedItem);
|
||||||
Items.Remove(SelectedItem);
|
Items.Remove(SelectedItem);
|
||||||
@@ -66,9 +66,9 @@ namespace StructureHelper.Windows.ViewModels
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
return editCommand ??
|
return editCommand ??
|
||||||
(editCommand = new RelayCommand(o=>
|
(editCommand = new RelayCommand(param=>
|
||||||
{
|
{
|
||||||
EditMethod(o);
|
EditMethod(param);
|
||||||
}, o => SelectedItem != null
|
}, o => SelectedItem != null
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -89,14 +89,14 @@ namespace StructureHelper.Windows.ViewModels
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
return copyCommand ??
|
return copyCommand ??
|
||||||
(copyCommand = new RelayCommand (o=>
|
(copyCommand = new RelayCommand (param=>
|
||||||
{
|
{
|
||||||
CopyMethod();
|
CopyMethod(param);
|
||||||
}, o => SelectedItem != null
|
}, o => SelectedItem != null
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public virtual void CopyMethod()
|
public virtual void CopyMethod(object parameter)
|
||||||
{
|
{
|
||||||
if (SelectedItem is ICloneable)
|
if (SelectedItem is ICloneable)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
|||||||
base.AddMethod(parameter);
|
base.AddMethod(parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DeleteMethod()
|
public override void DeleteMethod(object parameter)
|
||||||
{
|
{
|
||||||
var dialogResult = MessageBox.Show("Delete action?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
var dialogResult = MessageBox.Show("Delete action?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||||
if (dialogResult == DialogResult.Yes)
|
if (dialogResult == DialogResult.Yes)
|
||||||
@@ -41,7 +41,7 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
base.DeleteMethod();
|
base.DeleteMethod(parameter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
25
StructureHelper/Windows/ViewModels/Help/AboutViewModel.cs
Normal file
25
StructureHelper/Windows/ViewModels/Help/AboutViewModel.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.ViewModels.Help
|
||||||
|
{
|
||||||
|
internal class AboutViewModel : OkCancelViewModelBase
|
||||||
|
{
|
||||||
|
public string Authors => "Redikultsev Evgeny, Petrov Sergey, Smirnov Nikolay";
|
||||||
|
public string Version
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string version;
|
||||||
|
version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,12 +37,12 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
}
|
}
|
||||||
base.EditMethod(parameter);
|
base.EditMethod(parameter);
|
||||||
}
|
}
|
||||||
public override void DeleteMethod()
|
public override void DeleteMethod(object parameter)
|
||||||
{
|
{
|
||||||
var dialogResult = MessageBox.Show("Delete calculator?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
var dialogResult = MessageBox.Show("Delete calculator?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||||
if (dialogResult == DialogResult.Yes)
|
if (dialogResult == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
base.DeleteMethod();
|
base.DeleteMethod(parameter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public RelayCommand Run
|
public RelayCommand Run
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelper.Windows.MainWindow;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||||
|
{
|
||||||
|
public class HelpLogic : ViewModelBase
|
||||||
|
{
|
||||||
|
private RelayCommand showAbout;
|
||||||
|
|
||||||
|
public RelayCommand ShowAbout
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return showAbout ??
|
||||||
|
(
|
||||||
|
showAbout = new RelayCommand(param =>
|
||||||
|
{
|
||||||
|
var wnd = new AboutView();
|
||||||
|
wnd.ShowDialog();
|
||||||
|
}
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -193,7 +193,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
}
|
}
|
||||||
private bool CheckMaxIndex()
|
private bool CheckMaxIndex()
|
||||||
{
|
{
|
||||||
if (SelectedItem is null) return false;
|
if (SelectedItem is null || Items.Count == 0) return false;
|
||||||
int maxZIndex = Items.Select(x => x.GetNdmPrimitive().VisualProperty.ZIndex).Max();
|
int maxZIndex = Items.Select(x => x.GetNdmPrimitive().VisualProperty.ZIndex).Max();
|
||||||
if (SelectedItem.ZIndex <= maxZIndex) return true;
|
if (SelectedItem.ZIndex <= maxZIndex) return true;
|
||||||
else return false;
|
else return false;
|
||||||
@@ -201,7 +201,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
|
|
||||||
private bool CheckMinIndex()
|
private bool CheckMinIndex()
|
||||||
{
|
{
|
||||||
if (SelectedItem is null) return false;
|
if (SelectedItem is null || Items.Count == 0) return false;
|
||||||
int minZIndex = Items.Select(x => x.GetNdmPrimitive().VisualProperty.ZIndex).Min();
|
int minZIndex = Items.Select(x => x.GetNdmPrimitive().VisualProperty.ZIndex).Min();
|
||||||
if (SelectedItem.ZIndex >= minZIndex) return true;
|
if (SelectedItem.ZIndex >= minZIndex) return true;
|
||||||
else return false;
|
else return false;
|
||||||
|
|||||||
@@ -7,11 +7,26 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels
|
namespace StructureHelper.Windows.ViewModels
|
||||||
{
|
{
|
||||||
public abstract class OkCancelViewModelBase : ViewModelBase
|
public abstract class OkCancelViewModelBase : ViewModelBase
|
||||||
{
|
{
|
||||||
|
public Window ParentWindow { get; set; }
|
||||||
|
public ICommand OkCommand => new RelayCommand(o => OkAction());
|
||||||
|
public ICommand CancelCommand => new RelayCommand(o => CancelAction());
|
||||||
|
private void CancelAction()
|
||||||
|
{
|
||||||
|
ParentWindow.DialogResult = false;
|
||||||
|
ParentWindow.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OkAction()
|
||||||
|
{
|
||||||
|
ParentWindow.DialogResult = true;
|
||||||
|
ParentWindow.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,6 +181,29 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double Diameter
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (primitive is CircleViewPrimitive)
|
||||||
|
{
|
||||||
|
var shape = primitive as CircleViewPrimitive;
|
||||||
|
return shape.Diameter;
|
||||||
|
}
|
||||||
|
return 0d;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (primitive is CircleViewPrimitive)
|
||||||
|
{
|
||||||
|
var shape = primitive as CircleViewPrimitive;
|
||||||
|
shape.Diameter = value;
|
||||||
|
OnPropertyChanged(nameof(Area));
|
||||||
|
OnPropertyChanged(nameof(shape.Diameter));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Color Color
|
public Color Color
|
||||||
{
|
{
|
||||||
get => primitive.Color;
|
get => primitive.Color;
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperLogics.Models.Templates.CrossSections.RCs;
|
||||||
|
using StructureHelperLogics.Models.Templates.RCs;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.ViewModels.PrimitiveTemplates.RCs
|
||||||
|
{
|
||||||
|
internal class CircleViewModel : OkCancelViewModelBase, IDataErrorInfo
|
||||||
|
{
|
||||||
|
public ICircleTemplate Model;
|
||||||
|
|
||||||
|
public double Diameter
|
||||||
|
{
|
||||||
|
get { return Model.Shape.Diameter; }
|
||||||
|
set { Model.Shape.Diameter = value; }
|
||||||
|
}
|
||||||
|
public double CoverGap
|
||||||
|
{
|
||||||
|
get { return Model.CoverGap; }
|
||||||
|
set { Model.CoverGap = value; }
|
||||||
|
}
|
||||||
|
public double BarDiameter
|
||||||
|
{
|
||||||
|
get { return Model.BarDiameter; }
|
||||||
|
set { Model.BarDiameter = value; }
|
||||||
|
}
|
||||||
|
public int BarCount
|
||||||
|
{
|
||||||
|
get { return Model.BarCount; }
|
||||||
|
set { Model.BarCount = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Error => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public string this[string columnName]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string error = null;
|
||||||
|
|
||||||
|
if (columnName == nameof(Diameter))
|
||||||
|
{
|
||||||
|
if (this.Diameter <= 0)
|
||||||
|
{
|
||||||
|
error = "Diameter of section must be greater than zero";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (columnName == nameof(BarDiameter))
|
||||||
|
{
|
||||||
|
if (BarDiameter < 0)
|
||||||
|
{
|
||||||
|
error = "Diameter must be greater than zero";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (columnName == nameof(CoverGap))
|
||||||
|
{
|
||||||
|
if (CoverGap > Diameter / 2)
|
||||||
|
{
|
||||||
|
error = "Cover gap is too big";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public CircleViewModel(ICircleTemplate model)
|
||||||
|
{
|
||||||
|
Model = model;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,17 +13,11 @@ using System.Windows.Input;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.PrimitiveTemplates.RCs
|
namespace StructureHelper.Windows.ViewModels.PrimitiveTemplates.RCs
|
||||||
{
|
{
|
||||||
internal class RectangleBeamViewModel : ViewModelBase, IDataErrorInfo
|
internal class RectangleBeamViewModel : OkCancelViewModelBase, IDataErrorInfo
|
||||||
{
|
{
|
||||||
public IRectangleBeamTemplate Model;
|
public IRectangleBeamTemplate Model;
|
||||||
|
|
||||||
private RectangleShape rectangle => Model.Shape as RectangleShape;
|
private RectangleShape rectangle => Model.Shape as RectangleShape;
|
||||||
|
|
||||||
public Window ParentWindow { get; set; }
|
|
||||||
|
|
||||||
public ICommand OkCommand { get; private set; }
|
|
||||||
public ICommand CancelCommand { get; private set; }
|
|
||||||
|
|
||||||
public double Width
|
public double Width
|
||||||
{
|
{
|
||||||
get { return rectangle.Width; }
|
get { return rectangle.Width; }
|
||||||
@@ -79,9 +73,16 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveTemplates.RCs
|
|||||||
}
|
}
|
||||||
else if (columnName == nameof(TopDiameter) || columnName == nameof(BottomDiameter))
|
else if (columnName == nameof(TopDiameter) || columnName == nameof(BottomDiameter))
|
||||||
{
|
{
|
||||||
if (CoverGap <0 )
|
if (TopDiameter < 0 || BottomDiameter < 0)
|
||||||
{
|
{
|
||||||
error = "Diameter must be grater than zero";
|
error = "Diameter must be greater than zero";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (columnName == nameof(CoverGap))
|
||||||
|
{
|
||||||
|
if (CoverGap < 0)
|
||||||
|
{
|
||||||
|
error = "Cover gap must be greater than zero";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
@@ -91,23 +92,10 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveTemplates.RCs
|
|||||||
public RectangleBeamViewModel(IRectangleBeamTemplate template)
|
public RectangleBeamViewModel(IRectangleBeamTemplate template)
|
||||||
{
|
{
|
||||||
Model = template;
|
Model = template;
|
||||||
|
|
||||||
OkCommand = new RelayCommand(o => OkAction());
|
|
||||||
CancelCommand = new RelayCommand(o => CancelAction());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void CancelAction()
|
|
||||||
{
|
|
||||||
ParentWindow.DialogResult = false;
|
|
||||||
ParentWindow.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OkAction()
|
|
||||||
{
|
|
||||||
ParentWindow.DialogResult = true;
|
|
||||||
ParentWindow.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
StructureHelperCommon/Models/Shapes/CircleShape.cs
Normal file
13
StructureHelperCommon/Models/Shapes/CircleShape.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Shapes
|
||||||
|
{
|
||||||
|
public class CircleShape : ICircleShape
|
||||||
|
{
|
||||||
|
public double Diameter { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,6 @@ namespace StructureHelperCommon.Services.ColorServices
|
|||||||
{
|
{
|
||||||
public static Color GetRandomColor()
|
public static Color GetRandomColor()
|
||||||
{
|
{
|
||||||
Thread.Sleep(100);
|
|
||||||
var randomR = new Random(new Random((int)DateTime.Now.Ticks % 1000).Next(50)).Next(0, 255);
|
var randomR = new Random(new Random((int)DateTime.Now.Ticks % 1000).Next(50)).Next(0, 255);
|
||||||
var randomG = new Random(new Random((int)DateTime.Now.Ticks % 200).Next(100, 200)).Next(0, 255);
|
var randomG = new Random(new Random((int)DateTime.Now.Ticks % 200).Next(100, 200)).Next(0, 255);
|
||||||
var randomB = new Random(new Random((int)DateTime.Now.Ticks % 50).Next(500, 1000)).Next(0, 255);
|
var randomB = new Random(new Random((int)DateTime.Now.Ticks % 50).Next(500, 1000)).Next(0, 255);
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
{
|
{
|
||||||
public class CircleGeometryLogic : IRCGeometryLogic
|
public class CircleGeometryLogic : IRCGeometryLogic
|
||||||
{
|
{
|
||||||
ICircleBeamTemplate template;
|
ICircleTemplate template;
|
||||||
|
|
||||||
|
|
||||||
public IEnumerable<IHeadMaterial> HeadMaterials { get; set; }
|
public IEnumerable<IHeadMaterial> HeadMaterials { get; set; }
|
||||||
|
|
||||||
public CircleGeometryLogic(ICircleBeamTemplate template)
|
public CircleGeometryLogic(ICircleTemplate template)
|
||||||
{
|
{
|
||||||
this.template = template;
|
this.template = template;
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
|
|
||||||
private IEnumerable<INdmPrimitive> GetConcretePrimitives()
|
private IEnumerable<INdmPrimitive> GetConcretePrimitives()
|
||||||
{
|
{
|
||||||
var diameter = template.SectionDiameter;
|
var diameter = template.Shape.Diameter;
|
||||||
var concreteMaterial = HeadMaterials.ToList()[0];
|
var concreteMaterial = HeadMaterials.ToList()[0];
|
||||||
var primitives = new List<INdmPrimitive>();
|
var primitives = new List<INdmPrimitive>();
|
||||||
var rectangle = new CirclePrimitive() { Diameter = diameter, Name = "Concrete block", HeadMaterial = concreteMaterial };
|
var rectangle = new CirclePrimitive() { Diameter = diameter, Name = "Concrete block", HeadMaterial = concreteMaterial };
|
||||||
@@ -43,11 +43,11 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
private IEnumerable<INdmPrimitive> GetReinfrocementPrimitives()
|
private IEnumerable<INdmPrimitive> GetReinfrocementPrimitives()
|
||||||
{
|
{
|
||||||
var reinforcementMaterial = HeadMaterials.ToList()[1];
|
var reinforcementMaterial = HeadMaterials.ToList()[1];
|
||||||
var radius = template.SectionDiameter / 2 - template.CoverGap;
|
var radius = template.Shape.Diameter / 2 - template.CoverGap;
|
||||||
var dAngle = 2d * Math.PI / template.BarQuantity;
|
var dAngle = 2d * Math.PI / template.BarCount;
|
||||||
var barArea = Math.PI* template.BarDiameter* template.BarDiameter / 4d;
|
var barArea = Math.PI* template.BarDiameter* template.BarDiameter / 4d;
|
||||||
var primitives = new List<INdmPrimitive>();
|
var primitives = new List<INdmPrimitive>();
|
||||||
for (int i = 0; i < template.BarQuantity; i++)
|
for (int i = 0; i < template.BarCount; i++)
|
||||||
{
|
{
|
||||||
var angle = i * dAngle;
|
var angle = i * dAngle;
|
||||||
var x = radius * Math.Sin(angle);
|
var x = radius * Math.Sin(angle);
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||||
|
{
|
||||||
|
public class CircleTemplate : ICircleTemplate
|
||||||
|
{
|
||||||
|
public ICircleShape Shape { get; }
|
||||||
|
public double CoverGap { get; set; }
|
||||||
|
public int BarCount { get; set; }
|
||||||
|
public double BarDiameter { get; set; }
|
||||||
|
public CircleTemplate()
|
||||||
|
{
|
||||||
|
Shape = new CircleShape();
|
||||||
|
Shape.Diameter = 0.5d;
|
||||||
|
CoverGap = 0.05d;
|
||||||
|
BarCount = 8;
|
||||||
|
BarDiameter = 0.025d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,14 +7,11 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||||
{
|
{
|
||||||
public interface ICircleBeamTemplate
|
public interface ICircleTemplate : IRCSectionTemplate
|
||||||
{
|
{
|
||||||
ICircleShape Circle { get; }
|
ICircleShape Shape { get; }
|
||||||
double CoverGap { get; set; }
|
double CoverGap { get; set; }
|
||||||
double SectionDiameter { get; set; }
|
int BarCount { get; set; }
|
||||||
int BarQuantity { get; set; }
|
|
||||||
double BarDiameter { get; set; }
|
double BarDiameter { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||||
|
{
|
||||||
|
public interface IRCSectionTemplate
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperLogics.Models.Templates.CrossSections.RCs;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -7,7 +8,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.Models.Templates.RCs
|
namespace StructureHelperLogics.Models.Templates.RCs
|
||||||
{
|
{
|
||||||
public interface IRectangleBeamTemplate
|
public interface IRectangleBeamTemplate : IRCSectionTemplate
|
||||||
{
|
{
|
||||||
IShape Shape { get; }
|
IShape Shape { get; }
|
||||||
double CoverGap { get; set; }
|
double CoverGap { get; set; }
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||||
{
|
{
|
||||||
@@ -17,9 +18,11 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
var result = new List<IHeadMaterial>();
|
var result = new List<IHeadMaterial>();
|
||||||
var concrete = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, ProgramSetting.CodeType);
|
var concrete = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, ProgramSetting.CodeType);
|
||||||
concrete.Name = "Concrete";
|
concrete.Name = "Concrete";
|
||||||
|
concrete.Color = (Color)ColorConverter.ConvertFromString("AliceBlue");
|
||||||
result.Add(concrete);
|
result.Add(concrete);
|
||||||
var reinforcement = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforecement400, ProgramSetting.CodeType);
|
var reinforcement = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforecement400, ProgramSetting.CodeType);
|
||||||
reinforcement.Name = "Reinforcement";
|
reinforcement.Name = "Reinforcement";
|
||||||
|
reinforcement.Color = (Color)ColorConverter.ConvertFromString("Red");
|
||||||
result.Add(reinforcement);
|
result.Add(reinforcement);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
{
|
{
|
||||||
public class RectGeometryLogic : IRCGeometryLogic
|
public class RectGeometryLogic : IRCGeometryLogic
|
||||||
{
|
{
|
||||||
RectangleBeamTemplate template;
|
IRectangleBeamTemplate template;
|
||||||
IHeadMaterial concrete => HeadMaterials.ToList()[0];
|
IHeadMaterial concrete => HeadMaterials.ToList()[0];
|
||||||
IHeadMaterial reinforcement => HeadMaterials.ToList()[1];
|
IHeadMaterial reinforcement => HeadMaterials.ToList()[1];
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
|
|
||||||
public IEnumerable<IHeadMaterial> HeadMaterials { get; set; }
|
public IEnumerable<IHeadMaterial> HeadMaterials { get; set; }
|
||||||
|
|
||||||
public RectGeometryLogic(RectangleBeamTemplate template)
|
public RectGeometryLogic(IRectangleBeamTemplate template)
|
||||||
{
|
{
|
||||||
this.template = template;
|
this.template = template;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.SteelSections
|
|||||||
|
|
||||||
[TestCase(0.3, 4e8, 0, 0, 706850.84713269188d, 0d, 0d, 5e-5d)]
|
[TestCase(0.3, 4e8, 0, 0, 706850.84713269188d, 0d, 0d, 5e-5d)]
|
||||||
[TestCase(0.3, 4e8, 0, 0, -706850.84713269188d, 0d, 0d, -5e-5d)]
|
[TestCase(0.3, 4e8, 0, 0, -706850.84713269188d, 0d, 0d, -5e-5d)]
|
||||||
[TestCase(0.3, 4e8, 700000, 0, 0, 0.0076471604851248189d, 0d, 0d)]
|
[TestCase(0.3, 4e8, 700000, 0, 0, 0.0088353506243542181d, 0d, 0d)]
|
||||||
public void Run_ShouldPass_Circle(double diameter, double strength, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ)
|
public void Run_ShouldPass_Circle(double diameter, double strength, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ)
|
||||||
{
|
{
|
||||||
//Arrange
|
//Arrange
|
||||||
|
|||||||
Reference in New Issue
Block a user