Skip to content

Commit 5aebbb0

Browse files
author
Vladyslav Horbachov
committed
Application and presentaion layer works with the new architecture
1 parent 1769eb2 commit 5aebbb0

File tree

79 files changed

+836
-862
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+836
-862
lines changed

Diff for: Inventory.sln

+3-21
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2538699A-4E3
77
EndProject
88
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Inventory.Infrastructure", "src\Inventory.Infrastructure\Inventory.Infrastructure.csproj", "{FD671329-1CC5-4551-B71D-980A4C6D4DFD}"
99
EndProject
10-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Inventory.Infrastructure.Core", "src\Inventory.Infrastructure.Core\Inventory.Infrastructure.Core.csproj", "{62B51B18-5E3D-4426-B627-D6316D5C855A}"
10+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Inventory.Presentation", "src\Inventory.Presentation\Inventory.Presentation.csproj", "{CE585B48-FD03-41FF-AEF7-9664BCFC0B20}"
1111
EndProject
12-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inventory.Presentation", "src\Inventory.Presentation\Inventory.Presentation.csproj", "{CE585B48-FD03-41FF-AEF7-9664BCFC0B20}"
13-
EndProject
14-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inventory.Application", "src\Inventory.Application\Inventory.Application.csproj", "{6FCA94C7-6535-4B5F-9F40-42EE44D71C93}"
12+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Inventory.Application", "src\Inventory.Application\Inventory.Application.csproj", "{6FCA94C7-6535-4B5F-9F40-42EE44D71C93}"
1513
EndProject
1614
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BuildingBlocks", "BuildingBlocks", "{DDC8A81B-DF7D-44E7-8954-40C279E6B600}"
1715
EndProject
@@ -26,6 +24,7 @@ EndProject
2624
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{381BCCCA-C07C-4E76-B9F5-BF2BD677EE07}"
2725
ProjectSection(SolutionItems) = preProject
2826
.editorconfig = .editorconfig
27+
Settings.XamlStyler = Settings.XamlStyler
2928
EndProjectSection
3029
EndProject
3130
Global
@@ -63,22 +62,6 @@ Global
6362
{FD671329-1CC5-4551-B71D-980A4C6D4DFD}.Release|x86.ActiveCfg = Release|x86
6463
{FD671329-1CC5-4551-B71D-980A4C6D4DFD}.Release|x86.Build.0 = Release|x86
6564
{FD671329-1CC5-4551-B71D-980A4C6D4DFD}.Release|x86.Deploy.0 = Release|x86
66-
{62B51B18-5E3D-4426-B627-D6316D5C855A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
67-
{62B51B18-5E3D-4426-B627-D6316D5C855A}.Debug|Any CPU.Build.0 = Debug|Any CPU
68-
{62B51B18-5E3D-4426-B627-D6316D5C855A}.Debug|arm64.ActiveCfg = Debug|arm64
69-
{62B51B18-5E3D-4426-B627-D6316D5C855A}.Debug|arm64.Build.0 = Debug|arm64
70-
{62B51B18-5E3D-4426-B627-D6316D5C855A}.Debug|x64.ActiveCfg = Debug|x64
71-
{62B51B18-5E3D-4426-B627-D6316D5C855A}.Debug|x64.Build.0 = Debug|x64
72-
{62B51B18-5E3D-4426-B627-D6316D5C855A}.Debug|x86.ActiveCfg = Debug|x86
73-
{62B51B18-5E3D-4426-B627-D6316D5C855A}.Debug|x86.Build.0 = Debug|x86
74-
{62B51B18-5E3D-4426-B627-D6316D5C855A}.Release|Any CPU.ActiveCfg = Release|Any CPU
75-
{62B51B18-5E3D-4426-B627-D6316D5C855A}.Release|Any CPU.Build.0 = Release|Any CPU
76-
{62B51B18-5E3D-4426-B627-D6316D5C855A}.Release|arm64.ActiveCfg = Release|arm64
77-
{62B51B18-5E3D-4426-B627-D6316D5C855A}.Release|arm64.Build.0 = Release|arm64
78-
{62B51B18-5E3D-4426-B627-D6316D5C855A}.Release|x64.ActiveCfg = Release|x64
79-
{62B51B18-5E3D-4426-B627-D6316D5C855A}.Release|x64.Build.0 = Release|x64
80-
{62B51B18-5E3D-4426-B627-D6316D5C855A}.Release|x86.ActiveCfg = Release|x86
81-
{62B51B18-5E3D-4426-B627-D6316D5C855A}.Release|x86.Build.0 = Release|x86
8265
{CE585B48-FD03-41FF-AEF7-9664BCFC0B20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
8366
{CE585B48-FD03-41FF-AEF7-9664BCFC0B20}.Debug|Any CPU.Build.0 = Debug|Any CPU
8467
{CE585B48-FD03-41FF-AEF7-9664BCFC0B20}.Debug|arm64.ActiveCfg = Debug|Any CPU
@@ -181,7 +164,6 @@ Global
181164
EndGlobalSection
182165
GlobalSection(NestedProjects) = preSolution
183166
{FD671329-1CC5-4551-B71D-980A4C6D4DFD} = {2538699A-4E3E-45D8-A89D-B1FCF077B9BD}
184-
{62B51B18-5E3D-4426-B627-D6316D5C855A} = {2538699A-4E3E-45D8-A89D-B1FCF077B9BD}
185167
{CE585B48-FD03-41FF-AEF7-9664BCFC0B20} = {2538699A-4E3E-45D8-A89D-B1FCF077B9BD}
186168
{6FCA94C7-6535-4B5F-9F40-42EE44D71C93} = {2538699A-4E3E-45D8-A89D-B1FCF077B9BD}
187169
{DDC8A81B-DF7D-44E7-8954-40C279E6B600} = {2538699A-4E3E-45D8-A89D-B1FCF077B9BD}

Diff for: Settings.XamlStyler

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"AttributesTolerance": 2,
3+
"KeepFirstAttributeOnSameLine": false,
4+
"MaxAttributeCharactersPerLine": 0,
5+
"MaxAttributesPerLine": 1,
6+
"NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransfom, SkewTransform, RotateTransform, TranslateTransform, Trigger, Condition, Setter",
7+
"SeparateByGroups": false,
8+
"AttributeIndentation": 0,
9+
"AttributeIndentationStyle": 1,
10+
"RemoveDesignTimeReferences": false,
11+
"EnableAttributeReordering": true,
12+
"AttributeOrderingRuleGroups": [
13+
"x:Class",
14+
"xmlns, xmlns:x",
15+
"xmlns:x",
16+
"xmlns:d",
17+
"xmlns:mc",
18+
"mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText",
19+
"xmlns:*",
20+
"x:Key, Key, x:Name, Name, x:Uid, Uid, Title",
21+
"Grid.Row, Grid.RowSpan, Grid.Column, Grid.ColumnSpan, Canvas.Left, Canvas.Top, Canvas.Right, Canvas.Bottom",
22+
"Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight",
23+
"Margin, Padding, HorizontalAlignment, VerticalAlignment, HorizontalContentAlignment, VerticalContentAlignment, Panel.ZIndex",
24+
"*:*, *",
25+
"PageSource, PageIndex, Offset, Color, TargetName, Property, Value, StartPoint, EndPoint",
26+
"Storyboard.*, From, To, Duration"
27+
],
28+
"FirstLineAttributes": "",
29+
"OrderAttributesByName": true,
30+
"PutEndingBracketOnNewLine": false,
31+
"RemoveEndingTagOfEmptyElement": true,
32+
"SpaceBeforeClosingSlash": true,
33+
"RootElementLineBreakRule": 0,
34+
"ReorderVSM": 2,
35+
"ReorderGridChildren": false,
36+
"ReorderCanvasChildren": false,
37+
"ReorderSetters": 0,
38+
"FormatMarkupExtension": true,
39+
"NoNewLineMarkupExtensions": "x:Bind, Binding",
40+
"ThicknessSeparator": 2,
41+
"ThicknessAttributes": "Margin, Padding, BorderThickness, ThumbnailClipMargin",
42+
"FormatOnSave": false,
43+
"CommentPadding": 2
44+
}

Diff for: src/Inventory.Application/Inventory.Application.csproj

+6
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,17 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12+
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
13+
<PackageReference Include="CommunityToolkit.WinUI" Version="7.1.2" />
1214
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.5" />
1315
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.1" />
1416
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
1517
<PrivateAssets>all</PrivateAssets>
1618
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1719
</PackageReference>
1820
</ItemGroup>
21+
22+
<ItemGroup>
23+
<ProjectReference Include="..\BuildingBlocks\BuildingBlocks.Application\BuildingBlocks.Application.csproj" />
24+
</ItemGroup>
1925
</Project>

Diff for: src/Inventory.Infrastructure.Core/Models/SampleCompany.cs renamed to src/Inventory.Application/Models/SampleCompany.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace Inventory.Infrastructure.Core.Models;
1+
using System.Collections.Generic;
2+
3+
namespace Inventory.Application.Models;
24

35
// Model for the SampleDataService. Replace with your own model.
46
public class SampleCompany
@@ -57,4 +59,4 @@ public ICollection<SampleOrder> Orders
5759
{
5860
get; set;
5961
}
60-
}
62+
}

