Head material was added

This commit is contained in:
Evgeny Redikultsev
2022-10-30 22:20:58 +05:00
parent e1af4d5e07
commit 1cf54603bc
18 changed files with 363 additions and 31 deletions

View File

@@ -0,0 +1,36 @@
using StructureHelper.Infrastructure;
using StructureHelper.Models.Materials;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace StructureHelper.Windows.ViewModels.Materials
{
public class HeadMaterialsViewModel : ViewModelBase
{
IEnumerable<IHeadMaterial> headMaterials;
public ICommand AddHeadMaterial;
public ICommand CopyHeadMaterial;
public ICommand DeleteHeadMaterial;
public ICommand EditHeadMaterial;
public ObservableCollection<IHeadMaterial> HeadMaterials { get; private set; }
public IHeadMaterial SelectedMaterial { get; set; }
public HeadMaterialsViewModel(IEnumerable<IHeadMaterial> materials)
{
headMaterials = materials;
HeadMaterials = new ObservableCollection<IHeadMaterial>();
foreach (var material in headMaterials)
{
HeadMaterials.Add(material);
}
}
}
}

View File

@@ -1,5 +1,6 @@
using StructureHelper.Infrastructure;
using StructureHelper.Infrastructure.UI.DataContexts;
using StructureHelper.Windows.ColorPickerWindow;
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
@@ -7,6 +8,8 @@ using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using System.Windows.Media;
using System.Xml.Linq;
using Point = StructureHelper.Infrastructure.UI.DataContexts.Point;
using Rectangle = StructureHelper.Infrastructure.UI.DataContexts.Rectangle;
@@ -17,6 +20,8 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
{
private PrimitiveBase primitive;
public ICommand EditColorCommand;
public string Name
{
get => primitive.Name;
@@ -48,7 +53,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
}
}
public double CenterY
{
get => primitive.CenterY;
@@ -61,11 +65,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
}
}
public double Prestrain_Kx
{
get => primitive.Pre
}
public int MinElementDivision
{
get => primitive.MinElementDivision;
@@ -145,6 +144,26 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
}
}
public Color Color
{
get => primitive.Color;
set
{
primitive.Color = value;
OnPropertyChanged(nameof(Color));
}
}
public bool SetMaterialColor
{
get => primitive.SetMaterialColor;
set
{
primitive.SetMaterialColor = value;
OnPropertyChanged(nameof(SetMaterialColor));
}
}
public string this[string columnName]
{
get
@@ -169,6 +188,14 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
public PrimitivePropertiesViewModel(PrimitiveBase primitive)
{
this.primitive = primitive;
EditColorCommand = new RelayCommand(o => EditColor(), o => !SetMaterialColor);
}
public void EditColor()
{
var wnd = new ColorPickerView(primitive);
wnd.ShowDialog();
OnPropertyChanged(nameof(Color));
}
}
}