Tree graph commands in process

This commit is contained in:
Иван Ивашкин
2024-10-17 13:15:30 +05:00
parent d8f0d9dd88
commit 88ac95af2f
20 changed files with 614 additions and 30 deletions

View File

@@ -5,8 +5,77 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:StructureHelper.Windows.MainGraph"
mc:Ignorable="d"
Title="FormulaView" Height="450" Width="800">
d:DataContext="{d:DesignInstance local:FormulaViewModel}"
Title="TableFunction" Height="300" Width="400"
MaxWidth="400"
MinWidth="400">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="*"/>
<RowDefinition Height="60"/>
<RowDefinition Height="60"/>
<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="Formula:"
VerticalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="y(x)="
FontStyle="Italic"
Margin="5"
VerticalAlignment="Center"
HorizontalAlignment="Right"/>
<TextBox Grid.Column="1" Text="{Binding Description}"
Margin="5"/>
</Grid>
</Grid>
<TextBlock Grid.Row="1"
Margin="5"
Background="LightYellow"
Text="y(x) = формула"
TextAlignment="Center"
FontSize="20"
TextWrapping="Wrap"
FontStyle="Italic">
</TextBlock>
<Grid Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Margin="5"
Text="Name:"
VerticalAlignment="Center"/>
<TextBox Grid.Row="1" Text="{Binding Name}" Margin="5"/>
</Grid>
<Grid Grid.Row="3">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Margin="5"
Text="Description:"
VerticalAlignment="Center"/>
<TextBox Grid.Row="1" Text="{Binding Description}" Margin="5"/>
</Grid>
<Button Grid.Row="4" Margin="5" Content="Save"
Command="{Binding DrawGraphCommand}"
CommandParameter="{Binding ElementName=TableFunction_win}">
</Button>
</Grid>
</Window>

View File

@@ -19,11 +19,11 @@
<RowDefinition Height="100"/>
</Grid.RowDefinitions>
<ListBox Grid.Row="0" Grid.Column="0" Margin="5"
ItemsSource="{Binding Functions}"
SelectedItem="{Binding SelectedFuntion}">
ItemsSource="{Binding Functions, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding SelectedFuntion, UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}"/>
<TextBlock Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>

View File

@@ -148,13 +148,17 @@ namespace StructureHelper.Windows.MainGraph
var tableView = new TableView();
tableView.DataContext = tableViewModel;
tableView.ShowDialog();
//SelectedFunction.Name = tableViewModel.Function.Name; //!!!!!!!!!!
//SelectedFunction.Description = tableViewModel.Function.Description; //!!!!!!!!!!
}
else if (SelectedFuntion.Type == FunctionType.FormulaFunction)
{
var formulaViewModel = new FormulaViewModel(SelectedFuntion as FormulaFunction);
var formulaView = new FormulaView();
formulaView.DataContext = formulaViewModel;
formulaView.ShowDialog();
formulaView.ShowDialog();
//SelectedFunction.Name = formulaViewModel.Function.Name; //!!!!!!!!!!
//SelectedFunction.Description = formulaViewModel.Function.Description; //!!!!!!!!!!
}
}
private void Delete()
@@ -179,7 +183,7 @@ namespace StructureHelper.Windows.MainGraph
private void Tree()
{
var treeGraphVM = new TreeGraphViewModel(SelectedFuntion);
var treeGraph = new TreeGraph.TreeGraph();
var treeGraph = new TreeGraph.TreeGraphView();
treeGraph.DataContext = treeGraphVM;
treeGraph.ShowDialog();
}

View File

@@ -16,8 +16,8 @@
<RowDefinition Height="30"/>
<RowDefinition Height="*"/>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="60"/>
<RowDefinition Height="60"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<Grid Grid.Column="0" Margin="5">
@@ -85,8 +85,8 @@
</Grid>
<Grid Grid.Row="3">
<Grid.RowDefinitions>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Margin="5"
@@ -96,14 +96,14 @@
</Grid>
<Grid Grid.Row="4">
<Grid.RowDefinitions>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Margin="5"
Text="Description:"
VerticalAlignment="Center"/>
<TextBox Grid.Row="1" Text="{Binding Name}" Margin="5"/>
<TextBox Grid.Row="1" Text="{Binding Description}" Margin="5"/>
</Grid>
<Button Grid.Row="5" Margin="5" Content="Save"
Command="{Binding DrawGraphCommand}"

View File

@@ -92,9 +92,9 @@ namespace StructureHelper.Windows.MainGraph
public TableViewModel(TableFunction tableFunction)
{
Function = tableFunction;
Table = new ObservableCollection<GraphPoint>(tableFunction.Table);
Name = tableFunction.Name;
Description = tableFunction.Description;
Table = new ObservableCollection<GraphPoint>((Function as TableFunction).Table);
Name = Function.Name;
Description = Function.Description;
}
private void DrawGraph(object parameter)
{