Primitive View Logic for Main View modael was added
This commit is contained in:
@@ -27,11 +27,9 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
private IPrimitiveRepository primitiveRepository;
|
||||
private INdmPrimitive primitive;
|
||||
private bool captured, parameterCaptured, elementLock, paramsPanelVisibilty, popupCanBeClosed = true, borderCaptured;
|
||||
private bool setMaterialColor;
|
||||
private Color color;
|
||||
private double opacity = 1, showedOpacity = 0, x, y, xY1, yX1, primitiveWidth, primitiveHeight;
|
||||
private double showedOpacity = 0, x, y, xY1, yX1, primitiveWidth, primitiveHeight;
|
||||
protected double delta = 0.5;
|
||||
private int showedZIndex = 1, zIndex;
|
||||
private int showedZIndex = 1;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -109,21 +107,23 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
|
||||
public bool SetMaterialColor
|
||||
{
|
||||
get => setMaterialColor;
|
||||
get => primitive.VisualProperty.SetMaterialColor;
|
||||
set
|
||||
{
|
||||
OnPropertyChanged(value, ref setMaterialColor);
|
||||
primitive.VisualProperty.SetMaterialColor = value;
|
||||
OnPropertyChanged(nameof(Color));
|
||||
}
|
||||
|
||||
}
|
||||
public Color Color
|
||||
{
|
||||
get => ((setMaterialColor == true) & (primitive.HeadMaterial !=null))? primitive.HeadMaterial.Color : color;
|
||||
get => ((primitive.VisualProperty.SetMaterialColor == true)
|
||||
& (primitive.HeadMaterial !=null))? primitive.HeadMaterial.Color : primitive.VisualProperty.Color;
|
||||
set
|
||||
{
|
||||
SetMaterialColor = false;
|
||||
OnPropertyChanged(value, ref color);
|
||||
primitive.VisualProperty.Color = value;
|
||||
OnPropertyChanged(nameof(Color));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,11 +142,6 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
get => elementLock;
|
||||
set => OnPropertyChanged(value, ref elementLock);
|
||||
}
|
||||
public Brush Brush
|
||||
{
|
||||
get => new SolidColorBrush(Color);
|
||||
set { }
|
||||
}
|
||||
|
||||
public bool ParamsPanelVisibilty
|
||||
{
|
||||
@@ -168,10 +163,25 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
OnPropertyChanged(value, ref showedOpacity);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsVisible
|
||||
{
|
||||
get => primitive.VisualProperty.IsVisible;
|
||||
set
|
||||
{
|
||||
primitive.VisualProperty.IsVisible = value;
|
||||
OnPropertyChanged(nameof(IsVisible));
|
||||
}
|
||||
}
|
||||
|
||||
public double Opacity
|
||||
{
|
||||
get => opacity;
|
||||
set => OnPropertyChanged(value, ref opacity);
|
||||
get => primitive.VisualProperty.Opacity;
|
||||
set
|
||||
{
|
||||
primitive.VisualProperty.Opacity = value;
|
||||
OnPropertyChanged(nameof(Opacity));
|
||||
}
|
||||
}
|
||||
public int ShowedZIndex
|
||||
{
|
||||
@@ -185,8 +195,12 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
}
|
||||
public int ZIndex
|
||||
{
|
||||
get => zIndex;
|
||||
set => OnPropertyChanged(value, ref zIndex);
|
||||
get => primitive.VisualProperty.ZIndex;
|
||||
set
|
||||
{
|
||||
primitive.VisualProperty.ZIndex = value;
|
||||
OnPropertyChanged(nameof(ZIndex));
|
||||
}
|
||||
}
|
||||
|
||||
public double Xy1
|
||||
@@ -218,8 +232,6 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
|
||||
public PrimitiveBase(INdmPrimitive primitive)
|
||||
{
|
||||
color = ColorProcessor.GetRandomColor();
|
||||
SetMaterialColor = true;
|
||||
this.primitive = primitive;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<ColumnDefinition Width="60"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox ItemsSource="{Binding SourceItems}" SelectedItem="{Binding SelectedSourceItem}" ItemTemplate="{StaticResource ResourceKey=SimpleItemTemplate}"/>
|
||||
<ListBox ItemsSource="{Binding SourceItems}" SelectedItem="{Binding SelectedSourceItem}" ItemTemplate="{Binding ItemDataDemplate}"/>
|
||||
<StackPanel Grid.Column="1">
|
||||
<Button Content="Add all" Command="{Binding AddAll}"/>
|
||||
<Button Content="Clear all" Command="{Binding ClearAll}"/>
|
||||
@@ -16,7 +16,7 @@
|
||||
<Button Content="<<" Command="{Binding RemoveSelected}"/>
|
||||
</StackPanel>
|
||||
<ListBox Grid.Column="2" ItemsSource="{Binding TargetItems}"
|
||||
SelectedItem="{Binding SelectedTargetItem}" ItemTemplate="{StaticResource ResourceKey=SimpleItemTemplate}"/>
|
||||
SelectedItem="{Binding SelectedTargetItem}" ItemTemplate="{Binding ItemDataDemplate}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ResourceDictionary>
|
||||
@@ -19,7 +19,7 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Shape" x:Key="ShapeStyle">
|
||||
<Style TargetType="{x:Type Shape}" x:Key="ShapeStyle">
|
||||
<Setter Property="Fill">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="{Binding Color}"/>
|
||||
@@ -33,6 +33,9 @@
|
||||
<Setter Property="Stroke" Value="Red"/>
|
||||
<Setter Property="StrokeThickness" Value="0.002"/>
|
||||
</Trigger>
|
||||
<!--<Trigger Property="IsVisible" Value="False">
|
||||
<Setter Property="Visibility" Value="Hidden"/>
|
||||
</Trigger>-->
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
|
||||
@@ -238,6 +238,8 @@
|
||||
<Compile Include="Windows\ViewModels\Calculations\CalculationProperies\CalculationPropertyViewModel.cs" />
|
||||
<Compile Include="Windows\ViewModels\Calculations\CalculationResult\CalculationResultViewModel.cs" />
|
||||
<Compile Include="Windows\ViewModels\Calculations\Calculators\ForcesResultsViewModel.cs" />
|
||||
<Compile Include="Windows\ViewModels\NdmCrossSections\IPrimitiveViewModelLogic.cs" />
|
||||
<Compile Include="Windows\ViewModels\NdmCrossSections\PrimitiveViewModelLogic.cs" />
|
||||
<Compile Include="Windows\ViewModels\SourceToTargetViewModel.cs" />
|
||||
<Compile Include="Windows\ViewModels\Calculations\Calculators\ForceCalculatorViewModel.cs" />
|
||||
<Compile Include="Windows\ViewModels\Calculations\Calculators\ICombinationSourceToTargetViewModel.cs" />
|
||||
|
||||
@@ -18,5 +18,6 @@ namespace StructureHelperCommon.Infrastructures.Strings
|
||||
public static string IncorrectValue => "#0007: value is not valid";
|
||||
public static string FileCantBeDeleted => "#0008: File can't be deleted";
|
||||
public static string FileCantBeSaved => "#0009: File can't be saved";
|
||||
public static string VisualPropertyIsNotRight => "#0010: VisualPropertyIsNotRight";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
double PrestrainKx { get; set; }
|
||||
double PrestrainKy { get; set; }
|
||||
double PrestrainEpsZ { get; set; }
|
||||
IVisualProperty VisualProperty {get; }
|
||||
|
||||
IEnumerable<INdm> GetNdms(IMaterial material);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface IVisualProperty
|
||||
{
|
||||
bool IsVisible { get; set; }
|
||||
Color Color { get; set; }
|
||||
bool SetMaterialColor { get; set; }
|
||||
int ZIndex { get; set; }
|
||||
double Opacity { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public IPoint2D EndPoint { get; set; }
|
||||
public double Thickness { get; set; }
|
||||
|
||||
public IVisualProperty VisualProperty => throw new NotImplementedException();
|
||||
|
||||
public LinePrimitive()
|
||||
{
|
||||
|
||||
@@ -26,17 +26,16 @@ namespace StructureHelperLogics.Models.Primitives
|
||||
public double PrestrainEpsZ { get; set; }
|
||||
public double Area { get; set; }
|
||||
|
||||
public IVisualProperty VisualProperty { get; }
|
||||
|
||||
public PointPrimitive()
|
||||
{
|
||||
Name = "New Point";
|
||||
Area = 0.0005d;
|
||||
VisualProperty = new VisualProperty();
|
||||
}
|
||||
|
||||
public PointPrimitive(IHeadMaterial material)
|
||||
{
|
||||
HeadMaterial = material;
|
||||
}
|
||||
public PointPrimitive(IHeadMaterial material) : this() { HeadMaterial = material; }
|
||||
|
||||
public IEnumerable<INdm> GetNdms(IMaterial material)
|
||||
{
|
||||
|
||||
@@ -31,11 +31,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public double Height { get; set; }
|
||||
public double Angle { get; set; }
|
||||
|
||||
public IVisualProperty VisualProperty { get; }
|
||||
|
||||
public RectanglePrimitive()
|
||||
{
|
||||
Name = "New Rectangle";
|
||||
NdmMaxSize = 0.01d;
|
||||
NdmMinDivision = 10;
|
||||
VisualProperty = new VisualProperty();
|
||||
}
|
||||
|
||||
public RectanglePrimitive(IHeadMaterial material) : this() { HeadMaterial = material; }
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Services.ColorServices;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class VisualProperty : IVisualProperty
|
||||
{
|
||||
|
||||
public bool IsVisible { get; set; }
|
||||
public Color Color { get; set; }
|
||||
public bool SetMaterialColor { get; set; }
|
||||
public int ZIndex { get; set; }
|
||||
private double opacity;
|
||||
|
||||
public double Opacity
|
||||
{
|
||||
get { return opacity; }
|
||||
set
|
||||
{
|
||||
if (value < 0d || value > 1d) { throw new StructureHelperException(ErrorStrings.VisualPropertyIsNotRight + nameof(Opacity) + value); }
|
||||
opacity = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public VisualProperty()
|
||||
{
|
||||
IsVisible = true;
|
||||
Color = ColorProcessor.GetRandomColor();
|
||||
SetMaterialColor = true;
|
||||
ZIndex = 0;
|
||||
Opacity = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,10 +15,22 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
{
|
||||
public static class NdmPrimitivesService
|
||||
{
|
||||
public static void CopyVisualProperty(IVisualProperty source, IVisualProperty target)
|
||||
{
|
||||
target.IsVisible = source.IsVisible;
|
||||
target.Color = source.Color;
|
||||
target.SetMaterialColor = source.SetMaterialColor;
|
||||
target.Opacity = source.Opacity;
|
||||
target.ZIndex = source.ZIndex;
|
||||
}
|
||||
|
||||
public static void CopyNdmProperties (INdmPrimitive source, INdmPrimitive target)
|
||||
{
|
||||
target.Name = source.Name + " - copy" ;
|
||||
target.HeadMaterial = source.HeadMaterial;
|
||||
target.Name = source.Name + " copy" ;
|
||||
if (source.HeadMaterial != null) target.HeadMaterial = source.HeadMaterial;
|
||||
CopyVisualProperty(source.VisualProperty, target.VisualProperty);
|
||||
target.CenterX = source.CenterX;
|
||||
target.CenterY = source.CenterY;
|
||||
target.PrestrainKx = source.PrestrainKx;
|
||||
target.PrestrainKy = source.PrestrainKy;
|
||||
target.PrestrainEpsZ = source.PrestrainEpsZ;
|
||||
|
||||
@@ -47,23 +47,7 @@
|
||||
<ContentControl ContentTemplate="{StaticResource SourceToTarget}" Content="{Binding CombinationViewModel}"/>
|
||||
</TabItem>
|
||||
<TabItem Header="Primitives">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="60"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox ItemsSource="{Binding AllowedPrimitives}"
|
||||
SelectedItem="{Binding SelectedAllowedPrimitive}"
|
||||
ItemTemplate="{StaticResource ColoredItemTemplate}"/>
|
||||
<StackPanel Grid.Column="1">
|
||||
<Button Content="Add all" Command="{Binding AddAllPrimitivesCommand}"/>
|
||||
<Button Content="Clear all" Command="{Binding ClearAllPrimitivesCommand}"/>
|
||||
<Button Content=">>" Command="{Binding AddSelectedPrimitiveCommand}"/>
|
||||
<Button Content="<<" Command="{Binding RemoveSelectedPrimitiveCommand}"/>
|
||||
</StackPanel>
|
||||
<ListBox Grid.Column="2" ItemsSource="{Binding Primitives}" SelectedItem="{Binding SelectedPrimitive}" ItemTemplate="{StaticResource ColoredItemTemplate}"/>
|
||||
</Grid>
|
||||
<ContentControl ContentTemplate="{StaticResource SourceToTarget}" Content="{Binding PrimitivesViewModel}"/>
|
||||
</TabItem>
|
||||
<TabItem Header="Iterations">
|
||||
<Grid>
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
<DataTemplate DataType="{x:Type dataContexts:PointViewPrimitive}">
|
||||
<dataTemplates:EllipseTemplate/>
|
||||
</DataTemplate>
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
@@ -94,20 +95,23 @@
|
||||
<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 AddPrimitive}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
||||
<Button Content="Add Point" Command="{Binding AddPrimitive}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||
<Button Content="Add Rectangle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
||||
<Button Content="Add Point" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</Expander.ContextMenu>
|
||||
<ListBox ItemsSource="{Binding Primitives}" SelectedItem="{Binding SelectedPrimitive}" ItemTemplate="{StaticResource ColoredItemTemplate}">
|
||||
<ListBox ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}" ItemTemplate="{StaticResource ColoredItemTemplate}">
|
||||
<ListBox.ContextMenu>
|
||||
<ContextMenu>
|
||||
<Button Content="Edit" Command="{Binding EditPrimitive}"/>
|
||||
<Button Content="Delete" Command="{Binding DeletePrimitive}"/>
|
||||
<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>
|
||||
@@ -170,22 +174,10 @@
|
||||
<Rectangle StrokeThickness="{Binding GridLineThickness}" Height="0.050" Width="0.050" Stroke="Darkgray"/>
|
||||
</VisualBrush.Visual>
|
||||
</VisualBrush>
|
||||
<!--<DrawingBrush Viewport="0,0,0.05,0.05" ViewportUnits="Absolute" TileMode="Tile">
|
||||
<DrawingBrush.Drawing>
|
||||
<GeometryDrawing Brush="Black">
|
||||
<GeometryDrawing.Geometry>
|
||||
<GeometryGroup FillRule="EvenOdd">
|
||||
<RectangleGeometry Rect="0,0,0.050,0.050"/>
|
||||
<RectangleGeometry Rect="0,0,0.0499,0.0499"/>
|
||||
</GeometryGroup>
|
||||
</GeometryDrawing.Geometry>
|
||||
</GeometryDrawing>
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>-->
|
||||
</Canvas.Background>
|
||||
<Line X1="0" X2="{Binding XX2}" Y1="{Binding XY1}" Y2="{Binding XY1}" Stroke="Red" StrokeThickness="{Binding AxisLineThickness}"/>
|
||||
<Line X1="{Binding YX1}" X2="{Binding YX1}" Y1="0" Y2="{Binding YY2}" Stroke="ForestGreen" StrokeThickness="{Binding AxisLineThickness}"/>
|
||||
<ItemsControl ItemsSource="{Binding Primitives}" d:DataContext="{d:DesignInstance vm:MainViewModel}">
|
||||
<ItemsControl ItemsSource="{Binding PrimitiveLogic.Items}" d:DataContext="{d:DesignInstance vm:MainViewModel}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<Canvas/>
|
||||
@@ -196,6 +188,7 @@
|
||||
<Setter Property="Canvas.ZIndex" Value="{Binding ZIndex}"/>
|
||||
<Setter Property="Canvas.Left" Value="{Binding PrimitiveLeft}"/>
|
||||
<Setter Property="Canvas.Top" Value="{Binding PrimitiveTop}"/>
|
||||
<Setter Property="Visibility" Value="{Binding IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||
</Style>
|
||||
</ItemsControl.ItemContainerStyle>
|
||||
</ItemsControl>
|
||||
@@ -213,7 +206,7 @@
|
||||
<StatusBarItem>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Number of primitives: "/>
|
||||
<TextBlock Text="{Binding PrimitivesCount}"/>
|
||||
<TextBlock Text="{Binding PrimitiveLogic.PrimitivesCount}"/>
|
||||
</StackPanel>
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
|
||||
@@ -1,31 +1,23 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Logics.Geometry;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.MaterialCatalogWindow;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Models.Primitives.Factories;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculationResultWindow;
|
||||
using StructureHelper.Windows.ColorPickerWindow;
|
||||
using StructureHelper.Windows.MainWindow.Materials;
|
||||
using StructureHelper.Windows.PrimitiveProperiesWindow;
|
||||
using StructureHelper.Windows.PrimitiveTemplates.RCs.RectangleBeam;
|
||||
using StructureHelper.Windows.ViewModels.Calculations.CalculationProperies;
|
||||
using StructureHelper.Windows.ViewModels.Calculations.CalculationResult;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.Models.Templates.CrossSections.RCs;
|
||||
using StructureHelperLogics.Models.Templates.RCs;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.Services.NdmCalculations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -54,9 +46,9 @@ namespace StructureHelper.Windows.MainWindow
|
||||
private readonly ICalculatorsViewModelLogic calculatorsLogic;
|
||||
public ICalculatorsViewModelLogic CalculatorsLogic { get => calculatorsLogic;}
|
||||
public IForceCombinationViewModelLogic CombinationsLogic { get => combinationsLogic; }
|
||||
public IPrimitiveViewModelLogic PrimitiveLogic => primitiveLogic;
|
||||
|
||||
private MainModel Model { get; }
|
||||
public ObservableCollection<PrimitiveBase> Primitives { get; private set; }
|
||||
|
||||
private double panelX, panelY, scrollPanelX, scrollPanelY;
|
||||
private CalculationProperty calculationProperty;
|
||||
@@ -82,8 +74,6 @@ namespace StructureHelper.Windows.MainWindow
|
||||
set => OnPropertyChanged(value, ref scrollPanelY);
|
||||
}
|
||||
|
||||
public int PrimitivesCount => Primitives.Count;
|
||||
|
||||
private double scaleValue;
|
||||
|
||||
public double ScaleValue
|
||||
@@ -155,13 +145,10 @@ namespace StructureHelper.Windows.MainWindow
|
||||
get => yY2;
|
||||
set => OnPropertyChanged(value, ref yY2);
|
||||
}
|
||||
public ICommand AddPrimitive { get; }
|
||||
|
||||
public ICommand Calculate { get; }
|
||||
public ICommand DeletePrimitive { get; }
|
||||
public ICommand EditCalculationPropertyCommand { get; }
|
||||
public ICommand EditHeadMaterialsCommand { get; }
|
||||
public ICommand EditPrimitive { get; }
|
||||
public ICommand AddBeamCase { get; }
|
||||
public ICommand AddColumnCase { get; }
|
||||
public ICommand AddSlabCase { get; }
|
||||
@@ -185,6 +172,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
private double axisLineThickness;
|
||||
private double gridLineThickness;
|
||||
private IForceCombinationViewModelLogic combinationsLogic;
|
||||
private IPrimitiveViewModelLogic primitiveLogic;
|
||||
|
||||
public MainViewModel(MainModel model)
|
||||
{
|
||||
@@ -194,6 +182,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
calculatorsLogic = new CalculatorsViewModelLogic(repository);
|
||||
CanvasWidth = 2d * scale;
|
||||
CanvasHeight = 1.5d * scale;
|
||||
primitiveLogic = new PrimitiveViewModelLogic(repository) { CanvasWidth = CanvasWidth, CanvasHeight = CanvasHeight };
|
||||
XX2 = CanvasWidth;
|
||||
XY1 = CanvasHeight / 2d;
|
||||
YX1 = CanvasWidth / 2d;
|
||||
@@ -226,15 +215,6 @@ namespace StructureHelper.Windows.MainWindow
|
||||
rect.PrimitiveHeight = PanelY - rect.PrimitiveTop + 10d;
|
||||
}
|
||||
});
|
||||
ClearSelection = new RelayCommand(o =>
|
||||
{
|
||||
var primitive = Primitives?.FirstOrDefault(x => x.ParamsPanelVisibilty);
|
||||
if (primitive != null && primitive.PopupCanBeClosed)
|
||||
{
|
||||
primitive.ParamsPanelVisibilty = false;
|
||||
primitive.ParameterCaptured = false;
|
||||
}
|
||||
});
|
||||
EditHeadMaterialsCommand = new RelayCommand(o => EditHeadMaterials());
|
||||
OpenMaterialCatalog = new RelayCommand(o =>
|
||||
{
|
||||
@@ -254,24 +234,6 @@ namespace StructureHelper.Windows.MainWindow
|
||||
var colorPickerView = new ColorPickerView(primitive);
|
||||
colorPickerView.ShowDialog();
|
||||
});
|
||||
SetInFrontOfAll = new RelayCommand(o =>
|
||||
{
|
||||
if (!(o is PrimitiveBase primitive)) return;
|
||||
foreach (var primitiveDefinition in Primitives)
|
||||
if (primitiveDefinition.ShowedZIndex > primitive.ShowedZIndex && primitiveDefinition != primitive)
|
||||
primitiveDefinition.ShowedZIndex--;
|
||||
primitive.ShowedZIndex = PrimitivesCount;
|
||||
OnPropertyChanged(nameof(primitive.ShowedZIndex));
|
||||
});
|
||||
SetInBackOfAll = new RelayCommand(o =>
|
||||
{
|
||||
if (!(o is PrimitiveBase primitive)) return;
|
||||
foreach (var primitiveDefinition in Primitives)
|
||||
if (primitiveDefinition != primitive && primitiveDefinition.ShowedZIndex < primitive.ShowedZIndex)
|
||||
primitiveDefinition.ShowedZIndex++;
|
||||
primitive.ShowedZIndex = 1;
|
||||
OnPropertyChanged(nameof(primitive.ShowedZIndex));
|
||||
});
|
||||
|
||||
ScaleCanvasDown = new RelayCommand(o =>
|
||||
{
|
||||
@@ -287,83 +249,20 @@ namespace StructureHelper.Windows.MainWindow
|
||||
ScaleValue /= scaleRate;
|
||||
});
|
||||
|
||||
Primitives = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(repository.Primitives);
|
||||
|
||||
AddPrimitive = new RelayCommand(o =>
|
||||
{
|
||||
if (!(o is PrimitiveType primitiveType)) return;
|
||||
PrimitiveBase viewPrimitive;
|
||||
INdmPrimitive ndmPrimitive;
|
||||
if (primitiveType == PrimitiveType.Rectangle)
|
||||
{
|
||||
var primitive = new RectanglePrimitive
|
||||
{
|
||||
Width = 0.4d,
|
||||
Height = 0.6d
|
||||
};
|
||||
ndmPrimitive = primitive;
|
||||
viewPrimitive = new RectangleViewPrimitive(primitive);
|
||||
|
||||
}
|
||||
else if (primitiveType == PrimitiveType.Point)
|
||||
{
|
||||
var primitive = new PointPrimitive
|
||||
{
|
||||
Area = 0.0005d
|
||||
};
|
||||
ndmPrimitive = primitive;
|
||||
viewPrimitive = new PointViewPrimitive(primitive);
|
||||
}
|
||||
|
||||
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + nameof(primitiveType)); }
|
||||
viewPrimitive.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2);
|
||||
repository.Primitives.Add(ndmPrimitive);
|
||||
Primitives.Add(viewPrimitive);
|
||||
OnPropertyChanged(nameof(Primitives));
|
||||
OnPropertyChanged(nameof(PrimitivesCount));
|
||||
});
|
||||
|
||||
DeletePrimitive = new RelayCommand(
|
||||
o=>DeleteSelectedPrimitive(),
|
||||
o => SelectedPrimitive != null
|
||||
);
|
||||
|
||||
EditPrimitive = new RelayCommand(
|
||||
o => EditSelectedPrimitive(),
|
||||
o => SelectedPrimitive != null
|
||||
);
|
||||
|
||||
AddBeamCase = new RelayCommand(o =>
|
||||
{
|
||||
foreach (var primitive in GetBeamCasePrimitives())
|
||||
{
|
||||
Primitives.Add(primitive);
|
||||
var ndmPrimitive = primitive.GetNdmPrimitive();
|
||||
repository.Primitives.Add(ndmPrimitive);
|
||||
}
|
||||
OnPropertyChanged(nameof(PrimitivesCount));
|
||||
PrimitiveLogic.AddItems(GetBeamCasePrimitives());
|
||||
//OnPropertyChanged(nameof(PrimitivesCount));
|
||||
});
|
||||
|
||||
AddColumnCase = new RelayCommand(o =>
|
||||
{
|
||||
foreach (var primitive in GetColumnCasePrimitives())
|
||||
{
|
||||
Primitives.Add(primitive);
|
||||
var ndmPrimitive = primitive.GetNdmPrimitive();
|
||||
repository.Primitives.Add(ndmPrimitive);
|
||||
}
|
||||
OnPropertyChanged(nameof(PrimitivesCount));
|
||||
PrimitiveLogic.AddItems(GetColumnCasePrimitives());
|
||||
});
|
||||
|
||||
AddSlabCase = new RelayCommand(o =>
|
||||
{
|
||||
foreach (var primitive in GetSlabCasePrimitives())
|
||||
{
|
||||
Primitives.Add(primitive);
|
||||
var ndmPrimitive = primitive.GetNdmPrimitive();
|
||||
repository.Primitives.Add(ndmPrimitive);
|
||||
}
|
||||
OnPropertyChanged(nameof(PrimitivesCount));
|
||||
PrimitiveLogic.AddItems(GetSlabCasePrimitives());
|
||||
});
|
||||
|
||||
Calculate = new RelayCommand(o =>
|
||||
@@ -406,39 +305,12 @@ namespace StructureHelper.Windows.MainWindow
|
||||
var wnd = new HeadMaterialsView(repository);
|
||||
wnd.ShowDialog();
|
||||
OnPropertyChanged(nameof(HeadMaterials));
|
||||
foreach (var primitive in Primitives)
|
||||
foreach (var primitive in primitiveLogic.Items)
|
||||
{
|
||||
primitive.RefreshColor();
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteSelectedPrimitive()
|
||||
{
|
||||
if (! (SelectedPrimitive is null))
|
||||
{
|
||||
var dialogResult = MessageBox.Show("Delete primitive?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
var ndmPrimitive = SelectedPrimitive.GetNdmPrimitive();
|
||||
repository.Primitives.Remove(ndmPrimitive);
|
||||
Primitives.Remove(SelectedPrimitive);
|
||||
}
|
||||
}
|
||||
else { MessageBox.Show("Selection is changed", "Please, select primitive", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); }
|
||||
OnPropertyChanged(nameof(PrimitivesCount));
|
||||
}
|
||||
|
||||
private void EditSelectedPrimitive()
|
||||
{
|
||||
if (!(SelectedPrimitive is null))
|
||||
{
|
||||
var wnd = new PrimitiveProperties(SelectedPrimitive, repository);
|
||||
wnd.ShowDialog();
|
||||
OnPropertyChanged(nameof(HeadMaterials));
|
||||
}
|
||||
else { MessageBox.Show("Selection is changed", "Please, select primitive", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); }
|
||||
}
|
||||
|
||||
private void CalculateResult()
|
||||
{
|
||||
bool check = CheckAnalisysOptions();
|
||||
@@ -460,16 +332,14 @@ namespace StructureHelper.Windows.MainWindow
|
||||
MessageBox.Show($"{ErrorStrings.UnknownError}: {ex}", "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckAnalisysOptions()
|
||||
{
|
||||
if (CheckMaterials() == false) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool CheckMaterials()
|
||||
{
|
||||
foreach (var item in Primitives)
|
||||
foreach (var item in primitiveLogic.Items)
|
||||
{
|
||||
if (item.HeadMaterial == null)
|
||||
{
|
||||
@@ -479,32 +349,27 @@ namespace StructureHelper.Windows.MainWindow
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
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 void EditCalculationProperty()
|
||||
{
|
||||
CalculationPropertyViewModel viewModel = new CalculationPropertyViewModel(calculationProperty);
|
||||
var view = new CalculationPropertyView(viewModel);
|
||||
view.ShowDialog();
|
||||
}
|
||||
|
||||
private IEnumerable<PrimitiveBase> GetCasePrimitives(RectangleBeamTemplate template)
|
||||
{
|
||||
var wnd = new RectangleBeamView(template);
|
||||
@@ -520,13 +385,12 @@ namespace StructureHelper.Windows.MainWindow
|
||||
OnPropertyChanged(nameof(HeadMaterials));
|
||||
CombinationsLogic.AddItems(newRepository.ForceCombinationLists);
|
||||
CalculatorsLogic.AddItems(newRepository.CalculatorsList);
|
||||
//OnPropertyChanged(nameof(CombinationsLogic.Items));
|
||||
//OnPropertyChanged(nameof(CalculatorsLogic.Items));
|
||||
var primitives = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(newRepository.Primitives);
|
||||
foreach (var item in primitives)
|
||||
{
|
||||
item.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2);
|
||||
}
|
||||
PrimitiveLogic.Refresh();
|
||||
return primitives;
|
||||
}
|
||||
return new List<PrimitiveBase>();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Window x:Class="StructureHelper.Windows.PrimitiveProperiesWindow.PrimitiveProperties"
|
||||
<Window x:Class="StructureHelper.Windows.PrimitiveProperiesWindow.PrimitivePropertiesView"
|
||||
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"
|
||||
@@ -9,6 +9,7 @@
|
||||
mc:Ignorable="d"
|
||||
Title="PrimitiveProperties" Height="450" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
||||
<Window.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||
<DataTemplate x:Key="RectangleProperties">
|
||||
<Expander Header="Rectangle" IsExpanded="True">
|
||||
<Grid>
|
||||
@@ -61,84 +62,115 @@
|
||||
</Expander>
|
||||
</DataTemplate>
|
||||
</Window.Resources>
|
||||
<ScrollViewer>
|
||||
<StackPanel x:Name="StpProperties">
|
||||
<Expander Header="Common properties" IsExpanded="True">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TabControl>
|
||||
<TabItem Header="Main">
|
||||
<ScrollViewer>
|
||||
<StackPanel x:Name="StpProperties">
|
||||
<Expander Header="Common properties" IsExpanded="True">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<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="Name"/>
|
||||
<TextBlock Grid.Row="1" Text="Name of material"/>
|
||||
<TextBlock Grid.Row="2" Text="Center X"/>
|
||||
<TextBlock Grid.Row="3" Text="Center Y"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding Name}"/>
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<ComboBox Width="100" ItemsSource="{Binding HeadMaterials}" SelectedItem="{Binding PrimitiveMaterial}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="20"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Rectangle Grid.Column="0" Margin="3">
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="{Binding Color}"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<Button Width="50" Content="..." Command="{Binding EditMaterialCommand}">
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Margin="1" Text="{Binding CenterY, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||
</Grid>
|
||||
</Expander>
|
||||
<Expander Header="Prestrain" IsExpanded="False">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="k_x"/>
|
||||
<TextBlock Grid.Row="1" Text="k_y"/>
|
||||
<TextBlock Grid.Row="2" Text="epsilon_z"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding PrestrainKx, Converter={StaticResource Curvature}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Text="{Binding PrestrainKy, Converter={StaticResource Curvature}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding PrestrainEpsZ, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||
</Grid>
|
||||
</Expander>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
<TabItem Header="Visual">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Visible"/>
|
||||
<TextBlock Grid.Row="1" Text="Material color"/>
|
||||
<TextBlock Grid.Row="2" Text="Z-index (integer)"/>
|
||||
<TextBlock Grid.Row="3" Text="Opacity"/>
|
||||
<CheckBox Grid.Column="1" IsChecked="{Binding IsVisible}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"/>
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<CheckBox IsChecked="{Binding SetMaterialColor}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,20,0"/>
|
||||
<Rectangle Width="50" Margin="5,0,10,0">
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="{Binding Color}"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<Button Width="50" Content="..." Command="{Binding EditColorCommand}"/>
|
||||
</StackPanel>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding ZIndex}"/>
|
||||
<Grid Grid.Row="3" Grid.Column="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Name"/>
|
||||
<TextBlock Grid.Row="1" Text="Name of material"/>
|
||||
<TextBlock Grid.Row="2" Text="Center X"/>
|
||||
<TextBlock Grid.Row="3" Text="Center Y"/>
|
||||
<TextBlock Grid.Row="4" Text="Material color"/>
|
||||
<TextBlock Grid.Row="5" Text="Z-index (integer)"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding Name}"/>
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<ComboBox Width="120" ItemsSource="{Binding HeadMaterials}" SelectedItem="{Binding PrimitiveMaterial}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="20"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Rectangle Grid.Column="0" Margin="3">
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="{Binding Color}"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<Button Width="50" Content="..." Command="{Binding EditMaterialCommand}">
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Margin="1" Text="{Binding CenterY, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="5" Grid.Column="1" Margin="1" Text="{Binding ZIndex}"/>
|
||||
<StackPanel Grid.Row="4" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<CheckBox IsChecked="{Binding SetMaterialColor}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,20,0"/>
|
||||
<Rectangle Width="50" Margin="5,0,10,0">
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="{Binding Color}"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<Button Width="50" Content="..." Command="{Binding EditColorCommand}"/>
|
||||
</StackPanel>
|
||||
<TextBox Text="{Binding Opacity, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}" Margin="5"/>
|
||||
<Slider Grid.Column="1" Value="{Binding Opacity}" Maximum="100" TickPlacement="BottomRight" TickFrequency="10" IsSnapToTickEnabled="True" Margin="2"/>
|
||||
</Grid>
|
||||
</Expander>
|
||||
<Expander Header="Prestrain" IsExpanded="False">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="k_x"/>
|
||||
<TextBlock Grid.Row="1" Text="k_y"/>
|
||||
<TextBlock Grid.Row="2" Text="epsilon_z"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding PrestrainKx, Converter={StaticResource Curvature}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Text="{Binding PrestrainKy, Converter={StaticResource Curvature}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding PrestrainEpsZ, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||
</Grid>
|
||||
</Expander>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
</Window>
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace StructureHelper.Windows.PrimitiveProperiesWindow
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для PrimitiveProperties.xaml
|
||||
/// </summary>
|
||||
public partial class PrimitiveProperties : Window
|
||||
public partial class PrimitivePropertiesView : Window
|
||||
{
|
||||
PrimitiveBase primitive;
|
||||
private PrimitivePropertiesViewModel viewModel;
|
||||
public PrimitiveProperties(PrimitiveBase primitive, IHasHeadMaterials headMaterials)
|
||||
public PrimitivePropertiesView(PrimitiveBase primitive, IHasHeadMaterials headMaterials)
|
||||
{
|
||||
this.primitive = primitive;
|
||||
viewModel = new PrimitivePropertiesViewModel(this.primitive, headMaterials);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Services.Primitives;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
@@ -13,6 +14,7 @@ using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
@@ -48,7 +50,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
public bool LongTerm { get; set; }
|
||||
|
||||
public ISourceToTargetViewModel<IForceCombinationList> CombinationViewModel { get; }
|
||||
//public ISourceToTargetViewModel<PrimitiveBase> PrimitivesViewModel { get; }
|
||||
public ISourceToTargetViewModel<PrimitiveBase> PrimitivesViewModel { get; }
|
||||
|
||||
public PrimitiveBase SelectedAllowedPrimitive { get; set; }
|
||||
public PrimitiveBase SelectedPrimitive { get; set; }
|
||||
@@ -60,7 +62,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
var sourceItems = forcesCalculator.Primitives;
|
||||
var rejectedItems = allowedPrimitives.Where(x => sourceItems.Contains(x));
|
||||
var filteredItems = allowedPrimitives.Except(rejectedItems);
|
||||
return ConvertNdmPrimitivesToPrimitiveBase(filteredItems);
|
||||
return PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(filteredItems);
|
||||
}
|
||||
}
|
||||
public ObservableCollection<PrimitiveBase> Primitives
|
||||
@@ -68,7 +70,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
get
|
||||
{
|
||||
var sourceItems = forcesCalculator.Primitives;
|
||||
return ConvertNdmPrimitivesToPrimitiveBase(sourceItems);
|
||||
return PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(sourceItems);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,37 +151,19 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
CombinationViewModel = new SourceToTargetViewModel<IForceCombinationList>();
|
||||
CombinationViewModel.SetTargetItems(forcesCalculator.ForceCombinationLists);
|
||||
CombinationViewModel.SetSourceItems(allowedForceCombinations);
|
||||
CombinationViewModel.ItemDataDemplate = Application.Current.Resources["SimpleItemTemplate"] as DataTemplate;
|
||||
|
||||
//PrimitivesViewModel = new SourceToTargetViewModel<PrimitiveBase>();
|
||||
//var targetItems = forcesCalculator.NdmPrimitives;
|
||||
//var viewPrimitives = ConvertNdmPrimitivesToPrimitiveBase(targetItems);
|
||||
//PrimitivesViewModel.SetTargetItems(viewPrimitives);
|
||||
//var sourceViewPrimitives = ConvertNdmPrimitivesToPrimitiveBase(allowedPrimitives) ;
|
||||
//PrimitivesViewModel.SetSourceItems(sourceViewPrimitives);
|
||||
PrimitivesViewModel = new SourceToTargetViewModel<PrimitiveBase>();
|
||||
var targetItems = forcesCalculator.Primitives;
|
||||
var sourceViewPrimitives = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(allowedPrimitives);
|
||||
var viewPrimitives = sourceViewPrimitives.Where(x => targetItems.Contains(x.GetNdmPrimitive()));
|
||||
PrimitivesViewModel.SetTargetItems(viewPrimitives);
|
||||
PrimitivesViewModel.SetSourceItems(sourceViewPrimitives);
|
||||
PrimitivesViewModel.ItemDataDemplate = Application.Current.Resources["ColoredItemTemplate"] as DataTemplate;
|
||||
|
||||
InputRefresh();
|
||||
}
|
||||
|
||||
private ObservableCollection<PrimitiveBase> ConvertNdmPrimitivesToPrimitiveBase(IEnumerable<INdmPrimitive> primitives)
|
||||
{
|
||||
ObservableCollection<PrimitiveBase> viewItems = new ObservableCollection<PrimitiveBase>();
|
||||
foreach (var item in primitives)
|
||||
{
|
||||
if (item is IPointPrimitive)
|
||||
{
|
||||
var point = item as IPointPrimitive;
|
||||
viewItems.Add(new PointViewPrimitive(point));
|
||||
}
|
||||
else if (item is IRectanglePrimitive)
|
||||
{
|
||||
var rect = item as IRectanglePrimitive;
|
||||
viewItems.Add(new RectangleViewPrimitive(rect));
|
||||
}
|
||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
|
||||
}
|
||||
return viewItems;
|
||||
}
|
||||
|
||||
public void InputRefresh()
|
||||
{
|
||||
ULS = forcesCalculator.LimitStatesList.Contains(LimitStates.ULS);
|
||||
@@ -196,11 +180,11 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
{
|
||||
forcesCalculator.ForceCombinationLists.Add(item);
|
||||
}
|
||||
//forcesCalculator.NdmPrimitives.Clear();
|
||||
//foreach (var item in PrimitivesViewModel.GetTargetItems())
|
||||
//{
|
||||
// forcesCalculator.NdmPrimitives.Add(item.GetNdmPrimitive());
|
||||
//}
|
||||
forcesCalculator.Primitives.Clear();
|
||||
foreach (var item in PrimitivesViewModel.GetTargetItems())
|
||||
{
|
||||
forcesCalculator.Primitives.Add(item.GetNdmPrimitive());
|
||||
}
|
||||
forcesCalculator.LimitStatesList.Clear();
|
||||
if (ULS == true) { forcesCalculator.LimitStatesList.Add(LimitStates.ULS); }
|
||||
if (SLS == true) { forcesCalculator.LimitStatesList.Add(LimitStates.SLS); }
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels
|
||||
{
|
||||
@@ -14,6 +15,7 @@ namespace StructureHelper.Windows.ViewModels
|
||||
TItem SelectedTargetItem { get; set; }
|
||||
ObservableCollection<TItem> SourceItems { get; }
|
||||
ObservableCollection<TItem> TargetItems { get; }
|
||||
DataTemplate ItemDataDemplate { get; set; }
|
||||
RelayCommand AddAll { get; }
|
||||
RelayCommand ClearAll { get; }
|
||||
RelayCommand AddSelected { get; }
|
||||
|
||||
@@ -21,14 +21,14 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
public INdmCalculator SelectedItem { get; set; }
|
||||
public ObservableCollection<INdmCalculator> Items { get; private set; }
|
||||
|
||||
private RelayCommand addCalculatorCommand;
|
||||
private RelayCommand addCommand;
|
||||
public RelayCommand Add
|
||||
{
|
||||
get
|
||||
{
|
||||
return addCalculatorCommand ??
|
||||
return addCommand ??
|
||||
(
|
||||
addCalculatorCommand = new RelayCommand(o =>
|
||||
addCommand = new RelayCommand(o =>
|
||||
{
|
||||
AddCalculator();
|
||||
OnPropertyChanged(nameof(Items));
|
||||
@@ -41,14 +41,14 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
Items.Add(item);
|
||||
repository.CalculatorsList.Add(item);
|
||||
}
|
||||
private RelayCommand editCalculatorCommand;
|
||||
private RelayCommand editCommand;
|
||||
public RelayCommand Edit
|
||||
{
|
||||
get
|
||||
{
|
||||
return editCalculatorCommand ??
|
||||
return editCommand ??
|
||||
(
|
||||
editCalculatorCommand = new RelayCommand(o =>
|
||||
editCommand = new RelayCommand(o =>
|
||||
{
|
||||
var tmpSelected = SelectedItem;
|
||||
EditCalculator();
|
||||
@@ -70,23 +70,22 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
}
|
||||
private RelayCommand deleteCalculatorCommand;
|
||||
private RelayCommand deleteCommand;
|
||||
private RelayCommand runCommand;
|
||||
private RelayCommand copyCalculatorCommand;
|
||||
private RelayCommand copyCommand;
|
||||
|
||||
public RelayCommand Delete
|
||||
{
|
||||
get
|
||||
{
|
||||
return deleteCalculatorCommand ??
|
||||
return deleteCommand ??
|
||||
(
|
||||
deleteCalculatorCommand = new RelayCommand(o =>
|
||||
deleteCommand = new RelayCommand(o =>
|
||||
{
|
||||
DeleteCalculator();
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
|
||||
public RelayCommand Run
|
||||
{
|
||||
get
|
||||
@@ -111,14 +110,13 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
|
||||
public RelayCommand Copy
|
||||
{
|
||||
get
|
||||
{
|
||||
return copyCalculatorCommand ??
|
||||
return copyCommand ??
|
||||
(
|
||||
copyCalculatorCommand = new RelayCommand(o =>
|
||||
copyCommand = new RelayCommand(o =>
|
||||
{
|
||||
var item = SelectedItem.Clone() as INdmCalculator;
|
||||
repository.CalculatorsList.Add(item);
|
||||
@@ -127,7 +125,6 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteCalculator()
|
||||
{
|
||||
var dialogResult = MessageBox.Show("Delete calculator?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
{
|
||||
public interface IPrimitiveViewModelLogic : ICRUDViewModel<PrimitiveBase>
|
||||
{
|
||||
RelayCommand SetToFront { get; }
|
||||
RelayCommand SetToBack { get; }
|
||||
int PrimitivesCount { get; }
|
||||
void Refresh();
|
||||
}
|
||||
}
|
||||
227
Windows/ViewModels/NdmCrossSections/PrimitiveViewModelLogic.cs
Normal file
227
Windows/ViewModels/NdmCrossSections/PrimitiveViewModelLogic.cs
Normal file
@@ -0,0 +1,227 @@
|
||||
using FieldVisualizer.ViewModels;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using StructureHelper.Services.Primitives;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using ViewModelBase = StructureHelper.Infrastructure.ViewModelBase;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Documents;
|
||||
using StructureHelper.Windows.PrimitiveProperiesWindow;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
{
|
||||
public class PrimitiveViewModelLogic : ViewModelBase, IPrimitiveViewModelLogic
|
||||
{
|
||||
private readonly ICrossSectionRepository repository;
|
||||
private RelayCommand addCommand;
|
||||
private RelayCommand deleteCommand;
|
||||
private RelayCommand editCommand;
|
||||
private RelayCommand copyCommand;
|
||||
private RelayCommand setToFront;
|
||||
private RelayCommand setToBack;
|
||||
|
||||
public double CanvasWidth { get; set; }
|
||||
public double CanvasHeight { get; set; }
|
||||
|
||||
public PrimitiveBase SelectedItem { get; set; }
|
||||
|
||||
public ObservableCollection<PrimitiveBase> Items { get; private set; }
|
||||
|
||||
public RelayCommand Add
|
||||
{
|
||||
get
|
||||
{
|
||||
return addCommand ??
|
||||
(
|
||||
addCommand = new RelayCommand(o =>
|
||||
{
|
||||
if (!(o is PrimitiveType primitiveType)) return;
|
||||
AddPrimitive(primitiveType);
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
private void AddPrimitive(PrimitiveType primitiveType)
|
||||
{
|
||||
PrimitiveBase viewPrimitive;
|
||||
INdmPrimitive ndmPrimitive;
|
||||
if (primitiveType == PrimitiveType.Rectangle)
|
||||
{
|
||||
var primitive = new RectanglePrimitive
|
||||
{
|
||||
Width = 0.4d,
|
||||
Height = 0.6d
|
||||
};
|
||||
ndmPrimitive = primitive;
|
||||
viewPrimitive = new RectangleViewPrimitive(primitive);
|
||||
|
||||
}
|
||||
else if (primitiveType == PrimitiveType.Point)
|
||||
{
|
||||
var primitive = new PointPrimitive
|
||||
{
|
||||
Area = 0.0005d
|
||||
};
|
||||
ndmPrimitive = primitive;
|
||||
viewPrimitive = new PointViewPrimitive(primitive);
|
||||
}
|
||||
|
||||
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + nameof(primitiveType)); }
|
||||
viewPrimitive.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2);
|
||||
repository.Primitives.Add(ndmPrimitive);
|
||||
Items.Add(viewPrimitive);
|
||||
OnPropertyChanged(nameof(Items));
|
||||
OnPropertyChanged(nameof(PrimitivesCount));
|
||||
}
|
||||
|
||||
public RelayCommand Delete
|
||||
{
|
||||
get
|
||||
{
|
||||
return deleteCommand ??
|
||||
(
|
||||
deleteCommand = new RelayCommand(o=>
|
||||
DeleteSelectedPrimitive(),
|
||||
o => SelectedItem != null
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteSelectedPrimitive()
|
||||
{
|
||||
var dialogResult = MessageBox.Show("Delete primitive?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
var ndmPrimitive = SelectedItem.GetNdmPrimitive();
|
||||
repository.Primitives.Remove(ndmPrimitive);
|
||||
Items.Remove(SelectedItem);
|
||||
}
|
||||
OnPropertyChanged(nameof(Items));
|
||||
OnPropertyChanged(nameof(PrimitivesCount));
|
||||
}
|
||||
|
||||
public RelayCommand Edit
|
||||
{
|
||||
get
|
||||
{
|
||||
return editCommand ??
|
||||
(
|
||||
editCommand = new RelayCommand(
|
||||
o => EditSelectedItem(),
|
||||
o => SelectedItem != null
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
private void EditSelectedItem()
|
||||
{
|
||||
var wnd = new PrimitivePropertiesView(SelectedItem, repository);
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
|
||||
public RelayCommand Copy
|
||||
{
|
||||
get
|
||||
{
|
||||
return copyCommand ??
|
||||
(
|
||||
copyCommand = new RelayCommand(
|
||||
o => CopySelectedItem(),
|
||||
o => SelectedItem != null
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
private void CopySelectedItem()
|
||||
{
|
||||
var oldPrimitive = SelectedItem.GetNdmPrimitive();
|
||||
var newPrimitive = oldPrimitive.Clone() as INdmPrimitive;
|
||||
repository.Primitives.Add(newPrimitive);
|
||||
PrimitiveBase primitiveBase;
|
||||
if (newPrimitive is IRectanglePrimitive) { primitiveBase = new RectangleViewPrimitive(newPrimitive as IRectanglePrimitive); }
|
||||
else if (newPrimitive is IPointPrimitive) { primitiveBase = new PointViewPrimitive(newPrimitive as IPointPrimitive); }
|
||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
|
||||
primitiveBase.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2);
|
||||
Items.Add(primitiveBase);
|
||||
OnPropertyChanged(nameof(Items));
|
||||
OnPropertyChanged(nameof(PrimitivesCount));
|
||||
}
|
||||
|
||||
public int PrimitivesCount => repository.Primitives.Count();
|
||||
|
||||
public RelayCommand SetToFront
|
||||
{
|
||||
get
|
||||
{
|
||||
return setToFront ??
|
||||
(setToFront = new RelayCommand(o=>
|
||||
{
|
||||
int maxZIndex = Items.Select(x => x.GetNdmPrimitive().VisualProperty.ZIndex).Max();
|
||||
SelectedItem.ZIndex = maxZIndex + 1;
|
||||
},o => CheckMaxIndex()
|
||||
));
|
||||
}
|
||||
}
|
||||
private bool CheckMaxIndex()
|
||||
{
|
||||
if (SelectedItem is null) return false;
|
||||
int maxZIndex = Items.Select(x => x.GetNdmPrimitive().VisualProperty.ZIndex).Max();
|
||||
if (SelectedItem.ZIndex <= maxZIndex) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
private bool CheckMinIndex()
|
||||
{
|
||||
if (SelectedItem is null) return false;
|
||||
int minZIndex = Items.Select(x => x.GetNdmPrimitive().VisualProperty.ZIndex).Min();
|
||||
if (SelectedItem.ZIndex >= minZIndex) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
public RelayCommand SetToBack
|
||||
{
|
||||
get
|
||||
{
|
||||
return setToBack ??
|
||||
(setToBack = new RelayCommand(o =>
|
||||
{
|
||||
int minZIndex = Items.Select(x => x.GetNdmPrimitive().VisualProperty.ZIndex).Min();
|
||||
SelectedItem.ZIndex = minZIndex - 1;
|
||||
}, o => CheckMinIndex()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
public void AddItems(IEnumerable<PrimitiveBase> items)
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
Items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
OnPropertyChanged(nameof(PrimitivesCount));
|
||||
}
|
||||
|
||||
public PrimitiveViewModelLogic(ICrossSectionRepository repository)
|
||||
{
|
||||
this.repository = repository;
|
||||
Items = new ObservableCollection<PrimitiveBase>();
|
||||
AddItems(PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(this.repository.Primitives));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -206,6 +206,28 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsVisible
|
||||
{
|
||||
get => primitive.IsVisible;
|
||||
set
|
||||
{
|
||||
primitive.IsVisible = value;
|
||||
OnPropertyChanged(nameof(IsVisible));
|
||||
}
|
||||
}
|
||||
|
||||
public double Opacity
|
||||
{
|
||||
get => primitive.Opacity * 100d;
|
||||
set
|
||||
{
|
||||
if (value < 0d ) { value = 0d; }
|
||||
if (value > 100d) { value = 100d; }
|
||||
primitive.Opacity = value / 100d;
|
||||
OnPropertyChanged(nameof(Opacity));
|
||||
}
|
||||
}
|
||||
|
||||
public string this[string columnName]
|
||||
{
|
||||
get
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels
|
||||
{
|
||||
@@ -23,6 +24,7 @@ namespace StructureHelper.Windows.ViewModels
|
||||
public TItem SelectedTargetItem { get; set; }
|
||||
public ObservableCollection<TItem> SourceItems { get; }
|
||||
public ObservableCollection<TItem> TargetItems { get; }
|
||||
public DataTemplate ItemDataDemplate { get; set; }
|
||||
public RelayCommand AddAll
|
||||
{
|
||||
get
|
||||
@@ -82,6 +84,8 @@ namespace StructureHelper.Windows.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public SourceToTargetViewModel()
|
||||
{
|
||||
SourceItems = new ObservableCollection<TItem>();
|
||||
|
||||
Reference in New Issue
Block a user