diff --git a/Pores/Controllers/ConnectedPoreReportGenerator.cs b/Pores/Controllers/ConnectedPoreReportGenerator.cs index 5d78e50..99b8476 100644 --- a/Pores/Controllers/ConnectedPoreReportGenerator.cs +++ b/Pores/Controllers/ConnectedPoreReportGenerator.cs @@ -25,7 +25,9 @@ namespace Pores.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 d5f2257..f840ea1 100644 --- a/Pores/Controllers/ReportGenerator.cs +++ b/Pores/Controllers/ReportGenerator.cs @@ -12,7 +12,7 @@ namespace Pores.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/MainWindow.xaml b/Pores/MainWindow.xaml index 395c128..dff3324 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:Pores.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 50bdf78..015dcef 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 Pores { @@ -83,7 +85,7 @@ namespace Pores 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 Pores 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 Pores 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 Pores ConnectedPoreReportGenerator.CreateReport(list2, i); } DisableGenerateAllFlag = false; + OperationCompletedMessage(); }); AllSavingThread.Start(); } + + private void OperationCompletedMessage() + => MessageBox.Show("Операция завершена!", "Сообщение"); } } diff --git a/Pores/Pores.csproj b/Pores/Pores.csproj index 3eeefb5..5a3c985 100644 --- a/Pores/Pores.csproj +++ b/Pores/Pores.csproj @@ -85,6 +85,7 @@ +