diff --git a/Pores.sln b/Pores.sln deleted file mode 100644 index a088a47..0000000 --- a/Pores.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.136 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pores", "Pores\Pores.csproj", "{12EAD304-2155-4F18-8373-3EEA60798B8D}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {12EAD304-2155-4F18-8373-3EEA60798B8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {12EAD304-2155-4F18-8373-3EEA60798B8D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {12EAD304-2155-4F18-8373-3EEA60798B8D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {12EAD304-2155-4F18-8373-3EEA60798B8D}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {740ACE1D-F83D-4181-9888-B3EA705A5E70} - EndGlobalSection -EndGlobal diff --git a/Pores/Controllers/ConnectedPoreReportGenerator.cs b/Pores/Controllers/ConnectedPoreReportGenerator.cs index 75005f4..4af9ddc 100644 --- a/Pores/Controllers/ConnectedPoreReportGenerator.cs +++ b/Pores/Controllers/ConnectedPoreReportGenerator.cs @@ -25,7 +25,9 @@ namespace MODELING_DEF_DES_MI_VI.Controllers if (!report.Any(a => a.Item1.Id == p2.Id && a.Item2.Id == p1.Id)) if (IsTwoPoresConnecting(p1, p2)) report.Add(Tuple.Create(p1, p2)); - ReportGenerator.Save(report, ReportGenerator.AddOther("report_connected_pores_" + index)); + + var s = string.Format("report_connected_pores_{0}_n{1}", index, report.Count); + ReportGenerator.Save(report, ReportGenerator.AddTime(s)); } public double DistanceBetweenTwoPoints(Point3D point1, Point3D point2) diff --git a/Pores/Controllers/ReportGenerator.cs b/Pores/Controllers/ReportGenerator.cs index 58c5e5d..e2dd605 100644 --- a/Pores/Controllers/ReportGenerator.cs +++ b/Pores/Controllers/ReportGenerator.cs @@ -12,7 +12,7 @@ namespace MODELING_DEF_DES_MI_VI.Controllers { public class ReportGenerator : BaseSaveLoadController { - public string AddOther(string fileName) + public string AddTime(string fileName) { return ".\\results\\" diff --git a/Pores/Converters/CubicPowerOfInt.cs b/Pores/Converters/CubicPowerOfInt.cs new file mode 100644 index 0000000..f2c46df --- /dev/null +++ b/Pores/Converters/CubicPowerOfInt.cs @@ -0,0 +1,15 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace Pores.Converters +{ + public class CubicPowerOfInt : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + => Math.Pow((int)value, 3).ToString(); + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + => throw new NotImplementedException(); + } +} diff --git a/Pores/MODELING-DEF-DES-MI-VI.csproj b/Pores/MODELING-DEF-DES-MI-VI.csproj index 3eeefb5..5a3c985 100644 --- a/Pores/MODELING-DEF-DES-MI-VI.csproj +++ b/Pores/MODELING-DEF-DES-MI-VI.csproj @@ -85,6 +85,7 @@ + diff --git a/Pores/MainWindow.xaml b/Pores/MainWindow.xaml index 032b8e0..8b7cd8a 100644 --- a/Pores/MainWindow.xaml +++ b/Pores/MainWindow.xaml @@ -4,11 +4,15 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:spreads="clr-namespace:MODELING_DEF_DES_MI_VI.Models.Spreads" + xmlns:converters="clr-namespace:Pores.Converters" mc:Ignorable="d" Title="Pores" Height="600" Width="1000"> + + + - + @@ -34,8 +38,15 @@ - - + + + + + + + + @@ -89,9 +100,9 @@ - + - + diff --git a/Pores/MainWindowViewModel.cs b/Pores/MainWindowViewModel.cs index e85da1c..351fe6e 100644 --- a/Pores/MainWindowViewModel.cs +++ b/Pores/MainWindowViewModel.cs @@ -8,6 +8,8 @@ using System.Threading; using System.IO; using System.Diagnostics; using System.Collections.ObjectModel; +using System.Windows; +using System.Linq; namespace MODELING_DEF_DES_MI_VI { @@ -83,7 +85,7 @@ namespace MODELING_DEF_DES_MI_VI public void Save() => Save(Pores); - public void Save(IList pores, int i = 0) + public void Save(IList pores, int i = -1) { var n = string.Format( "model_{0}_w{1}_d{2}_h{3}_n{4}", @@ -93,7 +95,8 @@ namespace MODELING_DEF_DES_MI_VI CurrentMaterial.Height, pores.Count); - ReportSaver.Save(pores, ReportSaver.AddOther(n)); + ReportSaver.Save(pores, ReportSaver.AddTime(n)); + if (i == -1) OperationCompletedMessage(); } public void SaveBatch() @@ -102,8 +105,8 @@ namespace MODELING_DEF_DES_MI_VI public IEnumerable SaveBatch(IEnumerable pores, int i = -1) { var batch = BatchGenerator.GenerateBatch(BatchPoint, pores); - if (i != -1) - ReportSaver.Save(batch, ReportSaver.AddOther(string.Format("batch_{0}", i))); + var s = string.Format("batch_{0}_n{1}", i, batch.ToList().Count); + ReportSaver.Save(batch, ReportSaver.AddTime(s)); return batch; } @@ -121,8 +124,12 @@ namespace MODELING_DEF_DES_MI_VI ConnectedPoreReportGenerator.CreateReport(list2, i); } DisableGenerateAllFlag = false; + OperationCompletedMessage(); }); AllSavingThread.Start(); } + + private void OperationCompletedMessage() + => MessageBox.Show("Операция завершена!", "Сообщение"); } }