AnalysisViewModal and StrainTuple was added
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
using FieldVisualizer.Infrastructure.Commands;
|
||||
using FieldVisualizer.ViewModels;
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Services.Reports;
|
||||
using StructureHelper.Services.Reports.CalculationReports;
|
||||
using StructureHelper.Services.ResultViewers;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
||||
using StructureHelper.Windows.Forces;
|
||||
using StructureHelper.Windows.PrimitivePropertiesWindow;
|
||||
@@ -14,6 +14,7 @@ using StructureHelper.Windows.ViewModels.PrimitiveProperties;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
@@ -21,6 +22,7 @@ using StructureHelperLogics.Services.NdmCalculations;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -43,6 +45,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
private RelayCommand showIsoFieldCommand;
|
||||
private RelayCommand exportToCSVCommand;
|
||||
private RelayCommand interpolateCommand;
|
||||
private RelayCommand setPrestrainCommand;
|
||||
|
||||
public IForcesResults ForcesResults
|
||||
{
|
||||
@@ -81,7 +84,6 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
private void ExportToCSV()
|
||||
{
|
||||
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
@@ -109,6 +111,13 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
{
|
||||
var logic = new ExportToCSVLogic(saveFileDialog.FileName);
|
||||
logic.Export(forcesResults);
|
||||
try
|
||||
{
|
||||
Process filopener = new Process();
|
||||
filopener.StartInfo.FileName = saveFileDialog.FileName;
|
||||
filopener.Start();
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -129,7 +138,6 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
}, o => SelectedResult != null));
|
||||
}
|
||||
}
|
||||
|
||||
private void Interpolate()
|
||||
{
|
||||
IDesignForceTuple startDesignTuple, finishDesignTuple;
|
||||
@@ -156,6 +164,34 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
}
|
||||
}
|
||||
|
||||
public RelayCommand SetPrestrainCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return setPrestrainCommand ??
|
||||
(setPrestrainCommand = new RelayCommand(o=>
|
||||
{
|
||||
SetPrestrain();
|
||||
}, o => SelectedResult != null
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
private void SetPrestrain()
|
||||
{
|
||||
var source = StrainTupleService.ConvertToStrainTuple(SelectedResult.LoaderResults.StrainMatrix);
|
||||
var vm = new SetPrestrainViewModel(source);
|
||||
var wnd = new SetPrestrainView(vm);
|
||||
wnd.ShowDialog();
|
||||
if (wnd.DialogResult == true)
|
||||
{
|
||||
foreach (var item in ndmPrimitives)
|
||||
{
|
||||
StrainTupleService.CopyProperties(wnd.StrainTuple, item.AutoPrestrain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ForcesResultsViewModel(IForceCalculator forceCalculator)
|
||||
{
|
||||
this.forceCalculator = forceCalculator;
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using FieldVisualizer.ViewModels;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
{
|
||||
public class SetPrestrainViewModel : ViewModelBase
|
||||
{
|
||||
IStrainTuple SourceTuple;
|
||||
private double coeffcient;
|
||||
|
||||
public double Coefficient
|
||||
{
|
||||
get
|
||||
{
|
||||
return coeffcient;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref coeffcient, value);
|
||||
}
|
||||
}
|
||||
|
||||
public SetPrestrainViewModel(IStrainTuple sourceTuple)
|
||||
{
|
||||
SourceTuple = sourceTuple;
|
||||
coeffcient = 1d;
|
||||
}
|
||||
|
||||
public IStrainTuple GetStrainTuple()
|
||||
{
|
||||
var result = new StrainTuple();
|
||||
StrainTupleService.CopyProperties(SourceTuple, result, coeffcient);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
77
Windows/ViewModels/NdmCrossSections/AnalysisVewModel.cs
Normal file
77
Windows/ViewModels/NdmCrossSections/AnalysisVewModel.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
||||
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
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.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
{
|
||||
public class AnalysisVewModel : CRUDViewModelBase<INdmCalculator>
|
||||
{
|
||||
private ICrossSectionRepository repository;
|
||||
private RelayCommand runCommand;
|
||||
|
||||
public override void AddMethod(object parameter)
|
||||
{
|
||||
NewItem = new ForceCalculator() { Name = "New force calculator" };
|
||||
base.AddMethod(parameter);
|
||||
}
|
||||
public override void EditMethod(object parameter)
|
||||
{
|
||||
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();
|
||||
}
|
||||
base.EditMethod(parameter);
|
||||
}
|
||||
public override void DeleteMethod()
|
||||
{
|
||||
var dialogResult = MessageBox.Show("Delete calculator?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
base.DeleteMethod();
|
||||
}
|
||||
}
|
||||
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 AnalysisVewModel(ICrossSectionRepository sectionRepository) : base(sectionRepository.CalculatorsList)
|
||||
{
|
||||
repository = sectionRepository;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,6 +90,10 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
||||
set => primitive.PrestrainEpsZ = value;
|
||||
}
|
||||
|
||||
public double AutoPrestrainKx => primitive.AutoPrestrainKx;
|
||||
public double AutoPrestrainKy => primitive.AutoPrestrainKy;
|
||||
public double AutoPrestrainEpsZ => primitive.AutoPrestrainEpsZ;
|
||||
|
||||
public int MinElementDivision
|
||||
{
|
||||
get => (primitive as IHasDivision).NdmMinDivision;
|
||||
|
||||
Reference in New Issue
Block a user