Tree graph commands in process
This commit is contained in:
@@ -87,7 +87,16 @@
|
||||
<Compile Update="Windows\Services\CopyByParameterView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Windows\TreeGraph\TreeGraph.xaml.cs">
|
||||
<Compile Update="Windows\TreeGraph\GetValueView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Windows\TreeGraph\LimView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Windows\TreeGraph\ScaleView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Windows\TreeGraph\TreeGraphView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Windows\UserControls\MultiplyDouble.xaml.cs">
|
||||
@@ -197,7 +206,13 @@
|
||||
<Page Update="Windows\Services\CopyByParameterView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Windows\TreeGraph\TreeGraph.xaml">
|
||||
<Page Update="Windows\TreeGraph\LimView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Windows\TreeGraph\ScaleView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Windows\TreeGraph\TreeGraphView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Windows\UserControls\MultiplyDouble.xaml">
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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}"
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
81
StructureHelper/Windows/TreeGraph/GetValueView.xaml
Normal file
81
StructureHelper/Windows/TreeGraph/GetValueView.xaml
Normal file
@@ -0,0 +1,81 @@
|
||||
<Window x:Class="StructureHelper.Windows.TreeGraph.GetValueView"
|
||||
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:GetValueViewModel}"
|
||||
Title="GetY" Height="300" Width="400"
|
||||
MinWidth="400">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="60"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0"
|
||||
Margin="5"
|
||||
Text="Enter function argument:"
|
||||
VerticalAlignment="Center"/>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="50"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="x="
|
||||
FontStyle="Italic"
|
||||
Margin="5"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding Argument}"
|
||||
Margin="5"/>
|
||||
<Button Grid.Column="2" Margin="5" Content="Get value"
|
||||
Command="{Binding DrawGraphCommand}">
|
||||
</Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<ScrollViewer Grid.Row="1" Margin="5" >
|
||||
<TextBlock
|
||||
Background="LightYellow"
|
||||
Text="{Binding Trace}"
|
||||
TextAlignment="Center"
|
||||
FontSize="20"
|
||||
TextWrapping="Wrap"
|
||||
FontStyle="Italic">
|
||||
</TextBlock>
|
||||
</ScrollViewer>
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0"
|
||||
Margin="5"
|
||||
Text="Function value:"
|
||||
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"/>
|
||||
<TextBlock Grid.Column="1"
|
||||
Background="AliceBlue"
|
||||
Text="{Binding Value}"
|
||||
FontWeight="DemiBold"
|
||||
Margin="5"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
27
StructureHelper/Windows/TreeGraph/GetValueView.xaml.cs
Normal file
27
StructureHelper/Windows/TreeGraph/GetValueView.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 GetValueView.xaml
|
||||
/// </summary>
|
||||
public partial class GetValueView : Window
|
||||
{
|
||||
public GetValueView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
53
StructureHelper/Windows/TreeGraph/GetValueViewModel.cs
Normal file
53
StructureHelper/Windows/TreeGraph/GetValueViewModel.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
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.Input;
|
||||
|
||||
namespace StructureHelper.Windows.TreeGraph
|
||||
{
|
||||
public class GetValueViewModel : ViewModelBase
|
||||
{
|
||||
public IOneVariableFunction function;
|
||||
private double argument;
|
||||
private double value;
|
||||
private string trace = "Будет логика расчёта";
|
||||
public IOneVariableFunction Function
|
||||
{
|
||||
get => function;
|
||||
set => function = value;
|
||||
}
|
||||
public double Argument
|
||||
{
|
||||
get => argument;
|
||||
set => argument = value;
|
||||
}
|
||||
public double Value
|
||||
{
|
||||
get => value;
|
||||
set => this.value = value;
|
||||
}
|
||||
public string Trace
|
||||
{
|
||||
get => trace;
|
||||
set => trace = value;
|
||||
}
|
||||
private RelayCommand _getValueCommand;
|
||||
public ICommand GetValueCommand
|
||||
{
|
||||
get => _getValueCommand ??= new RelayCommand(o => GetValue());
|
||||
}
|
||||
public GetValueViewModel(IOneVariableFunction function)
|
||||
{
|
||||
Function = function;
|
||||
}
|
||||
private void GetValue()
|
||||
{
|
||||
Value = Function.GetByX(Argument);
|
||||
Trace = "скорее всего переменная внутри функции";
|
||||
}
|
||||
}
|
||||
}
|
||||
77
StructureHelper/Windows/TreeGraph/LimView.xaml
Normal file
77
StructureHelper/Windows/TreeGraph/LimView.xaml
Normal file
@@ -0,0 +1,77 @@
|
||||
<Window x:Class="StructureHelper.Windows.TreeGraph.LimView"
|
||||
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:LimViewModel}"
|
||||
Title="Limit" Height="230" Width="250"
|
||||
MinWidth="250">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="90"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="20"/>
|
||||
<ColumnDefinition Width="10"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Grid.ColumnSpan="3"
|
||||
Margin="5"
|
||||
Text="Enter limit bounds:"
|
||||
VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
Text="{Binding X_or_Y_text}"
|
||||
FontStyle="Italic"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"/>
|
||||
<TextBlock Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
Text="{Binding GREATER}"
|
||||
FontStyle="Italic"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"/>
|
||||
<TextBox Grid.Column="2"
|
||||
Grid.Row="1"
|
||||
Text="{Binding LeftBound}"
|
||||
Margin="5"/>
|
||||
<TextBlock Grid.Column="0"
|
||||
Grid.Row="2"
|
||||
Text="{Binding X_or_Y_text}"
|
||||
FontStyle="Italic"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"/>
|
||||
<TextBlock Grid.Column="1"
|
||||
Grid.Row="2"
|
||||
Text="{Binding LESS}"
|
||||
FontStyle="Italic"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"/>
|
||||
<TextBox Grid.Column="2"
|
||||
Grid.Row="2"
|
||||
Text="{Binding RightBound}"
|
||||
Margin="5"/>
|
||||
</Grid>
|
||||
<TextBlock Grid.Row="1"
|
||||
Margin="5"
|
||||
Background="LightYellow"
|
||||
Text="{Binding LimitText}"
|
||||
TextAlignment="Center"
|
||||
FontSize="20"
|
||||
TextWrapping="Wrap"
|
||||
FontStyle="Italic">
|
||||
</TextBlock>
|
||||
<Button Grid.Row="4" Margin="5" Content="Save">
|
||||
</Button>
|
||||
</Grid>
|
||||
</Window>
|
||||
27
StructureHelper/Windows/TreeGraph/LimView.xaml.cs
Normal file
27
StructureHelper/Windows/TreeGraph/LimView.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 LimView.xaml
|
||||
/// </summary>
|
||||
public partial class LimView : Window
|
||||
{
|
||||
public LimView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
47
StructureHelper/Windows/TreeGraph/LimViewModel.cs
Normal file
47
StructureHelper/Windows/TreeGraph/LimViewModel.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.TreeGraph
|
||||
{
|
||||
public class LimViewModel : ViewModelBase
|
||||
{
|
||||
public char GREATER { get; } = '\u2A7E';
|
||||
public char LESS { get; } = '\u2264';
|
||||
public char IN { get; } = '\u2208';
|
||||
public char LEFT_BOUND { get; } = '[';
|
||||
public char RIGHT_BOUND { get; } = ']';
|
||||
public char SEMICOLON { get; } = ';';
|
||||
private string x_or_y_text = "x";
|
||||
private string limitText;
|
||||
public string X_or_Y_text
|
||||
{
|
||||
get => x_or_y_text;
|
||||
set => x_or_y_text = value;
|
||||
}
|
||||
public string LimitText
|
||||
{
|
||||
get => limitText;
|
||||
set => limitText = value;
|
||||
}
|
||||
private double leftBound;
|
||||
private double rightBound;
|
||||
public double LeftBound
|
||||
{
|
||||
get => leftBound;
|
||||
set => leftBound = value;
|
||||
}
|
||||
public double RightBound
|
||||
{
|
||||
get => rightBound;
|
||||
set => rightBound = value;
|
||||
}
|
||||
public LimViewModel()
|
||||
{
|
||||
LimitText = $"{X_or_Y_text}" + $"{IN}" + $"{LEFT_BOUND}" + $"{LeftBound}" + $"{SEMICOLON}" + $"{rightBound}" + $"{RIGHT_BOUND}";
|
||||
}
|
||||
}
|
||||
}
|
||||
52
StructureHelper/Windows/TreeGraph/ScaleView.xaml
Normal file
52
StructureHelper/Windows/TreeGraph/ScaleView.xaml
Normal file
@@ -0,0 +1,52 @@
|
||||
<Window x:Class="StructureHelper.Windows.TreeGraph.ScaleView"
|
||||
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:ScaleViewModel}"
|
||||
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 scale factor:"
|
||||
VerticalAlignment="Center"/>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="scale factor="
|
||||
FontStyle="Italic"
|
||||
Margin="5"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding ScaleFormula}"
|
||||
Margin="5"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<TextBlock Grid.Row="1"
|
||||
Margin="5"
|
||||
Background="LightYellow"
|
||||
Text="y=sf(x)"
|
||||
TextAlignment="Center"
|
||||
FontSize="20"
|
||||
TextWrapping="Wrap"
|
||||
FontStyle="Italic">
|
||||
</TextBlock>
|
||||
<Button Grid.Row="4" Margin="5" Content="Save">
|
||||
</Button>
|
||||
</Grid>
|
||||
</Window>
|
||||
27
StructureHelper/Windows/TreeGraph/ScaleView.xaml.cs
Normal file
27
StructureHelper/Windows/TreeGraph/ScaleView.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 ScaleView.xaml
|
||||
/// </summary>
|
||||
public partial class ScaleView : Window
|
||||
{
|
||||
public ScaleView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
28
StructureHelper/Windows/TreeGraph/ScaleViewModel.cs
Normal file
28
StructureHelper/Windows/TreeGraph/ScaleViewModel.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.TreeGraph
|
||||
{
|
||||
public class ScaleViewModel : ViewModelBase
|
||||
{
|
||||
private double scaleFactor;
|
||||
private string scaleText;
|
||||
public double ScaleFactor
|
||||
{
|
||||
get => scaleFactor;
|
||||
set => scaleFactor = value;
|
||||
}
|
||||
public string ScaleText
|
||||
{
|
||||
get => scaleText;
|
||||
set => scaleText = value;
|
||||
}
|
||||
public ScaleViewModel()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<Window x:Class="StructureHelper.Windows.TreeGraph.TreeGraph"
|
||||
<Window x:Class="StructureHelper.Windows.TreeGraph.TreeGraphView"
|
||||
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"
|
||||
@@ -40,19 +40,30 @@
|
||||
<RowDefinition Height="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Button Grid.Column="0" Margin="5" Content="Get Y"
|
||||
Background="Goldenrod"/>
|
||||
Background="Goldenrod"
|
||||
Command="{Binding GetYCommand}"/>
|
||||
<Button Grid.Column="1" Margin="5" Content="ScaleX"
|
||||
Background="Turquoise"/>
|
||||
Background="Turquoise"
|
||||
Command="{Binding ScaleCommand}"
|
||||
CommandParameter="x"/>
|
||||
<Button Grid.Column="2" Margin="5" Content="ScaleY"
|
||||
Background="Turquoise"/>
|
||||
Background="Turquoise"
|
||||
Command="{Binding ScaleCommand}"
|
||||
CommandParameter="y"/>
|
||||
<Button Grid.Column="3" Margin="5" Content="limX"
|
||||
Background="DodgerBlue"/>
|
||||
Background="DodgerBlue"
|
||||
Command="{Binding LimitCommand}"
|
||||
CommandParameter="x"/>
|
||||
<Button Grid.Column="4" Margin="5" Content="limY"
|
||||
Background="DodgerBlue"/>
|
||||
Background="DodgerBlue"
|
||||
Command="{Binding LimitCommand}"
|
||||
CommandParameter="y"/>
|
||||
<Button Grid.Column="5" Margin="5" Content="Edit"
|
||||
Background="LightYellow"/>
|
||||
Background="LightYellow"
|
||||
Command="{Binding EditCommand}"/>
|
||||
<Button Grid.Column="6" Margin="5" Content="Delete"
|
||||
Background="LightPink"/>
|
||||
Background="LightPink"
|
||||
Command="{Binding DeleteCommand}"/>
|
||||
</Grid>
|
||||
<lvc:CartesianChart Grid.Row="0" Grid.Column="1" Grid.RowSpan="2"
|
||||
Series="{Binding SeriesCollection}" Margin="5">
|
||||
@@ -18,9 +18,9 @@ namespace StructureHelper.Windows.TreeGraph
|
||||
/// <summary>
|
||||
/// Interaction logic for TreeGraph.xaml
|
||||
/// </summary>
|
||||
public partial class TreeGraph : Window
|
||||
public partial class TreeGraphView : Window
|
||||
{
|
||||
public TreeGraph()
|
||||
public TreeGraphView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
@@ -1,17 +1,44 @@
|
||||
using NLog.Common;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Functions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.TreeGraph
|
||||
{
|
||||
public class TreeGraphViewModel : ViewModelBase
|
||||
{
|
||||
private RelayCommand _getYCommand;
|
||||
private RelayCommand _scaleCommand;
|
||||
private RelayCommand _limCommand;
|
||||
private RelayCommand _editCommand;
|
||||
private RelayCommand _deleteCommand;
|
||||
public ICommand GetYCommand
|
||||
{
|
||||
get => _getYCommand ??= new RelayCommand(o => GetY());
|
||||
}
|
||||
public ICommand ScaleCommand
|
||||
{
|
||||
get => _scaleCommand ??= new RelayCommand(o => Scale(o));
|
||||
}
|
||||
public ICommand LimitCommand
|
||||
{
|
||||
get => _limCommand ??= new RelayCommand(o => Limit(o));
|
||||
}
|
||||
public ICommand EditCommand
|
||||
{
|
||||
get => _editCommand ??= new RelayCommand(o => Edit());
|
||||
}
|
||||
public ICommand DeleteCommand
|
||||
{
|
||||
get => _deleteCommand ??= new RelayCommand(o => Delete());
|
||||
}
|
||||
private ObservableCollection<IOneVariableFunction> nodes;
|
||||
public ObservableCollection<IOneVariableFunction> Nodes { get; set; }
|
||||
public TreeGraphViewModel(IOneVariableFunction function)
|
||||
@@ -19,6 +46,33 @@ namespace StructureHelper.Windows.TreeGraph
|
||||
Nodes = new ObservableCollection<IOneVariableFunction>();
|
||||
Nodes.Add(function);
|
||||
}
|
||||
private void GetY()
|
||||
{
|
||||
var vm = new GetValueViewModel(new TableFunction());
|
||||
var v = new GetValueView();
|
||||
v.DataContext = vm;
|
||||
v.ShowDialog();
|
||||
}
|
||||
private void Scale(object parameter)
|
||||
{
|
||||
var vm = new ScaleViewModel();
|
||||
var v = new ScaleView();
|
||||
v.DataContext = vm;
|
||||
v.ShowDialog();
|
||||
}
|
||||
private void Limit(object parameter)
|
||||
{
|
||||
var vm = new LimViewModel();
|
||||
var v = new LimView();
|
||||
v.DataContext = vm;
|
||||
v.ShowDialog();
|
||||
}
|
||||
private void Edit()
|
||||
{
|
||||
}
|
||||
private void Delete()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -3,6 +3,7 @@ using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -11,14 +12,24 @@ namespace StructureHelperCommon.Models.Functions
|
||||
{
|
||||
public class TableFunction : IOneVariableFunction
|
||||
{
|
||||
private string name;
|
||||
public bool IsUser { get; set; }
|
||||
public FunctionType Type { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Name
|
||||
{
|
||||
get => name;
|
||||
set
|
||||
{
|
||||
name = value;
|
||||
}
|
||||
}
|
||||
public string Description { get; set; }
|
||||
public List<GraphPoint> Table { get; set; }
|
||||
|
||||
public Guid Id => throw new NotImplementedException();
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
Reference in New Issue
Block a user