Templates was added
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.PrimitiveTemplates
|
||||
{
|
||||
public interface IRectangleBeamProperties
|
||||
{
|
||||
IShape Shape { get; }
|
||||
}
|
||||
}
|
||||
41
Infrastructure/UI/PrimitiveTemplates/TemplateFactory.cs
Normal file
41
Infrastructure/UI/PrimitiveTemplates/TemplateFactory.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.Templates.RCs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Shapes = StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.PrimitiveTemplates
|
||||
{
|
||||
internal static class TemplateFactory
|
||||
{
|
||||
//public static IEnumerable<PrimitiveBase> RectangleBeam(IRectangleBeamTemplate properties)
|
||||
//{
|
||||
// var rect = properties.Shape as Shapes.Rectangle;
|
||||
// var width = rect.Width;
|
||||
// var height = rect.Height;
|
||||
// var area1 = Math.PI * properties.BottomDiameter * properties.BottomDiameter / 4d;
|
||||
// var area2 = Math.PI * properties.TopDiameter * properties.TopDiameter / 4d;
|
||||
// var gap = properties.CoverGap;
|
||||
|
||||
//IHeadMaterial concrete = new HeadMaterial() { Name = "Concrete 40" };
|
||||
//concrete.HelperMaterial = Model.HeadMaterialRepository.LibMaterials.Where(x => (x.MaterialType == MaterialTypes.Concrete & x.Name.Contains("40"))).First();
|
||||
//IHeadMaterial reinforcement = new HeadMaterial() { Name = "Reinforcement 400" };
|
||||
//reinforcement.HelperMaterial = Model.HeadMaterialRepository.LibMaterials.Where(x => (x.MaterialType == MaterialTypes.Reinforcement & x.Name.Contains("400"))).First();
|
||||
//headMaterials.Add(concrete);
|
||||
//headMaterials.Add(reinforcement);
|
||||
//OnPropertyChanged(nameof(headMaterials));
|
||||
|
||||
//yield return new Rectangle(width, height, 0, 0, this) { HeadMaterial = concrete };
|
||||
//yield return new Point(area1, -width / 2 + gap, -height / 2 + gap, this) { HeadMaterial = reinforcement };
|
||||
//yield return new Point(area1, width / 2 - gap, -height / 2 + gap, this) { HeadMaterial = reinforcement };
|
||||
//yield return new Point(area2, -width / 2 + gap, height / 2 - gap, this) { HeadMaterial = reinforcement };
|
||||
//yield return new Point(area2, width / 2 - gap, height / 2 - gap, this) { HeadMaterial = reinforcement };
|
||||
//}
|
||||
}
|
||||
}
|
||||
21
Infrastructure/UI/Resources/ShapeEditTemplates.xaml
Normal file
21
Infrastructure/UI/Resources/ShapeEditTemplates.xaml
Normal file
@@ -0,0 +1,21 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<DataTemplate x:Key="RectangleShapeEdit">
|
||||
<DataTemplate.Resources>
|
||||
</DataTemplate.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Width"/>
|
||||
<TextBlock Grid.Row="1" Text="Height"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Style="{StaticResource ValidatedError}" Text="{Binding Width, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Text="{Binding Height, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ResourceDictionary>
|
||||
@@ -11,6 +11,14 @@
|
||||
<converters:Length x:Key="LengthConverter"/>
|
||||
<converters:Area x:Key="AreaConverter"/>
|
||||
|
||||
<Style TargetType="TextBox" x:Key="ValidatedError">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="Validation.HasError" Value="True">
|
||||
<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Shape" x:Key="ShapeStyle">
|
||||
<Setter Property="Fill">
|
||||
<Setter.Value>
|
||||
|
||||
Reference in New Issue
Block a user