Add graph application

This commit is contained in:
Иван Ивашкин
2024-10-06 18:53:47 +05:00
parent c10d6eb94e
commit ccc9513416
10 changed files with 174 additions and 2 deletions

View File

@@ -57,6 +57,9 @@
<Compile Update="Windows\Graphs\GraphView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\MainGraph\GraphView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\MainWindow\AboutView.xaml.cs">
<SubType>Code</SubType>
</Compile>
@@ -155,6 +158,9 @@
<Page Update="Windows\Graphs\GraphView.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\MainGraph\GraphView.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\MainWindow\AboutView.xaml">
<SubType>Designer</SubType>
</Page>

View File

@@ -0,0 +1,17 @@
<Window x:Class="StructureHelper.Windows.MainGraph.GraphView"
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"
mc:Ignorable="d"
Title="GraphView" Height="450" Width="800">
<Grid>
<TextBlock
Text = "Здесь будет приложение с графиком"
FontSize="20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
/>
</Grid>
</Window>

View 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.MainGraph
{
/// <summary>
/// Interaction logic for GraphView.xaml
/// </summary>
public partial class GraphView : Window
{
public GraphView()
{
InitializeComponent();
}
}
}

View File

@@ -1,8 +1,10 @@
using StructureHelper.Infrastructure;
using StructureHelper.Windows.Graphs;
using StructureHelper.Windows.MainWindow.Analyses;
using StructureHelperCommon.Infrastructures.Settings;
using StructureHelperCommon.Models.Analyses;
using StructureHelperLogic.Models.Analyses;
using StructureHelperLogics.Models.Editors;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -17,6 +19,7 @@ namespace StructureHelper.Windows.MainWindow
public class AnalysesLogic : ViewModelBase
{
private RelayCommand? addAnalyisCommand;
private RelayCommand? addEditorCommand;
private RelayCommand? runCommand;
private RelayCommand? editCommand;
private RelayCommand? deleteCommand;
@@ -35,6 +38,17 @@ namespace StructureHelper.Windows.MainWindow
});
}
}
public RelayCommand AddGraphEditorCommand
{
get
{
return addEditorCommand ??= new RelayCommand(obj =>
{
AddGraphEditor();
Refresh();
});
}
}
public RelayCommand RunCommand
{
get
@@ -124,5 +138,13 @@ namespace StructureHelper.Windows.MainWindow
var visualAnalysis = new VisualAnalysis(analysis);
ProgramSetting.CurrentProject.VisualAnalyses.Add(visualAnalysis);
}
private void AddGraphEditor()
{
var editor = new GraphEditorAnalysis();
editor.Name = "New Graph Editor";
editor.Tags = "#New group";
var visualAnalysis = new VisualAnalysis(editor);
ProgramSetting.CurrentProject.VisualAnalyses.Add(visualAnalysis);
}
}
}

View File

@@ -1,7 +1,9 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelper.Windows.MainGraph;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Analyses;
using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.Models.Graphs;
using System;
namespace StructureHelper.Windows.MainWindow.Analyses
@@ -35,6 +37,10 @@ namespace StructureHelper.Windows.MainWindow.Analyses
{
ProcessCrossSection(crossSection);
}
else if (version.Item is IGraph graph)
{
ProcessEditGraph(graph);
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(version));
@@ -46,6 +52,11 @@ namespace StructureHelper.Windows.MainWindow.Analyses
var window = new CrossSectionView(crossSection);
window.ShowDialog();
}
private void ProcessEditGraph(IGraph graph)
{
var window = new GraphView();
window.ShowDialog();
}
public object Clone()
{

View File

@@ -33,7 +33,7 @@
</Button>
</ToolBar>
<ToolBar ToolTip="Diagrams">
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" ToolTip="Diagrams">
<Button Style="{StaticResource ToolButton}" Command="{Binding AnalysesLogic.AddGraphEditorCommand}" ToolTip="Diagrams">
<Viewbox>
<ContentControl ContentTemplate="{DynamicResource Diagrams}"/>
</Viewbox>

View File

@@ -0,0 +1,16 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Analyses
{
public interface IEditor : ISaveable, ICloneable
{
string Name { get; set; }
string Tags { get; set; }
IVersionProcessor VersionProcessor { get; }
}
}

View File

@@ -0,0 +1,37 @@
using StructureHelperCommon.Models.Analyses;
using StructureHelperLogic.Models.Analyses;
using StructureHelperLogics.Models.Analyses;
using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.Models.Graphs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Editors
{
public class GraphEditorAnalysis : IAnalysis
{
public Guid Id { get; private set; }
public string Name { get; set; }
public string Tags { get; set; }
public IVersionProcessor VersionProcessor { get; private set; }
public GraphEditorAnalysis(Guid Id, IVersionProcessor versionProcessor)
{
this.Id = Id;
VersionProcessor = versionProcessor;
}
public GraphEditorAnalysis() : this(Guid.NewGuid(), new VersionProcessor())
{
Graph graph = new Graph();
VersionProcessor.AddVersion(graph);
}
public object Clone()
{
GraphEditorAnalysis newAnalysis = new();
//updateStrategy.Update(newAnalysis, this);
return newAnalysis;
}
}
}

View File

@@ -0,0 +1,22 @@
using StructureHelperLogics.Models.CrossSections;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Graphs
{
internal class Graph : IGraph
{
public Guid Id { get; private set; }
public Graph()
{
}
public object Clone()
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,14 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperLogics.Models.CrossSections;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Graphs
{
public interface IGraph : ISaveable, ICloneable
{
}
}