Materials were refactored
This commit is contained in:
@@ -20,26 +20,30 @@
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="SelectItems">
|
||||
<StackPanel>
|
||||
<StackPanel Height="25" Orientation="Horizontal" HorizontalAlignment="Right" Visibility="{Binding ShowButtons, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Visibility="{Binding ShowButtons, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<Button Content="Select All" Command="{Binding SelectAllCommand}"/>
|
||||
<Button Content="Unselect All" Command="{Binding UnSelectAllCommand}"/>
|
||||
<Button Content="Invert Selection" Command="{Binding InvertSelectionCommand}"/>
|
||||
</StackPanel>
|
||||
<ListBox ItemsSource="{Binding CollectionItems}" SelectedItem="SelectedItem">
|
||||
<ListBox Grid.Row="1" ItemsSource="{Binding CollectionItems}" SelectedItem="SelectedItem">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="22"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox IsChecked="{Binding IsSelected}"/>
|
||||
<ContentControl Grid.Column="1" ContentTemplate="{StaticResource ColoredItemTemplate}" Content="{Binding Item}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="22"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox IsChecked="{Binding IsSelected}"/>
|
||||
<ContentControl Grid.Column="1" ContentTemplate="{StaticResource ColoredItemTemplate}" Content="{Binding Item}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ResourceDictionary>
|
||||
@@ -3,7 +3,24 @@
|
||||
|
||||
<DataTemplate x:Key="LibraryMaterial">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Library material"/>
|
||||
<TextBlock Text="Material Code"/>
|
||||
<ComboBox Height="25" VerticalAlignment="Top" ItemsSource="{Binding CodeList}" SelectedItem="{Binding CodeEntity}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Name}">
|
||||
<!--<ToolTip>
|
||||
<StackPanel>
|
||||
<TextBlock FontWeight="Bold" Text="Code short name:"/>
|
||||
<TextBlock Text="{Binding Name}"/>
|
||||
<TextBlock FontWeight="Bold" Text="Full name:"/>
|
||||
<TextBlock Text="{Binding FullName}"/>
|
||||
</StackPanel>
|
||||
</ToolTip>-->
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<TextBlock Text="Material Kind"/>
|
||||
<ComboBox Height="25" VerticalAlignment="Top" ItemsSource="{Binding MaterialLibrary}" SelectedItem="{Binding MaterialEntity}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
<Window x:Class="StructureHelper.Windows.ColorPickerWindow.ColorPickerView"
|
||||
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"
|
||||
xmlns:colorPickerWindow="clr-namespace:StructureHelper.Windows.ColorPickerWindow"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance colorPickerWindow:ColorPickerViewModel}"
|
||||
Title="Выбрать цвет" Height="200" Width="500" Topmost="True" ResizeMode="NoResize">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="80"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Красный"/>
|
||||
<Slider Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="10" Value="{Binding Red}" Minimum="0" Maximum="255"/>
|
||||
<TextBox Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="10" Text="{Binding Red}"/>
|
||||
|
||||
<Border Grid.Column="3" Grid.RowSpan="3" Margin="10" BorderBrush="Black" BorderThickness="1">
|
||||
<Rectangle>
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="{Binding SelectedColor}"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
</Border>
|
||||
|
||||
|
||||
<TextBlock Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Зеленый"/>
|
||||
<Slider Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="10" Value="{Binding Green}" Minimum="0" Maximum="255"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="10" Text="{Binding Green}"/>
|
||||
|
||||
<TextBlock Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Синий"/>
|
||||
<Slider Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="10" Value="{Binding Blue}" Minimum="0" Maximum="255"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="10" Text="{Binding Blue}"/>
|
||||
|
||||
<Button Grid.Row="3" Grid.Column="2" Grid.ColumnSpan="2" Margin="10" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Выбрать цвет" Command="{Binding SetColor}"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -1,18 +0,0 @@
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using System.Windows;
|
||||
|
||||
namespace StructureHelper.Windows.ColorPickerWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для ColorPickerView.xaml
|
||||
/// </summary>
|
||||
public partial class ColorPickerView : Window
|
||||
{
|
||||
public ColorPickerView(PrimitiveBase primitive)
|
||||
{
|
||||
var viewModel = new ColorPickerViewModel(primitive);
|
||||
DataContext = viewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
|
||||
namespace StructureHelper.Windows.ColorPickerWindow
|
||||
{
|
||||
public class ColorPickerViewModel : ViewModelBase
|
||||
{
|
||||
private int red, green, blue;
|
||||
|
||||
public int Red
|
||||
{
|
||||
get => red;
|
||||
set => OnColorItemChanged(value, ref red);
|
||||
}
|
||||
public int Green
|
||||
{
|
||||
get => green;
|
||||
set => OnColorItemChanged(value, ref green);
|
||||
}
|
||||
public int Blue
|
||||
{
|
||||
get => blue;
|
||||
set => OnColorItemChanged(value, ref blue);
|
||||
}
|
||||
|
||||
private Color selectedColor;
|
||||
public Color SelectedColor
|
||||
{
|
||||
get => selectedColor;
|
||||
set => OnPropertyChanged(value, ref selectedColor);
|
||||
}
|
||||
public ICommand SetColor { get; }
|
||||
public ColorPickerViewModel(PrimitiveBase primitive)
|
||||
{
|
||||
if (primitive != null)
|
||||
{
|
||||
var color = primitive.Color;
|
||||
Red = color.R;
|
||||
Green = color.G;
|
||||
Blue = color.B;
|
||||
|
||||
SetColor = new RelayCommand(o => primitive.Color = SelectedColor);
|
||||
}
|
||||
}
|
||||
private void OnColorItemChanged(int value, ref int colorItem, [CallerMemberName] string propertyName = null)
|
||||
{
|
||||
if (value >= 0 && value <= 255 && Math.Abs(colorItem - value) > 0.001)
|
||||
{
|
||||
colorItem = value;
|
||||
OnPropertyChanged(propertyName);
|
||||
UpdateSelectedColor();
|
||||
}
|
||||
}
|
||||
private void UpdateSelectedColor()
|
||||
{
|
||||
var color = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue);
|
||||
SelectedColor = color;
|
||||
OnPropertyChanged(nameof(SelectedColor));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,6 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Models.Materials;
|
||||
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;
|
||||
@@ -262,12 +260,12 @@ namespace StructureHelper.Windows.MainWindow
|
||||
}
|
||||
});
|
||||
|
||||
SetColor = new RelayCommand(o =>
|
||||
{
|
||||
var primitive = o as PrimitiveBase;
|
||||
var colorPickerView = new ColorPickerView(primitive);
|
||||
colorPickerView.ShowDialog();
|
||||
});
|
||||
//SetColor = new RelayCommand(o =>
|
||||
//{
|
||||
// var primitive = o as PrimitiveBase;
|
||||
// var colorPickerView = new ColorPickerView(primitive);
|
||||
// colorPickerView.ShowDialog();
|
||||
//});
|
||||
|
||||
ScaleCanvasDown = new RelayCommand(o =>
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.PrimitiveProperties"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance vm:SelectPrimitivesViewModel}"
|
||||
Title="Select Primitives" Height="250" Width="250" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
||||
Title="Select Primitives" Height="250" Width="250" MinHeight="250" MinWidth="250" MaxHeight="500" MaxWidth="500" WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
|
||||
@@ -14,7 +14,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
internal class ConcreteViewModel : LibMaterialViewModel
|
||||
internal class ConcreteViewModel : LibMaterialViewModel<IConcreteMaterialEntity>
|
||||
{
|
||||
readonly IConcreteLibMaterial concreteMaterial;
|
||||
public bool TensionForULS
|
||||
@@ -43,10 +43,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
concreteMaterial.Humidity = value;
|
||||
OnPropertyChanged(nameof(Humidity));
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<ILibMaterialEntity> MaterialLibrary => LibMaterialPepository.GetConcreteRepository(ProgramSetting.CodeType);
|
||||
|
||||
}
|
||||
|
||||
public ConcreteViewModel(ILibMaterial material) : base(material)
|
||||
{
|
||||
@@ -54,7 +51,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $". Expected: {typeof(IConcreteLibMaterial)}, but was: {material.GetType()}");
|
||||
}
|
||||
this.concreteMaterial = material as IConcreteLibMaterial;
|
||||
concreteMaterial = material as IConcreteLibMaterial;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.AddMaterialWindow;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperCommon.Services.ColorServices;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
@@ -78,7 +79,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
else if (helperMaterial is IReinforcementLibMaterial)
|
||||
{
|
||||
var material = helperMaterial as IReinforcementLibMaterial;
|
||||
helperMaterialViewModel = new ReinforcementViewModel(material);
|
||||
helperMaterialViewModel = new LibMaterialViewModel<IReinforcementMaterialEntity>(material);
|
||||
}
|
||||
else if (helperMaterial is IElasticMaterial)
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
|
||||
private void AddElasticMaterial()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Elastic200, ProgramSetting.CodeType);
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Elastic200);
|
||||
material.Name = "New Elastic Material";
|
||||
HeadMaterials.Add(material);
|
||||
headMaterials.Add(material);
|
||||
@@ -163,7 +163,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
get
|
||||
{
|
||||
return LibMaterialPepository.GetConcreteRepository(ProgramSetting.CodeType);
|
||||
return LibMaterialPepository.GetConcreteRepository();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
get
|
||||
{
|
||||
return LibMaterialPepository.GetReinforcementRepository(ProgramSetting.CodeType);
|
||||
return LibMaterialPepository.GetReinforcementRepository();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
|
||||
private void AddConcreteMaterial()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, ProgramSetting.CodeType);
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
material.Name = "New Concrete";
|
||||
HeadMaterials.Add(material);
|
||||
headMaterials.Add(material);
|
||||
@@ -245,7 +245,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
|
||||
private void AddReinforcementMaterial()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforecement400, ProgramSetting.CodeType);
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforcement400);
|
||||
material.Name = "New Reinforcement";
|
||||
HeadMaterials.Add(material);
|
||||
headMaterials.Add(material);
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Windows.AddMaterialWindow;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models.Codes;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -13,11 +16,12 @@ using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
internal abstract class LibMaterialViewModel : HelperMaterialViewModel
|
||||
internal class LibMaterialViewModel<T> : HelperMaterialViewModel where T: class, ILibMaterialEntity
|
||||
{
|
||||
ILibMaterial material;
|
||||
ICommand showSafetyFactors;
|
||||
SafetyFactorsViewModel safetyFactorsViewModel;
|
||||
private ICodeEntity codeEntity;
|
||||
|
||||
public ILibMaterialEntity MaterialEntity
|
||||
{
|
||||
@@ -28,7 +32,43 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
OnPropertyChanged(nameof(MaterialEntity));
|
||||
}
|
||||
}
|
||||
public abstract IEnumerable<ILibMaterialEntity> MaterialLibrary { get; }
|
||||
public ICodeEntity CodeEntity
|
||||
{
|
||||
get
|
||||
{
|
||||
return codeEntity;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
codeEntity = value;
|
||||
OnPropertyChanged(nameof(CodeEntity));
|
||||
FillMaterialKinds();
|
||||
}
|
||||
}
|
||||
|
||||
private void FillMaterialKinds()
|
||||
{
|
||||
var materialKinds = ProgramSetting
|
||||
.MaterialRepository
|
||||
.Repository
|
||||
.Where(x => x.Code == codeEntity & x is T);
|
||||
|
||||
MaterialLibrary = new ObservableCollection<T>();
|
||||
if (materialKinds.Count() > 0)
|
||||
{
|
||||
foreach (var item in materialKinds)
|
||||
{
|
||||
MaterialLibrary.Add((T)item);
|
||||
}
|
||||
OnPropertyChanged(nameof(MaterialLibrary));
|
||||
material.MaterialEntity = MaterialLibrary.First();
|
||||
OnPropertyChanged(nameof(MaterialEntity));
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<ICodeEntity> CodeList { get; }
|
||||
public ObservableCollection<T> MaterialLibrary { get; private set; }
|
||||
public SafetyFactorsViewModel SafetyFactors => safetyFactorsViewModel;
|
||||
|
||||
public ICommand ShowSafetyFactors =>
|
||||
@@ -44,6 +84,21 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
public LibMaterialViewModel(ILibMaterial material)
|
||||
{
|
||||
this.material = material;
|
||||
var selectedMaterialKind = this.material.MaterialEntity;
|
||||
CodeList = new ObservableCollection<ICodeEntity>();
|
||||
var materialsKind = ProgramSetting.MaterialRepository.Repository
|
||||
.Where(x => x is T);
|
||||
var codes = materialsKind
|
||||
.Select(x => x.Code)
|
||||
.Distinct();
|
||||
foreach (var item in codes)
|
||||
{
|
||||
CodeList.Add(item);
|
||||
}
|
||||
CodeEntity = codes.Where(x => x == selectedMaterialKind.Code).Single();
|
||||
MaterialEntity = MaterialLibrary
|
||||
.Single(x => x.Id == selectedMaterialKind.Id);
|
||||
OnPropertyChanged(nameof(MaterialEntity));
|
||||
safetyFactorsViewModel = new SafetyFactorsViewModel(material.SafetyFactors);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,13 @@
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.MainWindow.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox;
|
||||
using System.Windows.Forms;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
@@ -76,31 +68,31 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
}
|
||||
private void AddElastic()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Elastic200, ProgramSetting.CodeType);
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Elastic200);
|
||||
material.Name = "New Elastic Material";
|
||||
NewItem = material;
|
||||
}
|
||||
private void AddCarbonFiber()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Carbon1400, ProgramSetting.CodeType);
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Carbon1400);
|
||||
material.Name = "New CFR Material";
|
||||
NewItem = material;
|
||||
}
|
||||
private void AddGlassFiber()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Glass1200, ProgramSetting.CodeType);
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Glass1200);
|
||||
material.Name = "New GFR Material";
|
||||
NewItem = material;
|
||||
}
|
||||
private void AddReinforcement()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforecement400, ProgramSetting.CodeType);
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforcement400);
|
||||
material.Name = "New Reinforcement";
|
||||
NewItem = material;
|
||||
}
|
||||
private void AddConcrete()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, ProgramSetting.CodeType);
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
material.Name = "New Concrete";
|
||||
NewItem = material;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Codes;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
@@ -11,10 +12,17 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
internal class ReinforcementViewModel : LibMaterialViewModel
|
||||
internal class ReinforcementViewModel
|
||||
{
|
||||
public override IEnumerable<ILibMaterialEntity> MaterialLibrary => LibMaterialPepository.GetReinforcementRepository(ProgramSetting.CodeType);
|
||||
public ReinforcementViewModel(ILibMaterial material) : base(material)
|
||||
public IEnumerable<ICodeEntity> CodeList => ProgramSetting
|
||||
.MaterialRepository
|
||||
.Repository
|
||||
.Select( x => x.Code)
|
||||
.Distinct();
|
||||
public IEnumerable<ILibMaterialEntity> MaterialLibrary => LibMaterialPepository.GetReinforcementRepository();
|
||||
|
||||
|
||||
public ReinforcementViewModel(ILibMaterial material)
|
||||
{
|
||||
if (material is not IReinforcementLibMaterial)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.ColorPickerWindow;
|
||||
using StructureHelper.Windows.MainWindow.Materials;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
@@ -9,21 +8,13 @@ using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.ColorServices;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Xml.Linq;
|
||||
using PointViewPrimitive = StructureHelper.Infrastructure.UI.DataContexts.PointViewPrimitive;
|
||||
using RectangleViewPrimitive = StructureHelper.Infrastructure.UI.DataContexts.RectangleViewPrimitive;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user