Skip to content

Commit 43bbd65

Browse files
committed
fixes, refactors, redesigns, comments documentation, some new tests, translations, DI update
1 parent 21f725b commit 43bbd65

67 files changed

Lines changed: 1206 additions & 538 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace JSharp.Domain.Abstractions
9+
{
10+
public interface IAppSettings
11+
{
12+
byte PngCompressionLevel { get; }
13+
byte JpgSaveQuality { get; }
14+
string SaveFileExtension { get; }
15+
string Language { get; }
16+
double CumulativeZoomFactor { get; }
17+
}
18+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows;
7+
8+
namespace JSharp.Domain.Abstractions
9+
{
10+
public interface IMessageService
11+
{
12+
public abstract MessageBoxResult ShowMessage(string message, string caption, MessageBoxButton buttonSettings, MessageBoxImage icon);
13+
14+
public abstract MessageBoxResult ShowMessage(Window owner, string message, string caption, MessageBoxButton buttonSettings, MessageBoxImage icon);
15+
}
16+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using JSharp.Services;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.ComponentModel;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace JSharp.Domain.Abstractions
10+
{
11+
public interface ISettingsService
12+
{
13+
byte PngCompressionLevel { get; }
14+
byte JpgSaveQuality { get; }
15+
string SaveFileExtension { get; }
16+
string Language { get; }
17+
double ZoomFactor { get; }
18+
19+
abstract void SaveSettings(EditableSettings newSettings);
20+
abstract void RestoreDefaults();
21+
}
22+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel.DataAnnotations;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace JSharp.Domain.Abstractions.Validation
9+
{
10+
public interface IValidationManager
11+
{
12+
void AddValidator(IValidator validator);
13+
IEnumerable<string> ValidateAll();
14+
}
15+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace JSharp.Domain.Abstractions.Validation
2+
{
3+
public interface IValidator
4+
{
5+
string? Validate();
6+
}
7+
}

JSharp.Domain/JSharp.Domain.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<ItemGroup>
1111
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
12-
<PackageReference Include="Emgu.CV" Version="4.10.0.5680" />
12+
<PackageReference Include="Emgu.CV" Version="4.12.0.5764" />
1313
<PackageReference Include="LiveChartsCore.SkiaSharpView.WPF" Version="2.0.0-rc2" />
1414
</ItemGroup>
1515

JSharp.Domain/Models/DataModels/Histogram.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace JSharp.Domain.Models.DataModels
99
{
1010
public class Histogram : ObservableObject
1111
{
12-
private ISeries[] _histogramSeries;
12+
private ISeries[] _histogramSeries = null!;
1313
public ISeries[] HistogramSeries
1414
{
1515
get { return _histogramSeries; }
@@ -23,7 +23,7 @@ public int PixelSum
2323
set { SetProperty(ref _pixelSum, value); }
2424
}
2525

26-
private ObservableCollection<object> _histogramData;
26+
private ObservableCollection<object> _histogramData = null!;
2727
public ObservableCollection<object> HistogramData
2828
{
2929
get { return _histogramData; }
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
using CommunityToolkit.Mvvm.ComponentModel;
2+
using JSharp.Domain.Abstractions;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.ComponentModel;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Threading.Tasks;
9+
10+
namespace JSharp.Services
11+
{
12+
/// <summary>
13+
/// Represents a temporary, editable copy of application settings for the UI and passing settings to be saved
14+
/// </summary>
15+
public class EditableSettings : ObservableObject, IEditableObject
16+
{
17+
// current value fields
18+
private string _language;
19+
private double _zoomFactor;
20+
private byte _pngCompressionLevel;
21+
private byte _jpgSaveQuality;
22+
private string _saveFileExtension;
23+
24+
// Backup fields for edit session
25+
private string _backupLanguage;
26+
private double _backupZoomFactor;
27+
private byte _backupPngCompressionLevel;
28+
private byte _backupJpgSaveQuality;
29+
private string _backupSaveFileExtension;
30+
31+
private bool inEdit;
32+
33+
// exposed properties for UI
34+
public string Language
35+
{
36+
get => _language;
37+
set => SetProperty(ref _language, value);
38+
}
39+
40+
public double ZoomFactor
41+
{
42+
get => _zoomFactor;
43+
set => SetProperty(ref _zoomFactor, value);
44+
}
45+
46+
public byte PngCompressionLevel
47+
{
48+
get => _pngCompressionLevel;
49+
set => SetProperty(ref _pngCompressionLevel, value);
50+
}
51+
52+
public byte JpgSaveQuality
53+
{
54+
get => _jpgSaveQuality;
55+
set => SetProperty(ref _jpgSaveQuality, value);
56+
}
57+
58+
public string SaveFileExtension
59+
{
60+
get => _saveFileExtension;
61+
set => SetProperty(ref _saveFileExtension, value);
62+
}
63+
64+
public EditableSettings()
65+
{
66+
}
67+
68+
public void BeginEdit()
69+
{
70+
if (inEdit) return;
71+
72+
_backupLanguage = _language;
73+
_backupZoomFactor = _zoomFactor;
74+
_backupPngCompressionLevel = _pngCompressionLevel;
75+
_backupJpgSaveQuality = _jpgSaveQuality;
76+
_backupSaveFileExtension = _saveFileExtension;
77+
78+
inEdit = true;
79+
}
80+
81+
public void CancelEdit()
82+
{
83+
if (!inEdit) return;
84+
85+
Language = _backupLanguage;
86+
ZoomFactor = _backupZoomFactor;
87+
PngCompressionLevel = _backupPngCompressionLevel;
88+
JpgSaveQuality = _backupJpgSaveQuality;
89+
SaveFileExtension = _backupSaveFileExtension;
90+
91+
inEdit = false;
92+
}
93+
94+
public void EndEdit()
95+
{
96+
if (!inEdit) return;
97+
98+
inEdit = false;
99+
100+
_backupLanguage = default!;
101+
_backupZoomFactor = default;
102+
_backupPngCompressionLevel = default;
103+
_backupJpgSaveQuality = default;
104+
_backupSaveFileExtension = default!;
105+
}
106+
}
107+
}

JSharp.Domain/Services/ImageProcessingCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ public static Mat Skeletonize(Mat inputMat)
859859
Mat skeleton = new Mat(inputMat.Size, DepthType.Cv8U, 1);
860860
Mat imCopy = inputMat.Clone();
861861

862-
Mat element = CvInvoke.GetStructuringElement(ElementShape.Cross, new Size(3, 3), new Point(-1, -1));
862+
Mat element = CvInvoke.GetStructuringElement(MorphShapes.Cross, new Size(3, 3), new Point(-1, -1));
863863
BorderType borderType = BorderType.Default; // Ustawienie typu brzegu na domyślny
864864

865865
// Krok 4: Wykonanie operacji erozji na oryginalnym obrazie oraz poprawienie szkieletu

JSharp.Shared/Resources/Errors.Designer.cs

Lines changed: 47 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)