Diff for: src/Inventory.Infrastructure.Core/Models/SampleOrder.cs renamed to src/Inventory.Application/Models/SampleOrder.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
namespace Inventory.Infrastructure.Core.Models;
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace Inventory.Application.Models;
25

36
// Model for the SampleDataService. Replace with your own model.
47
public class SampleOrder
@@ -78,4 +81,4 @@ public ICollection<SampleOrderDetail> Details
7881
public string ShortDescription => $"Order ID: {OrderID}";
7982

8083
public override string ToString() => $"{Company} {Status}";
81-
}
84+
}

Diff for: src/Inventory.Infrastructure.Core/Models/SampleOrderDetail.cs renamed to src/Inventory.Application/Models/SampleOrderDetail.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Inventory.Infrastructure.Core.Models;
1+
namespace Inventory.Application.Models;
22

33
// Model for the SampleDataService. Replace with your own model.
44
public class SampleOrderDetail
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
using Inventory.Infrastructure.Contracts.Services;
2-
using Inventory.Infrastructure.ViewModels;
3-
1+
using System.Threading.Tasks;
2+
using BuildingBlocks.Application.Services.Activation.Handlers;
3+
using Inventory.Application.Services.Navigation;
4+
using Inventory.Application.ViewModels.Main;
45
using Microsoft.UI.Xaml;
56

