CompressedProperty was added
This commit is contained in:
@@ -15,7 +15,7 @@ using System.Windows.Forms;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
{
|
||||
public class AnalysisVewModel : CRUDViewModelBase<INdmCalculator>
|
||||
public class AnalysisVewModelLogic : CRUDViewModelBase<INdmCalculator>
|
||||
{
|
||||
private ICrossSectionRepository repository;
|
||||
private RelayCommand runCommand;
|
||||
@@ -69,7 +69,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
public AnalysisVewModel(ICrossSectionRepository sectionRepository) : base(sectionRepository.CalculatorsList)
|
||||
public AnalysisVewModelLogic(ICrossSectionRepository sectionRepository) : base(sectionRepository.CalculatorsList)
|
||||
{
|
||||
repository = sectionRepository;
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
||||
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
{
|
||||
public class CalculatorsViewModelLogic : ViewModelBase, ICalculatorsViewModelLogic
|
||||
{
|
||||
private readonly ICrossSectionRepository repository;
|
||||
|
||||
public INdmCalculator SelectedItem { get; set; }
|
||||
public ObservableCollection<INdmCalculator> Items { get; private set; }
|
||||
|
||||
private RelayCommand addCommand;
|
||||
public RelayCommand Add
|
||||
{
|
||||
get
|
||||
{
|
||||
return addCommand ??
|
||||
(
|
||||
addCommand = new RelayCommand(o =>
|
||||
{
|
||||
AddCalculator();
|
||||
OnPropertyChanged(nameof(Items));
|
||||
}));
|
||||
}
|
||||
}
|
||||
private void AddCalculator()
|
||||
{
|
||||
var item = new ForceCalculator() { Name = "New force calculator" };
|
||||
Items.Add(item);
|
||||
repository.CalculatorsList.Add(item);
|
||||
}
|
||||
private RelayCommand editCommand;
|
||||
public RelayCommand Edit
|
||||
{
|
||||
get
|
||||
{
|
||||
return editCommand ??
|
||||
(
|
||||
editCommand = new RelayCommand(o =>
|
||||
{
|
||||
var tmpSelected = SelectedItem;
|
||||
EditCalculator();
|
||||
Items.Clear();
|
||||
AddItems(repository.CalculatorsList);
|
||||
OnPropertyChanged(nameof(Items));
|
||||
SelectedItem = tmpSelected;
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
private void EditCalculator()
|
||||
{
|
||||
if (SelectedItem is ForceCalculator)
|
||||
{
|
||||
var calculator = SelectedItem as ForceCalculator;
|
||||
var vm = new ForceCalculatorViewModel(repository.Primitives, repository.ForceCombinationLists, calculator);
|
||||
|
||||
var wnd = new ForceCalculatorView(vm);
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
}
|
||||
private RelayCommand deleteCommand;
|
||||
private RelayCommand runCommand;
|
||||
private RelayCommand copyCommand;
|
||||
|
||||
public RelayCommand Delete
|
||||
{
|
||||
get
|
||||
{
|
||||
return deleteCommand ??
|
||||
(
|
||||
deleteCommand = new RelayCommand(o =>
|
||||
{
|
||||
DeleteCalculator();
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
public RelayCommand Run
|
||||
{
|
||||
get
|
||||
{
|
||||
return runCommand ??
|
||||
(
|
||||
runCommand = new RelayCommand(o =>
|
||||
{
|
||||
SelectedItem.Run();
|
||||
var result = SelectedItem.Result;
|
||||
if (result.IsValid == false)
|
||||
{
|
||||
MessageBox.Show(result.Desctription, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
var calculator = SelectedItem as IForceCalculator;
|
||||
var vm = new ForcesResultsViewModel(calculator);
|
||||
var wnd = new ForceResultsView(vm);
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
public RelayCommand Copy
|
||||
{
|
||||
get
|
||||
{
|
||||
return copyCommand ??
|
||||
(
|
||||
copyCommand = new RelayCommand(o =>
|
||||
{
|
||||
var item = SelectedItem.Clone() as INdmCalculator;
|
||||
repository.CalculatorsList.Add(item);
|
||||
Items.Add(item);
|
||||
OnPropertyChanged(nameof(Items));
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
private void DeleteCalculator()
|
||||
{
|
||||
var dialogResult = MessageBox.Show("Delete calculator?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
repository.CalculatorsList.Remove(SelectedItem as INdmCalculator);
|
||||
OnPropertyChanged(nameof(Items));
|
||||
}
|
||||
}
|
||||
|
||||
public void AddItems(IEnumerable<INdmCalculator> items)
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
Items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public CalculatorsViewModelLogic(ICrossSectionRepository repository)
|
||||
{
|
||||
this.repository = repository;
|
||||
Items = new ObservableCollection<INdmCalculator>();
|
||||
AddItems(this.repository.CalculatorsList);
|
||||
}
|
||||
}
|
||||
}
|
||||
60
Windows/ViewModels/NdmCrossSections/SecondOrderViewModel.cs
Normal file
60
Windows/ViewModels/NdmCrossSections/SecondOrderViewModel.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using FieldVisualizer.ViewModels;
|
||||
using StructureHelperCommon.Models.Sections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
{
|
||||
public class SecondOrderViewModel : ViewModelBase
|
||||
{
|
||||
ICompressedMember member;
|
||||
|
||||
public bool Buckling
|
||||
{
|
||||
get => member.Buckling;
|
||||
set
|
||||
{
|
||||
member.Buckling = value;
|
||||
OnPropertyChanged(nameof(Buckling));
|
||||
}
|
||||
}
|
||||
|
||||
public double GeometryLength
|
||||
{
|
||||
get => member.GeometryLength;
|
||||
set
|
||||
{
|
||||
member.GeometryLength = value;
|
||||
OnPropertyChanged(nameof(GeometryLength));
|
||||
}
|
||||
}
|
||||
|
||||
public double LengthFactorX
|
||||
{
|
||||
get => member.LengthFactorX;
|
||||
set
|
||||
{
|
||||
member.GeometryLength = value;
|
||||
OnPropertyChanged(nameof(LengthFactorX));
|
||||
}
|
||||
}
|
||||
|
||||
public double LengthFactorY
|
||||
{
|
||||
get => member.LengthFactorY;
|
||||
set
|
||||
{
|
||||
member.GeometryLength = value;
|
||||
OnPropertyChanged(nameof(LengthFactorY));
|
||||
}
|
||||
}
|
||||
|
||||
public SecondOrderViewModel(ICompressedMember compressedMember)
|
||||
{
|
||||
member = compressedMember;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user