From 88ac95af2f12d621350ba177e2af8f97ba6999ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD=20=D0=98=D0=B2=D0=B0=D1=88=D0=BA?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Thu, 17 Oct 2024 13:15:30 +0500 Subject: [PATCH] Tree graph commands in process --- StructureHelper/StructureHelper.csproj.user | 19 ++++- .../Windows/MainGraph/FormulaView.xaml | 73 ++++++++++++++++- .../Windows/MainGraph/GraphView.xaml | 6 +- .../Windows/MainGraph/GraphViewModel.cs | 8 +- .../Windows/MainGraph/TableView.xaml | 14 ++-- .../Windows/MainGraph/TableViewModel.cs | 6 +- .../Windows/TreeGraph/GetValueView.xaml | 81 +++++++++++++++++++ .../Windows/TreeGraph/GetValueView.xaml.cs | 27 +++++++ .../Windows/TreeGraph/GetValueViewModel.cs | 53 ++++++++++++ .../Windows/TreeGraph/LimView.xaml | 77 ++++++++++++++++++ .../Windows/TreeGraph/LimView.xaml.cs | 27 +++++++ .../Windows/TreeGraph/LimViewModel.cs | 47 +++++++++++ .../Windows/TreeGraph/ScaleView.xaml | 52 ++++++++++++ .../Windows/TreeGraph/ScaleView.xaml.cs | 27 +++++++ .../Windows/TreeGraph/ScaleViewModel.cs | 28 +++++++ .../{TreeGraph.xaml => TreeGraphView.xaml} | 27 +++++-- ...reeGraph.xaml.cs => TreeGraphView.xaml.cs} | 4 +- .../Windows/TreeGraph/TreeGraphViewModel.cs | 54 +++++++++++++ .../Interfaces/IOneVariableFunction.cs | 1 + .../Models/Functions/TableFunction.cs | 13 ++- 20 files changed, 614 insertions(+), 30 deletions(-) create mode 100644 StructureHelper/Windows/TreeGraph/GetValueView.xaml create mode 100644 StructureHelper/Windows/TreeGraph/GetValueView.xaml.cs create mode 100644 StructureHelper/Windows/TreeGraph/GetValueViewModel.cs create mode 100644 StructureHelper/Windows/TreeGraph/LimView.xaml create mode 100644 StructureHelper/Windows/TreeGraph/LimView.xaml.cs create mode 100644 StructureHelper/Windows/TreeGraph/LimViewModel.cs create mode 100644 StructureHelper/Windows/TreeGraph/ScaleView.xaml create mode 100644 StructureHelper/Windows/TreeGraph/ScaleView.xaml.cs create mode 100644 StructureHelper/Windows/TreeGraph/ScaleViewModel.cs rename StructureHelper/Windows/TreeGraph/{TreeGraph.xaml => TreeGraphView.xaml} (74%) rename StructureHelper/Windows/TreeGraph/{TreeGraph.xaml.cs => TreeGraphView.xaml.cs} (88%) diff --git a/StructureHelper/StructureHelper.csproj.user b/StructureHelper/StructureHelper.csproj.user index ea96ed2..bd8bbec 100644 --- a/StructureHelper/StructureHelper.csproj.user +++ b/StructureHelper/StructureHelper.csproj.user @@ -87,7 +87,16 @@ Code - + + Code + + + Code + + + Code + + Code @@ -197,7 +206,13 @@ Designer - + + Designer + + + Designer + + Designer diff --git a/StructureHelper/Windows/MainGraph/FormulaView.xaml b/StructureHelper/Windows/MainGraph/FormulaView.xaml index 2f5929a..70c763e 100644 --- a/StructureHelper/Windows/MainGraph/FormulaView.xaml +++ b/StructureHelper/Windows/MainGraph/FormulaView.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"> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/StructureHelper/Windows/MainGraph/GraphView.xaml b/StructureHelper/Windows/MainGraph/GraphView.xaml index aee2c20..6a44b0b 100644 --- a/StructureHelper/Windows/MainGraph/GraphView.xaml +++ b/StructureHelper/Windows/MainGraph/GraphView.xaml @@ -19,11 +19,11 @@ + ItemsSource="{Binding Functions, UpdateSourceTrigger=PropertyChanged}" + SelectedItem="{Binding SelectedFuntion, UpdateSourceTrigger=PropertyChanged}"> - + diff --git a/StructureHelper/Windows/MainGraph/GraphViewModel.cs b/StructureHelper/Windows/MainGraph/GraphViewModel.cs index 3391d1b..9fa55ae 100644 --- a/StructureHelper/Windows/MainGraph/GraphViewModel.cs +++ b/StructureHelper/Windows/MainGraph/GraphViewModel.cs @@ -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(); } diff --git a/StructureHelper/Windows/MainGraph/TableView.xaml b/StructureHelper/Windows/MainGraph/TableView.xaml index 4b6ba22..f232943 100644 --- a/StructureHelper/Windows/MainGraph/TableView.xaml +++ b/StructureHelper/Windows/MainGraph/TableView.xaml @@ -16,8 +16,8 @@ - - + + @@ -85,8 +85,8 @@ - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/StructureHelper/Windows/TreeGraph/GetValueView.xaml.cs b/StructureHelper/Windows/TreeGraph/GetValueView.xaml.cs new file mode 100644 index 0000000..5b5be3d --- /dev/null +++ b/StructureHelper/Windows/TreeGraph/GetValueView.xaml.cs @@ -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 +{ + /// + /// Interaction logic for GetValueView.xaml + /// + public partial class GetValueView : Window + { + public GetValueView() + { + InitializeComponent(); + } + } +} diff --git a/StructureHelper/Windows/TreeGraph/GetValueViewModel.cs b/StructureHelper/Windows/TreeGraph/GetValueViewModel.cs new file mode 100644 index 0000000..917576d --- /dev/null +++ b/StructureHelper/Windows/TreeGraph/GetValueViewModel.cs @@ -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 = "скорее всего переменная внутри функции"; + } + } +} diff --git a/StructureHelper/Windows/TreeGraph/LimView.xaml b/StructureHelper/Windows/TreeGraph/LimView.xaml new file mode 100644 index 0000000..b1f4224 --- /dev/null +++ b/StructureHelper/Windows/TreeGraph/LimView.xaml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/StructureHelper/Windows/TreeGraph/LimView.xaml.cs b/StructureHelper/Windows/TreeGraph/LimView.xaml.cs new file mode 100644 index 0000000..012bb78 --- /dev/null +++ b/StructureHelper/Windows/TreeGraph/LimView.xaml.cs @@ -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 +{ + /// + /// Interaction logic for LimView.xaml + /// + public partial class LimView : Window + { + public LimView() + { + InitializeComponent(); + } + } +} diff --git a/StructureHelper/Windows/TreeGraph/LimViewModel.cs b/StructureHelper/Windows/TreeGraph/LimViewModel.cs new file mode 100644 index 0000000..21831ec --- /dev/null +++ b/StructureHelper/Windows/TreeGraph/LimViewModel.cs @@ -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}"; + } + } +} diff --git a/StructureHelper/Windows/TreeGraph/ScaleView.xaml b/StructureHelper/Windows/TreeGraph/ScaleView.xaml new file mode 100644 index 0000000..f40f830 --- /dev/null +++ b/StructureHelper/Windows/TreeGraph/ScaleView.xaml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/StructureHelper/Windows/TreeGraph/ScaleView.xaml.cs b/StructureHelper/Windows/TreeGraph/ScaleView.xaml.cs new file mode 100644 index 0000000..ea122f1 --- /dev/null +++ b/StructureHelper/Windows/TreeGraph/ScaleView.xaml.cs @@ -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 +{ + /// + /// Interaction logic for ScaleView.xaml + /// + public partial class ScaleView : Window + { + public ScaleView() + { + InitializeComponent(); + } + } +} diff --git a/StructureHelper/Windows/TreeGraph/ScaleViewModel.cs b/StructureHelper/Windows/TreeGraph/ScaleViewModel.cs new file mode 100644 index 0000000..8292057 --- /dev/null +++ b/StructureHelper/Windows/TreeGraph/ScaleViewModel.cs @@ -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() + { + } + } +} diff --git a/StructureHelper/Windows/TreeGraph/TreeGraph.xaml b/StructureHelper/Windows/TreeGraph/TreeGraphView.xaml similarity index 74% rename from StructureHelper/Windows/TreeGraph/TreeGraph.xaml rename to StructureHelper/Windows/TreeGraph/TreeGraphView.xaml index eb02237..dbbf7f9 100644 --- a/StructureHelper/Windows/TreeGraph/TreeGraph.xaml +++ b/StructureHelper/Windows/TreeGraph/TreeGraphView.xaml @@ -1,4 +1,4 @@ -