Delete and DrawGraph command done
This commit is contained in:
@@ -7,11 +7,14 @@
|
||||
xmlns:local="clr-namespace:StructureHelper.Windows.MainGraph"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance local:FormulaViewModel}"
|
||||
Title="FormulaFunction" Height="320" Width="400">
|
||||
Title="FormulaFunction" Height="580" Width="400">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="150"/>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition Height="50"/>
|
||||
@@ -47,6 +50,79 @@
|
||||
TextWrapping="Wrap">
|
||||
</TextBlock>
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="90"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</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}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"/>
|
||||
<TextBlock Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
Text="{Binding GREATER}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"/>
|
||||
<TextBox Grid.Column="2"
|
||||
Grid.Row="1"
|
||||
Text="{Binding LeftBound,
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
StringFormat=\{0:n\}}"
|
||||
Margin="5"/>
|
||||
<TextBlock Grid.Column="0"
|
||||
Grid.Row="2"
|
||||
Text="{Binding X_or_Y_text}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"/>
|
||||
<TextBlock Grid.Column="1"
|
||||
Grid.Row="2"
|
||||
Text="{Binding LESS}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"/>
|
||||
<TextBox Grid.Column="2"
|
||||
Grid.Row="2"
|
||||
Text="{Binding RightBound,
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
StringFormat=\{0:n\}}"
|
||||
Margin="5"/>
|
||||
</Grid>
|
||||
<TextBlock Grid.Row="1"
|
||||
Margin="5"
|
||||
Background="LightYellow"
|
||||
Text="{Binding LimitText, UpdateSourceTrigger=PropertyChanged}"
|
||||
TextAlignment="Center"
|
||||
FontSize="20"
|
||||
TextWrapping="Wrap">
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
<Grid Grid.Row="3">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0"
|
||||
Margin="5"
|
||||
Text="Step:"
|
||||
VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="1" Text="{Binding Step}" Margin="5"/>
|
||||
</Grid>
|
||||
<Grid Grid.Row="4">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
@@ -57,7 +133,7 @@
|
||||
VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="1" Text="{Binding Name}" Margin="5"/>
|
||||
</Grid>
|
||||
<Grid Grid.Row="3">
|
||||
<Grid Grid.Row="5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
@@ -68,8 +144,19 @@
|
||||
VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="1" Text="{Binding Description}" Margin="5"/>
|
||||
</Grid>
|
||||
<Button Grid.Row="4" Margin="5" Content="Save"
|
||||
Command="{Binding DrawGraphCommand}"
|
||||
<Grid Grid.Row="6">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0"
|
||||
Margin="5"
|
||||
Text="Color:"
|
||||
VerticalAlignment="Center"/>
|
||||
<ComboBox Grid.Row="1" Text="{Binding Description}" Margin="5"/>
|
||||
</Grid>
|
||||
<Button Grid.Row="7" Margin="5" Content="Save"
|
||||
Command="{Binding SaveCommand}"
|
||||
CommandParameter="{Binding ElementName=FormulaFunction_win}">
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
@@ -22,10 +22,10 @@ namespace StructureHelper.Windows.MainGraph
|
||||
private const double DEFAULT_LEFT_BOUND = 0;
|
||||
private const double DEFAULT_RIGHT_BOUND = 1000;
|
||||
private const int DEFAULT_STEP = 100;
|
||||
private RelayCommand drawGraphCommand;
|
||||
public ICommand DrawGraphCommand
|
||||
private RelayCommand saveCommand;
|
||||
public ICommand SaveCommand
|
||||
{
|
||||
get => drawGraphCommand ??= new RelayCommand(o => Save(o));
|
||||
get => saveCommand ??= new RelayCommand(o => Save(o));
|
||||
}
|
||||
private string formula;
|
||||
|
||||
|
||||
@@ -101,13 +101,13 @@
|
||||
Background="AntiqueWhite"/>
|
||||
</Grid>
|
||||
<lvc:CartesianChart Grid.Row="0" Grid.Column="1"
|
||||
Series="{Binding SeriesCollection}" Margin="5"
|
||||
Zoom="Xy">
|
||||
Series="{Binding SeriesCollection, UpdateSourceTrigger=PropertyChanged}" Margin="5"
|
||||
Zoom="None">
|
||||
<lvc:CartesianChart.AxisY>
|
||||
<lvc:Axis Title="Y"></lvc:Axis>
|
||||
</lvc:CartesianChart.AxisY>
|
||||
<lvc:CartesianChart.AxisX>
|
||||
<lvc:Axis Title="X" Labels="{Binding Labels}"></lvc:Axis>
|
||||
<lvc:Axis Title="X" Labels="{Binding Labels, UpdateSourceTrigger=PropertyChanged}"></lvc:Axis>
|
||||
</lvc:CartesianChart.AxisX>
|
||||
</lvc:CartesianChart>
|
||||
<Grid Grid.Row="1" Grid.Column="1">
|
||||
|
||||
@@ -43,7 +43,6 @@ namespace StructureHelper.Windows.MainGraph
|
||||
public void Refresh()
|
||||
{
|
||||
FunctionList.Items.Refresh();
|
||||
DescriptionTextBlock.UpdateLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,11 +16,26 @@ namespace StructureHelper.Windows.MainGraph
|
||||
{
|
||||
public class GraphViewModel : ViewModelBase
|
||||
{
|
||||
public SeriesCollection SeriesCollection { get; set; }
|
||||
public List<string> Labels { get; set; }
|
||||
|
||||
|
||||
|
||||
private SeriesCollection seriesCollection;
|
||||
private List<string> labels;
|
||||
public SeriesCollection SeriesCollection
|
||||
{
|
||||
get => seriesCollection;
|
||||
set
|
||||
{
|
||||
seriesCollection = value;
|
||||
OnPropertyChanged(nameof(seriesCollection));
|
||||
}
|
||||
}
|
||||
public List<string> Labels
|
||||
{
|
||||
get => labels;
|
||||
set
|
||||
{
|
||||
labels = value;
|
||||
OnPropertyChanged(nameof(labels));
|
||||
}
|
||||
}
|
||||
private IOneVariableFunction selectedFunction;
|
||||
public IOneVariableFunction SelectedFuntion
|
||||
{
|
||||
@@ -31,6 +46,7 @@ namespace StructureHelper.Windows.MainGraph
|
||||
set
|
||||
{
|
||||
selectedFunction = value;
|
||||
DrawGraph();
|
||||
OnPropertyChanged(nameof(SelectedFuntion));
|
||||
}
|
||||
}
|
||||
@@ -89,6 +105,9 @@ namespace StructureHelper.Windows.MainGraph
|
||||
var f2 = new FormulaFunction();
|
||||
f2.Name = "Формульная системная функция";
|
||||
f2.Formula = "x^2";
|
||||
f2.Step = 100;
|
||||
f2.MinArg = -1000;
|
||||
f2.MaxArg = 1000;
|
||||
f2.IsUser = false;
|
||||
f2.Description = "Описание формульной системной функции";
|
||||
|
||||
@@ -106,6 +125,7 @@ namespace StructureHelper.Windows.MainGraph
|
||||
if (tableView.ShowDialog() == true)
|
||||
{
|
||||
Functions.Add(tableViewModel.Function);
|
||||
SelectedFuntion = tableViewModel.Function;
|
||||
}
|
||||
}
|
||||
private void AddFormula()
|
||||
@@ -116,6 +136,7 @@ namespace StructureHelper.Windows.MainGraph
|
||||
if (formulaView.ShowDialog() == true)
|
||||
{
|
||||
Functions.Add(formulaViewModel.Function);
|
||||
SelectedFuntion = formulaViewModel.Function;
|
||||
}
|
||||
}
|
||||
private void Edit(object parameter)
|
||||
@@ -139,9 +160,9 @@ namespace StructureHelper.Windows.MainGraph
|
||||
formulaView.DataContext = formulaViewModel;
|
||||
formulaView.ShowDialog();
|
||||
SelectedFuntion = formulaViewModel.Function;
|
||||
}
|
||||
var graphView = parameter as GraphView;
|
||||
graphView.Refresh();
|
||||
}
|
||||
//var graphView = parameter as GraphView;
|
||||
//graphView.Refresh();
|
||||
}
|
||||
private void Delete()
|
||||
{
|
||||
@@ -175,12 +196,18 @@ namespace StructureHelper.Windows.MainGraph
|
||||
}
|
||||
private void Tree()
|
||||
{
|
||||
var func = Database.GetFunctionTree();
|
||||
if (SelectedFuntion is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//var testFunction = Database.GetFunctionTree();
|
||||
//var treeGraphVM = new TreeGraphViewModel(testFunction);
|
||||
|
||||
var treeGraphVM = new TreeGraphViewModel(func);
|
||||
var treeGraphVM = new TreeGraphViewModel(SelectedFuntion);
|
||||
var treeGraph = new TreeGraphView();
|
||||
treeGraph.DataContext = treeGraphVM;
|
||||
treeGraphVM.TreeGraphView_win = treeGraph;
|
||||
treeGraph.ShowDialog();
|
||||
}
|
||||
private void DrawGraph()
|
||||
@@ -196,6 +223,7 @@ namespace StructureHelper.Windows.MainGraph
|
||||
}
|
||||
lineSeries.Values = chartValues;
|
||||
Labels = labels;
|
||||
seriesCollection.Add(lineSeries);
|
||||
SeriesCollection = seriesCollection;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
mc:Ignorable="d"
|
||||
ResizeMode="CanResize"
|
||||
d:DataContext="{d:DesignInstance local:TableViewModel}"
|
||||
Title="TableFunction" Height="500" Width="400"
|
||||
Title="TableFunction" Height="560" Width="400"
|
||||
MaxWidth="400"
|
||||
MinWidth="400">
|
||||
<Grid>
|
||||
@@ -18,6 +18,7 @@
|
||||
<RowDefinition Height="50"/>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition Height="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Column="0" Margin="5">
|
||||
@@ -105,8 +106,19 @@
|
||||
VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="1" Text="{Binding Description}" Margin="5"/>
|
||||
</Grid>
|
||||
<Button Grid.Row="5" Margin="5" Content="Save"
|
||||
Command="{Binding DrawGraphCommand}"
|
||||
<Grid Grid.Row="5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0"
|
||||
Margin="5"
|
||||
Text="Color:"
|
||||
VerticalAlignment="Center"/>
|
||||
<ComboBox Grid.Row="1" Text="{Binding Description}" Margin="5"/>
|
||||
</Grid>
|
||||
<Button Grid.Row="6" Margin="5" Content="Save"
|
||||
Command="{Binding SaveCommand}"
|
||||
CommandParameter="{Binding ElementName=TableFunction_win}">
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
@@ -18,12 +18,12 @@ namespace StructureHelper.Windows.MainGraph
|
||||
{
|
||||
private const string DEFAULT_NAME = "Put function name here...";
|
||||
private const string DEFAULT_DESCRIPTION = "Put function description here...";
|
||||
private RelayCommand drawGraphCommand;
|
||||
private RelayCommand saveCommand;
|
||||
private RelayCommand addPointCommand;
|
||||
private RelayCommand deletePointCommand;
|
||||
public ICommand DrawGraphCommand
|
||||
public ICommand SaveCommand
|
||||
{
|
||||
get => drawGraphCommand ??= new RelayCommand(o => Save(o));
|
||||
get => saveCommand ??= new RelayCommand(o => Save(o));
|
||||
}
|
||||
public ICommand AddPointCommand
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user