Add rename and tree modifiers, binding function purpose enum
This commit is contained in:
@@ -93,6 +93,9 @@
|
|||||||
<Compile Update="Windows\TreeGraph\LimView.xaml.cs">
|
<Compile Update="Windows\TreeGraph\LimView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="Windows\TreeGraph\RenameView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Windows\TreeGraph\ScaleView.xaml.cs">
|
<Compile Update="Windows\TreeGraph\ScaleView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -209,6 +212,9 @@
|
|||||||
<Page Update="Windows\TreeGraph\LimView.xaml">
|
<Page Update="Windows\TreeGraph\LimView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Update="Windows\TreeGraph\RenameView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="Windows\TreeGraph\ScaleView.xaml">
|
<Page Update="Windows\TreeGraph\ScaleView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
@@ -1,13 +1,23 @@
|
|||||||
<Window x:Class="StructureHelper.Windows.MainGraph.FormulaView"
|
<Window x:Class="StructureHelper.Windows.MainGraph.FormulaView"
|
||||||
x:Name="FormulaFunction_win"
|
x:Name="FormulaFunction_win"
|
||||||
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:StructureHelper.Windows.MainGraph"
|
xmlns:local="clr-namespace:StructureHelper.Windows.MainGraph"
|
||||||
|
xmlns:ens="clr-namespace:StructureHelperCommon.Infrastructures.Enums;assembly=StructureHelperCommon"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DataContext="{d:DesignInstance local:FormulaViewModel}"
|
d:DataContext="{d:DesignInstance local:FormulaViewModel}"
|
||||||
Title="FormulaFunction" Height="580" Width="400">
|
Title="FormulaFunction" Height="640" Width="400">
|
||||||
|
<Window.Resources>
|
||||||
|
<ObjectDataProvider x:Key="PurposeEnum" MethodName="GetValues"
|
||||||
|
ObjectType="{x:Type sys:Enum}">
|
||||||
|
<ObjectDataProvider.MethodParameters>
|
||||||
|
<x:Type TypeName="ens:FunctionPurpose"/>
|
||||||
|
</ObjectDataProvider.MethodParameters>
|
||||||
|
</ObjectDataProvider>
|
||||||
|
</Window.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="60"/>
|
<RowDefinition Height="60"/>
|
||||||
@@ -17,6 +27,7 @@
|
|||||||
<RowDefinition Height="60"/>
|
<RowDefinition Height="60"/>
|
||||||
<RowDefinition Height="60"/>
|
<RowDefinition Height="60"/>
|
||||||
<RowDefinition Height="60"/>
|
<RowDefinition Height="60"/>
|
||||||
|
<RowDefinition Height="60"/>
|
||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="50"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid Grid.Row="0">
|
<Grid Grid.Row="0">
|
||||||
@@ -134,6 +145,20 @@
|
|||||||
<TextBox Grid.Row="1" Text="{Binding Name}" Margin="5"/>
|
<TextBox Grid.Row="1" Text="{Binding Name}" Margin="5"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid Grid.Row="5">
|
<Grid Grid.Row="5">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="30"/>
|
||||||
|
<RowDefinition Height="30"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Row="0"
|
||||||
|
Margin="5"
|
||||||
|
Text="Purpose:"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<ComboBox Grid.Row="1"
|
||||||
|
Margin="5"
|
||||||
|
ItemsSource="{Binding Source={StaticResource PurposeEnum}}"
|
||||||
|
SelectedItem="{Binding FunctionPurpose}"/>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="6">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="30"/>
|
<RowDefinition Height="30"/>
|
||||||
<RowDefinition Height="30"/>
|
<RowDefinition Height="30"/>
|
||||||
@@ -144,7 +169,7 @@
|
|||||||
VerticalAlignment="Center"/>
|
VerticalAlignment="Center"/>
|
||||||
<TextBox Grid.Row="1" Text="{Binding Description}" Margin="5"/>
|
<TextBox Grid.Row="1" Text="{Binding Description}" Margin="5"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid Grid.Row="6">
|
<Grid Grid.Row="7">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="30"/>
|
<RowDefinition Height="30"/>
|
||||||
<RowDefinition Height="30"/>
|
<RowDefinition Height="30"/>
|
||||||
@@ -173,7 +198,7 @@
|
|||||||
</Rectangle.Fill>
|
</Rectangle.Fill>
|
||||||
</Rectangle>
|
</Rectangle>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Button Grid.Row="7" Margin="5" Content="Save"
|
<Button Grid.Row="8" Margin="5" Content="Save"
|
||||||
Command="{Binding SaveCommand}"
|
Command="{Binding SaveCommand}"
|
||||||
CommandParameter="{Binding ElementName=FormulaFunction_win}">
|
CommandParameter="{Binding ElementName=FormulaFunction_win}">
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
using StructureHelper.Infrastructure;
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models.Functions;
|
using StructureHelperCommon.Models.Functions;
|
||||||
using StructureHelperCommon.Services.ColorServices;
|
using StructureHelperCommon.Services.ColorServices;
|
||||||
@@ -103,6 +104,15 @@ namespace StructureHelper.Windows.MainGraph
|
|||||||
name = value;
|
name = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private FunctionPurpose functionPurpose;
|
||||||
|
public FunctionPurpose FunctionPurpose
|
||||||
|
{
|
||||||
|
get => functionPurpose;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
functionPurpose = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
private string description;
|
private string description;
|
||||||
public string Description
|
public string Description
|
||||||
{
|
{
|
||||||
@@ -148,6 +158,7 @@ namespace StructureHelper.Windows.MainGraph
|
|||||||
Formula = formulaFunction.Formula;
|
Formula = formulaFunction.Formula;
|
||||||
Step = formulaFunction.Step;
|
Step = formulaFunction.Step;
|
||||||
Name = Function.Name;
|
Name = Function.Name;
|
||||||
|
FunctionPurpose = Function.FunctionPurpose;
|
||||||
Description = Function.Description;
|
Description = Function.Description;
|
||||||
LeftBound = Function.MinArg;
|
LeftBound = Function.MinArg;
|
||||||
RightBound = Function.MaxArg;
|
RightBound = Function.MaxArg;
|
||||||
@@ -173,6 +184,7 @@ namespace StructureHelper.Windows.MainGraph
|
|||||||
Function.Color = Color;
|
Function.Color = Color;
|
||||||
Function.MinArg = LeftBound;
|
Function.MinArg = LeftBound;
|
||||||
Function.MaxArg = RightBound;
|
Function.MaxArg = RightBound;
|
||||||
|
Function.FunctionPurpose = FunctionPurpose;
|
||||||
var window = parameter as Window;
|
var window = parameter as Window;
|
||||||
if (LeftBound > RightBound)
|
if (LeftBound > RightBound)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,16 +1,26 @@
|
|||||||
<Window x:Class="StructureHelper.Windows.MainGraph.TableView"
|
<Window x:Class="StructureHelper.Windows.MainGraph.TableView"
|
||||||
x:Name="TableFunction_win"
|
x:Name="TableFunction_win"
|
||||||
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:StructureHelper.Windows.MainGraph"
|
xmlns:local="clr-namespace:StructureHelper.Windows.MainGraph"
|
||||||
|
xmlns:ens="clr-namespace:StructureHelperCommon.Infrastructures.Enums;assembly=StructureHelperCommon"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
ResizeMode="CanResize"
|
ResizeMode="CanResize"
|
||||||
d:DataContext="{d:DesignInstance local:TableViewModel}"
|
d:DataContext="{d:DesignInstance local:TableViewModel}"
|
||||||
Title="TableFunction" Height="560" Width="400"
|
Title="TableFunction" Height="620" Width="400"
|
||||||
MaxWidth="400"
|
MaxWidth="400"
|
||||||
MinWidth="400">
|
MinWidth="400">
|
||||||
|
<Window.Resources>
|
||||||
|
<ObjectDataProvider x:Key="PurposeEnum" MethodName="GetValues"
|
||||||
|
ObjectType="{x:Type sys:Enum}">
|
||||||
|
<ObjectDataProvider.MethodParameters>
|
||||||
|
<x:Type TypeName="ens:FunctionPurpose"/>
|
||||||
|
</ObjectDataProvider.MethodParameters>
|
||||||
|
</ObjectDataProvider>
|
||||||
|
</Window.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="30"/>
|
<RowDefinition Height="30"/>
|
||||||
@@ -19,6 +29,7 @@
|
|||||||
<RowDefinition Height="60"/>
|
<RowDefinition Height="60"/>
|
||||||
<RowDefinition Height="60"/>
|
<RowDefinition Height="60"/>
|
||||||
<RowDefinition Height="60"/>
|
<RowDefinition Height="60"/>
|
||||||
|
<RowDefinition Height="60"/>
|
||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="50"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid Grid.Column="0" Margin="5">
|
<Grid Grid.Column="0" Margin="5">
|
||||||
@@ -96,6 +107,20 @@
|
|||||||
<TextBox Grid.Row="1" Text="{Binding Name}" Margin="5"/>
|
<TextBox Grid.Row="1" Text="{Binding Name}" Margin="5"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid Grid.Row="4">
|
<Grid Grid.Row="4">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="30"/>
|
||||||
|
<RowDefinition Height="30"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Row="0"
|
||||||
|
Margin="5"
|
||||||
|
Text="Purpose:"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<ComboBox Grid.Row="1"
|
||||||
|
Margin="5"
|
||||||
|
ItemsSource="{Binding Source={StaticResource PurposeEnum}}"
|
||||||
|
SelectedItem="{Binding FunctionPurpose}"/>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="5">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="30"/>
|
<RowDefinition Height="30"/>
|
||||||
<RowDefinition Height="30"/>
|
<RowDefinition Height="30"/>
|
||||||
@@ -106,7 +131,7 @@
|
|||||||
VerticalAlignment="Center"/>
|
VerticalAlignment="Center"/>
|
||||||
<TextBox Grid.Row="1" Text="{Binding Description}" Margin="5"/>
|
<TextBox Grid.Row="1" Text="{Binding Description}" Margin="5"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid Grid.Row="5">
|
<Grid Grid.Row="6">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="30"/>
|
<RowDefinition Height="30"/>
|
||||||
<RowDefinition Height="30"/>
|
<RowDefinition Height="30"/>
|
||||||
@@ -135,7 +160,7 @@
|
|||||||
</Rectangle.Fill>
|
</Rectangle.Fill>
|
||||||
</Rectangle>
|
</Rectangle>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Button Grid.Row="6" Margin="5" Content="Save"
|
<Button Grid.Row="7" Margin="5" Content="Save"
|
||||||
Command="{Binding SaveCommand}"
|
Command="{Binding SaveCommand}"
|
||||||
CommandParameter="{Binding ElementName=TableFunction_win}">
|
CommandParameter="{Binding ElementName=TableFunction_win}">
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelper.Infrastructure;
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models.Functions;
|
using StructureHelperCommon.Models.Functions;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
@@ -79,6 +80,15 @@ namespace StructureHelper.Windows.MainGraph
|
|||||||
name = value;
|
name = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private FunctionPurpose functionPurpose;
|
||||||
|
public FunctionPurpose FunctionPurpose
|
||||||
|
{
|
||||||
|
get => functionPurpose;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
functionPurpose = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
private string description;
|
private string description;
|
||||||
public string Description
|
public string Description
|
||||||
{
|
{
|
||||||
@@ -114,6 +124,7 @@ namespace StructureHelper.Windows.MainGraph
|
|||||||
Function = tableFunction;
|
Function = tableFunction;
|
||||||
Table = new ObservableCollection<GraphPoint>((Function as TableFunction).Table);
|
Table = new ObservableCollection<GraphPoint>((Function as TableFunction).Table);
|
||||||
Name = Function.Name;
|
Name = Function.Name;
|
||||||
|
FunctionPurpose = Function.FunctionPurpose;
|
||||||
Description = Function.Description;
|
Description = Function.Description;
|
||||||
Color = Function.Color;
|
Color = Function.Color;
|
||||||
}
|
}
|
||||||
@@ -134,6 +145,7 @@ namespace StructureHelper.Windows.MainGraph
|
|||||||
Function.IsUser = true;
|
Function.IsUser = true;
|
||||||
(Function as TableFunction).Table = Table.OrderBy(x => x.X).ToList();
|
(Function as TableFunction).Table = Table.OrderBy(x => x.X).ToList();
|
||||||
Function.Color = Color;
|
Function.Color = Color;
|
||||||
|
Function.FunctionPurpose = FunctionPurpose;
|
||||||
var window = parameter as Window;
|
var window = parameter as Window;
|
||||||
window.DialogResult = true;
|
window.DialogResult = true;
|
||||||
window.Close();
|
window.Close();
|
||||||
|
|||||||
51
StructureHelper/Windows/TreeGraph/RenameView.xaml
Normal file
51
StructureHelper/Windows/TreeGraph/RenameView.xaml
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<Window x:Class="StructureHelper.Windows.TreeGraph.RenameView"
|
||||||
|
x:Name="RenameView_win"
|
||||||
|
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.Windows.TreeGraph"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DataContext="{d:DesignInstance local:RenameViewModel}"
|
||||||
|
Title="Scale" Height="200" Width="250"
|
||||||
|
MinWidth="250">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="60"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid Grid.Row="0">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="30"/>
|
||||||
|
<RowDefinition Height="30"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Row="0"
|
||||||
|
Margin="5"
|
||||||
|
Text="Enter new function name:"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<Grid Grid.Row="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBox Grid.Column="1" Text="{Binding FunctionName,
|
||||||
|
UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Margin="5"/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
<TextBlock Grid.Row="1"
|
||||||
|
Margin="5"
|
||||||
|
Background="LightYellow"
|
||||||
|
Text="{Binding FunctionName,
|
||||||
|
UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
TextAlignment="Center"
|
||||||
|
FontSize="20"
|
||||||
|
TextWrapping="Wrap">
|
||||||
|
</TextBlock>
|
||||||
|
<Button Grid.Row="4" Margin="5" Content="Save"
|
||||||
|
Command="{Binding SaveCommand}"
|
||||||
|
CommandParameter="{Binding ElementName=RenameView_win}">
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
|
|
||||||
27
StructureHelper/Windows/TreeGraph/RenameView.xaml.cs
Normal file
27
StructureHelper/Windows/TreeGraph/RenameView.xaml.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.TreeGraph
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for RenameView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class RenameView : Window
|
||||||
|
{
|
||||||
|
public RenameView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
42
StructureHelper/Windows/TreeGraph/RenameViewModel.cs
Normal file
42
StructureHelper/Windows/TreeGraph/RenameViewModel.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.TreeGraph
|
||||||
|
{
|
||||||
|
public class RenameViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private RelayCommand saveCommand;
|
||||||
|
public ICommand SaveCommand
|
||||||
|
{
|
||||||
|
get => saveCommand ??= new RelayCommand(o => Save(o));
|
||||||
|
}
|
||||||
|
private string functionName;
|
||||||
|
public string FunctionName
|
||||||
|
{
|
||||||
|
get => functionName;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
functionName = value;
|
||||||
|
OnPropertyChanged(nameof(FunctionName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public RenameViewModel(TreeViewItemViewModel item)
|
||||||
|
{
|
||||||
|
FunctionName = item.Name;
|
||||||
|
}
|
||||||
|
private void Save(object parameter)
|
||||||
|
{
|
||||||
|
var window = parameter as Window;
|
||||||
|
window.DialogResult = true;
|
||||||
|
window.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
xmlns:local="clr-namespace:StructureHelper.Windows.TreeGraph"
|
xmlns:local="clr-namespace:StructureHelper.Windows.TreeGraph"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DataContext="{d:DesignInstance local:TreeGraphViewModel}"
|
d:DataContext="{d:DesignInstance local:TreeGraphViewModel}"
|
||||||
Title="StructureHelper" Height="700"
|
Title="StructureHelper" Height="750"
|
||||||
Width="1000" MinHeight="400" MinWidth="600">
|
Width="1000" MinHeight="400" MinWidth="600">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
<RowDefinition Height="170"/>
|
<RowDefinition Height="170"/>
|
||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="50"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TreeView Name="FunctionTreeView"
|
<TreeView Name="FunctionTreeView"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
@@ -124,6 +125,23 @@
|
|||||||
Background="LightPink"
|
Background="LightPink"
|
||||||
Command="{Binding DeleteCommand}"/>
|
Command="{Binding DeleteCommand}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
<Grid Grid.Row="3" Grid.Column="0">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="50"/>
|
||||||
|
<ColumnDefinition Width="50"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Button Grid.Column="0" Margin="5" Content="Tree"
|
||||||
|
Background="AntiqueWhite"
|
||||||
|
Command="{Binding TreeCommand}"/>
|
||||||
|
<Button Grid.Column="1" Margin="5" Content="Rename"
|
||||||
|
FontSize="10"
|
||||||
|
Background="HotPink"
|
||||||
|
Command="{Binding RenameCommand}"
|
||||||
|
CommandParameter="{Binding ElementName=FunctionTreeView}"/>
|
||||||
|
</Grid>
|
||||||
<lvc:CartesianChart Grid.Row="0" Grid.Column="1" Grid.RowSpan="2"
|
<lvc:CartesianChart Grid.Row="0" Grid.Column="1" Grid.RowSpan="2"
|
||||||
Series="{Binding SeriesCollection}" Margin="5"
|
Series="{Binding SeriesCollection}" Margin="5"
|
||||||
Zoom="Xy">
|
Zoom="Xy">
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ using System.Windows.Input;
|
|||||||
using StructureHelperCommon.Models.Functions.Decorator;
|
using StructureHelperCommon.Models.Functions.Decorator;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using StructureHelper.Windows.Graphs;
|
using StructureHelper.Windows.Graphs;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
|
||||||
namespace StructureHelper.Windows.TreeGraph
|
namespace StructureHelper.Windows.TreeGraph
|
||||||
{
|
{
|
||||||
@@ -23,15 +25,18 @@ namespace StructureHelper.Windows.TreeGraph
|
|||||||
private SeriesCollection seriesCollection;
|
private SeriesCollection seriesCollection;
|
||||||
private List<string> labels;
|
private List<string> labels;
|
||||||
readonly ObservableCollection<TreeViewItemViewModel> _tree;
|
readonly ObservableCollection<TreeViewItemViewModel> _tree;
|
||||||
readonly TreeViewItemViewModel _rootFunction;
|
readonly TreeViewItemViewModel _root;
|
||||||
readonly ICommand _searchCommand;
|
readonly ICommand _searchCommand;
|
||||||
private RelayCommand _getYCommand;
|
private RelayCommand _getYCommand;
|
||||||
private RelayCommand _scaleCommand;
|
private RelayCommand _scaleCommand;
|
||||||
private RelayCommand _limCommand;
|
private RelayCommand _limCommand;
|
||||||
private RelayCommand _deleteCommand;
|
private RelayCommand _deleteCommand;
|
||||||
|
private RelayCommand _treeCommand;
|
||||||
|
private RelayCommand _renameCommand;
|
||||||
private RelayCommand _saveCommand;
|
private RelayCommand _saveCommand;
|
||||||
private TreeGraphView _treeGraphView_win;
|
private TreeGraphView _treeGraphView_win;
|
||||||
private IOneVariableFunction selectedFunction;
|
private IOneVariableFunction selectedFunction;
|
||||||
|
private IOneVariableFunction rootFunction;
|
||||||
public IOneVariableFunction SelectedFuntion
|
public IOneVariableFunction SelectedFuntion
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -44,6 +49,18 @@ namespace StructureHelper.Windows.TreeGraph
|
|||||||
OnPropertyChanged(nameof(SelectedFuntion));
|
OnPropertyChanged(nameof(SelectedFuntion));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public IOneVariableFunction RootFunction
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return rootFunction;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
rootFunction = value;
|
||||||
|
OnPropertyChanged(nameof(RootFunction));
|
||||||
|
}
|
||||||
|
}
|
||||||
public SeriesCollection SeriesCollection
|
public SeriesCollection SeriesCollection
|
||||||
{
|
{
|
||||||
get => seriesCollection;
|
get => seriesCollection;
|
||||||
@@ -97,19 +114,27 @@ namespace StructureHelper.Windows.TreeGraph
|
|||||||
{
|
{
|
||||||
get => _deleteCommand ??= new RelayCommand(o => Delete());
|
get => _deleteCommand ??= new RelayCommand(o => Delete());
|
||||||
}
|
}
|
||||||
|
public ICommand TreeCommand
|
||||||
|
{
|
||||||
|
get => _treeCommand ??= new RelayCommand(o => NewTree());
|
||||||
|
}
|
||||||
|
public ICommand RenameCommand
|
||||||
|
{
|
||||||
|
get => _renameCommand ??= new RelayCommand(o => Rename(o));
|
||||||
|
}
|
||||||
public ICommand SaveCommand
|
public ICommand SaveCommand
|
||||||
{
|
{
|
||||||
get => _saveCommand ??= new RelayCommand(o => Save());
|
get => _saveCommand ??= new RelayCommand(o => Save());
|
||||||
}
|
}
|
||||||
public TreeGraphViewModel(IOneVariableFunction rootFunction)
|
public TreeGraphViewModel(IOneVariableFunction rootFunction)
|
||||||
{
|
{
|
||||||
_rootFunction = new TreeViewItemViewModel(rootFunction, this);
|
RootFunction = rootFunction;
|
||||||
|
_root = new TreeViewItemViewModel(rootFunction, this);
|
||||||
_tree = new ObservableCollection<TreeViewItemViewModel>
|
_tree = new ObservableCollection<TreeViewItemViewModel>
|
||||||
(
|
(
|
||||||
new ObservableCollection<TreeViewItemViewModel>()
|
new ObservableCollection<TreeViewItemViewModel>()
|
||||||
{
|
{
|
||||||
_rootFunction,
|
_root,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -218,6 +243,39 @@ namespace StructureHelper.Windows.TreeGraph
|
|||||||
}
|
}
|
||||||
selectedTreeViewItemParent.Children.Remove(selectedTreeViewItem);
|
selectedTreeViewItemParent.Children.Remove(selectedTreeViewItem);
|
||||||
}
|
}
|
||||||
|
private void Rename(object parameter)
|
||||||
|
{
|
||||||
|
var selectedTreeViewItem = TreeGraphView_win.FunctionTreeView.SelectedItem as TreeViewItemViewModel;
|
||||||
|
if (selectedTreeViewItem is null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var selectedTreeViewItemParent = selectedTreeViewItem.Parent;
|
||||||
|
if (selectedTreeViewItemParent is null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var renameViewModel = new RenameViewModel(selectedTreeViewItem);
|
||||||
|
var renameView = new RenameView();
|
||||||
|
renameView.DataContext = renameViewModel;
|
||||||
|
if (renameView.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
selectedTreeViewItem.Name = renameViewModel.FunctionName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void NewTree()
|
||||||
|
{
|
||||||
|
if (SelectedFuntion is null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var treeGraphVM = new TreeGraphViewModel(SelectedFuntion);
|
||||||
|
var treeGraph = new TreeGraphView();
|
||||||
|
treeGraph.DataContext = treeGraphVM;
|
||||||
|
treeGraphVM.TreeGraphView_win = treeGraph;
|
||||||
|
treeGraph.ShowDialog();
|
||||||
|
//Сохранить поддерево
|
||||||
|
}
|
||||||
public void DrawGraph()
|
public void DrawGraph()
|
||||||
{
|
{
|
||||||
var labels = new List<string>();
|
var labels = new List<string>();
|
||||||
@@ -240,6 +298,12 @@ namespace StructureHelper.Windows.TreeGraph
|
|||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
private List<IOneVariableFunction> GetFunctionChildern(TreeViewItemViewModel item)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,11 @@ namespace StructureHelper.Windows.TreeGraph
|
|||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get { return _function.Name; }
|
get { return _function.Name; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_function.Name = value;
|
||||||
|
OnPropertyChanged(nameof(Name));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public bool IsExpanded
|
public bool IsExpanded
|
||||||
{
|
{
|
||||||
@@ -71,6 +76,7 @@ namespace StructureHelper.Windows.TreeGraph
|
|||||||
{
|
{
|
||||||
_isSelected = value;
|
_isSelected = value;
|
||||||
_treeGraphViewModel.DrawGraph();
|
_treeGraphViewModel.DrawGraph();
|
||||||
|
_treeGraphViewModel.Save();
|
||||||
OnPropertyChanged(nameof(IsSelected));
|
OnPropertyChanged(nameof(IsSelected));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,9 +96,26 @@ namespace StructureHelperCommon.Infrastructures.Settings
|
|||||||
}
|
}
|
||||||
public static ObservableCollection<IOneVariableFunction> Functions { get; set; } = new ObservableCollection<IOneVariableFunction>
|
public static ObservableCollection<IOneVariableFunction> Functions { get; set; } = new ObservableCollection<IOneVariableFunction>
|
||||||
{
|
{
|
||||||
|
new TableFunction()
|
||||||
|
{
|
||||||
|
Name = "Not StressStrain",
|
||||||
|
FunctionPurpose = FunctionPurpose.FireProtection,
|
||||||
|
Table = new List<GraphPoint>()
|
||||||
|
{
|
||||||
|
new GraphPoint(1, 1),
|
||||||
|
new GraphPoint(2, 2),
|
||||||
|
new GraphPoint(3, 3),
|
||||||
|
new GraphPoint(4, 4),
|
||||||
|
new GraphPoint(5, 5),
|
||||||
|
new GraphPoint(6, 6),
|
||||||
|
},
|
||||||
|
IsUser = false,
|
||||||
|
Description = "Пример описания",
|
||||||
|
},
|
||||||
new TableFunction()
|
new TableFunction()
|
||||||
{
|
{
|
||||||
Name = "Табличная системная функция",
|
Name = "Табличная системная функция",
|
||||||
|
FunctionPurpose = FunctionPurpose.StressStrain,
|
||||||
Table = new List<GraphPoint>()
|
Table = new List<GraphPoint>()
|
||||||
{
|
{
|
||||||
new GraphPoint(1, 1),
|
new GraphPoint(1, 1),
|
||||||
@@ -114,6 +131,7 @@ namespace StructureHelperCommon.Infrastructures.Settings
|
|||||||
new FormulaFunction()
|
new FormulaFunction()
|
||||||
{
|
{
|
||||||
Name = "Формульная системная функция",
|
Name = "Формульная системная функция",
|
||||||
|
FunctionPurpose = FunctionPurpose.StressStrain,
|
||||||
Formula = "x^2",
|
Formula = "x^2",
|
||||||
Step = 100,
|
Step = 100,
|
||||||
MinArg = 1,
|
MinArg = 1,
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ namespace StructureHelperCommon.Models.Functions
|
|||||||
formulaFunction.Step = Step;
|
formulaFunction.Step = Step;
|
||||||
formulaFunction.MinArg = MinArg;
|
formulaFunction.MinArg = MinArg;
|
||||||
formulaFunction.MaxArg = MaxArg;
|
formulaFunction.MaxArg = MaxArg;
|
||||||
|
formulaFunction.FunctionPurpose = FunctionPurpose;
|
||||||
return formulaFunction;
|
return formulaFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ namespace StructureHelperCommon.Models.Functions
|
|||||||
tableFunction.Table = newTable;
|
tableFunction.Table = newTable;
|
||||||
tableFunction.IsUser = true;
|
tableFunction.IsUser = true;
|
||||||
tableFunction.Group = GROUP_TYPE_2;
|
tableFunction.Group = GROUP_TYPE_2;
|
||||||
|
tableFunction.FunctionPurpose = FunctionPurpose;
|
||||||
return tableFunction;
|
return tableFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace StructureHelperCommon.Windows
|
|||||||
public string SPECIAL { get; } = "Special Limit State";
|
public string SPECIAL { get; } = "Special Limit State";
|
||||||
public string CREATE_MATERIAL { get; } = "Create Function Material";
|
public string CREATE_MATERIAL { get; } = "Create Function Material";
|
||||||
private const string ERROR_TEXT_1 = "Not all material states have functions ";
|
private const string ERROR_TEXT_1 = "Not all material states have functions ";
|
||||||
public ObservableCollection<IOneVariableFunction> Functions { get; set; } = ProgramSetting.Functions;
|
public ObservableCollection<IOneVariableFunction> Functions { get; set; }
|
||||||
public IOneVariableFunction Func_ST_ULS { get; set; }
|
public IOneVariableFunction Func_ST_ULS { get; set; }
|
||||||
public IOneVariableFunction Func_ST_SLS { get; set; }
|
public IOneVariableFunction Func_ST_SLS { get; set; }
|
||||||
public IOneVariableFunction Func_ST_Special { get; set; }
|
public IOneVariableFunction Func_ST_Special { get; set; }
|
||||||
@@ -35,6 +35,11 @@ namespace StructureHelperCommon.Windows
|
|||||||
public IOneVariableFunction Func_LT_SLS { get; set; }
|
public IOneVariableFunction Func_LT_SLS { get; set; }
|
||||||
public IOneVariableFunction Func_LT_Special { get; set; }
|
public IOneVariableFunction Func_LT_Special { get; set; }
|
||||||
public FunctionStorage FunctionStorage { get; set; } = new();
|
public FunctionStorage FunctionStorage { get; set; } = new();
|
||||||
|
public FunctionSelectionVM()
|
||||||
|
{
|
||||||
|
var listFunctions = ProgramSetting.Functions.Where(x => x.FunctionPurpose == Infrastructures.Enums.FunctionPurpose.StressStrain).ToList();
|
||||||
|
Functions = new ObservableCollection<IOneVariableFunction>();
|
||||||
|
}
|
||||||
private void CreateFunctionMaterial(object parameter)
|
private void CreateFunctionMaterial(object parameter)
|
||||||
{
|
{
|
||||||
var window = parameter as Window;
|
var window = parameter as Window;
|
||||||
|
|||||||
Reference in New Issue
Block a user