Add rename and tree modifiers, binding function purpose enum

This commit is contained in:
Иван Ивашкин
2025-03-05 12:58:02 +05:00
parent 45dc56a63e
commit 0829b9c57e
15 changed files with 326 additions and 13 deletions

View File

@@ -1,13 +1,23 @@
<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: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.MainGraph"
xmlns:ens="clr-namespace:StructureHelperCommon.Infrastructures.Enums;assembly=StructureHelperCommon"
mc:Ignorable="d"
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.RowDefinitions>
<RowDefinition Height="60"/>
@@ -17,6 +27,7 @@
<RowDefinition Height="60"/>
<RowDefinition Height="60"/>
<RowDefinition Height="60"/>
<RowDefinition Height="60"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
@@ -134,6 +145,20 @@
<TextBox Grid.Row="1" Text="{Binding Name}" Margin="5"/>
</Grid>
<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>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
@@ -144,7 +169,7 @@
VerticalAlignment="Center"/>
<TextBox Grid.Row="1" Text="{Binding Description}" Margin="5"/>
</Grid>
<Grid Grid.Row="6">
<Grid Grid.Row="7">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
@@ -173,7 +198,7 @@
</Rectangle.Fill>
</Rectangle>
</Grid>
<Button Grid.Row="7" Margin="5" Content="Save"
<Button Grid.Row="8" Margin="5" Content="Save"
Command="{Binding SaveCommand}"
CommandParameter="{Binding ElementName=FormulaFunction_win}">
</Button>

View File

@@ -1,5 +1,6 @@
using StructureHelper.Infrastructure;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Functions;
using StructureHelperCommon.Services.ColorServices;
@@ -103,6 +104,15 @@ namespace StructureHelper.Windows.MainGraph
name = value;
}
}
private FunctionPurpose functionPurpose;
public FunctionPurpose FunctionPurpose
{
get => functionPurpose;
set
{
functionPurpose = value;
}
}
private string description;
public string Description
{
@@ -148,6 +158,7 @@ namespace StructureHelper.Windows.MainGraph
Formula = formulaFunction.Formula;
Step = formulaFunction.Step;
Name = Function.Name;
FunctionPurpose = Function.FunctionPurpose;
Description = Function.Description;
LeftBound = Function.MinArg;
RightBound = Function.MaxArg;
@@ -173,6 +184,7 @@ namespace StructureHelper.Windows.MainGraph
Function.Color = Color;
Function.MinArg = LeftBound;
Function.MaxArg = RightBound;
Function.FunctionPurpose = FunctionPurpose;
var window = parameter as Window;
if (LeftBound > RightBound)
{

View File

@@ -1,16 +1,26 @@
<Window x:Class="StructureHelper.Windows.MainGraph.TableView"
x:Name="TableFunction_win"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
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.MainGraph"
xmlns:ens="clr-namespace:StructureHelperCommon.Infrastructures.Enums;assembly=StructureHelperCommon"
mc:Ignorable="d"
ResizeMode="CanResize"
d:DataContext="{d:DesignInstance local:TableViewModel}"
Title="TableFunction" Height="560" Width="400"
Title="TableFunction" Height="620" Width="400"
MaxWidth="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.RowDefinitions>
<RowDefinition Height="30"/>
@@ -19,6 +29,7 @@
<RowDefinition Height="60"/>
<RowDefinition Height="60"/>
<RowDefinition Height="60"/>
<RowDefinition Height="60"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<Grid Grid.Column="0" Margin="5">
@@ -96,6 +107,20 @@
<TextBox Grid.Row="1" Text="{Binding Name}" Margin="5"/>
</Grid>
<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>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
@@ -106,7 +131,7 @@
VerticalAlignment="Center"/>
<TextBox Grid.Row="1" Text="{Binding Description}" Margin="5"/>
</Grid>
<Grid Grid.Row="5">
<Grid Grid.Row="6">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
@@ -135,7 +160,7 @@
</Rectangle.Fill>
</Rectangle>
</Grid>
<Button Grid.Row="6" Margin="5" Content="Save"
<Button Grid.Row="7" Margin="5" Content="Save"
Command="{Binding SaveCommand}"
CommandParameter="{Binding ElementName=TableFunction_win}">
</Button>

View File

@@ -1,4 +1,5 @@
using StructureHelper.Infrastructure;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Functions;
using StructureHelperCommon.Models.Shapes;
@@ -79,6 +80,15 @@ namespace StructureHelper.Windows.MainGraph
name = value;
}
}
private FunctionPurpose functionPurpose;
public FunctionPurpose FunctionPurpose
{
get => functionPurpose;
set
{
functionPurpose = value;
}
}
private string description;
public string Description
{
@@ -114,6 +124,7 @@ namespace StructureHelper.Windows.MainGraph
Function = tableFunction;
Table = new ObservableCollection<GraphPoint>((Function as TableFunction).Table);
Name = Function.Name;
FunctionPurpose = Function.FunctionPurpose;
Description = Function.Description;
Color = Function.Color;
}
@@ -134,6 +145,7 @@ namespace StructureHelper.Windows.MainGraph
Function.IsUser = true;
(Function as TableFunction).Table = Table.OrderBy(x => x.X).ToList();
Function.Color = Color;
Function.FunctionPurpose = FunctionPurpose;
var window = parameter as Window;
window.DialogResult = true;
window.Close();