Save function tree done
This commit is contained in:
@@ -38,11 +38,13 @@ namespace StructureHelper.Windows.MainGraph
|
||||
{
|
||||
CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(FunctionList.ItemsSource);
|
||||
PropertyGroupDescription groupDescription = new PropertyGroupDescription(GROUP_FACTOR);
|
||||
view.GroupDescriptions.Clear();
|
||||
view.GroupDescriptions.Add(groupDescription);
|
||||
}
|
||||
public void Refresh()
|
||||
{
|
||||
FunctionList.Items.Refresh();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using StructureHelper.Windows.Graphs;
|
||||
using StructureHelper.Windows.TreeGraph;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models.Functions;
|
||||
using StructureHelperLogics.Models.Graphs;
|
||||
using System;
|
||||
@@ -82,6 +83,7 @@ namespace StructureHelper.Windows.MainGraph
|
||||
private RelayCommand copyCommand;
|
||||
private RelayCommand treeCommand;
|
||||
private RelayCommand drawGraphCommand;
|
||||
private RelayCommand _saveCommand;
|
||||
public ICommand AddTableCommand
|
||||
{
|
||||
get => addTableCommand ??= new RelayCommand(o => AddTable());
|
||||
@@ -110,7 +112,14 @@ namespace StructureHelper.Windows.MainGraph
|
||||
{
|
||||
get => drawGraphCommand ??= new RelayCommand(o => DrawGraph());
|
||||
}
|
||||
public ICommand SaveCommand
|
||||
{
|
||||
get => _saveCommand ??= new RelayCommand(o => Save());
|
||||
}
|
||||
public GraphViewModel()
|
||||
{
|
||||
Functions = null;
|
||||
if (ProgramSetting.Functions is null)
|
||||
{
|
||||
//Пример 1
|
||||
Functions = new ObservableCollection<IOneVariableFunction>();
|
||||
@@ -140,9 +149,11 @@ namespace StructureHelper.Windows.MainGraph
|
||||
Functions.Add(f1);
|
||||
Functions.Add(f2);
|
||||
}
|
||||
/*public GraphViewModel(IGraph graph)
|
||||
else
|
||||
{
|
||||
}*/
|
||||
Functions = ProgramSetting.Functions;
|
||||
}
|
||||
}
|
||||
private void AddTable()
|
||||
{
|
||||
var tableViewModel = new TableViewModel();
|
||||
@@ -153,6 +164,7 @@ namespace StructureHelper.Windows.MainGraph
|
||||
Functions.Add(tableViewModel.Function);
|
||||
SelectedFuntion = tableViewModel.Function;
|
||||
}
|
||||
Save();
|
||||
}
|
||||
private void AddFormula()
|
||||
{
|
||||
@@ -164,6 +176,7 @@ namespace StructureHelper.Windows.MainGraph
|
||||
Functions.Add(formulaViewModel.Function);
|
||||
SelectedFuntion = formulaViewModel.Function;
|
||||
}
|
||||
Save();
|
||||
}
|
||||
private void Edit(object parameter)
|
||||
{
|
||||
@@ -189,6 +202,7 @@ namespace StructureHelper.Windows.MainGraph
|
||||
}
|
||||
var graphView = parameter as GraphView;
|
||||
graphView.Refresh();
|
||||
Save();
|
||||
}
|
||||
private void Delete()
|
||||
{
|
||||
@@ -204,6 +218,7 @@ namespace StructureHelper.Windows.MainGraph
|
||||
{
|
||||
Functions.Remove(SelectedFuntion);
|
||||
}
|
||||
Save();
|
||||
}
|
||||
private void Copy()
|
||||
{
|
||||
@@ -219,6 +234,7 @@ namespace StructureHelper.Windows.MainGraph
|
||||
{
|
||||
Functions.Add(SelectedFuntion.Clone() as FormulaFunction);
|
||||
}
|
||||
Save();
|
||||
}
|
||||
private void Tree()
|
||||
{
|
||||
@@ -244,6 +260,11 @@ namespace StructureHelper.Windows.MainGraph
|
||||
GraphService.SetVisualProps(LineSeries, VisualProps);
|
||||
SeriesCollection = new SeriesCollection();
|
||||
SeriesCollection.Add(LineSeries);
|
||||
Save();
|
||||
}
|
||||
public void Save()
|
||||
{
|
||||
ProgramSetting.Functions = Functions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace StructureHelper.Windows.TreeGraph
|
||||
private RelayCommand _scaleCommand;
|
||||
private RelayCommand _limCommand;
|
||||
private RelayCommand _deleteCommand;
|
||||
private RelayCommand _saveCommand;
|
||||
private TreeGraphView _treeGraphView_win;
|
||||
private IOneVariableFunction selectedFunction;
|
||||
public IOneVariableFunction SelectedFuntion
|
||||
@@ -96,6 +97,10 @@ namespace StructureHelper.Windows.TreeGraph
|
||||
{
|
||||
get => _deleteCommand ??= new RelayCommand(o => Delete());
|
||||
}
|
||||
public ICommand SaveCommand
|
||||
{
|
||||
get => _saveCommand ??= new RelayCommand(o => Save());
|
||||
}
|
||||
public TreeGraphViewModel(IOneVariableFunction rootFunction)
|
||||
{
|
||||
_rootFunction = new TreeViewItemViewModel(rootFunction, this);
|
||||
@@ -232,5 +237,9 @@ namespace StructureHelper.Windows.TreeGraph
|
||||
SeriesCollection = new SeriesCollection();
|
||||
SeriesCollection.Add(LineSeries);
|
||||
}
|
||||
public void Save()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Codes;
|
||||
using StructureHelperCommon.Models.Codes.Factories;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperCommon.Models.Projects;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel.Design.Serialization;
|
||||
using System.Linq;
|
||||
using System.Windows.Documents;
|
||||
@@ -90,5 +92,6 @@ namespace StructureHelperCommon.Infrastructures.Settings
|
||||
SubVersionNumber = 0
|
||||
};
|
||||
}
|
||||
public static ObservableCollection<IOneVariableFunction> Functions { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperLogics.Models.Materials.Logics;
|
||||
using System;
|
||||
@@ -28,7 +29,7 @@ namespace StructureHelperLogics.Models.Materials
|
||||
}
|
||||
public FunctionMaterial() : this(Guid.NewGuid())
|
||||
{
|
||||
|
||||
Function = ProgramSetting.Functions.First();
|
||||
}
|
||||
public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user