6-
namespace Inventory.Infrastructure.Activation;
7+
namespace Inventory.Application.Services.Activation;
78

8-
public class DefaultActivationHandler : ActivationHandler<LaunchActivatedEventArgs>
9+
public sealed class DefaultActivationHandler : ActivationHandler<LaunchActivatedEventArgs>
910
{
1011
private readonly INavigationService _navigationService;
1112

@@ -14,16 +15,16 @@ public DefaultActivationHandler(INavigationService navigationService)
1415
_navigationService = navigationService;
1516
}
1617

17-
protected override bool CanHandleInternal(LaunchActivatedEventArgs args)
18+
protected override bool CanHandleInternal(LaunchActivatedEventArgs? args)
1819
{
1920
// None of the ActivationHandlers has handled the activation.
2021
return _navigationService.Frame?.Content == null;
2122
}
2223

23-
protected async override Task HandleInternalAsync(LaunchActivatedEventArgs args)
24+
protected override async Task HandleInternalAsync(LaunchActivatedEventArgs? args)
2425
{
25-
_navigationService.NavigateTo(typeof(MainViewModel).FullName!, args.Arguments);
26+
_navigationService.NavigateTo(typeof(MainViewModel).FullName!, args?.Arguments);
2627

2728
await Task.CompletedTask;
2829
}
29-
}
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using System.Threading.Tasks;
2+
3+
namespace Inventory.Application.Services.Activation;
4+
5+
public interface IActivationService
6+
{
7+
Task ActivateAsync(object activationArgs);
8+
}

Diff for: src/Inventory.Infrastructure.Core/Contracts/Services/IFileService.cs renamed to src/Inventory.Application/Services/Files/IFileService.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
namespace Inventory.Infrastructure.Core.Contracts.Services;
1+
namespace Inventory.Application.Services.Files;
22

