From 0f76f3a60a597cf3236c5165677d6aadee4eb070 Mon Sep 17 00:00:00 2001 From: Nikita Romanenko Date: Thu, 13 Dec 2018 09:46:42 +0300 Subject: [PATCH] A lot of visual improvements and code refactoring. --- Pores/Bootstrap.cs | 6 +- .../ConnectedPoreReportGenerator.cs | 2 +- Pores/Controllers/PoreGenerator.cs | 6 +- Pores/Interfaces/IPoreGenerator.cs | 2 +- .../{IPoreLocalization.cs => IPoreSpread.cs} | 4 +- Pores/MainWindow.xaml | 79 +++++++++---------- Pores/MainWindowViewModel.cs | 16 ++-- .../Models/Localizations/BaseLocalization.cs | 11 --- Pores/Models/Spreads/BaseSpread.cs | 11 +++ .../NormalSpread.cs} | 10 +-- Pores/Pores.csproj | 6 +- 11 files changed, 72 insertions(+), 81 deletions(-) rename Pores/Interfaces/{IPoreLocalization.cs => IPoreSpread.cs} (53%) delete mode 100644 Pores/Models/Localizations/BaseLocalization.cs create mode 100644 Pores/Models/Spreads/BaseSpread.cs rename Pores/Models/{Localizations/NormalLocalization.cs => Spreads/NormalSpread.cs} (88%) diff --git a/Pores/Bootstrap.cs b/Pores/Bootstrap.cs index ecd0940..1b9f811 100644 --- a/Pores/Bootstrap.cs +++ b/Pores/Bootstrap.cs @@ -2,7 +2,7 @@ using Pores.Controllers; using Pores.Interfaces; using Pores.Models; -using Pores.Models.Localizations; +using Pores.Models.Spreads; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -24,8 +24,8 @@ namespace Pores .SingleInstance(); build - .Register(c => new ObservableCollection() { new NormalLocalization(c.Resolve()) }) - .As>() + .Register(c => new ObservableCollection() { new NormalSpread(c.Resolve()) }) + .As>() .SingleInstance(); build diff --git a/Pores/Controllers/ConnectedPoreReportGenerator.cs b/Pores/Controllers/ConnectedPoreReportGenerator.cs index 4088138..388a96d 100644 --- a/Pores/Controllers/ConnectedPoreReportGenerator.cs +++ b/Pores/Controllers/ConnectedPoreReportGenerator.cs @@ -21,7 +21,7 @@ namespace Pores.Controllers IList> report = new List>(); foreach(Pore p1 in pores) foreach(Pore p2 in pores) - if (!p1.Equals(p2)) + if (!p1.Id.Equals(p2.Id)) if (!report.Any(a => a.Item1.Id == p2.Id && a.Item2.Id == p1.Id)) if (IsTwoPoresConnecting(p1, p2)) report.Add(Tuple.Create(p1, p2)); diff --git a/Pores/Controllers/PoreGenerator.cs b/Pores/Controllers/PoreGenerator.cs index 2e2cc46..02eddfd 100644 --- a/Pores/Controllers/PoreGenerator.cs +++ b/Pores/Controllers/PoreGenerator.cs @@ -7,7 +7,7 @@ namespace Pores.Controllers { public class PoreGenerator : PropertyChangedClass, IPoreGenerator { - public IPoreLocalization PoresLocalization { get; set; } + public IPoreSpread PoresLocalization { get; set; } public Material CurrentMaterial { get; set; } public PoreGenerator(Material currentMaterial) @@ -15,9 +15,9 @@ namespace Pores.Controllers CurrentMaterial = currentMaterial; } - public IList Generate(IPoreLocalization localization) + public IList Generate(IPoreSpread localization) { - return localization.GetLocalization(); + return localization.GetSpread(); } } } diff --git a/Pores/Interfaces/IPoreGenerator.cs b/Pores/Interfaces/IPoreGenerator.cs index c3accc7..1e7e3d0 100644 --- a/Pores/Interfaces/IPoreGenerator.cs +++ b/Pores/Interfaces/IPoreGenerator.cs @@ -5,6 +5,6 @@ namespace Pores.Interfaces { public interface IPoreGenerator { - IList Generate(IPoreLocalization localization); + IList Generate(IPoreSpread localization); } } diff --git a/Pores/Interfaces/IPoreLocalization.cs b/Pores/Interfaces/IPoreSpread.cs similarity index 53% rename from Pores/Interfaces/IPoreLocalization.cs rename to Pores/Interfaces/IPoreSpread.cs index c060349..807748f 100644 --- a/Pores/Interfaces/IPoreLocalization.cs +++ b/Pores/Interfaces/IPoreSpread.cs @@ -3,8 +3,8 @@ using System.Collections.ObjectModel; namespace Pores.Interfaces { - public interface IPoreLocalization + public interface IPoreSpread { - ObservableCollection GetLocalization(); + ObservableCollection GetSpread(); } } diff --git a/Pores/MainWindow.xaml b/Pores/MainWindow.xaml index 63a17f5..5dd160e 100644 --- a/Pores/MainWindow.xaml +++ b/Pores/MainWindow.xaml @@ -3,8 +3,7 @@ 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:localizations="clr-namespace:Pores.Models.Localizations" - xmlns:local="clr-namespace:Pores" + xmlns:spreads="clr-namespace:Pores.Models.Spreads" mc:Ignorable="d" Title="Pores" Height="600" Width="1000"> @@ -24,46 +23,44 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -