PrimitiveProps editing via context menu was added
This commit is contained in:
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="Primitives">
|
||||
<MenuItem Header="Add">
|
||||
<Button Content="Add Rectangle" Command="{Binding AddPrimitive}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
||||
<Button Content="Add Point" Command="{Binding AddPrimitive}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||
<Button Content="Rectangle" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
||||
<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>
|
||||
<Button Content="Edit primitive" Command="{Binding EditPrimitive}"/>
|
||||
<Button Content="Delete primitive" Command="{Binding DeletePrimitive}"/>
|
||||
<Button Content="Edit primitive" Command="{Binding PrimitiveLogic.Edit}"/>
|
||||
<Button Content="Delete primitive" Command="{Binding PrimitiveLogic.Delete}"/>
|
||||
</MenuItem>
|
||||
<Button Content="Materials" Command="{Binding EditHeadMaterialsCommand}"/>
|
||||
<Button Content="Move primitives to center" Command="{Binding Path=MovePrimitiveToGravityCenterCommand}"/>
|
||||
@@ -53,13 +54,15 @@
|
||||
<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>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Tools">
|
||||
<Button Content="Settings" Command="{Binding ShowVisualProperty}"/>
|
||||
</MenuItem>
|
||||
<!--<MenuItem Header="Help">
|
||||
</MenuItem>-->
|
||||
<MenuItem Header="Help">
|
||||
<Button Content="About..." Command="{Binding HelpLogic.ShowAbout}"/>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -100,24 +103,24 @@
|
||||
<ListBox ItemsSource="{Binding HeadMaterials}" ItemTemplate="{StaticResource ColoredItemTemplate}">
|
||||
</ListBox>
|
||||
</Expander>
|
||||
<Expander Header="Geometry" MinWidth="20">
|
||||
<Expander Header="Geometry" MinWidth="20" DataContext="{Binding PrimitiveLogic}">
|
||||
<Expander.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="Add">
|
||||
<Button Content="Add Rectangle" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
||||
<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 Rectangle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
||||
<Button Content="Add Circle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}"/>
|
||||
<Button Content="Add Point" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</Expander.ContextMenu>
|
||||
<ListBox ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}" ItemTemplate="{StaticResource ColoredItemTemplate}">
|
||||
<ListBox.ContextMenu>
|
||||
<ContextMenu>
|
||||
<Button Content="Edit" Command="{Binding PrimitiveLogic.Edit}"/>
|
||||
<Button Content="Copy" Command="{Binding PrimitiveLogic.Copy}"/>
|
||||
<Button Content="Delete" Command="{Binding PrimitiveLogic.Delete}"/>
|
||||
<Button Content="To Foreground" Command="{Binding PrimitiveLogic.SetToFront}"/>
|
||||
<Button Content="To Background" Command="{Binding PrimitiveLogic.SetToBack}"/>
|
||||
<Button Content="Edit" Command="{Binding Edit}"/>
|
||||
<Button Content="Copy" Command="{Binding Copy}"/>
|
||||
<Button Content="Delete" Command="{Binding Delete}"/>
|
||||
<Button Content="To Foreground" Command="{Binding SetToFront}"/>
|
||||
<Button Content="To Background" Command="{Binding SetToBack}"/>
|
||||
</ContextMenu>
|
||||
</ListBox.ContextMenu>
|
||||
</ListBox>
|
||||
@@ -163,6 +166,12 @@
|
||||
<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}"/>
|
||||
</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>
|
||||
</Canvas.ContextMenu>
|
||||
<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.UI.DataContexts;
|
||||
using StructureHelper.MaterialCatalogWindow;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculationResultWindow;
|
||||
using StructureHelper.Windows.ColorPickerWindow;
|
||||
using StructureHelper.Windows.MainWindow.Materials;
|
||||
using StructureHelper.Windows.PrimitiveTemplates.RCs.Beams;
|
||||
using StructureHelper.Windows.PrimitiveTemplates.RCs.RectangleBeam;
|
||||
using StructureHelper.Windows.ViewModels.Calculations.CalculationProperies;
|
||||
using StructureHelper.Windows.ViewModels.Calculations.CalculationResult;
|
||||
using StructureHelper.Windows.ViewModels.Forces;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.Models.Templates.CrossSections.RCs;
|
||||
using StructureHelperLogics.Models.Templates.RCs;
|
||||
using StructureHelperLogics.Services.NdmCalculations;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
|
||||
@@ -47,6 +43,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
public AnalysisVewModelLogic CalculatorsLogic { get => calculatorsLogic;}
|
||||
public ActionsViewModel CombinationsLogic { get => combinationsLogic; }
|
||||
public IPrimitiveViewModelLogic PrimitiveLogic => primitiveLogic;
|
||||
public HelpLogic HelpLogic => new HelpLogic();
|
||||
|
||||
private MainModel Model { get; }
|
||||
|
||||
@@ -157,6 +154,15 @@ namespace StructureHelper.Windows.MainWindow
|
||||
public ICommand Calculate { get; }
|
||||
public ICommand EditCalculationPropertyCommand { get; }
|
||||
public ICommand EditHeadMaterialsCommand { get; }
|
||||
public ICommand AddRCCircleCase
|
||||
{ get
|
||||
{
|
||||
return new RelayCommand(o =>
|
||||
{
|
||||
PrimitiveLogic.AddItems(GetRCCirclePrimitives());
|
||||
});
|
||||
}
|
||||
}
|
||||
public ICommand AddBeamCase { get; }
|
||||
public ICommand AddColumnCase { get; }
|
||||
public ICommand AddSlabCase { get; }
|
||||
@@ -286,7 +292,6 @@ namespace StructureHelper.Windows.MainWindow
|
||||
AddBeamCase = new RelayCommand(o =>
|
||||
{
|
||||
PrimitiveLogic.AddItems(GetBeamCasePrimitives());
|
||||
//OnPropertyChanged(nameof(PrimitivesCount));
|
||||
});
|
||||
|
||||
AddColumnCase = new RelayCommand(o =>
|
||||
@@ -348,12 +353,17 @@ namespace StructureHelper.Windows.MainWindow
|
||||
{
|
||||
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 true;
|
||||
}
|
||||
private IEnumerable<PrimitiveBase> GetRCCirclePrimitives()
|
||||
{
|
||||
var template = new CircleTemplate();
|
||||
return GetCasePrimitives(template);
|
||||
}
|
||||
private IEnumerable<PrimitiveBase> GetBeamCasePrimitives()
|
||||
{
|
||||
var template = new RectangleBeamTemplate();
|
||||
@@ -370,13 +380,28 @@ namespace StructureHelper.Windows.MainWindow
|
||||
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();
|
||||
if (wnd.DialogResult == true)
|
||||
{
|
||||
var newSection = new SectionTemplate(new RectGeometryLogic(template)).GetCrossSection();
|
||||
|
||||
var newSection = new SectionTemplate(geometryLogic).GetCrossSection();
|
||||
var newRepository = newSection.SectionRepository;
|
||||
repository.HeadMaterials.AddRange(newRepository.HeadMaterials);
|
||||
repository.Primitives.AddRange(newRepository.Primitives);
|
||||
|
||||
Reference in New Issue
Block a user