33
public interface IFileService
44
{
5-
T Read<T>(string folderPath, string fileName);
5+
T? Read<T>(string folderPath, string fileName);
66

77
void Save<T>(string folderPath, string fileName, T content);
88

Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
namespace Inventory.Infrastructure.Contracts.Services;
1+
using System.Threading.Tasks;
2+
3+
namespace Inventory.Application.Services.LocalSettings;
24

35
public interface ILocalSettingsService
46
{
57
Task<T?> ReadSettingAsync<T>(string key);
68

79
Task SaveSettingAsync<T>(string key, T value);
8-
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
namespace Inventory.Infrastructure.Contracts.ViewModels;
1+
namespace Inventory.Application.Services.Navigation;
22

33
public interface INavigationAware
44
{
55
void OnNavigatedTo(object parameter);
66

77
void OnNavigatedFrom();
8-
}
8+
}

Diff for: src/Inventory.Infrastructure/Contracts/Services/INavigationService.cs renamed to src/Inventory.Application/Services/Navigation/INavigationService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Microsoft.UI.Xaml.Controls;
22
using Microsoft.UI.Xaml.Navigation;
33

4-
namespace Inventory.Infrastructure.Contracts.Services;
4+
namespace Inventory.Application.Services.Navigation;
55

66
public interface INavigationService
77
{

Diff for: src/Inventory.Infrastructure/Contracts/Services/INavigationViewService.cs renamed to src/Inventory.Application/Services/Navigation/INavigationViewService.cs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
using Microsoft.UI.Xaml.Controls;
1+
using System;
2+
using System.Collections.Generic;
3+
using Microsoft.UI.Xaml.Controls;
24

3-
namespace Inventory.Infrastructure.Contracts.Services;
5+
namespace Inventory.Application.Services.Navigation;
46

57
public interface INavigationViewService
68
{
@@ -19,4 +21,4 @@ public interface INavigationViewService
1921
void UnregisterEvents();
2022

2123
NavigationViewItem? GetSelectedItem(Type pageType);
22-
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using System;
2+
3+
namespace Inventory.Application.Services.Navigation;
4+
5+
public interface IPageService
6+
{
7+
Type GetPageType(string key);
8+
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
using Inventory.Infrastructure.Core.Models;
1+
using System.Collections.Generic;
2+
using System.Threading.Tasks;
3+
using Inventory.Application.Models;
24

3-
namespace Inventory.Infrastructure.Core.Contracts.Services;
5+
namespace Inventory.Application.Services.SampleData;
46

57
// Remove this class once your pages/features are using your data.
68
public interface ISampleDataService
@@ -10,4 +12,4 @@ public interface ISampleDataService
1012
Task<IEnumerable<SampleOrder>> GetGridDataAsync();
1113

1214
Task<IEnumerable<SampleOrder>> GetListDetailsDataAsync();
13-
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
using Microsoft.UI.Xaml;
1+
using System.Threading.Tasks;
2+
using Microsoft.UI.Xaml;
23

3-
namespace Inventory.Infrastructure.Contracts.Services;
4+
namespace Inventory.Application.Services.ThemeSelector;
45

56
public interface IThemeSelectorService
67
{
7-
ElementTheme Theme
8-
{
9-
get;
10-
}
8+
ElementTheme Theme { get; }
119

1210
Task InitializeAsync();
1311

1412
Task SetThemeAsync(ElementTheme theme);
1513

1614
Task SetRequestedThemeAsync();
17-
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
1-
using Microsoft.UI.Xaml.Controls;
1+
using System;
2+
using Microsoft.UI.Xaml.Controls;
23
using Microsoft.Web.WebView2.Core;
34

4-
namespace Inventory.Infrastructure.Contracts.Services;
5+
namespace Inventory.Application.Services.WebView;
56

67
public interface IWebViewService
78
{
8-
Uri? Source
9-
{
10-
get;
11-
}
9+
event EventHandler<CoreWebView2WebErrorStatus>? NavigationCompleted;
1210

13-
bool CanGoBack
14-
{
15-
get;
16-
}
11+
Uri? Source { get; }
1712

18-
bool CanGoForward
19-
{
20-
get;
21-
}
13+
bool CanGoBack { get; }
2214

23-
event EventHandler<CoreWebView2WebErrorStatus>? NavigationCompleted;
15+
bool CanGoForward { get; }
2416

2517
void Initialize(WebView2 webView);
2618

@@ -31,4 +23,4 @@ bool CanGoForward
3123
void Reload();
3224

3325
void UnregisterEvents();
34-
}
26+
}

0 commit comments

Comments
 (0)