HyperGraph
Changes
HyperGraph.sln 14(+0 -14)
HyperGraphModel/Combinatorics.cs 40(+0 -40)
HyperGraphModel/Diagram/ClassDiagram.cd 33(+13 -20)
HyperGraphModel/HyperGraph.cs 3(+2 -1)
HyperGraphModel/Theorem.cs 14(+7 -7)
WPF/App.xaml.cs 4(+0 -4)
WPF/Common/Helpers/AppPaths.cs 2(+1 -1)
WPF/Common/Helpers/BringToFront.cs 2(+1 -1)
WPF/Common/Helpers/IniFile.cs 2(+1 -1)
WPF/Common/Helpers/MyExtensions.cs 2(+1 -1)
WPF/Common/Helpers/ProgressBar.cs 2(+1 -1)
WPF/Common/Helpers/QSort.cs 2(+1 -1)
WPF/Common/Helpers/SelfDiagnose.cs 2(+1 -1)
WPF/Common/Helpers/StatusBar.cs 2(+1 -1)
WPF/Common/Parameters/Parameter.cs 2(+1 -1)
WPF/Common/Parameters/Status.cs 2(+1 -1)
WPF/Common/WPF/BaseViewModel.cs 2(+1 -1)
WPF/Common/WPF/Dictionary.xaml 2(+1 -1)
WPF/Common/WPF/ModifyViewModel.cs 2(+1 -1)
WPF/Common/WPF/RelayCommand.cs 2(+1 -1)
WPF/Model/Calculate.cs 119(+61 -58)
WPF/Model/EnumTheorem.cs 9(+4 -5)
WPF/View/MainWindow.xaml 4(+2 -2)
WPF/View/MainWindow.xaml.cs 57(+0 -57)
WPF/ViewModel/MainViewModel.cs 102(+70 -32)
WPF/WPF.csproj 2(+1 -1)
Details
HyperGraph.sln 14(+0 -14)
diff --git a/HyperGraph.sln b/HyperGraph.sln
index 4c3cf45..bd53ff2 100644
--- a/HyperGraph.sln
+++ b/HyperGraph.sln
@@ -5,8 +5,6 @@ VisualStudioVersion = 16.0.30611.23
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF", "WPF\WPF.csproj", "{6086DC2B-27CD-43B8-BA7B-D6A41C92CE4B}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleTest", "ConsoleTest\ConsoleTest.csproj", "{DC20CE22-B876-4BEC-8E6E-1687AD4B5305}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HyperGraphModel", "HyperGraphModel\HyperGraphModel.csproj", "{09FECAA7-0025-45B4-A633-9F07EDB28C5A}"
EndProject
Global
@@ -31,18 +29,6 @@ Global
{6086DC2B-27CD-43B8-BA7B-D6A41C92CE4B}.Release|x64.Build.0 = Release|Any CPU
{6086DC2B-27CD-43B8-BA7B-D6A41C92CE4B}.Release|x86.ActiveCfg = Release|Any CPU
{6086DC2B-27CD-43B8-BA7B-D6A41C92CE4B}.Release|x86.Build.0 = Release|Any CPU
- {DC20CE22-B876-4BEC-8E6E-1687AD4B5305}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {DC20CE22-B876-4BEC-8E6E-1687AD4B5305}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {DC20CE22-B876-4BEC-8E6E-1687AD4B5305}.Debug|x64.ActiveCfg = Debug|Any CPU
- {DC20CE22-B876-4BEC-8E6E-1687AD4B5305}.Debug|x64.Build.0 = Debug|Any CPU
- {DC20CE22-B876-4BEC-8E6E-1687AD4B5305}.Debug|x86.ActiveCfg = Debug|Any CPU
- {DC20CE22-B876-4BEC-8E6E-1687AD4B5305}.Debug|x86.Build.0 = Debug|Any CPU
- {DC20CE22-B876-4BEC-8E6E-1687AD4B5305}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {DC20CE22-B876-4BEC-8E6E-1687AD4B5305}.Release|Any CPU.Build.0 = Release|Any CPU
- {DC20CE22-B876-4BEC-8E6E-1687AD4B5305}.Release|x64.ActiveCfg = Release|Any CPU
- {DC20CE22-B876-4BEC-8E6E-1687AD4B5305}.Release|x64.Build.0 = Release|Any CPU
- {DC20CE22-B876-4BEC-8E6E-1687AD4B5305}.Release|x86.ActiveCfg = Release|Any CPU
- {DC20CE22-B876-4BEC-8E6E-1687AD4B5305}.Release|x86.Build.0 = Release|Any CPU
{09FECAA7-0025-45B4-A633-9F07EDB28C5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{09FECAA7-0025-45B4-A633-9F07EDB28C5A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{09FECAA7-0025-45B4-A633-9F07EDB28C5A}.Debug|x64.ActiveCfg = Debug|Any CPU
HyperGraphModel/Combinatorics.cs 40(+0 -40)
diff --git a/HyperGraphModel/Combinatorics.cs b/HyperGraphModel/Combinatorics.cs
index e225822..0e1fc69 100644
--- a/HyperGraphModel/Combinatorics.cs
+++ b/HyperGraphModel/Combinatorics.cs
@@ -118,45 +118,5 @@ namespace HyperGraphModel
test2.Add(minus(a.Take(m).ToList()));
return test2;
}
-
- /// <summary>
- /// Маска, позволяющая перебрать множество сочетаний элементов без повторений
- /// </summary>
- /// <param name="n">Мощность множества элементов</param>
- /// <param name="m">По скольку элементов нужно сочетать выборку</param>
- /// <returns>Вернет двумерный список размера n^m, где каждый список имеет размер m</returns>
- public static List<List<int>> СombinationWithoutReplays(int n, int m)
- {
- List<List<int>> test2 = new List<List<int>>();
- bool NextSet(int[] aa, int nn, int mm)
- {
- int k = mm;
- for (int i = k - 1; i >= 0; --i)
- if (aa[i] < nn - k + i + 1)
- {
- aa[i]++;
- for (int j = i + 1; j < k; j++)
- aa[j] = aa[j - 1] + 1;
- return true;
- }
- return false;
- }
- List<int> minus(List<int> from)
- {
- for (int i = 0; i < from.Count; i++)
- from[i]--;
- return from;
- }
- int[] a = new int[n];
- for (int i = 0; i < n; i++)
- a[i] = i + 1;
- test2.Add(minus(a.Take(m).ToList()));
- if (n >= m)
- {
- while (NextSet(a, n, m))
- test2.Add(minus(a.Take(m).ToList()));
- }
- return test2;
- }
}
}
diff --git a/HyperGraphModel/Diagram/class diagram.graphml b/HyperGraphModel/Diagram/class diagram.graphml
index c21fc5c..762eb0e 100644
--- a/HyperGraphModel/Diagram/class diagram.graphml
+++ b/HyperGraphModel/Diagram/class diagram.graphml
@@ -25,8 +25,8 @@
- Factorial() : long
- Pow() : long
+ isEqualNumberOfVertices() : bool
- + TheoremAutomorphism() : TheoremAuto
- + TheoremAutomorphismForEqualNumberOfVertices() : TheoremAuto
+ + TheoremSecond() : TheoremAuto
+ + TheoremThird() : TheoremAuto
</y:NodeLabel>
<y:StyleProperties>
<y:Property class="java.lang.Boolean" name="y.view.ShadowNodePainter.SHADOW_PAINTING" value="false"/>
HyperGraphModel/HyperGraph.cs 3(+2 -1)
diff --git a/HyperGraphModel/HyperGraph.cs b/HyperGraphModel/HyperGraph.cs
index 19e5378..1879d28 100644
--- a/HyperGraphModel/HyperGraph.cs
+++ b/HyperGraphModel/HyperGraph.cs
@@ -46,7 +46,8 @@ namespace HyperGraphModel
this.Dispose();
}
- public bool IsEqualNumberOfVertices { get => Theorem.isEqualNumberOfVertices(this); }
+ // Свойство, выполняющее проверку, равномощны ли ребра графа
+ public bool IsEqualNumberOfVertices { get => Theorem.IsEqualNumberOfVertices(this); }
// Очистка памяти
public void Dispose()
diff --git a/HyperGraphModel/HyperGraphModel.csproj b/HyperGraphModel/HyperGraphModel.csproj
index 431430c..4cf1b52 100644
--- a/HyperGraphModel/HyperGraphModel.csproj
+++ b/HyperGraphModel/HyperGraphModel.csproj
@@ -52,8 +52,8 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
- <None Include="Diagram\Class Diagram.cd" />
<None Include="Diagram\class diagram.graphml" />
+ <None Include="Diagram\ClassDiagram.cd" />
</ItemGroup>
<ItemGroup>
<Content Include="Diagram\class diagram.jpg" />
HyperGraphModel/Theorem.cs 14(+7 -7)
diff --git a/HyperGraphModel/Theorem.cs b/HyperGraphModel/Theorem.cs
index 3384780..1a13edf 100644
--- a/HyperGraphModel/Theorem.cs
+++ b/HyperGraphModel/Theorem.cs
@@ -21,9 +21,9 @@ namespace HyperGraphModel
public HyperGraph GraphWithoutAutoEdges;
}
- public static TheoremAuto TheoremAutomorphism(HyperGraph Graph)
+ public static TheoremAuto TheoremSecond(HyperGraph Graph)
{
- if (Theorem.isEqualNumberOfVertices(Graph))
+ if (Theorem.IsEqualNumberOfVertices(Graph))
{
return default;
}
@@ -69,9 +69,9 @@ namespace HyperGraphModel
return result;
}
- public static TheoremAuto TheoremAutomorphismForEqualNumberOfVertices(HyperGraph Graph)
+ public static TheoremAuto TheoremThird(HyperGraph Graph)
{
- if (!Theorem.isEqualNumberOfVertices(Graph))
+ if (!Theorem.IsEqualNumberOfVertices(Graph))
{
return default;
}
@@ -129,7 +129,7 @@ namespace HyperGraphModel
public static TheoremAuto TheoremForth(HyperGraph Graph)
{
- if (Theorem.isEqualNumberOfVertices(Graph))
+ if (Theorem.IsEqualNumberOfVertices(Graph))
{
return default;
}
@@ -191,7 +191,7 @@ namespace HyperGraphModel
public static TheoremAuto TheoremFifth(HyperGraph Graph)
{
- if (!Theorem.isEqualNumberOfVertices(Graph))
+ if (!Theorem.IsEqualNumberOfVertices(Graph))
{
return default;
}
@@ -261,7 +261,7 @@ namespace HyperGraphModel
return result;
}
- public static bool isEqualNumberOfVertices(HyperGraph Graph)
+ public static bool IsEqualNumberOfVertices(HyperGraph Graph)
{
int count = Graph.HyperEdge[0].Count;
foreach (var hyperedge in Graph.HyperEdge)
WPF/App.xaml.cs 4(+0 -4)
diff --git a/WPF/App.xaml.cs b/WPF/App.xaml.cs
index 3a730d1..2752e51 100644
--- a/WPF/App.xaml.cs
+++ b/WPF/App.xaml.cs
@@ -13,10 +13,6 @@ namespace WPF
/// </summary>
public partial class App : Application
{
- //public static string BackupDirPath { get { return System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"Passwords"); } }
- //public static int BackupMaxCount { get { return 10; } }
- //public static string DataFilePath { get { return System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Uri.UnescapeDataString(new System.UriBuilder(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).Path)), "data.pw"); } }
-
void Application_Startup(object sender, StartupEventArgs e)
{
StartupUri = new Uri("View/MainWindow.xaml", UriKind.Relative);
WPF/Common/Helpers/AppPaths.cs 2(+1 -1)
diff --git a/WPF/Common/Helpers/AppPaths.cs b/WPF/Common/Helpers/AppPaths.cs
index 0dc7f18..6effa5f 100644
--- a/WPF/Common/Helpers/AppPaths.cs
+++ b/WPF/Common/Helpers/AppPaths.cs
@@ -2,7 +2,7 @@
using System.IO;
using System.Xml.Linq;
-namespace Common.Helpers
+namespace WPF.Common.Helpers
{
public static class AppPaths
{
WPF/Common/Helpers/BringToFront.cs 2(+1 -1)
diff --git a/WPF/Common/Helpers/BringToFront.cs b/WPF/Common/Helpers/BringToFront.cs
index f465227..08b8f19 100644
--- a/WPF/Common/Helpers/BringToFront.cs
+++ b/WPF/Common/Helpers/BringToFront.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
-namespace Common.Helpers
+namespace WPF.Common.Helpers
{
public static class BringToFront
{
WPF/Common/Helpers/IniFile.cs 2(+1 -1)
diff --git a/WPF/Common/Helpers/IniFile.cs b/WPF/Common/Helpers/IniFile.cs
index aad574f..e189405 100644
--- a/WPF/Common/Helpers/IniFile.cs
+++ b/WPF/Common/Helpers/IniFile.cs
@@ -5,7 +5,7 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Text;
-namespace Common.Helpers
+namespace WPF.Common.Helpers
{
public class IniFile
{
WPF/Common/Helpers/MyExtensions.cs 2(+1 -1)
diff --git a/WPF/Common/Helpers/MyExtensions.cs b/WPF/Common/Helpers/MyExtensions.cs
index 1536c79..9462ee9 100644
--- a/WPF/Common/Helpers/MyExtensions.cs
+++ b/WPF/Common/Helpers/MyExtensions.cs
@@ -4,7 +4,7 @@ using System.Drawing.Text;
using System.Linq;
using System.Text.RegularExpressions;
-namespace Common.Helpers
+namespace WPF.Common.Helpers
{
public static class MyExtensions
{
WPF/Common/Helpers/ProgressBar.cs 2(+1 -1)
diff --git a/WPF/Common/Helpers/ProgressBar.cs b/WPF/Common/Helpers/ProgressBar.cs
index 7ef95ba..67d707f 100644
--- a/WPF/Common/Helpers/ProgressBar.cs
+++ b/WPF/Common/Helpers/ProgressBar.cs
@@ -1,6 +1,6 @@
using System.ComponentModel;
-namespace Common.Helpers
+namespace WPF.Common.Helpers
{
public class ProgressBar : INotifyPropertyChanged
{
WPF/Common/Helpers/QSort.cs 2(+1 -1)
diff --git a/WPF/Common/Helpers/QSort.cs b/WPF/Common/Helpers/QSort.cs
index b6599c6..0a26e21 100644
--- a/WPF/Common/Helpers/QSort.cs
+++ b/WPF/Common/Helpers/QSort.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
-namespace Common.Helpers
+namespace WPF.Common.Helpers
{
public delegate int ItemComparer<in T>(T a, T b);
public delegate void Swap<T>(IList<T> elements, int index1, int index2);
WPF/Common/Helpers/SelfDiagnose.cs 2(+1 -1)
diff --git a/WPF/Common/Helpers/SelfDiagnose.cs b/WPF/Common/Helpers/SelfDiagnose.cs
index 06d3938..92d8a82 100644
--- a/WPF/Common/Helpers/SelfDiagnose.cs
+++ b/WPF/Common/Helpers/SelfDiagnose.cs
@@ -1,7 +1,7 @@
using System.IO;
using System.Windows.Forms;
-namespace Common.Helpers
+namespace WPF.Common.Helpers
{
public static class SelfDiagnose
{
WPF/Common/Helpers/StatusBar.cs 2(+1 -1)
diff --git a/WPF/Common/Helpers/StatusBar.cs b/WPF/Common/Helpers/StatusBar.cs
index af1c81f..c3f9bd0 100644
--- a/WPF/Common/Helpers/StatusBar.cs
+++ b/WPF/Common/Helpers/StatusBar.cs
@@ -4,7 +4,7 @@ using System.ComponentModel;
using System.Linq;
using System.Text;
-namespace Common.Helpers
+namespace WPF.Common.Helpers
{
public class StatusBar : INotifyPropertyChanged
{
WPF/Common/Parameters/Parameter.cs 2(+1 -1)
diff --git a/WPF/Common/Parameters/Parameter.cs b/WPF/Common/Parameters/Parameter.cs
index ea341ec..5e3b00a 100644
--- a/WPF/Common/Parameters/Parameter.cs
+++ b/WPF/Common/Parameters/Parameter.cs
@@ -1,7 +1,7 @@
using System;
using System.ComponentModel;
-namespace Common.Parameters
+namespace WPF.Common.Parameters
{
public abstract class Parameter : INotifyPropertyChanged
diff --git a/WPF/Common/Parameters/ParameterBool.cs b/WPF/Common/Parameters/ParameterBool.cs
index cf4e024..d1d32d8 100644
--- a/WPF/Common/Parameters/ParameterBool.cs
+++ b/WPF/Common/Parameters/ParameterBool.cs
@@ -1,6 +1,6 @@
using System;
-namespace Common.Parameters
+namespace WPF.Common.Parameters
{
[Serializable]
public class ParameterBool : Parameter
diff --git a/WPF/Common/Parameters/ParameterDouble.cs b/WPF/Common/Parameters/ParameterDouble.cs
index 96b407c..8cc0b06 100644
--- a/WPF/Common/Parameters/ParameterDouble.cs
+++ b/WPF/Common/Parameters/ParameterDouble.cs
@@ -1,6 +1,6 @@
using System;
-namespace Common.Parameters
+namespace WPF.Common.Parameters
{
[Serializable]
public class ParameterDouble : Parameter
diff --git a/WPF/Common/Parameters/ParameterInt.cs b/WPF/Common/Parameters/ParameterInt.cs
index 7758f3d..2b7defe 100644
--- a/WPF/Common/Parameters/ParameterInt.cs
+++ b/WPF/Common/Parameters/ParameterInt.cs
@@ -1,6 +1,6 @@
using System;
-namespace Common.Parameters
+namespace WPF.Common.Parameters
{
[Serializable]
public class ParameterInt: Parameter
diff --git a/WPF/Common/Parameters/ParameterRange.cs b/WPF/Common/Parameters/ParameterRange.cs
index 10f0467..0f59a2c 100644
--- a/WPF/Common/Parameters/ParameterRange.cs
+++ b/WPF/Common/Parameters/ParameterRange.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
-namespace Common.Parameters
+namespace WPF.Common.Parameters
{
public class ParameterRange : Parameter
{
diff --git a/WPF/Common/Parameters/ParameterString.cs b/WPF/Common/Parameters/ParameterString.cs
index 7a8e012..98101be 100644
--- a/WPF/Common/Parameters/ParameterString.cs
+++ b/WPF/Common/Parameters/ParameterString.cs
@@ -1,6 +1,6 @@
using System;
-namespace Common.Parameters
+namespace WPF.Common.Parameters
{
[Serializable]
public class ParameterString : Parameter
WPF/Common/Parameters/Status.cs 2(+1 -1)
diff --git a/WPF/Common/Parameters/Status.cs b/WPF/Common/Parameters/Status.cs
index e0c7d74..2730943 100644
--- a/WPF/Common/Parameters/Status.cs
+++ b/WPF/Common/Parameters/Status.cs
@@ -1,4 +1,4 @@
-namespace Common
+namespace WPF.Common
{
public enum Status
{
WPF/Common/WPF/BaseViewModel.cs 2(+1 -1)
diff --git a/WPF/Common/WPF/BaseViewModel.cs b/WPF/Common/WPF/BaseViewModel.cs
index 900de8e..4fb0ca2 100644
--- a/WPF/Common/WPF/BaseViewModel.cs
+++ b/WPF/Common/WPF/BaseViewModel.cs
@@ -6,7 +6,7 @@ using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Input;
-namespace Common.WPF
+namespace WPF.Common.WPF
{
public abstract class BaseViewModel : INotifyPropertyChanged
{
diff --git a/WPF/Common/WPF/Controls/CaptionButtons.xaml b/WPF/Common/WPF/Controls/CaptionButtons.xaml
index e1b3666..dd812f3 100644
--- a/WPF/Common/WPF/Controls/CaptionButtons.xaml
+++ b/WPF/Common/WPF/Controls/CaptionButtons.xaml
@@ -1,4 +1,4 @@
-<UserControl x:Class="Common.WPF.Controls.CaptionButtons"
+<UserControl x:Class="WPF.Common.WPF.Controls.CaptionButtons"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
diff --git a/WPF/Common/WPF/Controls/CaptionButtons.xaml.cs b/WPF/Common/WPF/Controls/CaptionButtons.xaml.cs
index 3ba89d1..b05c8e3 100644
--- a/WPF/Common/WPF/Controls/CaptionButtons.xaml.cs
+++ b/WPF/Common/WPF/Controls/CaptionButtons.xaml.cs
@@ -1,7 +1,7 @@
using System.Windows;
// ReSharper disable UnusedMember.Global
-namespace Common.WPF.Controls
+namespace WPF.Common.WPF.Controls
{
/// <summary>
/// Interaction logic for CaptionButtons.xaml
diff --git a/WPF/Common/WPF/Controls/EditorPresenter.cs b/WPF/Common/WPF/Controls/EditorPresenter.cs
index 49dd91e..20869f0 100644
--- a/WPF/Common/WPF/Controls/EditorPresenter.cs
+++ b/WPF/Common/WPF/Controls/EditorPresenter.cs
@@ -4,7 +4,7 @@ using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
-namespace Common.WPF.Controls
+namespace WPF.Common.WPF.Controls
{
public class EditorPresenter : Control
{
diff --git a/WPF/Common/WPF/Controls/TreeGridViewRowPresenter.cs b/WPF/Common/WPF/Controls/TreeGridViewRowPresenter.cs
index b65d307..42c3140 100644
--- a/WPF/Common/WPF/Controls/TreeGridViewRowPresenter.cs
+++ b/WPF/Common/WPF/Controls/TreeGridViewRowPresenter.cs
@@ -7,7 +7,7 @@ using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;
-namespace Common.WPF.Controls
+namespace WPF.Common.WPF.Controls
{
public class TreeGridViewRowPresenter : GridViewRowPresenter
{
diff --git a/WPF/Common/WPF/Controls/TreeList/IItemComparer.cs b/WPF/Common/WPF/Controls/TreeList/IItemComparer.cs
index e61c43b..d8d6c92 100644
--- a/WPF/Common/WPF/Controls/TreeList/IItemComparer.cs
+++ b/WPF/Common/WPF/Controls/TreeList/IItemComparer.cs
@@ -1,4 +1,4 @@
-namespace Common.WPF.Controls.TreeList
+namespace WPF.Common.WPF.Controls.TreeList
{
public interface IItemComparer
{
diff --git a/WPF/Common/WPF/Controls/TreeList/ITreeList.cs b/WPF/Common/WPF/Controls/TreeList/ITreeList.cs
index c479736..3720338 100644
--- a/WPF/Common/WPF/Controls/TreeList/ITreeList.cs
+++ b/WPF/Common/WPF/Controls/TreeList/ITreeList.cs
@@ -1,4 +1,4 @@
-namespace Common.WPF.Controls.TreeList
+namespace WPF.Common.WPF.Controls.TreeList
{
public interface ITreeList
{
diff --git a/WPF/Common/WPF/Controls/TreeList/RootTreeNodeViewModel.cs b/WPF/Common/WPF/Controls/TreeList/RootTreeNodeViewModel.cs
index e8305d3..af28916 100644
--- a/WPF/Common/WPF/Controls/TreeList/RootTreeNodeViewModel.cs
+++ b/WPF/Common/WPF/Controls/TreeList/RootTreeNodeViewModel.cs
@@ -4,7 +4,7 @@ using System.Collections.Specialized;
using System.ComponentModel;
using System.Windows.Controls;
-namespace Common.WPF.Controls.TreeList
+namespace WPF.Common.WPF.Controls.TreeList
{
public class RootTreeNodeViewModel : TreeNodeViewModel, ITreeList
{
diff --git a/WPF/Common/WPF/Controls/TreeList/RowExpander.cs b/WPF/Common/WPF/Controls/TreeList/RowExpander.cs
index 2b271c0..6aa6bef 100644
--- a/WPF/Common/WPF/Controls/TreeList/RowExpander.cs
+++ b/WPF/Common/WPF/Controls/TreeList/RowExpander.cs
@@ -1,7 +1,7 @@
using System.Windows;
using System.Windows.Controls;
-namespace Common.WPF.Controls.TreeList
+namespace WPF.Common.WPF.Controls.TreeList
{
public class RowExpander : Control
{
diff --git a/WPF/Common/WPF/Controls/TreeList/SortBehavior.cs b/WPF/Common/WPF/Controls/TreeList/SortBehavior.cs
index bd9670f..aed6c2e 100644
--- a/WPF/Common/WPF/Controls/TreeList/SortBehavior.cs
+++ b/WPF/Common/WPF/Controls/TreeList/SortBehavior.cs
@@ -4,7 +4,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
-namespace Common.WPF.Controls.TreeList
+namespace WPF.Common.WPF.Controls.TreeList
{
public static class SortBehavior
{
diff --git a/WPF/Common/WPF/Controls/TreeList/TreeItemCollection.cs b/WPF/Common/WPF/Controls/TreeList/TreeItemCollection.cs
index 6f92506..2b8ff12 100644
--- a/WPF/Common/WPF/Controls/TreeList/TreeItemCollection.cs
+++ b/WPF/Common/WPF/Controls/TreeList/TreeItemCollection.cs
@@ -1,6 +1,6 @@
using System;
-namespace Common.WPF.Controls.TreeList
+namespace WPF.Common.WPF.Controls.TreeList
{
public class TreeItemCollection : ObservableCollectionAdv<TreeNodeViewModel>
{
diff --git a/WPF/Common/WPF/Controls/TreeList/TreeList.cs b/WPF/Common/WPF/Controls/TreeList/TreeList.cs
index 66bbeac..73a2568 100644
--- a/WPF/Common/WPF/Controls/TreeList/TreeList.cs
+++ b/WPF/Common/WPF/Controls/TreeList/TreeList.cs
@@ -6,7 +6,7 @@ using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Input;
-namespace Common.WPF.Controls.TreeList
+namespace WPF.Common.WPF.Controls.TreeList
{
public class TreeList : ListView, ITreeList
{
diff --git a/WPF/Common/WPF/Controls/TreeList/TreeListItem.cs b/WPF/Common/WPF/Controls/TreeList/TreeListItem.cs
index 88bc30c..a893f67 100644
--- a/WPF/Common/WPF/Controls/TreeList/TreeListItem.cs
+++ b/WPF/Common/WPF/Controls/TreeList/TreeListItem.cs
@@ -3,7 +3,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
-namespace Common.WPF.Controls.TreeList
+namespace WPF.Common.WPF.Controls.TreeList
{
public class TreeListItem : ListViewItem, INotifyPropertyChanged
{
diff --git a/WPF/Common/WPF/Controls/TreeList/TreeNodeViewModel.cs b/WPF/Common/WPF/Controls/TreeList/TreeNodeViewModel.cs
index fa9ea6c..902e65d 100644
--- a/WPF/Common/WPF/Controls/TreeList/TreeNodeViewModel.cs
+++ b/WPF/Common/WPF/Controls/TreeList/TreeNodeViewModel.cs
@@ -1,11 +1,11 @@
-using Common.Helpers;
+using WPF.Common.Helpers;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
-namespace Common.WPF.Controls.TreeList
+namespace WPF.Common.WPF.Controls.TreeList
{
public class TreeNodeViewModel : BaseViewModel, IDisposable
{
diff --git a/WPF/Common/WPF/Converters/BoolToVisibilityConverter.cs b/WPF/Common/WPF/Converters/BoolToVisibilityConverter.cs
index b12dc49..0713057 100644
--- a/WPF/Common/WPF/Converters/BoolToVisibilityConverter.cs
+++ b/WPF/Common/WPF/Converters/BoolToVisibilityConverter.cs
@@ -2,7 +2,7 @@
using System.Windows;
using System.Windows.Data;
-namespace Common.WPF.Converters
+namespace WPF.Common.WPF.Converters
{
public class BoolToVisibilityConverter : IValueConverter
{
diff --git a/WPF/Common/WPF/Converters/CanExpandConverter.cs b/WPF/Common/WPF/Converters/CanExpandConverter.cs
index b6782ff..0a7044c 100644
--- a/WPF/Common/WPF/Converters/CanExpandConverter.cs
+++ b/WPF/Common/WPF/Converters/CanExpandConverter.cs
@@ -3,7 +3,7 @@ using System.Globalization;
using System.Windows;
using System.Windows.Data;
-namespace Common.WPF.Converters
+namespace WPF.Common.WPF.Converters
{
public class CanExpandConverter : IValueConverter
{
diff --git a/WPF/Common/WPF/Converters/ColorToBrushConverter.cs b/WPF/Common/WPF/Converters/ColorToBrushConverter.cs
index 515aff7..0f5f87c 100644
--- a/WPF/Common/WPF/Converters/ColorToBrushConverter.cs
+++ b/WPF/Common/WPF/Converters/ColorToBrushConverter.cs
@@ -3,7 +3,7 @@ using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
-namespace Common.WPF.Converters
+namespace WPF.Common.WPF.Converters
{
public class ColorToBrushConverter : IValueConverter
{
diff --git a/WPF/Common/WPF/Converters/ColumnWidthConverter.cs b/WPF/Common/WPF/Converters/ColumnWidthConverter.cs
index 10171e6..6e079c9 100644
--- a/WPF/Common/WPF/Converters/ColumnWidthConverter.cs
+++ b/WPF/Common/WPF/Converters/ColumnWidthConverter.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Windows.Data;
-namespace Common.WPF.Converters
+namespace WPF.Common.WPF.Converters
{
/// <summary>
/// This converter targets a column header,
diff --git a/WPF/Common/WPF/Converters/EnumToDescrConverter.cs b/WPF/Common/WPF/Converters/EnumToDescrConverter.cs
index 95eeda0..f8253eb 100644
--- a/WPF/Common/WPF/Converters/EnumToDescrConverter.cs
+++ b/WPF/Common/WPF/Converters/EnumToDescrConverter.cs
@@ -12,7 +12,7 @@ using System.ComponentModel;
using System.Reflection;
using System.Windows.Data;
-namespace Common.WPF.Converters
+namespace WPF.Common.WPF.Converters
{
public class EnumToDescriptionConverter: IValueConverter
{
diff --git a/WPF/Common/WPF/Converters/InverseBooleanConverter.cs b/WPF/Common/WPF/Converters/InverseBooleanConverter.cs
index 9398fd8..c4e3701 100644
--- a/WPF/Common/WPF/Converters/InverseBooleanConverter.cs
+++ b/WPF/Common/WPF/Converters/InverseBooleanConverter.cs
@@ -2,7 +2,7 @@
using System.Globalization;
using System.Windows.Data;
-namespace Common.WPF.Converters
+namespace WPF.Common.WPF.Converters
{
public class InverseBooleanConverter : IValueConverter
{
diff --git a/WPF/Common/WPF/Converters/InversedBoolToVisibilityConverter.cs b/WPF/Common/WPF/Converters/InversedBoolToVisibilityConverter.cs
index 9b37f06..9aa7256 100644
--- a/WPF/Common/WPF/Converters/InversedBoolToVisibilityConverter.cs
+++ b/WPF/Common/WPF/Converters/InversedBoolToVisibilityConverter.cs
@@ -2,7 +2,7 @@
using System.Windows;
using System.Windows.Data;
-namespace Common.WPF.Converters
+namespace WPF.Common.WPF.Converters
{
public class InversedBoolToVisibilityConverter : IValueConverter
{
diff --git a/WPF/Common/WPF/Converters/LevelToIndentConverter.cs b/WPF/Common/WPF/Converters/LevelToIndentConverter.cs
index d7297ea..0f3a39f 100644
--- a/WPF/Common/WPF/Converters/LevelToIndentConverter.cs
+++ b/WPF/Common/WPF/Converters/LevelToIndentConverter.cs
@@ -2,7 +2,7 @@
using System.Globalization;
using System.Windows.Data;
-namespace Common.WPF.Converters
+namespace WPF.Common.WPF.Converters
{
/// <summary>
/// Convert Level to left margin
diff --git a/WPF/Common/WPF/Converters/RadioButtonToIntConverter.cs b/WPF/Common/WPF/Converters/RadioButtonToIntConverter.cs
index cdd86bb..e34da4c 100644
--- a/WPF/Common/WPF/Converters/RadioButtonToIntConverter.cs
+++ b/WPF/Common/WPF/Converters/RadioButtonToIntConverter.cs
@@ -5,7 +5,7 @@ using System.Linq;
using System.Text;
using System.Windows.Data;
-namespace Common.WPF.Converters
+namespace WPF.Common.WPF.Converters
{
public class RadioButtonToIntConverter : IValueConverter
{
diff --git a/WPF/Common/WPF/Converters/RoundProgressPathConverter.cs b/WPF/Common/WPF/Converters/RoundProgressPathConverter.cs
index e759242..c0633af 100644
--- a/WPF/Common/WPF/Converters/RoundProgressPathConverter.cs
+++ b/WPF/Common/WPF/Converters/RoundProgressPathConverter.cs
@@ -4,7 +4,7 @@ using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
-namespace Common.WPF.Converters
+namespace WPF.Common.WPF.Converters
{
public class RoundProgressPathConverter : IMultiValueConverter
{
diff --git a/WPF/Common/WPF/Converters/StatusToColorConverter.cs b/WPF/Common/WPF/Converters/StatusToColorConverter.cs
index cf73b10..9d1aef5 100644
--- a/WPF/Common/WPF/Converters/StatusToColorConverter.cs
+++ b/WPF/Common/WPF/Converters/StatusToColorConverter.cs
@@ -1,10 +1,10 @@
-using Common.Helpers;
+using WPF.Common.Helpers;
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
-namespace Common.WPF.Converters
+namespace WPF.Common.WPF.Converters
{
public class StatusToColorConverter : IValueConverter
{
diff --git a/WPF/Common/WPF/Converters/ValueConverter.cs b/WPF/Common/WPF/Converters/ValueConverter.cs
index a8d0094..b0ed8b7 100644
--- a/WPF/Common/WPF/Converters/ValueConverter.cs
+++ b/WPF/Common/WPF/Converters/ValueConverter.cs
@@ -1,7 +1,7 @@
using System;
using System.Windows.Data;
-namespace Common.WPF.Converters
+namespace WPF.Common.WPF.Converters
{
public class IntToStringConverter : IValueConverter
{
WPF/Common/WPF/Dictionary.xaml 2(+1 -1)
diff --git a/WPF/Common/WPF/Dictionary.xaml b/WPF/Common/WPF/Dictionary.xaml
index 9ead7c0..994378c 100644
--- a/WPF/Common/WPF/Dictionary.xaml
+++ b/WPF/Common/WPF/Dictionary.xaml
@@ -1,6 +1,6 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:converters="clr-namespace:Common.WPF.Converters">
+ xmlns:converters="clr-namespace:WPF.Common.WPF.Converters">
<!--<conv:DoubleConverter x:Key="DoubleConverter"/>-->
<converters:IntToStringConverter x:Key="IntToStringConverter"/>
<converters:RoundProgressPathConverter x:Key="RoundProgressPathConverter"/>
diff --git a/WPF/Common/WPF/IEditingBaseViewModel.cs b/WPF/Common/WPF/IEditingBaseViewModel.cs
index 7559f8f..48ba44f 100644
--- a/WPF/Common/WPF/IEditingBaseViewModel.cs
+++ b/WPF/Common/WPF/IEditingBaseViewModel.cs
@@ -1,4 +1,4 @@
-namespace Common.WPF
+namespace WPF.Common.WPF
{
public interface IEditingBaseViewModel
{
WPF/Common/WPF/ModifyViewModel.cs 2(+1 -1)
diff --git a/WPF/Common/WPF/ModifyViewModel.cs b/WPF/Common/WPF/ModifyViewModel.cs
index 9a7e833..2a09a24 100644
--- a/WPF/Common/WPF/ModifyViewModel.cs
+++ b/WPF/Common/WPF/ModifyViewModel.cs
@@ -1,6 +1,6 @@
using System.Windows;
-namespace Common.WPF
+namespace WPF.Common.WPF
{
public class ModifyViewModel : BaseViewModel
{
diff --git a/WPF/Common/WPF/NotifyPropertyChangedHelper.cs b/WPF/Common/WPF/NotifyPropertyChangedHelper.cs
index 182c9cd..e66cca7 100644
--- a/WPF/Common/WPF/NotifyPropertyChangedHelper.cs
+++ b/WPF/Common/WPF/NotifyPropertyChangedHelper.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel;
-namespace Common.WPF
+namespace WPF.Common.WPF
{
public class NotifyPropertyChangedHelper
{
diff --git a/WPF/Common/WPF/ObservableCollectionAdv.cs b/WPF/Common/WPF/ObservableCollectionAdv.cs
index 135009b..49ed05b 100644
--- a/WPF/Common/WPF/ObservableCollectionAdv.cs
+++ b/WPF/Common/WPF/ObservableCollectionAdv.cs
@@ -5,7 +5,7 @@ using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
-namespace Common.WPF
+namespace WPF.Common.WPF
{
public class ObservableCollectionAdv<T> : ObservableCollection<T>
{
WPF/Common/WPF/RelayCommand.cs 2(+1 -1)
diff --git a/WPF/Common/WPF/RelayCommand.cs b/WPF/Common/WPF/RelayCommand.cs
index 3832826..801a441 100644
--- a/WPF/Common/WPF/RelayCommand.cs
+++ b/WPF/Common/WPF/RelayCommand.cs
@@ -3,7 +3,7 @@ using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
-namespace Common.WPF
+namespace WPF.Common.WPF
{
public delegate bool PredicateDelegate();
public class RelayCommand : ICommand
diff --git a/WPF/Common/WPF/Style/ProgressbarStyle.xaml b/WPF/Common/WPF/Style/ProgressbarStyle.xaml
index a471427..3c08a80 100644
--- a/WPF/Common/WPF/Style/ProgressbarStyle.xaml
+++ b/WPF/Common/WPF/Style/ProgressbarStyle.xaml
@@ -1,7 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:PasswordApp.WPF.Style"
- xmlns:converters="clr-namespace:Common.WPF.Converters">
+ xmlns:converters="clr-namespace:WPF.Common.WPF.Converters">
<Style x:Key="RoundProgressBarStyle" TargetType="{x:Type ProgressBar}"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<Style.Resources>
diff --git a/WPF/Common/WPF/Style/WindowStyle.xaml b/WPF/Common/WPF/Style/WindowStyle.xaml
index beb6b3d..95bd0a7 100644
--- a/WPF/Common/WPF/Style/WindowStyle.xaml
+++ b/WPF/Common/WPF/Style/WindowStyle.xaml
@@ -1,7 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:shell="clr-namespace:Microsoft.Windows.Shell;assembly=Microsoft.Windows.Shell"
- xmlns:controls="clr-namespace:Common.WPF.Controls">
+ xmlns:controls="clr-namespace:WPF.Common.WPF.Controls">
<Style x:Key="MainWindowStyle" TargetType="{x:Type Window}">
<Setter Property="shell:WindowChrome.WindowChrome">
WPF/Model/Calculate.cs 119(+61 -58)
diff --git a/WPF/Model/Calculate.cs b/WPF/Model/Calculate.cs
index 8922076..47937f8 100644
--- a/WPF/Model/Calculate.cs
+++ b/WPF/Model/Calculate.cs
@@ -9,10 +9,22 @@ using TheoremAuto = HyperGraphModel.Theorem.TheoremAuto;
namespace WPF.Model
{
+ /// <summary>
+ /// Класс работы с гиперграфом.
+ /// Выполняет создание, наполнение гиперграфа, запускает расчет теорем, выполняет экспорт данных.
+ /// </summary>
public static class Calculate
{
+ // Статичный объект гиперграф
public static HyperGraph Graph { get; private set; } = new HyperGraph(new Matrix<int>());
+ /// <summary>
+ /// Создание и наполнение гиперграфа по вводным данным
+ /// </summary>
+ /// <param name="Edges">Число гиперребер</param>
+ /// <param name="SameVert">Число общих или пересекающихся вершин</param>
+ /// <param name="Verticies">Список числа вершин для каждого ребра</param>
+ /// <param name="SelectedTheorem">Тип выбранной теоремы. Влияет на наполнение графа (для общих верешин или для пересекающихся).</param>
public static void CreateGraph(int Edges, int SameVert, List<int> Verticies, EnumTheorem SelectedTheorem)
{
try
@@ -57,10 +69,6 @@ namespace WPF.Model
matrix[i++ % vert, j] = 1;
k++;
}
- //using (System.IO.StreamWriter wr = new StreamWriter(@"D:\test.txt"))
- //{
- // for (int o = 0; o < matrix.countRow; o++) { for (int h = 0; h < matrix.countColumn; h++) wr.Write($"{matrix[o, h]} "); wr.WriteLine(); }
- //}
}
}
}
@@ -74,65 +82,38 @@ namespace WPF.Model
}
}
- public static TheoremAuto TheoremSecond()
+ /// <summary>
+ /// Запускает расчет теорем
+ /// </summary>
+ /// <param name="SelectedTheorem">Тип выбранной теоремы</param>
+ /// <returns>Значение либо положительное, либо default</returns>
+ public static TheoremAuto GetTheoremResult(EnumTheorem SelectedTheorem)
{
try
{
if (Graph == null)
throw new Exception("Гипер граф не существует");
- return Theorem.TheoremAutomorphism(Graph);
- }
- catch (Exception e)
- {
- MainViewModel.Current.Status = Common.Status.Error;
- MainViewModel.Current.StatusMessage = e.Message;
- return default;
- }
- }
-
- public static TheoremAuto TheoremThird()
- {
- try
- {
- if (Graph == null)
- throw new Exception("Гипер граф не существует");
-
- return Theorem.TheoremAutomorphismForEqualNumberOfVertices(Graph);
- }
- catch (Exception e)
- {
- MainViewModel.Current.Status = Common.Status.Error;
- MainViewModel.Current.StatusMessage = e.Message;
- return default;
- }
- }
-
- public static TheoremAuto TheoremForth()
- {
- try
- {
- if (Graph == null)
- throw new Exception("Гипер граф не существует");
-
- return Theorem.TheoremForth(Graph);
- }
- catch (Exception e)
- {
- MainViewModel.Current.Status = Common.Status.Error;
- MainViewModel.Current.StatusMessage = e.Message;
- return default;
- }
- }
-
- public static TheoremAuto TheoremFifth()
- {
- try
- {
- if (Graph == null)
- throw new Exception("Гипер граф не существует");
-
- return Theorem.TheoremFifth(Graph);
+ switch (SelectedTheorem)
+ {
+ case EnumTheorem.Second:
+ {
+ return Theorem.TheoremSecond(Graph);
+ }
+ case EnumTheorem.Third:
+ {
+ return Theorem.TheoremThird(Graph);
+ }
+ case EnumTheorem.Forth:
+ {
+ return Theorem.TheoremForth(Graph);
+ }
+ case EnumTheorem.Fifth:
+ {
+ return Theorem.TheoremFifth(Graph);
+ }
+ }
+ throw new Exception("Не обработан тип теоремы");
}
catch (Exception e)
{
@@ -142,6 +123,13 @@ namespace WPF.Model
}
}
+ /// <summary>
+ /// Выполняет экспорт результатов расчета в поток в оперативной памяти
+ /// </summary>
+ /// <param name="result">Результат расчета теоремой</param>
+ /// <param name="theorem">Тип теоремы</param>
+ /// <remarks>Нет реализации для пятой теоремы</remarks>
+ /// <returns>Если экспорт успешный, поток будет закрыт для чтения и записи</returns>
public static MemoryStream Export(TheoremAuto result, EnumTheorem theorem)
{
MemoryStream memoryStream = new MemoryStream();
@@ -173,7 +161,7 @@ namespace WPF.Model
}
case EnumTheorem.Fifth:
{
-
+ // Для пятой теоремы нет метода вывода
break;
}
}
@@ -182,6 +170,11 @@ namespace WPF.Model
#region Private методы
+ /// <summary>
+ /// Вывод результата второй теоремы
+ /// </summary>
+ /// <param name="result">Результат расчета</param>
+ /// <param name="output">Поток вывода</param>
static void ExportTheoremaSecond(TheoremAuto result, StreamWriter output)
{
// Выполняется ли условие согласно теореме 2
@@ -262,6 +255,11 @@ namespace WPF.Model
}
}
+ /// <summary>
+ /// Вывод результата третьей теоремы
+ /// </summary>
+ /// <param name="result">Результат расчета</param>
+ /// <param name="output">Поток вывода</param>
static void ExportTheoremaThird(TheoremAuto result, StreamWriter output)
{
// Выполняется ли условие согласно теореме 3
@@ -423,6 +421,11 @@ namespace WPF.Model
}
}
+ /// <summary>
+ /// Вывод результата четвертой теоремы
+ /// </summary>
+ /// <param name="result">Результат расчета</param>
+ /// <param name="output">Поток вывода</param>
static void ExportTheoremaForth(TheoremAuto result, StreamWriter output)
{
// Выполняется ли условие согласно теореме 3
WPF/Model/EnumTheorem.cs 9(+4 -5)
diff --git a/WPF/Model/EnumTheorem.cs b/WPF/Model/EnumTheorem.cs
index aeb29f4..0b7f81d 100644
--- a/WPF/Model/EnumTheorem.cs
+++ b/WPF/Model/EnumTheorem.cs
@@ -1,11 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.ComponentModel;
+using System.ComponentModel;
namespace WPF.Model
{
+ /// <summary>
+ /// Перечисление типов теорем
+ /// </summary>
public enum EnumTheorem
{
[Description("Вторая теорема")]
WPF/View/MainWindow.xaml 4(+2 -2)
diff --git a/WPF/View/MainWindow.xaml b/WPF/View/MainWindow.xaml
index ae474a9..399453b 100644
--- a/WPF/View/MainWindow.xaml
+++ b/WPF/View/MainWindow.xaml
@@ -6,8 +6,8 @@
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:local="clr-namespace:WPF.View"
xmlns:viewmodel="clr-namespace:WPF.ViewModel"
- xmlns:converters="clr-namespace:Common.WPF.Converters"
- xmlns:controls="clr-namespace:Common.WPF.Controls"
+ xmlns:converters="clr-namespace:WPF.Common.WPF.Converters"
+ xmlns:controls="clr-namespace:WPF.Common.WPF.Controls"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d"
x:Name="Window"
WPF/View/MainWindow.xaml.cs 57(+0 -57)
diff --git a/WPF/View/MainWindow.xaml.cs b/WPF/View/MainWindow.xaml.cs
index 0db4991..17d2cb5 100644
--- a/WPF/View/MainWindow.xaml.cs
+++ b/WPF/View/MainWindow.xaml.cs
@@ -15,12 +15,6 @@ namespace WPF.View
{
InitializeComponent();
DataContext = new MainViewModel();
- Application.Current.Dispatcher.BeginInvoke(
- System.Windows.Threading.DispatcherPriority.ApplicationIdle,
- new Action(() =>
- {
- (DataContext as MainViewModel).OnLoad();
- }));
}
private void Window_Loaded(object sender, RoutedEventArgs e)
@@ -39,56 +33,5 @@ namespace WPF.View
DragMove();
}
}
-
- private void textBox_DoubleInput(object sender, TextCompositionEventArgs e)
- {
- TextBox thisTextBox = (sender as TextBox);
- e.Handled =
- (!(char.IsDigit(e.Text, 0) /*&& !((thisTextBox.Text.IndexOf("-") == 0) && thisTextBox.SelectionStart == 0)*/ )) &&
- //((e.Text.Substring(0, 1) != "-") || (thisTextBox.Text.IndexOf("-") == 0) || thisTextBox.SelectionStart != 0) &&
- ((e.Text.Substring(0, 1) != ".") || (thisTextBox.Text.IndexOf(".") != -1) || (thisTextBox.SelectionStart == 0) || (!char.IsDigit(thisTextBox.Text.Substring(thisTextBox.SelectionStart - 1, 1), 0)) || ((thisTextBox.Text.IndexOf(",") != -1))) &&
- ((e.Text.Substring(0, 1) != ",") || (thisTextBox.Text.IndexOf(",") != -1) || (thisTextBox.SelectionStart == 0) || (!char.IsDigit(thisTextBox.Text.Substring(thisTextBox.SelectionStart - 1, 1), 0)) || ((thisTextBox.Text.IndexOf(".") != -1)));
- }
- private void textBox_IntInput(object sender, TextCompositionEventArgs e)
- {
- TextBox thisTextBox = (sender as TextBox);
- e.Handled = (!(char.IsNumber(e.Text, 0)));
- }
-
- private void TextBox_LostFocus(object sender, RoutedEventArgs e)
- {
- if (sender is TextBox textBox)
- {
- if (string.IsNullOrEmpty(textBox.Text))
- {
- textBox.Text = "0";
- return;
- }
- if (double.TryParse(textBox.Text.Replace(',', '.'), System.Globalization.NumberStyles.Number, System.Globalization.CultureInfo.InvariantCulture, out double res))
- {
- if (res < 0)
- textBox.Text = "0";
- }
- else
- {
- textBox.Text = "0";
- }
- }
- }
-
- private bool isFocused = false;
- private void TextBox_GotFocus(object sender, RoutedEventArgs e)
- {
- isFocused = true;
- }
-
- private void TextBox_SelectionChanged(object sender, RoutedEventArgs e)
- {
- if (isFocused)
- {
- isFocused = false;
- (sender as TextBox).SelectAll();
- }
- }
}
}
WPF/ViewModel/MainViewModel.cs 102(+70 -32)
diff --git a/WPF/ViewModel/MainViewModel.cs b/WPF/ViewModel/MainViewModel.cs
index f47f13b..f287353 100644
--- a/WPF/ViewModel/MainViewModel.cs
+++ b/WPF/ViewModel/MainViewModel.cs
@@ -1,20 +1,22 @@
-using Common.WPF;
-using Common;
-//using WPF.Helpers;
+using WPF.Common.WPF;
+using WPF.Common;
using WPF.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
-using System.ComponentModel;
using System.Windows.Forms;
+
using Visibility = System.Windows.Visibility;
using TheoremAuto = HyperGraphModel.Theorem.TheoremAuto;
using static WPF.Model.Calculate;
namespace WPF.ViewModel
{
+ /// <summary>
+ /// Класс работы главного окна приложения
+ /// </summary>
public class MainViewModel : ModifyViewModel
{
public MainViewModel() : base()
@@ -37,12 +39,7 @@ namespace WPF.ViewModel
CalculateCommand = new RelayCommand(OnCalculate);
SaveResultCommand = new RelayCommand(OnSaveResult, () => CanSave && IsTheoremCorrect);
- //AddItemCommand = new RelayCommand<ItemViewModel>(OnAddItem, item => Items.FirstOrDefault(e => e.Value == item.Value) == null);
- //RemoveItemCommand = new RelayCommand<ItemViewModel>(OnRemoveItem, item => !item.Readonly);
-
- //SwitchDataVisibleCommand = new RelayCommand(OnSwitchDataVisible);
- //ClearSearchCommand = new RelayCommand(OnClearSearch);
-
+ // Так выполнял отладку, чтобы руками значения не вводить
#if DEBUG
//EdgesNum = 6;
//SameVertNum = 2;
@@ -60,20 +57,26 @@ namespace WPF.ViewModel
Verticies[3].Value = 8;
SelectedTheorem = EnumTheorem.Forth;
#endif
+
}
#region Поля и свойства
+ // Статичный указатель на текущее окно
public static MainViewModel Current { get; private set; }
+ // Стандартный путь к месту сохранения файла экспорта
private readonly string DefaultPathToSave = $"C:\\Users\\{Environment.UserName}\\Documents\\";
+ // Путь сохранения к файлу экспорта, используемый в runtime
private string PathToSave { get; set; }
public static int MaxValue { get; } = 99;
public static int MinValue { get; } = 0;
+ // Список вариантов типа теорем
public List<EnumTheorem> EnumTheorems { get; }
+ // Текущий выбранный тип теоремы
private EnumTheorem _selectedTheorem;
public EnumTheorem SelectedTheorem
{
@@ -88,6 +91,7 @@ namespace WPF.ViewModel
get => _selectedTheorem;
}
+ // Можно ли выполнить экспорт результатов
private bool _canSave;
public bool CanSave
{
@@ -99,6 +103,7 @@ namespace WPF.ViewModel
}
}
+ // Число ребер
private int _edgesNum;
public int EdgesNum
{
@@ -113,6 +118,7 @@ namespace WPF.ViewModel
}
}
+ // Число общих или пересекающихся вершин
private int _sameVertNum;
public int SameVertNum
{
@@ -127,6 +133,7 @@ namespace WPF.ViewModel
}
}
+ // Параметр показа блока ввода вершин для каждого ребра
public Visibility VisibilityVerticies
{
get
@@ -135,11 +142,13 @@ namespace WPF.ViewModel
}
}
+ // Коллекция числа вершин для каждого ребра
public ObservableCollection<VertViewModel> Verticies { get; }
+ // Параметр отображаемого текста для "Общих" или "Пересекающихся" вершин
private string _sameVertText;
- public string SameVertText
- {
+ public string SameVertText
+ {
get => _sameVertText;
set
{
@@ -147,6 +156,8 @@ namespace WPF.ViewModel
OnPropertyChanged(() => SameVertText);
}
}
+
+ // Параметр текста подсказки для "Общих" или "Пересекающихся" вершин
private string _sameVertTextTooltip;
public string SameVertTextTooltip
{
@@ -158,6 +169,8 @@ namespace WPF.ViewModel
}
}
+ #region Блок отображаемого текста
+
public string TitleText { get => "Расчет гиперграфов"; }
public string EdgesText { get => "Количество ребер"; }
@@ -175,6 +188,9 @@ namespace WPF.ViewModel
public string AutomorphismText { get => "Число автоморфизмов"; }
public string AutomorphismTooltip { get => "Подсказка. Число автоморфизмов"; }
+ #endregion
+
+ // Параметр, выполняются условия теоремы
private bool _isTheoremCorrect;
public bool IsTheoremCorrect
{
@@ -186,6 +202,7 @@ namespace WPF.ViewModel
}
}
+ // Параметр числа автоморфизмов
private long _automorphismCount;
public long AutomorphismCount
{
@@ -197,6 +214,7 @@ namespace WPF.ViewModel
}
}
+ // Параметр результата расчета теоремы
private TheoremAuto _result;
public TheoremAuto Result
{
@@ -210,6 +228,8 @@ namespace WPF.ViewModel
}
}
+ // Параметр статуса выполнения приложения
+ // Влияет на цвет
private Status _status;
public Status Status
{
@@ -221,6 +241,7 @@ namespace WPF.ViewModel
}
}
+ // Параметр текста сообщения в строке статуса
private string _statusMessage;
public string StatusMessage
{
@@ -232,6 +253,9 @@ namespace WPF.ViewModel
}
}
+ // Параметр, отвечающий за коэффициент минимального числа общих или пересекающихся вершин
+ // Т.к. в случае "общих" вершин, минимальным является само число общих вершин
+ // а в случае "пересекающихся", минимальным является число пересекающихся вершин * 2
private int _koeffForMinSameVert;
public int KoeffForMinSameVert
{
@@ -248,15 +272,10 @@ namespace WPF.ViewModel
#region Методы и команды
- public void OnLoad()
- {
- //LoadData(App.DataFilePath);
- //LoadDataAsync(App.DataFilePath, true);
- }
-
+ // Что происходит, когда пользователь меняет выбранную теорему
private void OnSelectedTheoremChange()
{
- switch(SelectedTheorem)
+ switch (SelectedTheorem)
{
case EnumTheorem.Second:
case EnumTheorem.Third:
@@ -266,7 +285,7 @@ namespace WPF.ViewModel
SameVertText = "Количество общих вершин";
SameVertTextTooltip = "Подсказка. Количество общих вершин";
break;
- }
+ }
case EnumTheorem.Forth:
{
CanSave = true;
@@ -286,6 +305,8 @@ namespace WPF.ViewModel
}
}
+ // Что происходит, когда пользователь меняет число ребер
+ // Нужно изменить размер коллекции числа вершин для каждого ребра
private void UpdateVerticies()
{
if (EdgesNum > Verticies.Count)
@@ -301,80 +322,90 @@ namespace WPF.ViewModel
Verticies.Remove(vert);
}
}
+ UpdateVerticiesValue();
}
+ // Когда пользователь меняет число общих или пересекающихся вершин
+ // нужно изменить минимальное число вершин для каждого ребра
+ // А еще, когда пользователь меняет тип теоремы, меняется коэффициент, и также нужно пересчитать минимальное число вершин
+ // Вместе с минимальным числом меняем и текущее, если оно меньше минимального
private void UpdateVerticiesValue()
{
+ var val = SameVertNum * KoeffForMinSameVert;
foreach (var vert in Verticies)
- {
- if (vert.Value < SameVertNum)
- vert.Value = SameVertNum;
- vert.MinValue = SameVertNum * KoeffForMinSameVert;
+ {
+ if (vert.Value < val)
+ vert.Value = val;
+ vert.MinValue = val;
}
}
+ // Обработка команды нажатия на кнопку вычисления
public RelayCommand CalculateCommand { get; }
private void OnCalculate()
{
+ // Создаем граф
CreateGraph(EdgesNum, SameVertNum, Verticies.Select(x => x.Value).ToList(), SelectedTheorem);
+ // Обнуляем результат и панель статуса
SetResultDefault();
switch (SelectedTheorem)
{
case EnumTheorem.Second:
{
- Result = TheoremSecond();
+ Result = GetTheoremResult(SelectedTheorem);
Status = Status.OperationSuccess;
StatusMessage = "Расчет успешно выполнен";
if (!Result.isSatisfyTheorem && Graph.IsEqualNumberOfVertices)
{
Status = Status.SpecialWarning;
- StatusMessage = "Расчет успешно выполнен. Используйте теорему три";
+ StatusMessage = "Не удовлетворяет условиям теоремы. Используйте теорему три";
}
break;
}
case EnumTheorem.Third:
{
- Result = TheoremThird();
+ Result = GetTheoremResult(SelectedTheorem);
Status = Status.OperationSuccess;
StatusMessage = "Расчет успешно выполнен";
if (!Result.isSatisfyTheorem && !Graph.IsEqualNumberOfVertices)
{
Status = Status.SpecialWarning;
- StatusMessage = "Расчет успешно выполнен. Используйте теорему два";
+ StatusMessage = "Не удовлетворяет условиям теоремы. Используйте теорему два";
}
break;
}
case EnumTheorem.Forth:
{
- Result = TheoremForth();
+ Result = GetTheoremResult(SelectedTheorem);
Status = Status.OperationSuccess;
StatusMessage = "Расчет успешно выполнен";
if (!Result.isSatisfyTheorem && Graph.IsEqualNumberOfVertices)
{
Status = Status.SpecialWarning;
- StatusMessage = "Расчет успешно выполнен. Используйте теорему пять";
+ StatusMessage = "Не удовлетворяет условиям теоремы. Используйте теорему пять";
}
break;
}
case EnumTheorem.Fifth:
{
- Result = TheoremFifth();
+ Result = GetTheoremResult(SelectedTheorem);
Status = Status.OperationSuccess;
StatusMessage = "Расчет успешно выполнен";
if (!Result.isSatisfyTheorem && !Graph.IsEqualNumberOfVertices)
{
Status = Status.SpecialWarning;
- StatusMessage = "Расчет успешно выполнен. Используйте теорему четыре";
+ StatusMessage = "Не удовлетворяет условиям теоремы. Используйте теорему четыре";
}
break;
}
}
}
+ // Обработка команды нажатия на экспорт результатов
public RelayCommand SaveResultCommand { get; }
private void OnSaveResult()
{
@@ -409,6 +440,7 @@ namespace WPF.ViewModel
}
+ // Сбрасывает текущее состояние и результат
private void SetResultDefault()
{
Result = default;
@@ -420,6 +452,9 @@ namespace WPF.ViewModel
}
+ /// <summary>
+ /// Класс отображения числа вершин в каждом ребре
+ /// </summary>
public class VertViewModel : BaseViewModel
{
public VertViewModel(int startValue, string text)
@@ -429,6 +464,7 @@ namespace WPF.ViewModel
VertText = text;
}
+ // Текущее значение числа вершин
private int _value;
public int Value
{
@@ -440,6 +476,7 @@ namespace WPF.ViewModel
}
}
+ // Минимальное значение число вершин
private int _minValue;
public int MinValue
{
@@ -451,6 +488,7 @@ namespace WPF.ViewModel
}
}
+ // Отображаемое название вершины
public string VertText { get; }
}
}
WPF/WPF.csproj 2(+1 -1)
diff --git a/WPF/WPF.csproj b/WPF/WPF.csproj
index 805b2a4..3a8933b 100644
--- a/WPF/WPF.csproj
+++ b/WPF/WPF.csproj
@@ -283,7 +283,7 @@
<Compile Include="Common\WPF\ObservableCollectionAdv.cs" />
<Compile Include="Common\WPF\RelayCommand.cs" />
<Compile Include="Model\Calculate.cs" />
- <Compile Include="Model\ObservableCollectionExtension.cs" />
+ <Compile Include="Common\WPF\ObservableCollectionExtension.cs" />
<Compile Include="Model\EnumTheorem.cs" />
<Compile Include="ViewModel\MainViewModel.cs" />
<Compile Include="View\MainWindow.xaml.cs">